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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #ifndef HTMLLabelElement_h | 24 #ifndef HTMLLabelElement_h |
25 #define HTMLLabelElement_h | 25 #define HTMLLabelElement_h |
26 | 26 |
27 #include "core/html/FormAssociatedElement.h" | 27 #include "core/html/FormAssociatedElement.h" |
28 #include "core/html/HTMLElement.h" | 28 #include "core/html/HTMLElement.h" |
29 #include "core/html/LabelableElement.h" | 29 #include "core/html/LabelableElement.h" |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 class HTMLLabelElement FINAL : public HTMLElement, public FormAssociatedElement
{ | 33 class HTMLLabelElement final : public HTMLElement, public FormAssociatedElement
{ |
34 DEFINE_WRAPPERTYPEINFO(); | 34 DEFINE_WRAPPERTYPEINFO(); |
35 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLLabelElement); | 35 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLLabelElement); |
36 public: | 36 public: |
37 static PassRefPtrWillBeRawPtr<HTMLLabelElement> create(Document&, HTMLFormEl
ement*); | 37 static PassRefPtrWillBeRawPtr<HTMLLabelElement> create(Document&, HTMLFormEl
ement*); |
38 LabelableElement* control() const; | 38 LabelableElement* control() const; |
39 | 39 |
40 virtual bool willRespondToMouseClickEvents() OVERRIDE; | 40 virtual bool willRespondToMouseClickEvents() override; |
41 | 41 |
42 virtual void trace(Visitor*) OVERRIDE; | 42 virtual void trace(Visitor*) override; |
43 | 43 |
44 virtual HTMLFormElement* formOwner() const OVERRIDE; | 44 virtual HTMLFormElement* formOwner() const override; |
45 | 45 |
46 | 46 |
47 #if !ENABLE(OILPAN) | 47 #if !ENABLE(OILPAN) |
48 using Node::ref; | 48 using Node::ref; |
49 using Node::deref; | 49 using Node::deref; |
50 #endif | 50 #endif |
51 | 51 |
52 private: | 52 private: |
53 explicit HTMLLabelElement(Document&, HTMLFormElement*); | 53 explicit HTMLLabelElement(Document&, HTMLFormElement*); |
54 bool isInInteractiveContent(Node*) const; | 54 bool isInInteractiveContent(Node*) const; |
55 | 55 |
56 virtual bool rendererIsFocusable() const OVERRIDE; | 56 virtual bool rendererIsFocusable() const override; |
57 virtual bool isInteractiveContent() const OVERRIDE; | 57 virtual bool isInteractiveContent() const override; |
58 virtual void accessKeyAction(bool sendMouseEvents) OVERRIDE; | 58 virtual void accessKeyAction(bool sendMouseEvents) override; |
59 | 59 |
60 virtual void attributeWillChange(const QualifiedName&, const AtomicString& o
ldValue, const AtomicString& newValue) OVERRIDE; | 60 virtual void attributeWillChange(const QualifiedName&, const AtomicString& o
ldValue, const AtomicString& newValue) override; |
61 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 61 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; |
62 virtual void removedFrom(ContainerNode*) OVERRIDE; | 62 virtual void removedFrom(ContainerNode*) override; |
63 | 63 |
64 // Overridden to update the hover/active state of the corresponding control. | 64 // Overridden to update the hover/active state of the corresponding control. |
65 virtual void setActive(bool = true) OVERRIDE; | 65 virtual void setActive(bool = true) override; |
66 virtual void setHovered(bool = true) OVERRIDE; | 66 virtual void setHovered(bool = true) override; |
67 | 67 |
68 // Overridden to either click() or focus() the corresponding control. | 68 // Overridden to either click() or focus() the corresponding control. |
69 virtual void defaultEventHandler(Event*) OVERRIDE; | 69 virtual void defaultEventHandler(Event*) override; |
70 | 70 |
71 virtual void focus(bool restorePreviousSelection, FocusType) OVERRIDE; | 71 virtual void focus(bool restorePreviousSelection, FocusType) override; |
72 | 72 |
73 // FormAssociatedElement methods | 73 // FormAssociatedElement methods |
74 virtual bool isFormControlElement() const OVERRIDE { return false; } | 74 virtual bool isFormControlElement() const override { return false; } |
75 virtual bool isEnumeratable() const OVERRIDE { return false; } | 75 virtual bool isEnumeratable() const override { return false; } |
76 virtual bool isLabelElement() const OVERRIDE { return true; } | 76 virtual bool isLabelElement() const override { return true; } |
77 #if !ENABLE(OILPAN) | 77 #if !ENABLE(OILPAN) |
78 virtual void refFormAssociatedElement() OVERRIDE { ref(); } | 78 virtual void refFormAssociatedElement() override { ref(); } |
79 virtual void derefFormAssociatedElement() OVERRIDE { deref(); } | 79 virtual void derefFormAssociatedElement() override { deref(); } |
80 #endif | 80 #endif |
81 | 81 |
82 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 82 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; |
83 | 83 |
84 void updateLabel(TreeScope&, const AtomicString& oldForAttributeValue, const
AtomicString& newForAttributeValue); | 84 void updateLabel(TreeScope&, const AtomicString& oldForAttributeValue, const
AtomicString& newForAttributeValue); |
85 | 85 |
86 bool m_processingClick; | 86 bool m_processingClick; |
87 }; | 87 }; |
88 | 88 |
89 | 89 |
90 template<typename T> inline const T& toElement(const FormAssociatedElement&); | 90 template<typename T> inline const T& toElement(const FormAssociatedElement&); |
91 template<typename T> inline const T* toElement(const FormAssociatedElement*); | 91 template<typename T> inline const T* toElement(const FormAssociatedElement*); |
92 // Make toHTMLLabelElement() accept a FormAssociatedElement as input instead of
a Node. | 92 // Make toHTMLLabelElement() accept a FormAssociatedElement as input instead of
a Node. |
93 template<> inline const HTMLLabelElement* toElement<HTMLLabelElement>(const Form
AssociatedElement* element) | 93 template<> inline const HTMLLabelElement* toElement<HTMLLabelElement>(const Form
AssociatedElement* element) |
94 { | 94 { |
95 const HTMLLabelElement* labelElement = static_cast<const HTMLLabelElement*>(
element); | 95 const HTMLLabelElement* labelElement = static_cast<const HTMLLabelElement*>(
element); |
96 // FormAssociatedElement doesn't have hasTagName, hence check for assert. | 96 // FormAssociatedElement doesn't have hasTagName, hence check for assert. |
97 ASSERT_WITH_SECURITY_IMPLICATION(!labelElement || labelElement->hasTagName(H
TMLNames::labelTag)); | 97 ASSERT_WITH_SECURITY_IMPLICATION(!labelElement || labelElement->hasTagName(H
TMLNames::labelTag)); |
98 return labelElement; | 98 return labelElement; |
99 } | 99 } |
100 | 100 |
101 template<> inline const HTMLLabelElement& toElement<HTMLLabelElement>(const Form
AssociatedElement& element) | 101 template<> inline const HTMLLabelElement& toElement<HTMLLabelElement>(const Form
AssociatedElement& element) |
102 { | 102 { |
103 const HTMLLabelElement& labelElement = static_cast<const HTMLLabelElement&>(
element); | 103 const HTMLLabelElement& labelElement = static_cast<const HTMLLabelElement&>(
element); |
104 // FormAssociatedElement doesn't have hasTagName, hence check for assert. | 104 // FormAssociatedElement doesn't have hasTagName, hence check for assert. |
105 ASSERT_WITH_SECURITY_IMPLICATION(labelElement.hasTagName(HTMLNames::labelTag
)); | 105 ASSERT_WITH_SECURITY_IMPLICATION(labelElement.hasTagName(HTMLNames::labelTag
)); |
106 return labelElement; | 106 return labelElement; |
107 } | 107 } |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
110 | 110 |
111 #endif // HTMLLabelElement_h | 111 #endif // HTMLLabelElement_h |
OLD | NEW |