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().

Old:
  It was called by updateFromElement() after an OPTION is
  added/removed. updateOptionsHeightWidth() makes layout dirty only if maximum
  width/height was changed.

New:
  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

Test update:
* http/tests/webfont/popup-menu-load-webfont-after-open.html
  LayoutMenuList correctly updates its width and height after this CL.
* fast/repaint/control-clip.html
  Extra invalidation as expected.

TBR=tkent@chromium.org
BUG=620142
Review-Url: https://codereview.chromium.org/2077343002
Cr-Commit-Position: refs/heads/master@{#400903}
(cherry picked from commit 1b32ab54ae3451e24152fc1e433b7e1cb44ac56e)

Review URL: https://codereview.chromium.org/2093563005 .

Cr-Commit-Position: refs/branch-heads/2743@{#466}
Cr-Branched-From: 2b3ae3b8090361f8af5a611712fc1a5ab2de53cb-refs/heads/master@{#394939}
4 files changed