diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/html/HTMLKeygenElement.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/html/HTMLKeygenElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLKeygenElement.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/Source/WebCore/html/HTMLKeygenElement.cpp b/Source/WebCore/html/HTMLKeygenElement.cpp index b617b0336..401de1c95 100644 --- a/Source/WebCore/html/HTMLKeygenElement.cpp +++ b/Source/WebCore/html/HTMLKeygenElement.cpp @@ -34,7 +34,6 @@ #include "SSLKeyGenerator.h" #include "ShadowRoot.h" #include "Text.h" -#include <wtf/NeverDestroyed.h> #include <wtf/StdLibExtras.h> using namespace WebCore; @@ -45,23 +44,23 @@ using namespace HTMLNames; class KeygenSelectElement final : public HTMLSelectElement { public: - static Ref<KeygenSelectElement> create(Document& document) + static PassRefPtr<KeygenSelectElement> create(Document& document) { - return adoptRef(*new KeygenSelectElement(document)); + return adoptRef(new KeygenSelectElement(document)); } protected: KeygenSelectElement(Document& document) : HTMLSelectElement(selectTag, document, 0) { - static NeverDestroyed<AtomicString> pseudoId("-webkit-keygen-select", AtomicString::ConstructFromLiteral); + DEFINE_STATIC_LOCAL(AtomicString, pseudoId, ("-webkit-keygen-select", AtomicString::ConstructFromLiteral)); setPseudo(pseudoId); } private: - virtual Ref<Element> cloneElementWithoutAttributesAndChildren(Document& targetDocument) override + virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren() override { - return create(targetDocument); + return create(document()); } }; @@ -74,19 +73,19 @@ inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Docume Vector<String> keys; getSupportedKeySizes(keys); - Ref<HTMLSelectElement> select = KeygenSelectElement::create(document); - for (auto& key : keys) { - Ref<HTMLOptionElement> option = HTMLOptionElement::create(document); - select->appendChild(option.copyRef(), IGNORE_EXCEPTION); - option->appendChild(Text::create(document, key), IGNORE_EXCEPTION); + RefPtr<HTMLSelectElement> select = KeygenSelectElement::create(document); + for (size_t i = 0; i < keys.size(); ++i) { + RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document); + select->appendChild(option, IGNORE_EXCEPTION); + option->appendChild(Text::create(document, keys[i]), IGNORE_EXCEPTION); } - ensureUserAgentShadowRoot().appendChild(WTFMove(select), IGNORE_EXCEPTION); + ensureUserAgentShadowRoot().appendChild(select, IGNORE_EXCEPTION); } -Ref<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form) +PassRefPtr<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form) { - return adoptRef(*new HTMLKeygenElement(tagName, document, form)); + return adoptRef(new HTMLKeygenElement(tagName, document, form)); } void HTMLKeygenElement::parseAttribute(const QualifiedName& name, const AtomicString& value) @@ -102,7 +101,7 @@ bool HTMLKeygenElement::appendFormData(FormDataList& encoded_values, bool) { // Only RSA is supported at this time. const AtomicString& keyType = fastGetAttribute(keytypeAttr); - if (!keyType.isNull() && !equalLettersIgnoringASCIICase(keyType, "rsa")) + if (!keyType.isNull() && !equalIgnoringCase(keyType, "rsa")) return false; String value = signedPublicKeyAndChallengeString(shadowSelect()->selectedIndex(), fastGetAttribute(challengeAttr), document().baseURL()); if (value.isNull()) @@ -113,7 +112,7 @@ bool HTMLKeygenElement::appendFormData(FormDataList& encoded_values, bool) const AtomicString& HTMLKeygenElement::formControlType() const { - static NeverDestroyed<const AtomicString> keygen("keygen", AtomicString::ConstructFromLiteral); + DEFINE_STATIC_LOCAL(const AtomicString, keygen, ("keygen", AtomicString::ConstructFromLiteral)); return keygen; } @@ -130,7 +129,7 @@ bool HTMLKeygenElement::shouldSaveAndRestoreFormControlState() const HTMLSelectElement* HTMLKeygenElement::shadowSelect() const { ShadowRoot* root = userAgentShadowRoot(); - return root ? downcast<HTMLSelectElement>(root->firstChild()) : nullptr; + return root ? toHTMLSelectElement(root->firstChild()) : 0; } } // namespace |