Title: [212869] trunk
Revision
212869
Author
[email protected]
Date
2017-02-22 17:55:05 -0800 (Wed, 22 Feb 2017)

Log Message

[Modern Media Controls] Scrubber stops moving while scrubbing on macOS
https://bugs.webkit.org/show_bug.cgi?id=168518
<rdar://problem/30577637>

Reviewed by Dean Jackson.

Source/WebCore:

As we start to scrub, controlValueWillStartChanging() is called on
ScrubberSupport and pauses the media if it's not already paused. This
causes the play/pause button to change icon and for layout() to be
called on MacOSInlineMediaControls. This in turns sets the .children
property on the .controlsBar and eventually yields a DOM manipulation
which re-inserts the scrubber's DOM hierarchy, causing stutters during
user interaction.

Our solution is to make the .children setter smarter about identifying
that the children list hasn't changed and that no DOM invalidation is
necessary.

* Modules/modern-media-controls/controls/layout-node.js:
(LayoutNode.prototype.set children):

LayoutTests:

Add assertions to check that setting children to a copy of itself doesn't
mark nodes as needing layout.

* media/modern-media-controls/layout-node/children-expected.txt:
* media/modern-media-controls/layout-node/children.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (212868 => 212869)


--- trunk/LayoutTests/ChangeLog	2017-02-23 01:48:40 UTC (rev 212868)
+++ trunk/LayoutTests/ChangeLog	2017-02-23 01:55:05 UTC (rev 212869)
@@ -1,5 +1,19 @@
 2017-02-22  Antoine Quint  <[email protected]>
 
+        [Modern Media Controls] Scrubber stops moving while scrubbing on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=168518
+        <rdar://problem/30577637>
+
+        Reviewed by Dean Jackson.
+
+        Add assertions to check that setting children to a copy of itself doesn't
+        mark nodes as needing layout.
+
+        * media/modern-media-controls/layout-node/children-expected.txt:
+        * media/modern-media-controls/layout-node/children.html:
+
+2017-02-22  Antoine Quint  <[email protected]>
+
         [Modern Media Controls] Controls bar may disappear while captions menu is visible
         https://bugs.webkit.org/show_bug.cgi?id=168751
         <rdar://problem/30663411>

Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/children-expected.txt (212868 => 212869)


--- trunk/LayoutTests/media/modern-media-controls/layout-node/children-expected.txt	2017-02-23 01:48:40 UTC (rev 212868)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/children-expected.txt	2017-02-23 01:55:05 UTC (rev 212869)
@@ -20,6 +20,11 @@
 PASS node.element.firstElementChild.nextElementSibling === b.element is true
 PASS node.element.lastElementChild === c.element is true
 
+Set children to be a copy of itself
+PASS node.children[0].needsLayout is false
+PASS node.children[1].needsLayout is false
+PASS node.children[2].needsLayout is false
+
 Set children to [b, a]
 PASS node.children.length === 2 is true
 PASS node.children[0] === b is true

Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/children.html (212868 => 212869)


--- trunk/LayoutTests/media/modern-media-controls/layout-node/children.html	2017-02-23 01:48:40 UTC (rev 212868)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/children.html	2017-02-23 01:55:05 UTC (rev 212869)
@@ -42,6 +42,12 @@
         shouldBeTrue("node.element.firstElementChild.nextElementSibling === b.element");
         shouldBeTrue("node.element.lastElementChild === c.element");
         debug("");
+        debug("Set children to be a copy of itself");
+        node.children = Array.from(node.children);
+        shouldBeFalse("node.children[0].needsLayout");
+        shouldBeFalse("node.children[1].needsLayout");
+        shouldBeFalse("node.children[2].needsLayout");
+        debug("");
         debug("Set children to [b, a]");
         node.children = [b, a];
         shouldBeTrue("node.children.length === 2");

Modified: trunk/Source/WebCore/ChangeLog (212868 => 212869)


--- trunk/Source/WebCore/ChangeLog	2017-02-23 01:48:40 UTC (rev 212868)
+++ trunk/Source/WebCore/ChangeLog	2017-02-23 01:55:05 UTC (rev 212869)
@@ -1,5 +1,28 @@
 2017-02-22  Antoine Quint  <[email protected]>
 
+        [Modern Media Controls] Scrubber stops moving while scrubbing on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=168518
+        <rdar://problem/30577637>
+
+        Reviewed by Dean Jackson.
+
+        As we start to scrub, controlValueWillStartChanging() is called on
+        ScrubberSupport and pauses the media if it's not already paused. This
+        causes the play/pause button to change icon and for layout() to be
+        called on MacOSInlineMediaControls. This in turns sets the .children
+        property on the .controlsBar and eventually yields a DOM manipulation
+        which re-inserts the scrubber's DOM hierarchy, causing stutters during
+        user interaction.
+
+        Our solution is to make the .children setter smarter about identifying
+        that the children list hasn't changed and that no DOM invalidation is
+        necessary.
+
+        * Modules/modern-media-controls/controls/layout-node.js:
+        (LayoutNode.prototype.set children):
+
+2017-02-22  Antoine Quint  <[email protected]>
+
         [Modern Media Controls] Controls bar may disappear while captions menu is visible
         https://bugs.webkit.org/show_bug.cgi?id=168751
         <rdar://problem/30663411>

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js (212868 => 212869)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js	2017-02-23 01:48:40 UTC (rev 212868)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js	2017-02-23 01:55:05 UTC (rev 212869)
@@ -126,6 +126,18 @@
 
     set children(children)
     {
+        if (children.length === this._children.length) {
+            let arraysDiffer = false;
+            for (let i = children.length - 1; i >= 0; --i) {
+                if (children[i] !== this._children[i]) {
+                    arraysDiffer = true;
+                    break;
+                }
+            }
+            if (!arraysDiffer)
+                return;
+        }
+
         while (this._children.length)
             this.removeChild(this._children[0]);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to