| 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 28 matching lines...) Expand all Loading... |
| 39 class AutoscrollController; | 39 class AutoscrollController; |
| 40 class ExceptionState; | 40 class ExceptionState; |
| 41 class HTMLOptionElement; | 41 class HTMLOptionElement; |
| 42 class HTMLOptionElementOrHTMLOptGroupElement; | 42 class HTMLOptionElementOrHTMLOptGroupElement; |
| 43 class HTMLElementOrLong; | 43 class HTMLElementOrLong; |
| 44 class PopupMenu; | 44 class PopupMenu; |
| 45 | 45 |
| 46 class CORE_EXPORT HTMLSelectElement final : public HTMLFormControlElementWithSta
te, private TypeAheadDataSource { | 46 class CORE_EXPORT HTMLSelectElement final : public HTMLFormControlElementWithSta
te, private TypeAheadDataSource { |
| 47 DEFINE_WRAPPERTYPEINFO(); | 47 DEFINE_WRAPPERTYPEINFO(); |
| 48 public: | 48 public: |
| 49 static PassRefPtrWillBeRawPtr<HTMLSelectElement> create(Document&); | 49 static RawPtr<HTMLSelectElement> create(Document&); |
| 50 static PassRefPtrWillBeRawPtr<HTMLSelectElement> create(Document&, HTMLFormE
lement*); | 50 static RawPtr<HTMLSelectElement> create(Document&, HTMLFormElement*); |
| 51 ~HTMLSelectElement() override; | 51 ~HTMLSelectElement() override; |
| 52 | 52 |
| 53 int selectedIndex() const; | 53 int selectedIndex() const; |
| 54 void setSelectedIndex(int); | 54 void setSelectedIndex(int); |
| 55 int suggestedIndex() const; | 55 int suggestedIndex() const; |
| 56 void setSuggestedIndex(int); | 56 void setSuggestedIndex(int); |
| 57 | 57 |
| 58 void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMul
tipleSelection = false); | 58 void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMul
tipleSelection = false); |
| 59 | 59 |
| 60 // For ValidityState | 60 // For ValidityState |
| (...skipping 16 matching lines...) Expand all Loading... |
| 77 void add(const HTMLOptionElementOrHTMLOptGroupElement&, const HTMLElementOrL
ong&, ExceptionState&); | 77 void add(const HTMLOptionElementOrHTMLOptGroupElement&, const HTMLElementOrL
ong&, ExceptionState&); |
| 78 | 78 |
| 79 using Node::remove; | 79 using Node::remove; |
| 80 void remove(int index); | 80 void remove(int index); |
| 81 | 81 |
| 82 String value() const; | 82 String value() const; |
| 83 void setValue(const String&, bool sendEvents = false); | 83 void setValue(const String&, bool sendEvents = false); |
| 84 String suggestedValue() const; | 84 String suggestedValue() const; |
| 85 void setSuggestedValue(const String&); | 85 void setSuggestedValue(const String&); |
| 86 | 86 |
| 87 PassRefPtrWillBeRawPtr<HTMLOptionsCollection> options(); | 87 RawPtr<HTMLOptionsCollection> options(); |
| 88 PassRefPtrWillBeRawPtr<HTMLCollection> selectedOptions(); | 88 RawPtr<HTMLCollection> selectedOptions(); |
| 89 | 89 |
| 90 void optionElementChildrenChanged(); | 90 void optionElementChildrenChanged(); |
| 91 | 91 |
| 92 void setRecalcListItems(); | 92 void setRecalcListItems(); |
| 93 void invalidateSelectedItems(); | 93 void invalidateSelectedItems(); |
| 94 | 94 |
| 95 using ListItems = WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>; | 95 using ListItems = HeapVector<Member<HTMLElement>>; |
| 96 const ListItems& listItems() const; | 96 const ListItems& listItems() const; |
| 97 | 97 |
| 98 void accessKeyAction(bool sendMouseEvents) override; | 98 void accessKeyAction(bool sendMouseEvents) override; |
| 99 void accessKeySetSelectedIndex(int); | 99 void accessKeySetSelectedIndex(int); |
| 100 | 100 |
| 101 void setOption(unsigned index, HTMLOptionElement*, ExceptionState&); | 101 void setOption(unsigned index, HTMLOptionElement*, ExceptionState&); |
| 102 | 102 |
| 103 Element* namedItem(const AtomicString& name); | 103 Element* namedItem(const AtomicString& name); |
| 104 HTMLOptionElement* item(unsigned index); | 104 HTMLOptionElement* item(unsigned index); |
| 105 | 105 |
| 106 void scrollToSelection(); | 106 void scrollToSelection(); |
| 107 void scrollToOption(HTMLOptionElement*); | 107 void scrollToOption(HTMLOptionElement*); |
| 108 | 108 |
| 109 void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shi
ft, bool fireOnChangeNow = true); | 109 void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shi
ft, bool fireOnChangeNow = true); |
| 110 | 110 |
| 111 bool canSelectAll() const; | 111 bool canSelectAll() const; |
| 112 void selectAll(); | 112 void selectAll(); |
| 113 int listToOptionIndex(int listIndex) const; | 113 int listToOptionIndex(int listIndex) const; |
| 114 void listBoxOnChange(); | 114 void listBoxOnChange(); |
| 115 int optionToListIndex(int optionIndex) const; | 115 int optionToListIndex(int optionIndex) const; |
| 116 int activeSelectionEndListIndex() const; | 116 int activeSelectionEndListIndex() const; |
| 117 HTMLOptionElement* activeSelectionEnd() const; | 117 HTMLOptionElement* activeSelectionEnd() const; |
| 118 void setActiveSelectionAnchor(HTMLOptionElement*); | 118 void setActiveSelectionAnchor(HTMLOptionElement*); |
| 119 void setActiveSelectionEnd(HTMLOptionElement*); | 119 void setActiveSelectionEnd(HTMLOptionElement*); |
| 120 | 120 |
| 121 // For use in the implementation of HTMLOptionElement. | 121 // For use in the implementation of HTMLOptionElement. |
| 122 void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected); | 122 void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected); |
| 123 void optionInserted(HTMLOptionElement&, bool optionIsSelected); | 123 void optionInserted(HTMLOptionElement&, bool optionIsSelected); |
| 124 void optionRemoved(const HTMLOptionElement&); | 124 void optionRemoved(const HTMLOptionElement&); |
| 125 bool anonymousIndexedSetter(unsigned, PassRefPtrWillBeRawPtr<HTMLOptionEleme
nt>, ExceptionState&); | 125 bool anonymousIndexedSetter(unsigned, RawPtr<HTMLOptionElement>, ExceptionSt
ate&); |
| 126 | 126 |
| 127 void updateListOnLayoutObject(); | 127 void updateListOnLayoutObject(); |
| 128 | 128 |
| 129 HTMLOptionElement* spatialNavigationFocusedOption(); | 129 HTMLOptionElement* spatialNavigationFocusedOption(); |
| 130 void handleMouseRelease(); | 130 void handleMouseRelease(); |
| 131 | 131 |
| 132 int listIndexForOption(const HTMLOptionElement&); | 132 int listIndexForOption(const HTMLOptionElement&); |
| 133 | 133 |
| 134 // Helper functions for popup menu implementations. | 134 // Helper functions for popup menu implementations. |
| 135 String itemText(const Element&) const; | 135 String itemText(const Element&) const; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 int optionCount() const override; | 250 int optionCount() const override; |
| 251 String optionAtIndex(int index) const override; | 251 String optionAtIndex(int index) const override; |
| 252 | 252 |
| 253 // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and | 253 // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and |
| 254 // HTMLHRElement objects. | 254 // HTMLHRElement objects. |
| 255 mutable ListItems m_listItems; | 255 mutable ListItems m_listItems; |
| 256 Vector<bool> m_lastOnChangeSelection; | 256 Vector<bool> m_lastOnChangeSelection; |
| 257 Vector<bool> m_cachedStateForActiveSelection; | 257 Vector<bool> m_cachedStateForActiveSelection; |
| 258 TypeAhead m_typeAhead; | 258 TypeAhead m_typeAhead; |
| 259 unsigned m_size; | 259 unsigned m_size; |
| 260 RefPtrWillBeMember<HTMLOptionElement> m_lastOnChangeOption; | 260 Member<HTMLOptionElement> m_lastOnChangeOption; |
| 261 RefPtrWillBeMember<HTMLOptionElement> m_activeSelectionAnchor; | 261 Member<HTMLOptionElement> m_activeSelectionAnchor; |
| 262 RefPtrWillBeMember<HTMLOptionElement> m_activeSelectionEnd; | 262 Member<HTMLOptionElement> m_activeSelectionEnd; |
| 263 RefPtrWillBeMember<HTMLOptionElement> m_optionToScrollTo; | 263 Member<HTMLOptionElement> m_optionToScrollTo; |
| 264 bool m_multiple; | 264 bool m_multiple; |
| 265 bool m_activeSelectionState; | 265 bool m_activeSelectionState; |
| 266 mutable bool m_shouldRecalcListItems; | 266 mutable bool m_shouldRecalcListItems; |
| 267 int m_suggestedIndex; | 267 int m_suggestedIndex; |
| 268 bool m_isAutofilledByPreview; | 268 bool m_isAutofilledByPreview; |
| 269 | 269 |
| 270 RefPtrWillBeMember<PopupMenu> m_popup; | 270 Member<PopupMenu> m_popup; |
| 271 int m_indexToSelectOnCancel; | 271 int m_indexToSelectOnCancel; |
| 272 bool m_popupIsVisible; | 272 bool m_popupIsVisible; |
| 273 | 273 |
| 274 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption); | 274 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption); |
| 275 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption); | 275 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption); |
| 276 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption); | 276 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption); |
| 277 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption); | 277 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption); |
| 278 }; | 278 }; |
| 279 | 279 |
| 280 } // namespace blink | 280 } // namespace blink |
| 281 | 281 |
| 282 #endif // HTMLSelectElement_h | 282 #endif // HTMLSelectElement_h |
| OLD | NEW |