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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 // |options| and |selectedOptions| are not safe to be used in in | 87 // |options| and |selectedOptions| are not safe to be used in in |
88 // HTMLOptionElement::removedFrom() and insertedInto() because their cache | 88 // HTMLOptionElement::removedFrom() and insertedInto() because their cache |
89 // is inconsistent in these functions. | 89 // is inconsistent in these functions. |
90 HTMLOptionsCollection* options(); | 90 HTMLOptionsCollection* options(); |
91 HTMLCollection* selectedOptions(); | 91 HTMLCollection* selectedOptions(); |
92 | 92 |
93 // This is similar to |options| HTMLCollection. But this is safe in | 93 // This is similar to |options| HTMLCollection. But this is safe in |
94 // HTMLOptionElement::removedFrom() and insertedInto(). | 94 // HTMLOptionElement::removedFrom() and insertedInto(). |
95 // OptionList supports only forward iteration. | 95 // OptionList supports only forward iteration. |
96 OptionList optionList() { return OptionList(*this); } | 96 OptionList optionList() const { return OptionList(*this); } |
97 | 97 |
98 void optionElementChildrenChanged(const HTMLOptionElement&); | 98 void optionElementChildrenChanged(const HTMLOptionElement&); |
99 | 99 |
100 void invalidateSelectedItems(); | 100 void invalidateSelectedItems(); |
101 | 101 |
102 using ListItems = HeapVector<Member<HTMLElement>>; | 102 using ListItems = HeapVector<Member<HTMLElement>>; |
103 // We prefer |optionList()| to |listItems()|. | 103 // We prefer |optionList()| to |listItems()|. |
104 const ListItems& listItems() const; | 104 const ListItems& listItems() const; |
105 | 105 |
106 void accessKeyAction(bool sendMouseEvents) override; | 106 void accessKeyAction(bool sendMouseEvents) override; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 LayoutObject* createLayoutObject(const ComputedStyle&) override; | 197 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
198 void didRecalcStyle(StyleRecalcChange) override; | 198 void didRecalcStyle(StyleRecalcChange) override; |
199 void detach(const AttachContext& = AttachContext()) override; | 199 void detach(const AttachContext& = AttachContext()) override; |
200 void appendToFormData(FormData&) override; | 200 void appendToFormData(FormData&) override; |
201 void didAddUserAgentShadowRoot(ShadowRoot&) override; | 201 void didAddUserAgentShadowRoot(ShadowRoot&) override; |
202 | 202 |
203 void defaultEventHandler(Event*) override; | 203 void defaultEventHandler(Event*) override; |
204 | 204 |
205 void dispatchInputAndChangeEventForMenuList(); | 205 void dispatchInputAndChangeEventForMenuList(); |
206 | 206 |
207 // |subject| is an element which was inserted or removed. | 207 void setRecalcListItems(); |
208 void setRecalcListItems(HTMLElement& subject); | |
209 void recalcListItems() const; | 208 void recalcListItems() const; |
210 enum ResetReason { | 209 enum ResetReason { |
211 ResetReasonSelectedOptionRemoved, | 210 ResetReasonSelectedOptionRemoved, |
212 ResetReasonOthers | 211 ResetReasonOthers |
213 }; | 212 }; |
214 void resetToDefaultSelection(ResetReason = ResetReasonOthers); | 213 void resetToDefaultSelection(ResetReason = ResetReasonOthers); |
215 void typeAheadFind(KeyboardEvent*); | 214 void typeAheadFind(KeyboardEvent*); |
216 void saveLastSelection(); | 215 void saveLastSelection(); |
217 void saveListboxActiveSelection(); | 216 void saveListboxActiveSelection(); |
218 // Returns the first selected OPTION, or nullptr. | 217 // Returns the first selected OPTION, or nullptr. |
219 HTMLOptionElement* selectedOption() const; | 218 HTMLOptionElement* selectedOption() const; |
220 | 219 |
221 bool isOptionalFormControl() const override { return !isRequiredFormControl(
); } | 220 bool isOptionalFormControl() const override { return !isRequiredFormControl(
); } |
222 bool isRequiredFormControl() const override; | 221 bool isRequiredFormControl() const override; |
223 | 222 |
224 bool hasPlaceholderLabelOption() const; | 223 bool hasPlaceholderLabelOption() const; |
225 | 224 |
226 enum SelectOptionFlag { | 225 enum SelectOptionFlag { |
227 DeselectOtherOptions = 1 << 0, | 226 DeselectOtherOptions = 1 << 0, |
228 DispatchInputAndChangeEvent = 1 << 1, | 227 DispatchInputAndChangeEvent = 1 << 1, |
229 MakeOptionDirty = 1 << 2, | 228 MakeOptionDirty = 1 << 2, |
230 }; | 229 }; |
231 typedef unsigned SelectOptionFlags; | 230 typedef unsigned SelectOptionFlags; |
232 void selectOption(HTMLOptionElement*, SelectOptionFlags); | 231 void selectOption(HTMLOptionElement*, SelectOptionFlags); |
233 void deselectItemsWithoutValidation(HTMLElement* elementToExclude = 0); | 232 void deselectItemsWithoutValidation(HTMLOptionElement* elementToExclude = nu
llptr); |
234 void parseMultipleAttribute(const AtomicString&); | 233 void parseMultipleAttribute(const AtomicString&); |
235 HTMLOptionElement* lastSelectedOption() const; | 234 HTMLOptionElement* lastSelectedOption() const; |
236 void updateSelectedState(HTMLOptionElement*, bool multi, bool shift); | 235 void updateSelectedState(HTMLOptionElement*, bool multi, bool shift); |
237 void menuListDefaultEventHandler(Event*); | 236 void menuListDefaultEventHandler(Event*); |
238 void handlePopupOpenKeyboardEvent(Event*); | 237 void handlePopupOpenKeyboardEvent(Event*); |
239 bool shouldOpenPopupForKeyDownEvent(KeyboardEvent*); | 238 bool shouldOpenPopupForKeyDownEvent(KeyboardEvent*); |
240 bool shouldOpenPopupForKeyPressEvent(KeyboardEvent*); | 239 bool shouldOpenPopupForKeyPressEvent(KeyboardEvent*); |
241 void listBoxDefaultEventHandler(Event*); | 240 void listBoxDefaultEventHandler(Event*); |
242 void setOptionsChangedOnLayoutObject(); | 241 void setOptionsChangedOnLayoutObject(); |
243 size_t searchOptionsForValue(const String&, size_t listIndexStart, size_t li
stIndexEnd) const; | 242 size_t searchOptionsForValue(const String&, size_t listIndexStart, size_t li
stIndexEnd) const; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 294 |
296 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption); | 295 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption); |
297 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption); | 296 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption); |
298 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption); | 297 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption); |
299 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption); | 298 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption); |
300 }; | 299 }; |
301 | 300 |
302 } // namespace blink | 301 } // namespace blink |
303 | 302 |
304 #endif // HTMLSelectElement_h | 303 #endif // HTMLSelectElement_h |
OLD | NEW |