Title: [174756] trunk/Source/WebCore
Revision
174756
Author
d...@apple.com
Date
2014-10-15 19:25:34 -0700 (Wed, 15 Oct 2014)

Log Message

[Media] Reduce style updates (painting) in controls
https://bugs.webkit.org/show_bug.cgi?id=137763
<rdar://problem/17833045>

Reviewed by Simon Fraser.

Media controls were causing a lot of repaints they were
constantly updating the style of the widgets, the value
of the forms, or the text in the display.

This is necessary when the controls are visible, but not
necessary when they are hidden. Return immediately in that case.

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.createControls): Initialise the slider to a zero value.
(Controller.prototype.handleDurationChange): Force an update even though we might be hidden.
(Controller.prototype.updateProgress): Don't update if we're hidden.
(Controller.prototype.updateTime): Ditto.
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.updateProgress): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174755 => 174756)


--- trunk/Source/WebCore/ChangeLog	2014-10-16 01:41:23 UTC (rev 174755)
+++ trunk/Source/WebCore/ChangeLog	2014-10-16 02:25:34 UTC (rev 174756)
@@ -1,3 +1,26 @@
+2014-10-15  Dean Jackson  <d...@apple.com>
+
+        [Media] Reduce style updates (painting) in controls
+        https://bugs.webkit.org/show_bug.cgi?id=137763
+        <rdar://problem/17833045>
+
+        Reviewed by Simon Fraser.
+
+        Media controls were causing a lot of repaints they were
+        constantly updating the style of the widgets, the value
+        of the forms, or the text in the display.
+
+        This is necessary when the controls are visible, but not
+        necessary when they are hidden. Return immediately in that case.
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.createControls): Initialise the slider to a zero value.
+        (Controller.prototype.handleDurationChange): Force an update even though we might be hidden.
+        (Controller.prototype.updateProgress): Don't update if we're hidden.
+        (Controller.prototype.updateTime): Ditto.
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.updateProgress): Ditto.
+
 2014-10-15  Chris Dumez  <cdu...@apple.com>
 
         [Mac] Fix inefficiencies in ResourceResponse::platformLazyInit(InitLevel) - Part 2

Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (174755 => 174756)


--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2014-10-16 01:41:23 UTC (rev 174755)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2014-10-16 02:25:34 UTC (rev 174756)
@@ -333,6 +333,7 @@
         timeline.setAttribute('pseudo', '-webkit-media-controls-timeline');
         timeline.setAttribute('aria-label', this.UIString('Duration'));
         timeline.type = 'range';
+        timeline.value = 0;
         this.listenFor(timeline, 'input', this.handleTimelineChange);
         this.listenFor(timeline, 'mouseover', this.handleTimelineMouseOver);
         this.listenFor(timeline, 'mouseout', this.handleTimelineMouseOut);
@@ -567,8 +568,8 @@
     handleDurationChange: function(event)
     {
         this.updateDuration();
-        this.updateTime();
-        this.updateProgress();
+        this.updateTime(true);
+        this.updateProgress(true);
     },
 
     handlePlay: function(event)
@@ -956,8 +957,11 @@
         return gradient;
     },
 
-    updateProgress: function()
+    updateProgress: function(forceUpdate)
     {
+        if (!forceUpdate && this.controlsAreHidden())
+            return;
+
         this.updateTimelineMetricsIfNeeded();
 
         var background = ''data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1" preserveAspectRatio="none"><linearGradient id="gradient" x2="0" y2="100%" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="rgb(2, 2, 2)"/><stop offset="1" stop-color="rgb(23, 23, 23)"/></linearGradient><g style="fill:url(#gradient)">'
@@ -1050,8 +1054,11 @@
         this.setNeedsTimelineMetricsUpdate();
     },
 
-    updateTime: function()
+    updateTime: function(forceUpdate)
     {
+        if (!forceUpdate && this.controlsAreHidden())
+            return;
+
         var currentTime = this.video.currentTime;
         var timeRemaining = currentTime - this.video.duration;
         this.controls.currentTime.innerText = this.formatTime(currentTime);

Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (174755 => 174756)


--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2014-10-16 01:41:23 UTC (rev 174755)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2014-10-16 02:25:34 UTC (rev 174756)
@@ -238,9 +238,12 @@
         return 'rgba(0, 0, 0, 0.5)';
     },
 
-    updateProgress: function() {
-        Controller.prototype.updateProgress.call(this);
+    updateProgress: function(forceUpdate) {
+        Controller.prototype.updateProgress.call(this, forceUpdate);
 
+        if (!forceUpdate && this.controlsAreHidden())
+            return;
+
         var width = this.timelineWidth;
         var height = this.timelineHeight;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to