OLD | NEW |
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 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #ifndef HTMLObjectElement_h | 23 #ifndef HTMLObjectElement_h |
24 #define HTMLObjectElement_h | 24 #define HTMLObjectElement_h |
25 | 25 |
26 #include "core/CoreExport.h" | 26 #include "core/CoreExport.h" |
27 #include "core/html/FormAssociatedElement.h" | |
28 #include "core/html/HTMLPlugInElement.h" | 27 #include "core/html/HTMLPlugInElement.h" |
| 28 #include "core/html/ListedElement.h" |
29 | 29 |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 class HTMLFormElement; | 32 class HTMLFormElement; |
33 | 33 |
34 // Inheritance of FormAssociatedElement was used for NPAPI form association, but | 34 // Inheritance of ListedElement was used for NPAPI form association, but |
35 // is still kept here so that legacy APIs such as form attribute can keep | 35 // is still kept here so that legacy APIs such as form attribute can keep |
36 // working according to the spec. See: | 36 // working according to the spec. See: |
37 // https://html.spec.whatwg.org/multipage/embedded-content.html#the-object-eleme
nt | 37 // https://html.spec.whatwg.org/multipage/embedded-content.html#the-object-eleme
nt |
38 class CORE_EXPORT HTMLObjectElement final : public HTMLPlugInElement, | 38 class CORE_EXPORT HTMLObjectElement final : public HTMLPlugInElement, |
39 public FormAssociatedElement { | 39 public ListedElement { |
40 DEFINE_WRAPPERTYPEINFO(); | 40 DEFINE_WRAPPERTYPEINFO(); |
41 USING_GARBAGE_COLLECTED_MIXIN(HTMLObjectElement); | 41 USING_GARBAGE_COLLECTED_MIXIN(HTMLObjectElement); |
42 | 42 |
43 public: | 43 public: |
44 static HTMLObjectElement* create(Document&, | 44 static HTMLObjectElement* create(Document&, |
45 HTMLFormElement*, | 45 HTMLFormElement*, |
46 bool createdByParser); | 46 bool createdByParser); |
47 ~HTMLObjectElement() override; | 47 ~HTMLObjectElement() override; |
48 DECLARE_VIRTUAL_TRACE(); | 48 DECLARE_VIRTUAL_TRACE(); |
49 | 49 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 bool shouldRegisterAsNamedItem() const override { return true; } | 120 bool shouldRegisterAsNamedItem() const override { return true; } |
121 bool shouldRegisterAsExtraNamedItem() const override { return true; } | 121 bool shouldRegisterAsExtraNamedItem() const override { return true; } |
122 | 122 |
123 String m_classId; | 123 String m_classId; |
124 bool m_useFallbackContent : 1; | 124 bool m_useFallbackContent : 1; |
125 }; | 125 }; |
126 | 126 |
127 // Intentionally left unimplemented, template specialization needs to be | 127 // Intentionally left unimplemented, template specialization needs to be |
128 // provided for specific return types. | 128 // provided for specific return types. |
129 template <typename T> | 129 template <typename T> |
130 inline const T& toElement(const FormAssociatedElement&); | 130 inline const T& toElement(const ListedElement&); |
131 template <typename T> | 131 template <typename T> |
132 inline const T* toElement(const FormAssociatedElement*); | 132 inline const T* toElement(const ListedElement*); |
133 | 133 |
134 // Make toHTMLObjectElement() accept a FormAssociatedElement as input instead of | 134 // Make toHTMLObjectElement() accept a ListedElement as input instead of |
135 // a Node. | 135 // a Node. |
136 template <> | 136 template <> |
137 inline const HTMLObjectElement* toElement<HTMLObjectElement>( | 137 inline const HTMLObjectElement* toElement<HTMLObjectElement>( |
138 const FormAssociatedElement* element) { | 138 const ListedElement* element) { |
139 SECURITY_DCHECK(!element || !element->isFormControlElement()); | 139 SECURITY_DCHECK(!element || !element->isFormControlElement()); |
140 const HTMLObjectElement* objectElement = | 140 const HTMLObjectElement* objectElement = |
141 static_cast<const HTMLObjectElement*>(element); | 141 static_cast<const HTMLObjectElement*>(element); |
142 // We need to assert after the cast because FormAssociatedElement doesn't | 142 // We need to assert after the cast because ListedElement doesn't |
143 // have hasTagName. | 143 // have hasTagName. |
144 SECURITY_DCHECK(!objectElement || | 144 SECURITY_DCHECK(!objectElement || |
145 objectElement->hasTagName(HTMLNames::objectTag)); | 145 objectElement->hasTagName(HTMLNames::objectTag)); |
146 return objectElement; | 146 return objectElement; |
147 } | 147 } |
148 | 148 |
149 template <> | 149 template <> |
150 inline const HTMLObjectElement& toElement<HTMLObjectElement>( | 150 inline const HTMLObjectElement& toElement<HTMLObjectElement>( |
151 const FormAssociatedElement& element) { | 151 const ListedElement& element) { |
152 SECURITY_DCHECK(!element.isFormControlElement()); | 152 SECURITY_DCHECK(!element.isFormControlElement()); |
153 const HTMLObjectElement& objectElement = | 153 const HTMLObjectElement& objectElement = |
154 static_cast<const HTMLObjectElement&>(element); | 154 static_cast<const HTMLObjectElement&>(element); |
155 // We need to assert after the cast because FormAssociatedElement doesn't | 155 // We need to assert after the cast because ListedElement doesn't |
156 // have hasTagName. | 156 // have hasTagName. |
157 SECURITY_DCHECK(objectElement.hasTagName(HTMLNames::objectTag)); | 157 SECURITY_DCHECK(objectElement.hasTagName(HTMLNames::objectTag)); |
158 return objectElement; | 158 return objectElement; |
159 } | 159 } |
160 | 160 |
161 } // namespace blink | 161 } // namespace blink |
162 | 162 |
163 #endif // HTMLObjectElement_h | 163 #endif // HTMLObjectElement_h |
OLD | NEW |