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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXListBoxOption.cpp

Issue 2147963004: AX: Don't use listIndex in AXListBoxOption class. (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/AXListBoxOption.h ('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/modules/accessibility/AXListBoxOption.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXListBoxOption.cpp b/third_party/WebKit/Source/modules/accessibility/AXListBoxOption.cpp
index b111fbf8f42f0da51608f3f81c645140a1b0c201..5cb090dc6935b4f3a5ee6ba2c96a765fc17c6200 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXListBoxOption.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXListBoxOption.cpp
@@ -108,7 +108,7 @@ bool AXListBoxOption::isSelectedOptionActive() const
if (!listBoxParentNode)
return false;
- return listBoxParentNode->activeSelectionEndListIndex() == listBoxOptionIndex();
+ return listBoxParentNode->activeSelectionEnd() == getNode();
}
bool AXListBoxOption::computeAccessibilityIsIgnored(IgnoredReasons* ignoredReasons) const
@@ -176,9 +176,7 @@ void AXListBoxOption::setSelected(bool selected)
if ((isOptionSelected && selected) || (!isOptionSelected && !selected))
return;
- // Convert from the entire list index to the option index.
- int optionIndex = selectElement->listToOptionIndex(listBoxOptionIndex());
- selectElement->accessKeySetSelectedIndex(optionIndex);
+ selectElement->selectOptionByAccessKey(toHTMLOptionElement(getNode()));
}
HTMLSelectElement* AXListBoxOption::listBoxOptionParentNode() const
@@ -192,20 +190,4 @@ HTMLSelectElement* AXListBoxOption::listBoxOptionParentNode() const
return 0;
}
-int AXListBoxOption::listBoxOptionIndex() const
-{
- HTMLSelectElement* selectElement = listBoxOptionParentNode();
- if (!selectElement)
- return -1;
-
- const HeapVector<Member<HTMLElement>>& listItems = selectElement->listItems();
- unsigned length = listItems.size();
- for (unsigned i = 0; i < length; i++) {
- if (listItems[i] == getNode())
- return i;
- }
-
- return -1;
-}
-
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXListBoxOption.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698