Changeset 209167 in webkit


Ignore:
Timestamp:
Nov 30, 2016 6:33:04 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[Modern Media Controls] LayoutNode: only mark properties as dirty if different than current value
https://bugs.webkit.org/show_bug.cgi?id=165236

Patch by Antoine Quint <Antoine Quint> on 2016-11-30
Reviewed by Simon Fraser.

Source/WebCore:

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):

LayoutTests:

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:
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r209166 r209167  
     12016-11-30  Antoine Quint  <graouts@apple.com>
     2
     3        [Modern Media Controls] LayoutNode: only mark properties as dirty if different than current value
     4        https://bugs.webkit.org/show_bug.cgi?id=165236
     5
     6        Reviewed by Simon Fraser.
     7
     8        Update LayoutNode property tests to check that setting a given property to the
     9        same value doesn't schedule an update.
     10
     11        * media/modern-media-controls/layout-node/height-expected.txt:
     12        * media/modern-media-controls/layout-node/height.html:
     13        * media/modern-media-controls/layout-node/visible-expected.txt:
     14        * media/modern-media-controls/layout-node/visible.html:
     15        * media/modern-media-controls/layout-node/width-expected.txt:
     16        * media/modern-media-controls/layout-node/width.html:
     17        * media/modern-media-controls/layout-node/x-expected.txt:
     18        * media/modern-media-controls/layout-node/x.html:
     19        * media/modern-media-controls/layout-node/y-expected.txt:
     20        * media/modern-media-controls/layout-node/y.html:
     21
    1222016-11-30  Jiewen Tan  <jiewen_tan@apple.com>
    223
  • trunk/LayoutTests/media/modern-media-controls/layout-node/height-expected.txt

    r206686 r209167  
    1717PASS node.height is 20
    1818PASS node.element.style.height is "20px"
     19
     20node.height = 20
     21PASS scheduler.hasScheduledLayoutCallbacks is false
     22
    1923PASS successfullyParsed is true
    2024
  • trunk/LayoutTests/media/modern-media-controls/layout-node/height.html

    r206686 r209167  
    3131    shouldBe("node.height", "20");
    3232    shouldBeEqualToString("node.element.style.height", "20px");
     33
     34    debug("");
     35    debug("node.height = 20");
     36    node.height = 20;
     37    shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
     38    debug("");
     39
    3340    finishJSTest();
    3441};
  • trunk/LayoutTests/media/modern-media-controls/layout-node/visible-expected.txt

    r206686 r209167  
    2121PASS node.visible is true
    2222PASS node.element.style.display is "inherit"
     23
     24node.visible = true
     25PASS scheduler.hasScheduledLayoutCallbacks is false
     26
    2327PASS successfullyParsed is true
    2428
  • trunk/LayoutTests/media/modern-media-controls/layout-node/visible.html

    r206686 r209167  
    3737        shouldBe("node.visible", "true");
    3838        shouldBeEqualToString("node.element.style.display", "inherit");
     39
     40        debug("");
     41        debug("node.visible = true");
     42        node.visible = true;
     43        shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
     44        debug("");
     45
    3946        finishJSTest();
    4047        break;
  • trunk/LayoutTests/media/modern-media-controls/layout-node/width-expected.txt

    r206686 r209167  
    1717PASS node.width is 20
    1818PASS node.element.style.width is "20px"
     19
     20node.width = 20
     21PASS scheduler.hasScheduledLayoutCallbacks is false
     22
    1923PASS successfullyParsed is true
    2024
  • trunk/LayoutTests/media/modern-media-controls/layout-node/width.html

    r206686 r209167  
    3131    shouldBe("node.width", "20");
    3232    shouldBeEqualToString("node.element.style.width", "20px");
     33
     34    debug("");
     35    debug("node.width = 20");
     36    node.width = 20;
     37    shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
     38    debug("");
     39
    3340    finishJSTest();
    3441};
  • trunk/LayoutTests/media/modern-media-controls/layout-node/x-expected.txt

    r206686 r209167  
    1717PASS node.x is 20
    1818PASS node.element.style.left is "20px"
     19
     20node.x = 20
     21PASS scheduler.hasScheduledLayoutCallbacks is false
     22
    1923PASS successfullyParsed is true
    2024
  • trunk/LayoutTests/media/modern-media-controls/layout-node/x.html

    r206686 r209167  
    3131    shouldBe("node.x", "20");
    3232    shouldBeEqualToString("node.element.style.left", "20px");
     33
     34    debug("");
     35    debug("node.x = 20");
     36    node.x = 20;
     37    shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
     38    debug("");
     39
    3340    finishJSTest();
    3441};
  • trunk/LayoutTests/media/modern-media-controls/layout-node/y-expected.txt

    r206686 r209167  
    1717PASS node.y is 20
    1818PASS node.element.style.top is "20px"
     19
     20node.y = 20
     21PASS scheduler.hasScheduledLayoutCallbacks is false
     22
    1923PASS successfullyParsed is true
    2024
  • trunk/LayoutTests/media/modern-media-controls/layout-node/y.html

    r206686 r209167  
    3131    shouldBe("node.y", "20");
    3232    shouldBeEqualToString("node.element.style.top", "20px");
     33
     34    debug("");
     35    debug("node.y = 20");
     36    node.y = 20;
     37    shouldBeFalse("scheduler.hasScheduledLayoutCallbacks");
     38    debug("");
     39
    3340    finishJSTest();
    3441};
  • trunk/Source/WebCore/ChangeLog

    r209166 r209167  
     12016-11-30  Antoine Quint  <graouts@apple.com>
     2
     3        [Modern Media Controls] LayoutNode: only mark properties as dirty if different than current value
     4        https://bugs.webkit.org/show_bug.cgi?id=165236
     5
     6        Reviewed by Simon Fraser.
     7
     8        Check that the new value is different than the current value before marking the property as dirty.
     9
     10        * Modules/modern-media-controls/controls/layout-node.js:
     11        (LayoutNode.prototype.set x):
     12        (LayoutNode.prototype.set y):
     13        (LayoutNode.prototype.set width):
     14        (LayoutNode.prototype.set height):
     15        (LayoutNode.prototype.set visible):
     16        (performScheduledLayout):
     17        * Modules/modern-media-controls/controls/scheduler.js:
     18        (const.scheduler.new.prototype.get hasScheduledLayoutCallbacks):
     19
    1202016-11-30  Jiewen Tan  <jiewen_tan@apple.com>
    221
  • trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js

    r207111 r209167  
    3838    set x(x)
    3939    {
     40        if (x === this._x)
     41            return;
     42
    4043        this._x = x;
    4144        this.markDirtyProperty("x");
     
    4952    set y(y)
    5053    {
     54        if (y === this._y)
     55            return;
     56
    5157        this._y = y;
    5258        this.markDirtyProperty("y");
     
    6066    set width(width)
    6167    {
     68        if (width === this._width)
     69            return;
     70
    6271        this._width = width;
    6372        this.markDirtyProperty("width");
     
    7180    set height(height)
    7281    {
     82        if (height === this._height)
     83            return;
     84
    7385        this._height = height;
    7486        this.markDirtyProperty("height");
     
    8294    set visible(flag)
    8395    {
     96        if (flag === this._visible)
     97            return;
     98
    8499        this._visible = flag;
    85100        this.markDirtyProperty("visible");
     
    266281    dirtyNodes.forEach(node => {
    267282        node.needsLayout = false;
    268         node.layout()
     283        node.layout();
    269284    });
    270285    dirtyNodes.clear();
  • trunk/Source/WebCore/Modules/modern-media-controls/controls/scheduler.js

    r207111 r209167  
    1010
    1111    // Public
     12
     13    get hasScheduledLayoutCallbacks()
     14    {
     15        return this._frameID !== -1 || this._layoutCallbacks.size > 0;
     16    }
    1217
    1318    scheduleLayout(callback)
Note: See TracChangeset for help on using the changeset viewer.