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 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class CORE_EXPORT HTMLLabelElement final : public HTMLElement, public FormAssoci
atedElement { | 34 class CORE_EXPORT HTMLLabelElement final : public HTMLElement, public FormAssoci
atedElement { |
35 DEFINE_WRAPPERTYPEINFO(); | 35 DEFINE_WRAPPERTYPEINFO(); |
36 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLLabelElement); | 36 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLLabelElement); |
37 public: | 37 public: |
38 static PassRefPtrWillBeRawPtr<HTMLLabelElement> create(Document&, HTMLFormEl
ement*); | 38 static PassRefPtrWillBeRawPtr<HTMLLabelElement> create(Document&, HTMLFormEl
ement*); |
39 LabelableElement* control() const; | 39 LabelableElement* control() const; |
40 | 40 |
41 virtual bool willRespondToMouseClickEvents() override; | 41 bool willRespondToMouseClickEvents() override; |
42 | 42 |
43 DECLARE_VIRTUAL_TRACE(); | 43 DECLARE_VIRTUAL_TRACE(); |
44 | 44 |
45 virtual HTMLFormElement* formOwner() const override; | 45 HTMLFormElement* formOwner() const override; |
46 | 46 |
47 | 47 |
48 #if !ENABLE(OILPAN) | 48 #if !ENABLE(OILPAN) |
49 using Node::ref; | 49 using Node::ref; |
50 using Node::deref; | 50 using Node::deref; |
51 #endif | 51 #endif |
52 | 52 |
53 private: | 53 private: |
54 explicit HTMLLabelElement(Document&, HTMLFormElement*); | 54 explicit HTMLLabelElement(Document&, HTMLFormElement*); |
55 bool isInInteractiveContent(Node*) const; | 55 bool isInInteractiveContent(Node*) const; |
56 | 56 |
57 virtual bool layoutObjectIsFocusable() const override; | 57 bool layoutObjectIsFocusable() const override; |
58 virtual bool isInteractiveContent() const override; | 58 bool isInteractiveContent() const override; |
59 virtual void accessKeyAction(bool sendMouseEvents) override; | 59 void accessKeyAction(bool sendMouseEvents) override; |
60 | 60 |
61 virtual void attributeWillChange(const QualifiedName&, const AtomicString& o
ldValue, const AtomicString& newValue) override; | 61 void attributeWillChange(const QualifiedName&, const AtomicString& oldValue,
const AtomicString& newValue) override; |
62 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; | 62 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
63 virtual void removedFrom(ContainerNode*) override; | 63 void removedFrom(ContainerNode*) override; |
64 | 64 |
65 // Overridden to update the hover/active state of the corresponding control. | 65 // Overridden to update the hover/active state of the corresponding control. |
66 virtual void setActive(bool = true) override; | 66 void setActive(bool = true) override; |
67 virtual void setHovered(bool = true) override; | 67 void setHovered(bool = true) override; |
68 | 68 |
69 // Overridden to either click() or focus() the corresponding control. | 69 // Overridden to either click() or focus() the corresponding control. |
70 virtual void defaultEventHandler(Event*) override; | 70 void defaultEventHandler(Event*) override; |
71 | 71 |
72 virtual void focus(bool restorePreviousSelection, WebFocusType) override; | 72 void focus(bool restorePreviousSelection, WebFocusType) override; |
73 | 73 |
74 // FormAssociatedElement methods | 74 // FormAssociatedElement methods |
75 virtual bool isFormControlElement() const override { return false; } | 75 bool isFormControlElement() const override { return false; } |
76 virtual bool isEnumeratable() const override { return false; } | 76 bool isEnumeratable() const override { return false; } |
77 virtual bool isLabelElement() const override { return true; } | 77 bool isLabelElement() const override { return true; } |
78 #if !ENABLE(OILPAN) | 78 #if !ENABLE(OILPAN) |
79 virtual void refFormAssociatedElement() override { ref(); } | 79 void refFormAssociatedElement() override { ref(); } |
80 virtual void derefFormAssociatedElement() override { deref(); } | 80 void derefFormAssociatedElement() override { deref(); } |
81 #endif | 81 #endif |
82 | 82 |
83 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; | 83 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
84 | 84 |
85 void updateLabel(TreeScope&, const AtomicString& oldForAttributeValue, const
AtomicString& newForAttributeValue); | 85 void updateLabel(TreeScope&, const AtomicString& oldForAttributeValue, const
AtomicString& newForAttributeValue); |
86 | 86 |
87 bool m_processingClick; | 87 bool m_processingClick; |
88 }; | 88 }; |
89 | 89 |
90 | 90 |
91 template<typename T> inline const T& toElement(const FormAssociatedElement&); | 91 template<typename T> inline const T& toElement(const FormAssociatedElement&); |
92 template<typename T> inline const T* toElement(const FormAssociatedElement*); | 92 template<typename T> inline const T* toElement(const FormAssociatedElement*); |
93 // Make toHTMLLabelElement() accept a FormAssociatedElement as input instead of
a Node. | 93 // Make toHTMLLabelElement() accept a FormAssociatedElement as input instead of
a Node. |
94 template<> inline const HTMLLabelElement* toElement<HTMLLabelElement>(const Form
AssociatedElement* element) | 94 template<> inline const HTMLLabelElement* toElement<HTMLLabelElement>(const Form
AssociatedElement* element) |
95 { | 95 { |
96 const HTMLLabelElement* labelElement = static_cast<const HTMLLabelElement*>(
element); | 96 const HTMLLabelElement* labelElement = static_cast<const HTMLLabelElement*>(
element); |
97 // FormAssociatedElement doesn't have hasTagName, hence check for assert. | 97 // FormAssociatedElement doesn't have hasTagName, hence check for assert. |
98 ASSERT_WITH_SECURITY_IMPLICATION(!labelElement || labelElement->hasTagName(H
TMLNames::labelTag)); | 98 ASSERT_WITH_SECURITY_IMPLICATION(!labelElement || labelElement->hasTagName(H
TMLNames::labelTag)); |
99 return labelElement; | 99 return labelElement; |
100 } | 100 } |
101 | 101 |
102 template<> inline const HTMLLabelElement& toElement<HTMLLabelElement>(const Form
AssociatedElement& element) | 102 template<> inline const HTMLLabelElement& toElement<HTMLLabelElement>(const Form
AssociatedElement& element) |
103 { | 103 { |
104 const HTMLLabelElement& labelElement = static_cast<const HTMLLabelElement&>(
element); | 104 const HTMLLabelElement& labelElement = static_cast<const HTMLLabelElement&>(
element); |
105 // FormAssociatedElement doesn't have hasTagName, hence check for assert. | 105 // FormAssociatedElement doesn't have hasTagName, hence check for assert. |
106 ASSERT_WITH_SECURITY_IMPLICATION(labelElement.hasTagName(HTMLNames::labelTag
)); | 106 ASSERT_WITH_SECURITY_IMPLICATION(labelElement.hasTagName(HTMLNames::labelTag
)); |
107 return labelElement; | 107 return labelElement; |
108 } | 108 } |
109 | 109 |
110 } // namespace blink | 110 } // namespace blink |
111 | 111 |
112 #endif // HTMLLabelElement_h | 112 #endif // HTMLLabelElement_h |
OLD | NEW |