Chromium Code Reviews
DescriptionImprove conformance of default OPTION selection of SELECT element
This CL changes the following behavior:
* When an OPTION element is removed from the owner SELECT element, default OPTION
selection happens immediately
* Do not select disabled OPTIONs in default OPTION selection
New behavior matches to Firefox, and conforms to the HTML standard.
Implementation:
- Separate default OPTION selection code from recalcListItems().
recalcListItems() is called lazily. So the timing of default OPTION selection
was unclear. Now we can run only default OPTION selection explicitly.
We could run default OPTION selection by recalcListItems(). However it was
hard to optimize it.
We apply the new default OPTION selection function to HTMLSelectElement::
resetImpl(). Default OPTION selection code in resetImpl() and recalcListItems()
were inconsistent for disabled OPTION elements.
- Remove !isFinisedParsingChildren() hack
It was necessary because we needed to call recalcListItems(), which is O(N), to
run default OPTION selection.
optionInserted() skips default OPTION selection if we already have the selected
OPTION. We don't need the hack any longer.
Tests:
This CL changes the beahvior of fast/forms/select/HTMLOptionElement_selected3.html.
It's expected because we run default OPTION selection immediately after adding an
OPTION, not run it lazily in HTMLOptionElement::selected().
BUG=335876
Committed: https://crrev.com/8dcbfa5cdab0982e4ebc485a9c8e70e20cef5026
Cr-Commit-Position: refs/heads/master@{#383480}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Renaming to resetToDefaultSelection #Messages
Total messages: 15 (7 generated)
|