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 c9744c5af5e4a1ff042bfd3feb47b03160144c99..2382c008a769a7faa36380d528f46e73a709d532 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutMedia.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutMedia.cpp |
@@ -83,8 +83,7 @@ void LayoutMedia::layout() { |
LayoutUnit width = newRect.width(); |
if (child->node()->isMediaControls()) { |
width = computePanelWidth(newRect); |
- if (width != oldSize.width()) |
- newPanelWidth = width; |
+ newPanelWidth = width; |
} |
LayoutBox* layoutBox = toLayoutBox(child); |
@@ -102,8 +101,13 @@ void LayoutMedia::layout() { |
// Notify our MediaControls that a layout has happened. |
if (mediaElement() && mediaElement()->mediaControls() && |
newPanelWidth.has_value()) { |
- mediaElement()->mediaControls()->notifyPanelWidthChanged( |
- newPanelWidth.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(); |
+ } |
} |
} |