| 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 * |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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" | 27 #include "core/html/FormAssociatedElement.h" |
| 28 #include "core/html/HTMLPlugInElement.h" | 28 #include "core/html/HTMLPlugInElement.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
is still | 34 // Inheritance of FormAssociatedElement was used for NPAPI form association, but |
| 35 // kept here so that legacy APIs such as form attribute can keep working accordi
ng to the spec. | 35 // is still kept here so that legacy APIs such as form attribute can keep |
| 36 // See: https://html.spec.whatwg.org/multipage/embedded-content.html#the-object-
element | 36 // working according to the spec. See: |
| 37 // https://html.spec.whatwg.org/multipage/embedded-content.html#the-object-eleme
nt |
| 37 class CORE_EXPORT HTMLObjectElement final : public HTMLPlugInElement, | 38 class CORE_EXPORT HTMLObjectElement final : public HTMLPlugInElement, |
| 38 public FormAssociatedElement { | 39 public FormAssociatedElement { |
| 39 DEFINE_WRAPPERTYPEINFO(); | 40 DEFINE_WRAPPERTYPEINFO(); |
| 40 USING_GARBAGE_COLLECTED_MIXIN(HTMLObjectElement); | 41 USING_GARBAGE_COLLECTED_MIXIN(HTMLObjectElement); |
| 41 | 42 |
| 42 public: | 43 public: |
| 43 static HTMLObjectElement* create(Document&, | 44 static HTMLObjectElement* create(Document&, |
| 44 HTMLFormElement*, | 45 HTMLFormElement*, |
| 45 bool createdByParser); | 46 bool createdByParser); |
| 46 ~HTMLObjectElement() override; | 47 ~HTMLObjectElement() override; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 114 |
| 114 void reloadPluginOnAttributeChange(const QualifiedName&); | 115 void reloadPluginOnAttributeChange(const QualifiedName&); |
| 115 | 116 |
| 116 bool shouldRegisterAsNamedItem() const override { return true; } | 117 bool shouldRegisterAsNamedItem() const override { return true; } |
| 117 bool shouldRegisterAsExtraNamedItem() const override { return true; } | 118 bool shouldRegisterAsExtraNamedItem() const override { return true; } |
| 118 | 119 |
| 119 String m_classId; | 120 String m_classId; |
| 120 bool m_useFallbackContent : 1; | 121 bool m_useFallbackContent : 1; |
| 121 }; | 122 }; |
| 122 | 123 |
| 123 // Intentionally left unimplemented, template specialization needs to be provide
d for specific | 124 // Intentionally left unimplemented, template specialization needs to be |
| 124 // return types. | 125 // provided for specific return types. |
| 125 template <typename T> | 126 template <typename T> |
| 126 inline const T& toElement(const FormAssociatedElement&); | 127 inline const T& toElement(const FormAssociatedElement&); |
| 127 template <typename T> | 128 template <typename T> |
| 128 inline const T* toElement(const FormAssociatedElement*); | 129 inline const T* toElement(const FormAssociatedElement*); |
| 129 | 130 |
| 130 // Make toHTMLObjectElement() accept a FormAssociatedElement as input instead of
a Node. | 131 // Make toHTMLObjectElement() accept a FormAssociatedElement as input instead of |
| 132 // a Node. |
| 131 template <> | 133 template <> |
| 132 inline const HTMLObjectElement* toElement<HTMLObjectElement>( | 134 inline const HTMLObjectElement* toElement<HTMLObjectElement>( |
| 133 const FormAssociatedElement* element) { | 135 const FormAssociatedElement* element) { |
| 134 SECURITY_DCHECK(!element || !element->isFormControlElement()); | 136 SECURITY_DCHECK(!element || !element->isFormControlElement()); |
| 135 const HTMLObjectElement* objectElement = | 137 const HTMLObjectElement* objectElement = |
| 136 static_cast<const HTMLObjectElement*>(element); | 138 static_cast<const HTMLObjectElement*>(element); |
| 137 // We need to assert after the cast because FormAssociatedElement doesn't | 139 // We need to assert after the cast because FormAssociatedElement doesn't |
| 138 // have hasTagName. | 140 // have hasTagName. |
| 139 SECURITY_DCHECK(!objectElement || | 141 SECURITY_DCHECK(!objectElement || |
| 140 objectElement->hasTagName(HTMLNames::objectTag)); | 142 objectElement->hasTagName(HTMLNames::objectTag)); |
| 141 return objectElement; | 143 return objectElement; |
| 142 } | 144 } |
| 143 | 145 |
| 144 template <> | 146 template <> |
| 145 inline const HTMLObjectElement& toElement<HTMLObjectElement>( | 147 inline const HTMLObjectElement& toElement<HTMLObjectElement>( |
| 146 const FormAssociatedElement& element) { | 148 const FormAssociatedElement& element) { |
| 147 SECURITY_DCHECK(!element.isFormControlElement()); | 149 SECURITY_DCHECK(!element.isFormControlElement()); |
| 148 const HTMLObjectElement& objectElement = | 150 const HTMLObjectElement& objectElement = |
| 149 static_cast<const HTMLObjectElement&>(element); | 151 static_cast<const HTMLObjectElement&>(element); |
| 150 // We need to assert after the cast because FormAssociatedElement doesn't | 152 // We need to assert after the cast because FormAssociatedElement doesn't |
| 151 // have hasTagName. | 153 // have hasTagName. |
| 152 SECURITY_DCHECK(objectElement.hasTagName(HTMLNames::objectTag)); | 154 SECURITY_DCHECK(objectElement.hasTagName(HTMLNames::objectTag)); |
| 153 return objectElement; | 155 return objectElement; |
| 154 } | 156 } |
| 155 | 157 |
| 156 } // namespace blink | 158 } // namespace blink |
| 157 | 159 |
| 158 #endif // HTMLObjectElement_h | 160 #endif // HTMLObjectElement_h |
| OLD | NEW |