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

Unified Diff: third_party/WebKit/Source/web/WebSearchableFormData.cpp

Issue 2141483002: SELECT element: Simplify the code by optionList(). (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebSearchableFormData.cpp
diff --git a/third_party/WebKit/Source/web/WebSearchableFormData.cpp b/third_party/WebKit/Source/web/WebSearchableFormData.cpp
index 23d17495fbfad0ba6c84ebbdbbee258bdcce9766..cd96fabf086d576471919a1ed4ec804104691903 100644
--- a/third_party/WebKit/Source/web/WebSearchableFormData.cpp
+++ b/third_party/WebKit/Source/web/WebSearchableFormData.cpp
@@ -102,12 +102,8 @@ HTMLFormControlElement* buttonToActivate(const HTMLFormElement& form)
// selected state.
bool isSelectInDefaultState(const HTMLSelectElement& select)
{
- const HeapVector<Member<HTMLElement>>& listItems = select.listItems();
if (select.multiple() || select.size() > 1) {
- for (const auto& item : listItems) {
- if (!isHTMLOptionElement(*item))
- continue;
- HTMLOptionElement* optionElement = toHTMLOptionElement(item);
+ for (const auto& optionElement : select.optionList()) {
if (optionElement->selected() != optionElement->fastHasAttribute(selectedAttr))
return false;
}
@@ -117,10 +113,7 @@ bool isSelectInDefaultState(const HTMLSelectElement& select)
// The select is rendered as a combobox (called menulist in WebKit). At
// least one item is selected, determine which one.
HTMLOptionElement* initialSelected = nullptr;
- for (const auto& item : listItems) {
- if (!isHTMLOptionElement(*item))
- continue;
- HTMLOptionElement* optionElement = toHTMLOptionElement(item);
+ for (const auto& optionElement : select.optionList()) {
if (optionElement->fastHasAttribute(selectedAttr)) {
// The page specified the option to select.
initialSelected = optionElement;
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXMenuListPopup.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698