Commit 2fe3813f authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Make FirstSelectableOption() and LastSelectedOption() of HTMLSelectElement faster

Resolves two TODO()s.
This CL has no behavior changes.

Change-Id: Ibee5cc16246703940b3312fcbea05a9b2a529e51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066420Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743418}
parent c580f7d7
...@@ -537,15 +537,11 @@ HTMLOptionElement* HTMLSelectElement::PreviousSelectableOption( ...@@ -537,15 +537,11 @@ HTMLOptionElement* HTMLSelectElement::PreviousSelectableOption(
} }
HTMLOptionElement* HTMLSelectElement::FirstSelectableOption() const { HTMLOptionElement* HTMLSelectElement::FirstSelectableOption() const {
// TODO(tkent): This is not efficient. nextSlectableOption(nullptr) is return NextValidOption(-1, kSkipForwards, 1);
// faster.
return NextValidOption(GetListItems().size(), kSkipBackwards, INT_MAX);
} }
HTMLOptionElement* HTMLSelectElement::LastSelectableOption() const { HTMLOptionElement* HTMLSelectElement::LastSelectableOption() const {
// TODO(tkent): This is not efficient. previousSlectableOption(nullptr) is return NextValidOption(GetListItems().size(), kSkipBackwards, 1);
// faster.
return NextValidOption(-1, kSkipForwards, INT_MAX);
} }
// Returns the index of the next valid item one page away from |startIndex| in // Returns the index of the next valid item one page away from |startIndex| in
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment