| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 static PassRefPtrWillBeRawPtr<HTMLSelectElement> create(Document&, HTMLFormE
lement*); | 48 static PassRefPtrWillBeRawPtr<HTMLSelectElement> create(Document&, HTMLFormE
lement*); |
| 49 | 49 |
| 50 int selectedIndex() const; | 50 int selectedIndex() const; |
| 51 void setSelectedIndex(int); | 51 void setSelectedIndex(int); |
| 52 int suggestedIndex() const; | 52 int suggestedIndex() const; |
| 53 void setSuggestedIndex(int); | 53 void setSuggestedIndex(int); |
| 54 | 54 |
| 55 void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMul
tipleSelection = false); | 55 void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMul
tipleSelection = false); |
| 56 | 56 |
| 57 // For ValidityState | 57 // For ValidityState |
| 58 virtual String validationMessage() const override; | 58 String validationMessage() const override; |
| 59 virtual bool valueMissing() const override; | 59 bool valueMissing() const override; |
| 60 | 60 |
| 61 virtual void resetImpl() override; | 61 void resetImpl() override; |
| 62 | 62 |
| 63 unsigned length() const; | 63 unsigned length() const; |
| 64 | 64 |
| 65 unsigned size() const { return m_size; } | 65 unsigned size() const { return m_size; } |
| 66 bool multiple() const { return m_multiple; } | 66 bool multiple() const { return m_multiple; } |
| 67 | 67 |
| 68 bool usesMenuList() const; | 68 bool usesMenuList() const; |
| 69 | 69 |
| 70 void add(const HTMLOptionElementOrHTMLOptGroupElement&, const HTMLElementOrL
ong&, ExceptionState&); | 70 void add(const HTMLOptionElementOrHTMLOptGroupElement&, const HTMLElementOrL
ong&, ExceptionState&); |
| 71 | 71 |
| 72 using Node::remove; | 72 using Node::remove; |
| 73 void remove(int index); | 73 void remove(int index); |
| 74 | 74 |
| 75 String value() const; | 75 String value() const; |
| 76 void setValue(const String&, bool sendEvents = false); | 76 void setValue(const String&, bool sendEvents = false); |
| 77 String suggestedValue() const; | 77 String suggestedValue() const; |
| 78 void setSuggestedValue(const String&); | 78 void setSuggestedValue(const String&); |
| 79 | 79 |
| 80 PassRefPtrWillBeRawPtr<HTMLOptionsCollection> options(); | 80 PassRefPtrWillBeRawPtr<HTMLOptionsCollection> options(); |
| 81 PassRefPtrWillBeRawPtr<HTMLCollection> selectedOptions(); | 81 PassRefPtrWillBeRawPtr<HTMLCollection> selectedOptions(); |
| 82 | 82 |
| 83 void optionElementChildrenChanged(); | 83 void optionElementChildrenChanged(); |
| 84 | 84 |
| 85 void setRecalcListItems(); | 85 void setRecalcListItems(); |
| 86 void invalidateSelectedItems(); | 86 void invalidateSelectedItems(); |
| 87 void updateListItemSelectedStates(); | 87 void updateListItemSelectedStates(); |
| 88 | 88 |
| 89 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems() const; | 89 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems() const; |
| 90 | 90 |
| 91 virtual void accessKeyAction(bool sendMouseEvents) override; | 91 void accessKeyAction(bool sendMouseEvents) override; |
| 92 void accessKeySetSelectedIndex(int); | 92 void accessKeySetSelectedIndex(int); |
| 93 | 93 |
| 94 void setMultiple(bool); | 94 void setMultiple(bool); |
| 95 | 95 |
| 96 void setSize(unsigned); | 96 void setSize(unsigned); |
| 97 | 97 |
| 98 void setOption(unsigned index, HTMLOptionElement*, ExceptionState&); | 98 void setOption(unsigned index, HTMLOptionElement*, ExceptionState&); |
| 99 void setLength(unsigned, ExceptionState&); | 99 void setLength(unsigned, ExceptionState&); |
| 100 | 100 |
| 101 Element* namedItem(const AtomicString& name); | 101 Element* namedItem(const AtomicString& name); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 127 void handleMouseRelease(); | 127 void handleMouseRelease(); |
| 128 | 128 |
| 129 int listIndexForOption(const HTMLOptionElement&); | 129 int listIndexForOption(const HTMLOptionElement&); |
| 130 | 130 |
| 131 DECLARE_VIRTUAL_TRACE(); | 131 DECLARE_VIRTUAL_TRACE(); |
| 132 | 132 |
| 133 protected: | 133 protected: |
| 134 HTMLSelectElement(Document&, HTMLFormElement*); | 134 HTMLSelectElement(Document&, HTMLFormElement*); |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 virtual void willRecalcStyle(StyleRecalcChange) override; | 137 void willRecalcStyle(StyleRecalcChange) override; |
| 138 | 138 |
| 139 virtual const AtomicString& formControlType() const override; | 139 const AtomicString& formControlType() const override; |
| 140 | 140 |
| 141 virtual bool shouldShowFocusRingOnMouseFocus() const override; | 141 bool shouldShowFocusRingOnMouseFocus() const override; |
| 142 | 142 |
| 143 virtual void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType) ov
erride; | 143 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType) override; |
| 144 virtual void dispatchBlurEvent(Element* newFocusedElement, WebFocusType) ove
rride; | 144 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType) override; |
| 145 | 145 |
| 146 virtual bool canStartSelection() const override { return false; } | 146 bool canStartSelection() const override { return false; } |
| 147 | 147 |
| 148 virtual bool isEnumeratable() const override { return true; } | 148 bool isEnumeratable() const override { return true; } |
| 149 virtual bool isInteractiveContent() const override; | 149 bool isInteractiveContent() const override; |
| 150 virtual bool supportsAutofocus() const override; | 150 bool supportsAutofocus() const override; |
| 151 virtual bool supportLabels() const override { return true; } | 151 bool supportLabels() const override { return true; } |
| 152 | 152 |
| 153 virtual FormControlState saveFormControlState() const override; | 153 FormControlState saveFormControlState() const override; |
| 154 virtual void restoreFormControlState(const FormControlState&) override; | 154 void restoreFormControlState(const FormControlState&) override; |
| 155 | 155 |
| 156 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; | 156 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
| 157 virtual bool isPresentationAttribute(const QualifiedName&) const override; | 157 bool isPresentationAttribute(const QualifiedName&) const override; |
| 158 | 158 |
| 159 virtual LayoutObject* createLayoutObject(const ComputedStyle&) override; | 159 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
| 160 virtual bool appendFormData(FormDataList&, bool) override; | 160 bool appendFormData(FormDataList&, bool) override; |
| 161 virtual void didAddUserAgentShadowRoot(ShadowRoot&) override; | 161 void didAddUserAgentShadowRoot(ShadowRoot&) override; |
| 162 | 162 |
| 163 virtual void defaultEventHandler(Event*) override; | 163 void defaultEventHandler(Event*) override; |
| 164 | 164 |
| 165 void dispatchInputAndChangeEventForMenuList(bool requiresUserGesture = true)
; | 165 void dispatchInputAndChangeEventForMenuList(bool requiresUserGesture = true)
; |
| 166 | 166 |
| 167 void recalcListItems(bool updateSelectedStates = true) const; | 167 void recalcListItems(bool updateSelectedStates = true) const; |
| 168 | 168 |
| 169 void typeAheadFind(KeyboardEvent*); | 169 void typeAheadFind(KeyboardEvent*); |
| 170 void saveLastSelection(); | 170 void saveLastSelection(); |
| 171 | 171 |
| 172 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; | 172 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 173 | 173 |
| 174 virtual bool isOptionalFormControl() const override { return !isRequiredForm
Control(); } | 174 bool isOptionalFormControl() const override { return !isRequiredFormControl(
); } |
| 175 virtual bool isRequiredFormControl() const override; | 175 bool isRequiredFormControl() const override; |
| 176 | 176 |
| 177 bool hasPlaceholderLabelOption() const; | 177 bool hasPlaceholderLabelOption() const; |
| 178 | 178 |
| 179 enum SelectOptionFlag { | 179 enum SelectOptionFlag { |
| 180 DeselectOtherOptions = 1 << 0, | 180 DeselectOtherOptions = 1 << 0, |
| 181 DispatchInputAndChangeEvent = 1 << 1, | 181 DispatchInputAndChangeEvent = 1 << 1, |
| 182 UserDriven = 1 << 2, | 182 UserDriven = 1 << 2, |
| 183 }; | 183 }; |
| 184 typedef unsigned SelectOptionFlags; | 184 typedef unsigned SelectOptionFlags; |
| 185 void selectOption(int optionIndex, SelectOptionFlags = 0); | 185 void selectOption(int optionIndex, SelectOptionFlags = 0); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 202 }; | 202 }; |
| 203 int nextValidIndex(int listIndex, SkipDirection, int skip) const; | 203 int nextValidIndex(int listIndex, SkipDirection, int skip) const; |
| 204 int nextSelectableListIndex(int startIndex) const; | 204 int nextSelectableListIndex(int startIndex) const; |
| 205 int previousSelectableListIndex(int startIndex) const; | 205 int previousSelectableListIndex(int startIndex) const; |
| 206 int firstSelectableListIndex() const; | 206 int firstSelectableListIndex() const; |
| 207 int lastSelectableListIndex() const; | 207 int lastSelectableListIndex() const; |
| 208 int nextSelectableListIndexPageAway(int startIndex, SkipDirection) const; | 208 int nextSelectableListIndexPageAway(int startIndex, SkipDirection) const; |
| 209 int listIndexForEventTargetOption(const Event&); | 209 int listIndexForEventTargetOption(const Event&); |
| 210 AutoscrollController* autoscrollController() const; | 210 AutoscrollController* autoscrollController() const; |
| 211 | 211 |
| 212 virtual void childrenChanged(const ChildrenChange&) override; | 212 void childrenChanged(const ChildrenChange&) override; |
| 213 virtual bool areAuthorShadowsAllowed() const override { return false; } | 213 bool areAuthorShadowsAllowed() const override { return false; } |
| 214 virtual void finishParsingChildren() override; | 214 void finishParsingChildren() override; |
| 215 | 215 |
| 216 // TypeAheadDataSource functions. | 216 // TypeAheadDataSource functions. |
| 217 virtual int indexOfSelectedOption() const override; | 217 int indexOfSelectedOption() const override; |
| 218 virtual int optionCount() const override; | 218 int optionCount() const override; |
| 219 virtual String optionAtIndex(int index) const override; | 219 String optionAtIndex(int index) const override; |
| 220 | 220 |
| 221 // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and HTMLHREl
ement objects. | 221 // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and HTMLHREl
ement objects. |
| 222 mutable WillBeHeapVector<RawPtrWillBeMember<HTMLElement>> m_listItems; | 222 mutable WillBeHeapVector<RawPtrWillBeMember<HTMLElement>> m_listItems; |
| 223 Vector<bool> m_lastOnChangeSelection; | 223 Vector<bool> m_lastOnChangeSelection; |
| 224 Vector<bool> m_cachedStateForActiveSelection; | 224 Vector<bool> m_cachedStateForActiveSelection; |
| 225 TypeAhead m_typeAhead; | 225 TypeAhead m_typeAhead; |
| 226 unsigned m_size; | 226 unsigned m_size; |
| 227 int m_lastOnChangeIndex; | 227 int m_lastOnChangeIndex; |
| 228 int m_activeSelectionAnchorIndex; | 228 int m_activeSelectionAnchorIndex; |
| 229 int m_activeSelectionEndIndex; | 229 int m_activeSelectionEndIndex; |
| 230 bool m_isProcessingUserDrivenChange; | 230 bool m_isProcessingUserDrivenChange; |
| 231 bool m_multiple; | 231 bool m_multiple; |
| 232 bool m_activeSelectionState; | 232 bool m_activeSelectionState; |
| 233 mutable bool m_shouldRecalcListItems; | 233 mutable bool m_shouldRecalcListItems; |
| 234 int m_suggestedIndex; | 234 int m_suggestedIndex; |
| 235 bool m_isAutofilledByPreview; | 235 bool m_isAutofilledByPreview; |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 } // namespace blink | 238 } // namespace blink |
| 239 | 239 |
| 240 #endif // HTMLSelectElement_h | 240 #endif // HTMLSelectElement_h |
| OLD | NEW |