Index: third_party/WebKit/Source/core/layout/LayoutMedia.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutMedia.cpp b/third_party/WebKit/Source/core/layout/LayoutMedia.cpp |
index ae50013ff9ecb3b817429f21eccb38bf6018c019..c5cfabd5438825095e56c340f62c4091a9059c36 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutMedia.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutMedia.cpp |
@@ -54,7 +54,9 @@ void LayoutMedia::layout() { |
LayoutState state(*this); |
- Optional<LayoutUnit> newPanelWidth; |
+ // Used to notify MediaControls of initial size. |
+ Optional<LayoutUnit> newWidth; |
+ Optional<LayoutUnit> newHeight; |
// Iterate the children in reverse order so that the media controls are laid |
// out before the text track container. This is to ensure that the text |
@@ -83,7 +85,8 @@ void LayoutMedia::layout() { |
LayoutUnit width = newRect.width(); |
if (child->node()->isMediaControls()) { |
width = computePanelWidth(newRect); |
- newPanelWidth = width; |
+ newWidth = width; |
+ newHeight = newRect.height(); |
} |
LayoutBox* layoutBox = toLayoutBox(child); |
@@ -100,14 +103,9 @@ void LayoutMedia::layout() { |
// Notify our MediaControls that a layout has happened. |
if (mediaElement() && mediaElement()->mediaControls() && |
- newPanelWidth.has_value()) { |
- if (!m_lastReportedPanelWidth.has_value() || |
- m_lastReportedPanelWidth.value() != newPanelWidth.value()) { |
- mediaElement()->mediaControls()->notifyPanelWidthChanged( |
- newPanelWidth.value()); |
- // Store the last value we reported, so we know if it has changed. |
- m_lastReportedPanelWidth = newPanelWidth.value(); |
- } |
+ newWidth.has_value() && newHeight.has_value()) { |
+ mediaElement()->mediaControls()->onLayout(newWidth->toInt(), |
+ newHeight->toInt()); |
} |
} |