Title: [209607] trunk
Revision
209607
Author
grao...@webkit.org
Date
2016-12-09 07:31:24 -0800 (Fri, 09 Dec 2016)

Log Message

[Modern Media Controls] Remaining time label first appears way to the left
https://bugs.webkit.org/show_bug.cgi?id=165637

Reviewed by Dean Jackson.

Source/WebCore:

We would sometimes see the remaining time label be laid out in an incorrect position
when a video would start playing. This happened because the time label was being committed
from a previous value before, in the same frame, we would call the layout() function
of MacOSInlineMediaControls. This would set the newly computed location for the
remaining time label, but because we would reset the list of dirty properties after
calling all layout functions, the new value set in MacOSInlineMediaControls.layout()
would be disregarded and the wrong, committed value would persist until it was reset
in a much later frame.

We now correctly clear the list of dirty nodes before laying them out, giving all nodes
a chance to become dirty again during layout, and updated again in the next frame.

Test: media/modern-media-controls/layout-node/node-made-dirty-during-layout.html

* Modules/modern-media-controls/controls/layout-node.js:
(performScheduledLayout):

LayoutTests:

Add a new test that checks that marking a property as dirty during a layout correctly commits
that property on the next frame.

* media/modern-media-controls/layout-node/node-made-dirty-during-layout-expected.txt: Added.
* media/modern-media-controls/layout-node/node-made-dirty-during-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209606 => 209607)


--- trunk/LayoutTests/ChangeLog	2016-12-09 15:30:34 UTC (rev 209606)
+++ trunk/LayoutTests/ChangeLog	2016-12-09 15:31:24 UTC (rev 209607)
@@ -1,3 +1,16 @@
+2016-12-09  Antoine Quint  <grao...@apple.com>
+
+        [Modern Media Controls] Remaining time label first appears way to the left
+        https://bugs.webkit.org/show_bug.cgi?id=165637
+
+        Reviewed by Dean Jackson.
+
+        Add a new test that checks that marking a property as dirty during a layout correctly commits
+        that property on the next frame.
+
+        * media/modern-media-controls/layout-node/node-made-dirty-during-layout-expected.txt: Added.
+        * media/modern-media-controls/layout-node/node-made-dirty-during-layout.html: Added.
+
 2016-12-08  Jiewen Tan  <jiewen_...@apple.com>
 
         [WebCrypto] Remove NoInterfaceObject attribute from SubtleCrypto Interface

Added: trunk/LayoutTests/media/modern-media-controls/layout-node/node-made-dirty-during-layout-expected.txt (0 => 209607)


--- trunk/LayoutTests/media/modern-media-controls/layout-node/node-made-dirty-during-layout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/node-made-dirty-during-layout-expected.txt	2016-12-09 15:31:24 UTC (rev 209607)
@@ -0,0 +1,11 @@
+Testing the LayoutNode.y property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS node.element.style.left is "20px"
+PASS node.element.style.left is "10px"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/media/modern-media-controls/layout-node/node-made-dirty-during-layout.html (0 => 209607)


--- trunk/LayoutTests/media/modern-media-controls/layout-node/node-made-dirty-during-layout.html	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/node-made-dirty-during-layout.html	2016-12-09 15:31:24 UTC (rev 209607)
@@ -0,0 +1,44 @@
+<script src=""
+<script src="" type="text/_javascript_"></script>
+<script src="" type="text/_javascript_"></script>
+<script type="text/_javascript_">
+
+description("Testing the <code>LayoutNode.y</code> property.");
+
+window.jsTestIsAsync = true;
+
+class CustomNode extends LayoutNode
+{
+    
+    layout()
+    {
+        super.layout();
+
+        this.x = 10;
+    }
+    
+}
+
+const node = new CustomNode;
+node.x = 20;
+
+let numberOfFrames = 0;
+scheduler.frameDidFire = function()
+{
+    numberOfFrames++;
+    if (numberOfFrames == 1)
+        shouldBeEqualToString("node.element.style.left", "20px");
+    else if (numberOfFrames == 2) {
+        shouldBeEqualToString("node.element.style.left", "10px");
+        finishJSTest();
+    }
+};
+
+// Half a second should be sufficient for this test to complete.
+setTimeout(() => {
+    debug("FAIL: Test timed out.");
+    finishJSTest();
+}, 500);
+
+</script>
+<script src=""

Modified: trunk/Source/WebCore/ChangeLog (209606 => 209607)


--- trunk/Source/WebCore/ChangeLog	2016-12-09 15:30:34 UTC (rev 209606)
+++ trunk/Source/WebCore/ChangeLog	2016-12-09 15:31:24 UTC (rev 209607)
@@ -1,3 +1,27 @@
+2016-12-09  Antoine Quint  <grao...@apple.com>
+
+        [Modern Media Controls] Remaining time label first appears way to the left
+        https://bugs.webkit.org/show_bug.cgi?id=165637
+
+        Reviewed by Dean Jackson.
+
+        We would sometimes see the remaining time label be laid out in an incorrect position
+        when a video would start playing. This happened because the time label was being committed
+        from a previous value before, in the same frame, we would call the layout() function
+        of MacOSInlineMediaControls. This would set the newly computed location for the
+        remaining time label, but because we would reset the list of dirty properties after
+        calling all layout functions, the new value set in MacOSInlineMediaControls.layout()
+        would be disregarded and the wrong, committed value would persist until it was reset
+        in a much later frame.
+
+        We now correctly clear the list of dirty nodes before laying them out, giving all nodes
+        a chance to become dirty again during layout, and updated again in the next frame.
+
+        Test: media/modern-media-controls/layout-node/node-made-dirty-during-layout.html
+
+        * Modules/modern-media-controls/controls/layout-node.js:
+        (performScheduledLayout):
+
 2016-12-09  Per Arne Vollan  <pvol...@apple.com>
 
         Fix compile errors on Windows when building with .proj files.

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


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js	2016-12-09 15:30:34 UTC (rev 209606)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js	2016-12-09 15:31:24 UTC (rev 209607)
@@ -288,12 +288,12 @@
 
 function performScheduledLayout()
 {
-    dirtyNodes.forEach(node => {
-        node.needsLayout = false;
+    const previousDirtyNodes = Array.from(dirtyNodes);
+    dirtyNodes.clear();
+    previousDirtyNodes.forEach(node => {
+        node._needsLayout = false;
         node.layout();
     });
-    dirtyNodes.clear();
-    scheduler.unscheduleLayout(performScheduledLayout);
 
     nodesRequiringChildrenUpdate.forEach(node => node._updateChildren());
     nodesRequiringChildrenUpdate.clear();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to