OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
4 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 4 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
5 * (C) 2000 Dirk Mueller (mueller@kde.org) | 5 * (C) 2000 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "core/html/HTMLOptionsCollection.h" | 31 #include "core/html/HTMLOptionsCollection.h" |
32 #include "core/html/TypeAhead.h" | 32 #include "core/html/TypeAhead.h" |
33 #include <wtf/Vector.h> | 33 #include <wtf/Vector.h> |
34 | 34 |
35 namespace WebCore { | 35 namespace WebCore { |
36 | 36 |
37 class HTMLOptionElement; | 37 class HTMLOptionElement; |
38 | 38 |
39 class HTMLSelectElement : public HTMLFormControlElementWithState, public TypeAhe
adDataSource { | 39 class HTMLSelectElement : public HTMLFormControlElementWithState, public TypeAhe
adDataSource { |
40 public: | 40 public: |
41 static PassRefPtr<HTMLSelectElement> create(const QualifiedName&, Document*,
HTMLFormElement*); | 41 static Result<HTMLSelectElement> create(const QualifiedName&, Document*, HTM
LFormElement*); |
42 | 42 |
43 int selectedIndex() const; | 43 int selectedIndex() const; |
44 void setSelectedIndex(int); | 44 void setSelectedIndex(int); |
45 | 45 |
46 void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMul
tipleSelection = false); | 46 void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMul
tipleSelection = false); |
47 | 47 |
48 // For ValidityState | 48 // For ValidityState |
49 virtual String validationMessage() const OVERRIDE; | 49 virtual String validationMessage() const OVERRIDE; |
50 virtual bool valueMissing() const OVERRIDE; | 50 virtual bool valueMissing() const OVERRIDE; |
51 | 51 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 int optionToListIndex(int optionIndex) const; | 98 int optionToListIndex(int optionIndex) const; |
99 int activeSelectionStartListIndex() const; | 99 int activeSelectionStartListIndex() const; |
100 int activeSelectionEndListIndex() const; | 100 int activeSelectionEndListIndex() const; |
101 void setActiveSelectionAnchorIndex(int); | 101 void setActiveSelectionAnchorIndex(int); |
102 void setActiveSelectionEndIndex(int); | 102 void setActiveSelectionEndIndex(int); |
103 void updateListBoxSelection(bool deselectOtherOptions); | 103 void updateListBoxSelection(bool deselectOtherOptions); |
104 | 104 |
105 // For use in the implementation of HTMLOptionElement. | 105 // For use in the implementation of HTMLOptionElement. |
106 void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected); | 106 void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected); |
107 | 107 |
| 108 virtual void acceptHeapVisitor(Visitor*) const OVERRIDE; |
| 109 |
108 protected: | 110 protected: |
109 HTMLSelectElement(const QualifiedName&, Document*, HTMLFormElement*); | 111 HTMLSelectElement(const QualifiedName&, Document*, HTMLFormElement*); |
110 | 112 |
111 private: | 113 private: |
112 virtual const AtomicString& formControlType() const; | 114 virtual const AtomicString& formControlType() const; |
113 | 115 |
114 virtual bool isKeyboardFocusable(KeyboardEvent*) const; | 116 virtual bool isKeyboardFocusable(KeyboardEvent*) const; |
115 virtual bool isMouseFocusable() const; | 117 virtual bool isMouseFocusable() const; |
116 | 118 |
117 virtual void dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode, FocusDirect
ion) OVERRIDE; | 119 virtual void dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode, FocusDirect
ion) OVERRIDE; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 bool m_multiple; | 202 bool m_multiple; |
201 bool m_activeSelectionState; | 203 bool m_activeSelectionState; |
202 mutable bool m_shouldRecalcListItems; | 204 mutable bool m_shouldRecalcListItems; |
203 }; | 205 }; |
204 | 206 |
205 inline bool isHTMLSelectElement(const Node* node) | 207 inline bool isHTMLSelectElement(const Node* node) |
206 { | 208 { |
207 return node->hasTagName(HTMLNames::selectTag); | 209 return node->hasTagName(HTMLNames::selectTag); |
208 } | 210 } |
209 | 211 |
210 inline HTMLSelectElement* toHTMLSelectElement(Node* node) | 212 inline Result<HTMLSelectElement> toHTMLSelectElement(Node* node) |
211 { | 213 { |
212 ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLSelectElement(node)); | 214 ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLSelectElement(node)); |
213 return static_cast<HTMLSelectElement*>(node); | 215 return Handle<HTMLSelectElement>(static_cast<HTMLSelectElement*>(node)); |
214 } | 216 } |
215 | 217 |
216 inline const HTMLSelectElement* toHTMLSelectElement(const Node* node) | 218 inline Result<const HTMLSelectElement> toHTMLSelectElement(const Node* node) |
217 { | 219 { |
218 ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLSelectElement(node)); | 220 ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLSelectElement(node)); |
219 return static_cast<const HTMLSelectElement*>(node); | 221 return Handle<const HTMLSelectElement>(static_cast<const HTMLSelectElement*>
(node)); |
220 } | 222 } |
221 | 223 |
222 void toHTMLSelectElement(const HTMLSelectElement*); // This overload will catch
anyone doing an unnecessary cast. | 224 void toHTMLSelectElement(const HTMLSelectElement*); // This overload will catch
anyone doing an unnecessary cast. |
223 | 225 |
224 } // namespace | 226 } // namespace |
225 | 227 |
226 #endif | 228 #endif |
OLD | NEW |