Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutMedia.cpp

Issue 2561823003: Ensure LayoutMedia notifies MediaControls of panel width (Closed)
Patch Set: feedback Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMedia.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+ }
}
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMedia.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698