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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 1417683004: Media controls refer to less magic state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cl feedback. Created 5 years, 2 months 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
Index: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
index ab6d1484d6c2745d87b7cf773b5775d974c2d41b..5ae1bf111926b3e06c1b2177035ac8772c686334 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
@@ -414,8 +414,7 @@ void MediaControls::updateVolume()
{
m_muteButton->updateDisplayType();
// Invalidate the mute button because it paints differently according to volume.
- if (LayoutObject* layoutObject = m_muteButton->layoutObject())
- layoutObject->setShouldDoFullPaintInvalidation();
+ invalidate(m_muteButton);
if (mediaElement().muted())
m_volumeSlider->setVolume(0);
@@ -441,8 +440,7 @@ void MediaControls::updateVolume()
}
// Invalidate the volume slider because it paints differently according to volume.
- if (LayoutObject* layoutObject = m_volumeSlider->layoutObject())
- layoutObject->setShouldDoFullPaintInvalidation();
+ invalidate(m_volumeSlider);
}
void MediaControls::changedClosedCaptionsVisibility()
@@ -708,6 +706,25 @@ void MediaControls::setAllowHiddenVolumeControls(bool allow)
updateVolume();
}
+void MediaControls::invalidate(Element* element)
+{
+ if (!element)
+ return;
+
+ if (LayoutObject* layoutObject = element->layoutObject())
+ layoutObject->setShouldDoFullPaintInvalidation();
+}
+
+void MediaControls::networkStateChanged()
+{
+ invalidate(m_playButton);
+ invalidate(m_overlayPlayButton);
+ invalidate(m_muteButton);
+ invalidate(m_fullScreenButton);
+ invalidate(m_timeline);
+ invalidate(m_volumeSlider);
+}
+
DEFINE_TRACE(MediaControls)
{
visitor->trace(m_mediaElement);

Powered by Google App Engine
This is Rietveld 408576698