Diff
Modified: trunk/LayoutTests/ChangeLog (209166 => 209167)
--- trunk/LayoutTests/ChangeLog 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/ChangeLog 2016-12-01 02:33:04 UTC (rev 209167)
@@ -1,3 +1,24 @@
+2016-11-30 Antoine Quint <[email protected]>
+
+ [Modern Media Controls] LayoutNode: only mark properties as dirty if different than current value
+ https://bugs.webkit.org/show_bug.cgi?id=165236
+
+ Reviewed by Simon Fraser.
+
+ Update LayoutNode property tests to check that setting a given property to the
+ same value doesn't schedule an update.
+
+ * media/modern-media-controls/layout-node/height-expected.txt:
+ * media/modern-media-controls/layout-node/height.html:
+ * media/modern-media-controls/layout-node/visible-expected.txt:
+ * media/modern-media-controls/layout-node/visible.html:
+ * media/modern-media-controls/layout-node/width-expected.txt:
+ * media/modern-media-controls/layout-node/width.html:
+ * media/modern-media-controls/layout-node/x-expected.txt:
+ * media/modern-media-controls/layout-node/x.html:
+ * media/modern-media-controls/layout-node/y-expected.txt:
+ * media/modern-media-controls/layout-node/y.html:
+
2016-11-30 Jiewen Tan <[email protected]>
SubtleCrypto::deriveKey always return NOT_SUPPORTED_ERR for now
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/height-expected.txt (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/height-expected.txt 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/height-expected.txt 2016-12-01 02:33:04 UTC (rev 209167)
@@ -16,6 +16,10 @@
Layout was performed
PASS node.height is 20
PASS node.element.style.height is "20px"
+
+node.height = 20
+PASS scheduler.hasScheduledLayoutCallbacks is false
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/height.html (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/height.html 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/height.html 2016-12-01 02:33:04 UTC (rev 209167)
@@ -30,6 +30,13 @@
debug("Layout was performed");
shouldBe("node.height", "20");
shouldBeEqualToString("node.element.style.height", "20px");
+
+ debug("");
+ debug("node.height = 20");
+ node.height = 20;
+ shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
+ debug("");
+
finishJSTest();
};
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/visible-expected.txt (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/visible-expected.txt 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/visible-expected.txt 2016-12-01 02:33:04 UTC (rev 209167)
@@ -20,6 +20,10 @@
Layout was performed
PASS node.visible is true
PASS node.element.style.display is "inherit"
+
+node.visible = true
+PASS scheduler.hasScheduledLayoutCallbacks is false
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/visible.html (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/visible.html 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/visible.html 2016-12-01 02:33:04 UTC (rev 209167)
@@ -36,6 +36,13 @@
case 2:
shouldBe("node.visible", "true");
shouldBeEqualToString("node.element.style.display", "inherit");
+
+ debug("");
+ debug("node.visible = true");
+ node.visible = true;
+ shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
+ debug("");
+
finishJSTest();
break;
}
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/width-expected.txt (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/width-expected.txt 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/width-expected.txt 2016-12-01 02:33:04 UTC (rev 209167)
@@ -16,6 +16,10 @@
Layout was performed
PASS node.width is 20
PASS node.element.style.width is "20px"
+
+node.width = 20
+PASS scheduler.hasScheduledLayoutCallbacks is false
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/width.html (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/width.html 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/width.html 2016-12-01 02:33:04 UTC (rev 209167)
@@ -30,6 +30,13 @@
debug("Layout was performed");
shouldBe("node.width", "20");
shouldBeEqualToString("node.element.style.width", "20px");
+
+ debug("");
+ debug("node.width = 20");
+ node.width = 20;
+ shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
+ debug("");
+
finishJSTest();
};
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/x-expected.txt (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/x-expected.txt 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/x-expected.txt 2016-12-01 02:33:04 UTC (rev 209167)
@@ -16,6 +16,10 @@
Layout was performed
PASS node.x is 20
PASS node.element.style.left is "20px"
+
+node.x = 20
+PASS scheduler.hasScheduledLayoutCallbacks is false
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/x.html (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/x.html 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/x.html 2016-12-01 02:33:04 UTC (rev 209167)
@@ -30,6 +30,13 @@
debug("Layout was performed");
shouldBe("node.x", "20");
shouldBeEqualToString("node.element.style.left", "20px");
+
+ debug("");
+ debug("node.x = 20");
+ node.x = 20;
+ shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
+ debug("");
+
finishJSTest();
};
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/y-expected.txt (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/y-expected.txt 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/y-expected.txt 2016-12-01 02:33:04 UTC (rev 209167)
@@ -16,6 +16,10 @@
Layout was performed
PASS node.y is 20
PASS node.element.style.top is "20px"
+
+node.y = 20
+PASS scheduler.hasScheduledLayoutCallbacks is false
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/media/modern-media-controls/layout-node/y.html (209166 => 209167)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/y.html 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/y.html 2016-12-01 02:33:04 UTC (rev 209167)
@@ -30,6 +30,13 @@
debug("Layout was performed");
shouldBe("node.y", "20");
shouldBeEqualToString("node.element.style.top", "20px");
+
+ debug("");
+ debug("node.y = 20");
+ node.y = 20;
+ shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
+ debug("");
+
finishJSTest();
};
Modified: trunk/Source/WebCore/ChangeLog (209166 => 209167)
--- trunk/Source/WebCore/ChangeLog 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/Source/WebCore/ChangeLog 2016-12-01 02:33:04 UTC (rev 209167)
@@ -1,3 +1,22 @@
+2016-11-30 Antoine Quint <[email protected]>
+
+ [Modern Media Controls] LayoutNode: only mark properties as dirty if different than current value
+ https://bugs.webkit.org/show_bug.cgi?id=165236
+
+ Reviewed by Simon Fraser.
+
+ Check that the new value is different than the current value before marking the property as dirty.
+
+ * Modules/modern-media-controls/controls/layout-node.js:
+ (LayoutNode.prototype.set x):
+ (LayoutNode.prototype.set y):
+ (LayoutNode.prototype.set width):
+ (LayoutNode.prototype.set height):
+ (LayoutNode.prototype.set visible):
+ (performScheduledLayout):
+ * Modules/modern-media-controls/controls/scheduler.js:
+ (const.scheduler.new.prototype.get hasScheduledLayoutCallbacks):
+
2016-11-30 Jiewen Tan <[email protected]>
SubtleCrypto::deriveKey always return NOT_SUPPORTED_ERR for now
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js (209166 => 209167)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js 2016-12-01 02:33:04 UTC (rev 209167)
@@ -37,6 +37,9 @@
set x(x)
{
+ if (x === this._x)
+ return;
+
this._x = x;
this.markDirtyProperty("x");
}
@@ -48,6 +51,9 @@
set y(y)
{
+ if (y === this._y)
+ return;
+
this._y = y;
this.markDirtyProperty("y");
}
@@ -59,6 +65,9 @@
set width(width)
{
+ if (width === this._width)
+ return;
+
this._width = width;
this.markDirtyProperty("width");
}
@@ -70,6 +79,9 @@
set height(height)
{
+ if (height === this._height)
+ return;
+
this._height = height;
this.markDirtyProperty("height");
}
@@ -81,6 +93,9 @@
set visible(flag)
{
+ if (flag === this._visible)
+ return;
+
this._visible = flag;
this.markDirtyProperty("visible");
}
@@ -265,7 +280,7 @@
{
dirtyNodes.forEach(node => {
node.needsLayout = false;
- node.layout()
+ node.layout();
});
dirtyNodes.clear();
scheduler.unscheduleLayout(performScheduledLayout);
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/scheduler.js (209166 => 209167)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/scheduler.js 2016-12-01 01:11:11 UTC (rev 209166)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/scheduler.js 2016-12-01 02:33:04 UTC (rev 209167)
@@ -10,6 +10,11 @@
// Public
+ get hasScheduledLayoutCallbacks()
+ {
+ return this._frameID !== -1 || this._layoutCallbacks.size > 0;
+ }
+
scheduleLayout(callback)
{
if (typeof callback !== "function")