Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSelectElement.h

Issue 2121083005: SELECT: Store the suggested value by an HTMLOptionElement pointer instead of an index number. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 class CORE_EXPORT HTMLSelectElement final : public HTMLFormControlElementWithSta te, private TypeAheadDataSource { 48 class CORE_EXPORT HTMLSelectElement final : public HTMLFormControlElementWithSta te, private TypeAheadDataSource {
49 DEFINE_WRAPPERTYPEINFO(); 49 DEFINE_WRAPPERTYPEINFO();
50 public: 50 public:
51 static HTMLSelectElement* create(Document&); 51 static HTMLSelectElement* create(Document&);
52 static HTMLSelectElement* create(Document&, HTMLFormElement*); 52 static HTMLSelectElement* create(Document&, HTMLFormElement*);
53 ~HTMLSelectElement() override; 53 ~HTMLSelectElement() override;
54 54
55 int selectedIndex() const; 55 int selectedIndex() const;
56 void setSelectedIndex(int); 56 void setSelectedIndex(int);
57 int suggestedIndex() const;
58 void setSuggestedIndex(int);
59 57
60 void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMul tipleSelection = false); 58 void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMul tipleSelection = false);
61 59
62 // For ValidityState 60 // For ValidityState
63 String validationMessage() const override; 61 String validationMessage() const override;
64 bool valueMissing() const override; 62 bool valueMissing() const override;
65 63
66 String defaultToolTip() const override; 64 String defaultToolTip() const override;
67 void resetImpl() override; 65 void resetImpl() override;
68 66
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void updateSelectedState(HTMLOptionElement*, bool multi, bool shift); 228 void updateSelectedState(HTMLOptionElement*, bool multi, bool shift);
231 void menuListDefaultEventHandler(Event*); 229 void menuListDefaultEventHandler(Event*);
232 void handlePopupOpenKeyboardEvent(Event*); 230 void handlePopupOpenKeyboardEvent(Event*);
233 bool shouldOpenPopupForKeyDownEvent(KeyboardEvent*); 231 bool shouldOpenPopupForKeyDownEvent(KeyboardEvent*);
234 bool shouldOpenPopupForKeyPressEvent(KeyboardEvent*); 232 bool shouldOpenPopupForKeyPressEvent(KeyboardEvent*);
235 void listBoxDefaultEventHandler(Event*); 233 void listBoxDefaultEventHandler(Event*);
236 void setOptionsChangedOnLayoutObject(); 234 void setOptionsChangedOnLayoutObject();
237 size_t searchOptionsForValue(const String&, size_t listIndexStart, size_t li stIndexEnd) const; 235 size_t searchOptionsForValue(const String&, size_t listIndexStart, size_t li stIndexEnd) const;
238 void updateListBoxSelection(bool deselectOtherOptions, bool scroll = true); 236 void updateListBoxSelection(bool deselectOtherOptions, bool scroll = true);
239 void setIndexToSelectOnCancel(int listIndex); 237 void setIndexToSelectOnCancel(int listIndex);
238 void setSuggestedOption(HTMLOptionElement*);
240 239
241 enum SkipDirection { 240 enum SkipDirection {
242 SkipBackwards = -1, 241 SkipBackwards = -1,
243 SkipForwards = 1 242 SkipForwards = 1
244 }; 243 };
245 HTMLOptionElement* nextValidOption(int listIndex, SkipDirection, int skip) c onst; 244 HTMLOptionElement* nextValidOption(int listIndex, SkipDirection, int skip) c onst;
246 HTMLOptionElement* nextSelectableOption(HTMLOptionElement*) const; 245 HTMLOptionElement* nextSelectableOption(HTMLOptionElement*) const;
247 HTMLOptionElement* previousSelectableOption(HTMLOptionElement*) const; 246 HTMLOptionElement* previousSelectableOption(HTMLOptionElement*) const;
248 HTMLOptionElement* firstSelectableOption() const; 247 HTMLOptionElement* firstSelectableOption() const;
249 HTMLOptionElement* lastSelectableOption() const; 248 HTMLOptionElement* lastSelectableOption() const;
(...skipping 17 matching lines...) Expand all
267 // HTMLHRElement objects. 266 // HTMLHRElement objects.
268 mutable ListItems m_listItems; 267 mutable ListItems m_listItems;
269 Vector<bool> m_lastOnChangeSelection; 268 Vector<bool> m_lastOnChangeSelection;
270 Vector<bool> m_cachedStateForActiveSelection; 269 Vector<bool> m_cachedStateForActiveSelection;
271 TypeAhead m_typeAhead; 270 TypeAhead m_typeAhead;
272 unsigned m_size; 271 unsigned m_size;
273 Member<HTMLOptionElement> m_lastOnChangeOption; 272 Member<HTMLOptionElement> m_lastOnChangeOption;
274 Member<HTMLOptionElement> m_activeSelectionAnchor; 273 Member<HTMLOptionElement> m_activeSelectionAnchor;
275 Member<HTMLOptionElement> m_activeSelectionEnd; 274 Member<HTMLOptionElement> m_activeSelectionEnd;
276 Member<HTMLOptionElement> m_optionToScrollTo; 275 Member<HTMLOptionElement> m_optionToScrollTo;
276 Member<HTMLOptionElement> m_suggestedOption;
277 bool m_multiple; 277 bool m_multiple;
278 bool m_activeSelectionState; 278 bool m_activeSelectionState;
279 mutable bool m_shouldRecalcListItems; 279 mutable bool m_shouldRecalcListItems;
280 int m_suggestedIndex;
281 bool m_isAutofilledByPreview; 280 bool m_isAutofilledByPreview;
282 281
283 class PopupUpdater; 282 class PopupUpdater;
284 Member<PopupUpdater> m_popupUpdater; 283 Member<PopupUpdater> m_popupUpdater;
285 Member<PopupMenu> m_popup; 284 Member<PopupMenu> m_popup;
286 int m_indexToSelectOnCancel; 285 int m_indexToSelectOnCancel;
287 bool m_popupIsVisible; 286 bool m_popupIsVisible;
288 287
289 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption); 288 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption);
290 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption); 289 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption);
291 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption); 290 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption);
292 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption); 291 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption);
293 }; 292 };
294 293
295 } // namespace blink 294 } // namespace blink
296 295
297 #endif // HTMLSelectElement_h 296 #endif // HTMLSelectElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698