Move LayoutMenuList's height calculation logic to styleDidChange method as we need to recalculate the height if the page zoom is changed.

BUG=624269
TEST=LayoutTests/transforms/2d/zoom-menulist.html

Review-Url: https://codereview.chromium.org/2108043003
Cr-Commit-Position: refs/heads/master@{#403248}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 41968d76..43444a27 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1385,6 +1385,8 @@
 crbug.com/624023 virtual/threaded/fast/compositorworker/basic-plumbing-worker-to-main.html [ Pass Timeout ]
 crbug.com/624023 virtual/threaded/fast/compositorworker/basic-plumbing-main-to-worker.html [ Pass Timeout ]
 
+crbug.com/624269 transforms/2d/zoom-menulist.html [ NeedsRebaseline ]
+
 crbug.com/624430 [ Win10 ] fast/text/font-features/caps-casemapping.html [ Failure ]
 
 crbug.com/624709 [ Win ] virtual/gpu-rasterization/fast/images/png-with-color-profile.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/transforms/2d/zoom-menulist.html b/third_party/WebKit/LayoutTests/transforms/2d/zoom-menulist.html
index a2ca6196..c4ca986 100644
--- a/third_party/WebKit/LayoutTests/transforms/2d/zoom-menulist.html
+++ b/third_party/WebKit/LayoutTests/transforms/2d/zoom-menulist.html
@@ -1,5 +1,5 @@
 <html>
-<body>
+<body onload="document.body.style.zoom = 1.5;">
 <h1>Zooming Menu List</h1>
 
 <select style="zoom:3"><option>One<option>Two<option>Three<Option>Four</select>
diff --git a/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp b/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
index 04b1aec..a5e44c0a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
@@ -80,8 +80,6 @@
 
     adjustInnerStyle();
     LayoutFlexibleBox::addChild(m_innerBlock);
-
-    m_innerBlockHeight = style()->getFontMetrics().height() + m_innerBlock->borderAndPaddingHeight();
 }
 
 void LayoutMenuList::adjustInnerStyle()
@@ -147,6 +145,12 @@
 
     m_buttonText->setStyle(mutableStyle());
     adjustInnerStyle();
+    updateInnerBlockHeight();
+}
+
+void LayoutMenuList::updateInnerBlockHeight()
+{
+    m_innerBlockHeight = style()->getFontMetrics().height() + m_innerBlock->borderAndPaddingHeight();
 }
 
 void LayoutMenuList::updateOptionsWidth() const
diff --git a/third_party/WebKit/Source/core/layout/LayoutMenuList.h b/third_party/WebKit/Source/core/layout/LayoutMenuList.h
index 51c643d..fa96089f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMenuList.h
+++ b/third_party/WebKit/Source/core/layout/LayoutMenuList.h
@@ -80,6 +80,7 @@
     void adjustInnerStyle();
     void setText(const String&);
     void setTextFromOption(int optionIndex);
+    void updateInnerBlockHeight();
     void updateOptionsWidth() const;
     float computeTextWidth(const TextRun&, const ComputedStyle&) const;
     void setIndexToSelectOnCancel(int listIndex);