Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: Source/core/html/HTMLKeygenElement.cpp

Issue 19510005: [oilpan] Completely move HTMLFormControlElement's hierarchy to the managed heap Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLKeygenElement.h ('k') | Source/core/html/HTMLLegendElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 27 matching lines...) Expand all
38 #include <wtf/StdLibExtras.h> 38 #include <wtf/StdLibExtras.h>
39 39
40 using namespace WebCore; 40 using namespace WebCore;
41 41
42 namespace WebCore { 42 namespace WebCore {
43 43
44 using namespace HTMLNames; 44 using namespace HTMLNames;
45 45
46 class KeygenSelectElement : public HTMLSelectElement { 46 class KeygenSelectElement : public HTMLSelectElement {
47 public: 47 public:
48 static PassRefPtr<KeygenSelectElement> create(Document* document) 48 static Result<KeygenSelectElement> create(Document* document)
49 { 49 {
50 return adoptRef(new KeygenSelectElement(document)); 50 return adoptNode(new KeygenSelectElement(document));
51 }
52
53 void acceptHeapVisitor(Visitor* visitor) const OVERRIDE
54 {
55 HTMLSelectElement::acceptHeapVisitor(visitor);
51 } 56 }
52 57
53 protected: 58 protected:
54 KeygenSelectElement(Document* document) 59 KeygenSelectElement(Document* document)
55 : HTMLSelectElement(selectTag, document, 0) 60 : HTMLSelectElement(selectTag, document, 0)
56 { 61 {
57 DEFINE_STATIC_LOCAL(AtomicString, pseudoId, ("-webkit-keygen-select", At omicString::ConstructFromLiteral)); 62 DEFINE_STATIC_LOCAL(AtomicString, pseudoId, ("-webkit-keygen-select", At omicString::ConstructFromLiteral));
58 setPseudo(pseudoId); 63 setPseudo(pseudoId);
59 } 64 }
60 65
61 private: 66 private:
62 virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren() 67 virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren()
63 { 68 {
64 return create(document()); 69 return create(document()).passRefPtr();
65 } 70 }
66 }; 71 };
67 72
68 inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Docume nt* document, HTMLFormElement* form) 73 inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Docume nt* document, HTMLFormElement* form)
69 : HTMLFormControlElementWithState(tagName, document, form) 74 : HTMLFormControlElementWithState(tagName, document, form)
70 { 75 {
71 ASSERT(hasTagName(keygenTag)); 76 ASSERT(hasTagName(keygenTag));
72 ScriptWrappable::init(this); 77 ScriptWrappable::init(this);
73 78
74 // Create a select element with one option element for each key size. 79 // Create a select element with one option element for each key size.
75 Vector<String> keys; 80 Vector<String> keys;
76 getSupportedKeySizes(keys); 81 getSupportedKeySizes(keys);
77 82
78 RefPtr<HTMLSelectElement> select = KeygenSelectElement::create(document); 83 Handle<HTMLSelectElement> select = KeygenSelectElement::create(document);
79 for (size_t i = 0; i < keys.size(); ++i) { 84 for (size_t i = 0; i < keys.size(); ++i) {
80 RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document); 85 RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document);
81 select->appendChild(option, IGNORE_EXCEPTION); 86 select->appendChild(option, IGNORE_EXCEPTION);
82 option->appendChild(Text::create(document, keys[i]), IGNORE_EXCEPTION); 87 option->appendChild(Text::create(document, keys[i]), IGNORE_EXCEPTION);
83 } 88 }
84 89
85 ensureUserAgentShadowRoot()->appendChild(select, IGNORE_EXCEPTION); 90 ensureUserAgentShadowRoot()->appendChild(select, IGNORE_EXCEPTION);
86 } 91 }
87 92
88 PassRefPtr<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tag Name, Document* document, HTMLFormElement* form) 93 Result<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tagName , Document* document, HTMLFormElement* form)
89 { 94 {
90 return adoptRef(new HTMLKeygenElement(tagName, document, form)); 95 return adoptNode(new HTMLKeygenElement(tagName, document, form));
91 } 96 }
92 97
93 void HTMLKeygenElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 98 void HTMLKeygenElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
94 { 99 {
95 // Reflect disabled attribute on the shadow select element 100 // Reflect disabled attribute on the shadow select element
96 if (name == disabledAttr) 101 if (name == disabledAttr)
97 shadowSelect()->setAttribute(name, value); 102 shadowSelect()->setAttribute(name, value);
98 103
99 HTMLFormControlElement::parseAttribute(name, value); 104 HTMLFormControlElement::parseAttribute(name, value);
100 } 105 }
(...skipping 12 matching lines...) Expand all
113 } 118 }
114 119
115 const AtomicString& HTMLKeygenElement::formControlType() const 120 const AtomicString& HTMLKeygenElement::formControlType() const
116 { 121 {
117 DEFINE_STATIC_LOCAL(const AtomicString, keygen, ("keygen", AtomicString::Con structFromLiteral)); 122 DEFINE_STATIC_LOCAL(const AtomicString, keygen, ("keygen", AtomicString::Con structFromLiteral));
118 return keygen; 123 return keygen;
119 } 124 }
120 125
121 void HTMLKeygenElement::reset() 126 void HTMLKeygenElement::reset()
122 { 127 {
123 static_cast<HTMLFormControlElement*>(shadowSelect())->reset(); 128 Handle<HTMLFormControlElement>::cast(shadowSelect())->reset();
124 } 129 }
125 130
126 bool HTMLKeygenElement::shouldSaveAndRestoreFormControlState() const 131 bool HTMLKeygenElement::shouldSaveAndRestoreFormControlState() const
127 { 132 {
128 return false; 133 return false;
129 } 134 }
130 135
131 HTMLSelectElement* HTMLKeygenElement::shadowSelect() const 136 Result<HTMLSelectElement> HTMLKeygenElement::shadowSelect() const
132 { 137 {
133 ShadowRoot* root = userAgentShadowRoot(); 138 ShadowRoot* root = userAgentShadowRoot();
134 return root ? toHTMLSelectElement(root->firstChild()) : 0; 139 return root ? toHTMLSelectElement(root->firstChild()) : nullptr;
140 }
141
142 void HTMLKeygenElement::acceptHeapVisitor(Visitor* visitor) const
143 {
144 HTMLFormControlElementWithState::acceptHeapVisitor(visitor);
135 } 145 }
136 146
137 } // namespace 147 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLKeygenElement.h ('k') | Source/core/html/HTMLLegendElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698