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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class CORE_EXPORT HTMLSelectElement final : public HTMLFormControlElementWithSta
te, private TypeAheadDataSource { | 49 class CORE_EXPORT HTMLSelectElement final : public HTMLFormControlElementWithSta
te, private TypeAheadDataSource { |
50 DEFINE_WRAPPERTYPEINFO(); | 50 DEFINE_WRAPPERTYPEINFO(); |
51 public: | 51 public: |
52 static HTMLSelectElement* create(Document&); | 52 static HTMLSelectElement* create(Document&); |
53 static HTMLSelectElement* create(Document&, HTMLFormElement*); | 53 static HTMLSelectElement* create(Document&, HTMLFormElement*); |
54 ~HTMLSelectElement() override; | 54 ~HTMLSelectElement() override; |
55 | 55 |
56 int selectedIndex() const; | 56 int selectedIndex() const; |
57 void setSelectedIndex(int); | 57 void setSelectedIndex(int); |
58 | 58 |
59 void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMul
tipleSelection = false); | |
60 | |
61 // For ValidityState | 59 // For ValidityState |
62 String validationMessage() const override; | 60 String validationMessage() const override; |
63 bool valueMissing() const override; | 61 bool valueMissing() const override; |
64 | 62 |
65 String defaultToolTip() const override; | 63 String defaultToolTip() const override; |
66 void resetImpl() override; | 64 void resetImpl() override; |
67 | 65 |
68 unsigned length() const; | 66 unsigned length() const; |
69 void setLength(unsigned, ExceptionState&); | 67 void setLength(unsigned, ExceptionState&); |
70 | 68 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void accessKeySetSelectedIndex(int); | 105 void accessKeySetSelectedIndex(int); |
108 | 106 |
109 void setOption(unsigned index, HTMLOptionElement*, ExceptionState&); | 107 void setOption(unsigned index, HTMLOptionElement*, ExceptionState&); |
110 | 108 |
111 Element* namedItem(const AtomicString& name); | 109 Element* namedItem(const AtomicString& name); |
112 HTMLOptionElement* item(unsigned index); | 110 HTMLOptionElement* item(unsigned index); |
113 | 111 |
114 void scrollToSelection(); | 112 void scrollToSelection(); |
115 void scrollToOption(HTMLOptionElement*); | 113 void scrollToOption(HTMLOptionElement*); |
116 | 114 |
117 void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shi
ft, bool fireOnChangeNow = true); | |
118 | |
119 bool canSelectAll() const; | 115 bool canSelectAll() const; |
120 void selectAll(); | 116 void selectAll(); |
121 int listToOptionIndex(int listIndex) const; | 117 int listToOptionIndex(int listIndex) const; |
122 void listBoxOnChange(); | 118 void listBoxOnChange(); |
123 int optionToListIndex(int optionIndex) const; | 119 int optionToListIndex(int optionIndex) const; |
124 int activeSelectionEndListIndex() const; | 120 int activeSelectionEndListIndex() const; |
125 HTMLOptionElement* activeSelectionEnd() const; | 121 HTMLOptionElement* activeSelectionEnd() const; |
126 void setActiveSelectionAnchor(HTMLOptionElement*); | 122 void setActiveSelectionAnchor(HTMLOptionElement*); |
127 void setActiveSelectionEnd(HTMLOptionElement*); | 123 void setActiveSelectionEnd(HTMLOptionElement*); |
128 | 124 |
(...skipping 18 matching lines...) Expand all Loading... |
147 bool itemIsDisplayNone(Element&) const; | 143 bool itemIsDisplayNone(Element&) const; |
148 // itemComputedStyle() returns nullptr only if the owner Document is not | 144 // itemComputedStyle() returns nullptr only if the owner Document is not |
149 // active. So, It returns a valid object when we open a popup. | 145 // active. So, It returns a valid object when we open a popup. |
150 const ComputedStyle* itemComputedStyle(Element&) const; | 146 const ComputedStyle* itemComputedStyle(Element&) const; |
151 IntRect elementRectRelativeToViewport() const; | 147 IntRect elementRectRelativeToViewport() const; |
152 // Text starting offset in LTR. | 148 // Text starting offset in LTR. |
153 LayoutUnit clientPaddingLeft() const; | 149 LayoutUnit clientPaddingLeft() const; |
154 // Text starting offset in RTL. | 150 // Text starting offset in RTL. |
155 LayoutUnit clientPaddingRight() const; | 151 LayoutUnit clientPaddingRight() const; |
156 void valueChanged(unsigned listIndex); | 152 void valueChanged(unsigned listIndex); |
| 153 // TODO(tkent): Rename this. This is used only for multiple-selection |
| 154 // menulist. |
| 155 void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool fir
eOnChangeNow); |
157 // A popup is canceled when the popup was hidden without selecting an item. | 156 // A popup is canceled when the popup was hidden without selecting an item. |
158 void popupDidCancel(); | 157 void popupDidCancel(); |
159 // Provisional selection is a selection made using arrow keys or type ahead. | 158 // Provisional selection is a selection made using arrow keys or type ahead. |
160 void provisionalSelectionChanged(unsigned); | 159 void provisionalSelectionChanged(unsigned); |
161 void popupDidHide(); | 160 void popupDidHide(); |
162 bool popupIsVisible() const { return m_popupIsVisible; } | 161 bool popupIsVisible() const { return m_popupIsVisible; } |
163 HTMLOptionElement* optionToBeShown() const; | 162 HTMLOptionElement* optionToBeShown() const; |
164 void showPopup(); | 163 void showPopup(); |
165 void hidePopup(); | 164 void hidePopup(); |
166 PopupMenu* popup() const { return m_popup.get(); } | 165 PopupMenu* popup() const { return m_popup.get(); } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 void saveLastSelection(); | 214 void saveLastSelection(); |
216 void saveListboxActiveSelection(); | 215 void saveListboxActiveSelection(); |
217 // Returns the first selected OPTION, or nullptr. | 216 // Returns the first selected OPTION, or nullptr. |
218 HTMLOptionElement* selectedOption() const; | 217 HTMLOptionElement* selectedOption() const; |
219 | 218 |
220 bool isOptionalFormControl() const override { return !isRequiredFormControl(
); } | 219 bool isOptionalFormControl() const override { return !isRequiredFormControl(
); } |
221 bool isRequiredFormControl() const override; | 220 bool isRequiredFormControl() const override; |
222 | 221 |
223 bool hasPlaceholderLabelOption() const; | 222 bool hasPlaceholderLabelOption() const; |
224 | 223 |
| 224 void optionSelectedByUser(int optionIndex, bool dispatchChangeEvent); |
225 enum SelectOptionFlag { | 225 enum SelectOptionFlag { |
226 DeselectOtherOptions = 1 << 0, | 226 DeselectOtherOptions = 1 << 0, |
227 DispatchInputAndChangeEvent = 1 << 1, | 227 DispatchInputAndChangeEvent = 1 << 1, |
228 MakeOptionDirty = 1 << 2, | 228 MakeOptionDirty = 1 << 2, |
229 }; | 229 }; |
230 typedef unsigned SelectOptionFlags; | 230 typedef unsigned SelectOptionFlags; |
231 void selectOption(HTMLOptionElement*, SelectOptionFlags); | 231 void selectOption(HTMLOptionElement*, SelectOptionFlags); |
232 void deselectItemsWithoutValidation(HTMLOptionElement* elementToExclude = nu
llptr); | 232 void deselectItemsWithoutValidation(HTMLOptionElement* elementToExclude = nu
llptr); |
233 void parseMultipleAttribute(const AtomicString&); | 233 void parseMultipleAttribute(const AtomicString&); |
234 HTMLOptionElement* lastSelectedOption() const; | 234 HTMLOptionElement* lastSelectedOption() const; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption); | 295 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption); |
296 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption); | 296 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption); |
297 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption); | 297 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption); |
298 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption); | 298 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption); |
299 }; | 299 }; |
300 | 300 |
301 } // namespace blink | 301 } // namespace blink |
302 | 302 |
303 #endif // HTMLSelectElement_h | 303 #endif // HTMLSelectElement_h |
OLD | NEW |