Improve performance to remove OPTIONs from a single-selection SELECT.
Manual merge from m53 to m52.
LayoutMenuList::updateOptionsHeightWidth() is an O(n) function to get maximum
OPTION width and height.
We had a bad performance because it is called whenever we remove a selected
OPTION from a SELECT. This CL changes the timing of updateOptionsHeightWidth().
It was called by updateFromElement() after an OPTION is
added/removed. updateOptionsHeightWidth() makes layout dirty only if maximum
width/height was changed.
OPTION addition/removal makes maximum width/height dirty and makes layout
dirty, and updateOptionsHeightWidth() is called only if the maximum
width/height is referred.
The new behavior makes layout dirty more frequently, however it reduces the
number of updateOptionsHeightWidth() calls significantly.
This CL makes PerformanceTests/DOM/select-single-remove.html faster.
On my local machine, 5.1 runs/s -> 45.1 runs/s
LayoutMenuList correctly updates its width and height after this CL.
Extra invalidation as expected.
(cherry picked from commit 1b32ab54ae3451e24152fc1e433b7e1cb44ac56e)
Review URL: https://codereview.chromium.org/2093563005 .
4 files changed