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

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

Issue 2130653002: SELECT element: Introduce light-weight OPTION iterater. (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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #ifndef HTMLSelectElement_h 26 #ifndef HTMLSelectElement_h
27 #define HTMLSelectElement_h 27 #define HTMLSelectElement_h
28 28
29 #include "base/gtest_prod_util.h" 29 #include "base/gtest_prod_util.h"
30 #include "core/CoreExport.h" 30 #include "core/CoreExport.h"
31 #include "core/html/HTMLContentElement.h" 31 #include "core/html/HTMLContentElement.h"
32 #include "core/html/HTMLFormControlElementWithState.h" 32 #include "core/html/HTMLFormControlElementWithState.h"
33 #include "core/html/HTMLOptionsCollection.h" 33 #include "core/html/HTMLOptionsCollection.h"
34 #include "core/html/forms/OptionList.h"
34 #include "core/html/forms/TypeAhead.h" 35 #include "core/html/forms/TypeAhead.h"
35 #include "wtf/Vector.h" 36 #include "wtf/Vector.h"
36 37
37 namespace blink { 38 namespace blink {
38 39
39 class AutoscrollController; 40 class AutoscrollController;
40 class ExceptionState; 41 class ExceptionState;
41 class HTMLHRElement; 42 class HTMLHRElement;
42 class HTMLOptGroupElement; 43 class HTMLOptGroupElement;
43 class HTMLOptionElement; 44 class HTMLOptionElement;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void add(const HTMLOptionElementOrHTMLOptGroupElement&, const HTMLElementOrL ong&, ExceptionState&); 77 void add(const HTMLOptionElementOrHTMLOptGroupElement&, const HTMLElementOrL ong&, ExceptionState&);
77 78
78 using Node::remove; 79 using Node::remove;
79 void remove(int index); 80 void remove(int index);
80 81
81 String value() const; 82 String value() const;
82 void setValue(const String&, bool sendEvents = false); 83 void setValue(const String&, bool sendEvents = false);
83 String suggestedValue() const; 84 String suggestedValue() const;
84 void setSuggestedValue(const String&); 85 void setSuggestedValue(const String&);
85 86
87 // |options| and |selectedOptions| are not safe to be used in in
88 // HTMLOptionElement::removedFrom() and insertedInto() because their cache
89 // is inconsistent in these functions.
86 HTMLOptionsCollection* options(); 90 HTMLOptionsCollection* options();
87 HTMLCollection* selectedOptions(); 91 HTMLCollection* selectedOptions();
88 92
93 // This is similar to |options| HTMLCollection. But this is safe in
94 // HTMLOptionElement::removedFrom() and insertedInto().
95 // OptionList supports only forward iteration.
96 OptionList optionList() { return OptionList(*this); }
97
89 void optionElementChildrenChanged(const HTMLOptionElement&); 98 void optionElementChildrenChanged(const HTMLOptionElement&);
90 99
91 void invalidateSelectedItems(); 100 void invalidateSelectedItems();
92 101
93 using ListItems = HeapVector<Member<HTMLElement>>; 102 using ListItems = HeapVector<Member<HTMLElement>>;
103 // We prefer |optionList()| to |listItems()|.
94 const ListItems& listItems() const; 104 const ListItems& listItems() const;
95 105
96 void accessKeyAction(bool sendMouseEvents) override; 106 void accessKeyAction(bool sendMouseEvents) override;
97 void accessKeySetSelectedIndex(int); 107 void accessKeySetSelectedIndex(int);
98 108
99 void setOption(unsigned index, HTMLOptionElement*, ExceptionState&); 109 void setOption(unsigned index, HTMLOptionElement*, ExceptionState&);
100 110
101 Element* namedItem(const AtomicString& name); 111 Element* namedItem(const AtomicString& name);
102 HTMLOptionElement* item(unsigned index); 112 HTMLOptionElement* item(unsigned index);
103 113
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 297
288 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption); 298 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, FirstSelectableOption);
289 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption); 299 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, LastSelectableOption);
290 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption); 300 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, NextSelectableOption);
291 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption); 301 FRIEND_TEST_ALL_PREFIXES(HTMLSelectElementTest, PreviousSelectableOption);
292 }; 302 };
293 303
294 } // namespace blink 304 } // namespace blink
295 305
296 #endif // HTMLSelectElement_h 306 #endif // HTMLSelectElement_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/html/HTMLSelectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698