| Differences between
and this patch
- a/LayoutTests/ChangeLog +59 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2013-04-02  Max Vujovic  <mvujovic@adobe.com>
2
3
        [CSS Filters] Filter outsets clipped on composited layers when filter is applied after first layout
4
        https://bugs.webkit.org/show_bug.cgi?id=109098
5
6
        Reviewed by Dean Jackson.
7
8
        * compositing/filters/sw-layer-overlaps-hw-shadow-expected.txt:
9
        * compositing/filters/sw-nested-shadow-overlaps-hw-nested-shadow-expected.txt:
10
        * compositing/filters/sw-shadow-overlaps-hw-layer-expected.txt:
11
        * compositing/filters/sw-shadow-overlaps-hw-shadow-expected.txt:
12
13
            The above tests needed rebaselining because we're now using smaller layers on Safari.
14
            We aren't inflating layers for filter outsets since CoreAnimation does it for us
15
            already.
16
17
        * css3/filters/composited-layer-bounds-after-sw-blur-animation-expected.txt: Added.
18
        * css3/filters/composited-layer-bounds-after-sw-blur-animation.html: Added.
19
        * css3/filters/composited-layer-bounds-with-composited-blur-expected.txt: Added.
20
        * css3/filters/composited-layer-bounds-with-composited-blur.html: Added.
21
        * css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change-expected.txt: Added.
22
        * css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change.html: Added.
23
        * css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow-expected.txt: Added.
24
        * css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow.html: Added.
25
        * css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow-expected.txt: Added.
26
        * css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow.html: Added.
27
28
            The above tests are all new. They mostly test edge cases with filter render mode
29
            changes, filter outset changes, and composited layer promotion due to overlap.
30
31
            Before this patch, composited-layer-bounds-after-sw-blur-animation.html breaks
32
            visibly on Safari WebKit nightly. The blur filter in the test appears clipped before
33
            this patch. The other tests render the same before and after this patch, but now their
34
            layer sizes are smaller.
35
36
        * css3/filters/filter-change-repaint-composited-expected.png:
37
        * css3/filters/filter-change-repaint-composited.html:
38
39
            This test has been expanded with two more cases, including the original reproduction of
40
            this bug. The test needs rebaselining on Chromium Linux and Win.
41
42
        * platform/chromium-win/css3/filters/filter-change-repaint-composited-expected.png: Removed.
43
        * platform/chromium/TestExpectations:
44
        * platform/chromium/compositing/filters/sw-nested-shadow-overlaps-hw-nested-shadow-expected.txt: Added.
45
        * platform/chromium/compositing/filters/sw-shadow-overlaps-hw-shadow-expected.txt: Added.
46
        * platform/chromium/css3/filters/composited-layer-bounds-after-sw-blur-animation-expected.txt: Added.
47
        * platform/chromium/css3/filters/composited-layer-bounds-with-composited-blur-expected.txt: Added.
48
        * platform/chromium/css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change-expected.txt: Added.
49
        * platform/chromium/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow-expected.txt: Added.
50
        * platform/chromium/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow-expected.txt: Added.
51
52
            We need different expectations for Chromium for the new tests because layer bounds
53
            include filter outsets on Chromium but not on Safari.
54
55
        * platform/chromium/css3/filters/filter-change-repaint-composited-expected.png: Added.
56
        * platform/qt/TestExpectations:
57
58
            Note that we need baselines on Qt for the new and updated tests.
59
1
2013-04-02  Philip Rogers  <pdr@google.com>
60
2013-04-02  Philip Rogers  <pdr@google.com>
2
61
3
        Rebaseline svg/as-image/image-respects-pageScaleFactor expectations
62
        Rebaseline svg/as-image/image-respects-pageScaleFactor expectations
- a/LayoutTests/compositing/filters/sw-layer-overlaps-hw-shadow-expected.txt -3 / +2 lines
Lines 6-14 a/LayoutTests/compositing/filters/sw-layer-overlaps-hw-shadow-expected.txt_sec1
6
      (contentsOpaque 1)
6
      (contentsOpaque 1)
7
      (children 2
7
      (children 2
8
        (GraphicsLayer
8
        (GraphicsLayer
9
          (position 80.00 80.00)
9
          (position 105.00 105.00)
10
          (anchor 0.60 0.60)
10
          (bounds 100.00 100.00)
11
          (bounds 125.00 125.00)
12
          (drawsContent 1)
11
          (drawsContent 1)
13
        )
12
        )
14
        (GraphicsLayer
13
        (GraphicsLayer
- a/LayoutTests/compositing/filters/sw-nested-shadow-overlaps-hw-nested-shadow-expected.txt -4 / +4 lines
Lines 6-18 a/LayoutTests/compositing/filters/sw-nested-shadow-overlaps-hw-nested-shadow-expected.txt_sec1
6
      (contentsOpaque 1)
6
      (contentsOpaque 1)
7
      (children 2
7
      (children 2
8
        (GraphicsLayer
8
        (GraphicsLayer
9
          (position 205.00 205.00)
9
          (position 230.00 230.00)
10
          (anchor 0.78 0.78)
10
          (anchor 0.75 0.75)
11
          (bounds 225.00 225.00)
11
          (bounds 200.00 200.00)
12
          (drawsContent 1)
12
          (drawsContent 1)
13
        )
13
        )
14
        (GraphicsLayer
14
        (GraphicsLayer
15
          (bounds 225.00 225.00)
15
          (bounds 200.00 200.00)
16
          (drawsContent 1)
16
          (drawsContent 1)
17
        )
17
        )
18
      )
18
      )
- a/LayoutTests/compositing/filters/sw-shadow-overlaps-hw-layer-expected.txt -1 / +1 lines
Lines 11-17 a/LayoutTests/compositing/filters/sw-shadow-overlaps-hw-layer-expected.txt_sec1
11
          (contentsOpaque 1)
11
          (contentsOpaque 1)
12
        )
12
        )
13
        (GraphicsLayer
13
        (GraphicsLayer
14
          (bounds 125.00 125.00)
14
          (bounds 100.00 100.00)
15
          (drawsContent 1)
15
          (drawsContent 1)
16
        )
16
        )
17
      )
17
      )
- a/LayoutTests/compositing/filters/sw-shadow-overlaps-hw-shadow-expected.txt -4 / +3 lines
Lines 6-18 a/LayoutTests/compositing/filters/sw-shadow-overlaps-hw-shadow-expected.txt_sec1
6
      (contentsOpaque 1)
6
      (contentsOpaque 1)
7
      (children 2
7
      (children 2
8
        (GraphicsLayer
8
        (GraphicsLayer
9
          (position 105.00 105.00)
9
          (position 130.00 130.00)
10
          (anchor 0.60 0.60)
10
          (bounds 100.00 100.00)
11
          (bounds 125.00 125.00)
12
          (drawsContent 1)
11
          (drawsContent 1)
13
        )
12
        )
14
        (GraphicsLayer
13
        (GraphicsLayer
15
          (bounds 125.00 125.00)
14
          (bounds 100.00 100.00)
16
          (drawsContent 1)
15
          (drawsContent 1)
17
        )
16
        )
18
      )
17
      )
- a/LayoutTests/css3/filters/composited-layer-bounds-after-sw-blur-animation-expected.txt +18 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-bounds-after-sw-blur-animation-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 30.00 30.00)
10
          (anchor 0.48 0.48)
11
          (bounds 250.00 250.00)
12
          (drawsContent 1)
13
        )
14
      )
15
    )
16
  )
17
)
18
- a/LayoutTests/css3/filters/composited-layer-bounds-after-sw-blur-animation.html +64 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-bounds-after-sw-blur-animation.html_sec1
1
<html>
2
<head>
3
    <!--
4
        On Safari, this test verifies that a composited layer's bounds include filter outsets after
5
        a software-painted blur animation. On Safari, the filter animation is painted in software
6
        because drop-shadow appears before another filter in the chain.
7
8
        If the test passes, you should see a blurred-out green element. Its composited layer should
9
        be large enough so that the blur does not appear clipped.
10
    -->
11
    <style>
12
        #composited-layer {
13
            background-color: green;
14
            -webkit-transform: translateZ(0);
15
            position: absolute;
16
            top: 100px;
17
            left: 100px;
18
            width: 100px;
19
            height: 100px;
20
        }
21
        .initial-drop-shadow {
22
            /* Safari paints filters in software when drop-shadow appears before another filter in the chain. */
23
            -webkit-filter: drop-shadow(10px 10px 0px black) blur(0);
24
        }
25
        .final-drop-shadow {
26
            -webkit-filter: drop-shadow(10px 10px 0px black) blur(25px);
27
            -webkit-animation-name: blur-animation;
28
            -webkit-animation-duration: 0.1s;
29
        }
30
        @-webkit-keyframes blur-animation {
31
            from {
32
                -webkit-filter: drop-shadow(10px 10px 0px black) blur(0);
33
            }
34
            to {
35
                -webkit-filter: drop-shadow(10px 10px 0px black) blur(25px);
36
            }
37
        }
38
    </style>
39
    <script>
40
        if (window.testRunner)
41
            testRunner.waitUntilDone();
42
43
        function startTest()
44
        {
45
            var targetElement = document.getElementById("composited-layer");
46
            if (window.testRunner)
47
                targetElement.addEventListener("webkitAnimationEnd", finishTest);
48
            targetElement.className = "final-drop-shadow";
49
        }
50
51
        function finishTest()
52
        {
53
            var layerTreeText = window.internals.layerTreeAsText(document);
54
            document.getElementById("console").appendChild(document.createTextNode(layerTreeText));
55
            testRunner.dumpAsText();
56
            testRunner.notifyDone();
57
        }
58
    </script>
59
</head>
60
<body onload="startTest()">
61
    <div id="composited-layer" class="initial-drop-shadow"></div>
62
    <pre id="console"></pre>
63
</body>
64
</html>
- a/LayoutTests/css3/filters/composited-layer-bounds-with-composited-blur-expected.txt +18 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-bounds-with-composited-blur-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 100.00 100.00)
10
          (bounds 100.00 100.00)
11
          (contentsOpaque 1)
12
          (drawsContent 1)
13
        )
14
      )
15
    )
16
  )
17
)
18
- a/LayoutTests/css3/filters/composited-layer-bounds-with-composited-blur.html +34 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-bounds-with-composited-blur.html_sec1
1
<html>
2
<head>
3
    <!--
4
        This test verifies that a compositor-painted blur filter does not add filter outsets to
5
        the composited layer bounds.
6
7
        Note: Some platforms' compositors may not be capable of computing their own filter outsets
8
        yet, so they will need different expectations that include filter outsets in the composited
9
        layer bounds.
10
    -->
11
    <style>
12
        #composited {
13
            background-color: green;
14
            -webkit-transform: translateZ(0);
15
            -webkit-filter: blur(25px);
16
            position: absolute;
17
            top: 100px;
18
            left: 100px;
19
            width: 100px;
20
            height: 100px;
21
        }
22
    </style>
23
</head>
24
<body>
25
    <div id="composited"></div>
26
    <pre id="console"></pre>
27
    <script>
28
        if (window.testRunner) {
29
            testRunner.dumpAsText();
30
            document.getElementById("console").appendChild(document.createTextNode(window.internals.layerTreeAsText(document)));
31
        }
32
    </script>
33
</body>
34
</html>
- a/LayoutTests/css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change-expected.txt +48 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 100.00 100.00)
10
          (bounds 100.00 100.00)
11
          (contentsOpaque 1)
12
          (drawsContent 1)
13
          (children 1
14
            (GraphicsLayer
15
              (bounds 100.00 100.00)
16
              (contentsOpaque 1)
17
            )
18
          )
19
        )
20
      )
21
    )
22
  )
23
)
24
(GraphicsLayer
25
  (bounds 800.00 600.00)
26
  (children 1
27
    (GraphicsLayer
28
      (bounds 800.00 600.00)
29
      (contentsOpaque 1)
30
      (children 1
31
        (GraphicsLayer
32
          (position 50.00 50.00)
33
          (anchor 0.67 0.67)
34
          (bounds 150.00 150.00)
35
          (drawsContent 1)
36
          (children 1
37
            (GraphicsLayer
38
              (position 50.00 50.00)
39
              (bounds 100.00 100.00)
40
              (contentsOpaque 1)
41
            )
42
          )
43
        )
44
      )
45
    )
46
  )
47
)
48
- a/LayoutTests/css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change.html +79 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change.html_sec1
1
<html>
2
<head>
3
    <!--
4
        On Safari, this test verifies that:
5
        (1) A composited parent layer's composited child remains positioned correctly when the
6
            parent's bounds change due to compositor-painted filters falling back to software
7
            painting. On Safari, the filters fallback to software painting because drop-shadow is
8
            not the last filter in the chain.
9
        (2) The composited parent layer's bounds increase to include filter outsets when
10
            compositor-painted filters fall back to software-painting.
11
12
        If the test passes, you should see the green child div exactly covering the red parent div,
13
        so no red is visible. There should be a gray drop shadow visible.
14
    -->
15
    <style>
16
        #composited-parent {
17
            background-color: red;
18
            -webkit-transform: translateZ(0);
19
            position: absolute;
20
            top: 100px;
21
            left: 100px;
22
            width: 100px;
23
            height: 100px;
24
        }
25
        #absolutely-positioned-composited-child {
26
            background-color: green;
27
            -webkit-transform: translateZ(0);
28
            position: absolute;
29
            top: 0;
30
            left: 0;
31
            width: 100px;
32
            height: 100px;
33
        }
34
        .compositor-painted-shadow {
35
            -webkit-filter: grayscale(0.5) drop-shadow(-50px -50px 0px gray);
36
        }
37
        .software-painted-shadow {
38
            /* Safari paints filters in software when drop-shadow is not the last filter in the chain. */
39
            -webkit-filter: drop-shadow(-50px -50px 0px gray) grayscale(0.5);
40
        }
41
    </style>
42
    <script>
43
        if (window.testRunner)
44
            testRunner.waitUntilDone();
45
46
        function appendLayerTreeTextToConsole()
47
        {
48
            if (!window.testRunner || !window.internals)
49
                return;
50
51
            var layerTreeText = window.internals.layerTreeAsText(document);
52
            document.getElementById("console").appendChild(document.createTextNode(layerTreeText));
53
        }
54
55
        function runTest()
56
        {
57
            // Dump the layer tree with the compositor-painted drop shadow.
58
            appendLayerTreeTextToConsole();
59
60
            // Force a software-painted drop shadow on Safari.
61
            var targetElement = document.getElementById("composited-parent");
62
            targetElement.className = "software-painted-shadow";
63
            appendLayerTreeTextToConsole();
64
65
            // Dump the layer tree again with the software-painted drop shadow.
66
            if (window.testRunner) {
67
                testRunner.dumpAsText();
68
                testRunner.notifyDone();                
69
            }
70
        }
71
    </script>
72
</head>
73
<body onload="runTest()">
74
    <div id="composited-parent" class="compositor-painted-shadow">
75
        <div id="absolutely-positioned-composited-child"></div>
76
    </div>
77
    <pre id="console"></pre>
78
</body>
79
</html>
- a/LayoutTests/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow-expected.txt +39 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 250.00 250.00)
10
          (bounds 100.00 100.00)
11
          (contentsOpaque 1)
12
        )
13
      )
14
    )
15
  )
16
)
17
(GraphicsLayer
18
  (bounds 800.00 600.00)
19
  (children 1
20
    (GraphicsLayer
21
      (bounds 800.00 600.00)
22
      (contentsOpaque 1)
23
      (children 2
24
        (GraphicsLayer
25
          (position 250.00 250.00)
26
          (bounds 100.00 100.00)
27
          (contentsOpaque 1)
28
        )
29
        (GraphicsLayer
30
          (position 100.00 100.00)
31
          (bounds 100.00 100.00)
32
          (contentsOpaque 1)
33
          (drawsContent 1)
34
        )
35
      )
36
    )
37
  )
38
)
39
- a/LayoutTests/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow.html +71 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow.html_sec1
1
<html>
2
<head>
3
    <!--
4
        This test verifies that software layers are promoted to composited layers when their filter
5
        outsets change to overlap a hardware layer.
6
        
7
        If the test passes, the green drop-shadow of the black layer should appear over the blue
8
        composited layer.
9
    -->
10
    <style>
11
        #software-layer-to-promote {
12
            background-color: black;
13
            position: absolute;
14
            top: 100px;
15
            left: 100px;
16
            width: 100px;
17
            height: 100px;
18
        }
19
        .initial-drop-shadow {
20
            -webkit-filter: drop-shadow(10px 10px 0px green);
21
        }
22
        .final-drop-shadow {
23
            -webkit-filter: drop-shadow(100px 100px 0px green);
24
        }
25
        #composited-layer-to-overlap {
26
            background-color: blue;
27
            -webkit-transform: translateZ(0);
28
            position: absolute;
29
            top: 250px;
30
            left: 250px;
31
            width: 100px;
32
            height: 100px;
33
        }
34
    </style>
35
    <script>
36
        if (window.testRunner)
37
            testRunner.waitUntilDone();
38
39
        function appendLayerTreeTextToConsole()
40
        {
41
            if (!window.testRunner || !window.internals)
42
                return;
43
44
            var layerTreeText = window.internals.layerTreeAsText(document);
45
            document.getElementById("console").appendChild(document.createTextNode(layerTreeText));
46
        }
47
48
        function runTest()
49
        {
50
            // Dump the layer tree with the initial drop shadow, which does not overlap the composited layer.
51
            appendLayerTreeTextToConsole();
52
53
            // Force a software-painted drop shadow on Safari.
54
            var targetElement = document.getElementById("software-layer-to-promote");
55
            targetElement.className = "final-drop-shadow";
56
            appendLayerTreeTextToConsole();
57
58
            // Dump the layer tree again with the final drop shadow, which overlaps the composited layer.
59
            if (window.testRunner) {
60
                testRunner.dumpAsText();
61
                testRunner.notifyDone();
62
            }
63
        }
64
    </script>
65
</head>
66
<body onload="runTest()">
67
    <div id="composited-layer-to-overlap"></div>
68
    <div id="software-layer-to-promote" class="initial-drop-shadow"></div>
69
    <pre id="console"></pre>
70
</body>
71
</html>
- a/LayoutTests/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow-expected.txt +38 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 250.00 250.00)
10
          (bounds 100.00 100.00)
11
          (contentsOpaque 1)
12
        )
13
      )
14
    )
15
  )
16
)
17
(GraphicsLayer
18
  (bounds 800.00 600.00)
19
  (children 1
20
    (GraphicsLayer
21
      (bounds 800.00 600.00)
22
      (contentsOpaque 1)
23
      (children 2
24
        (GraphicsLayer
25
          (position 250.00 250.00)
26
          (bounds 100.00 100.00)
27
          (contentsOpaque 1)
28
        )
29
        (GraphicsLayer
30
          (position 100.00 100.00)
31
          (bounds 200.00 200.00)
32
          (drawsContent 1)
33
        )
34
      )
35
    )
36
  )
37
)
38
- a/LayoutTests/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow.html +75 lines
Line 0 a/LayoutTests/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow.html_sec1
1
<html>
2
<head>
3
    <!--
4
        This test verifies that software layers are promoted to composited layers when their filter
5
        outsets change to overlap a hardware layer.
6
7
        If the test passes, the green drop-shadow of the black layer should appear over the blue
8
        composited layer.
9
10
        Note: Safari will paint the filter in software because drop-shadow is not the last filter in
11
        the chain.
12
    -->
13
    <style>
14
        #software-layer-to-promote {
15
            background-color: black;
16
            position: absolute;
17
            top: 100px;
18
            left: 100px;
19
            width: 100px;
20
            height: 100px;
21
        }
22
        .initial-drop-shadow {
23
            /* Safari paints filters in software when drop-shadow is not the last filter in the chain. */
24
            -webkit-filter: drop-shadow(10px 10px 0px green) grayscale(0.5);
25
        }
26
        .final-drop-shadow {
27
            -webkit-filter: drop-shadow(100px 100px 0px green) grayscale(0.5);
28
        }
29
        #composited-layer-to-overlap {
30
            background-color: blue;
31
            -webkit-transform: translateZ(0);
32
            position: absolute;
33
            top: 250px;
34
            left: 250px;
35
            width: 100px;
36
            height: 100px;
37
        }
38
    </style>
39
    <script>
40
        if (window.testRunner)
41
            testRunner.waitUntilDone();
42
43
        function appendLayerTreeTextToConsole()
44
        {
45
            if (!window.testRunner || !window.internals)
46
                return;
47
48
            var layerTreeText = window.internals.layerTreeAsText(document);
49
            document.getElementById("console").appendChild(document.createTextNode(layerTreeText));
50
        }
51
52
        function runTest()
53
        {
54
            // Dump the layer tree with the initial drop shadow, which does not overlap the composited layer.
55
            appendLayerTreeTextToConsole();
56
57
            // Force a software-painted drop shadow on Safari.
58
            var targetElement = document.getElementById("software-layer-to-promote");
59
            targetElement.className = "final-drop-shadow";
60
            appendLayerTreeTextToConsole();
61
62
            // Dump the layer tree again with the final drop shadow, which overlaps the composited layer.
63
            if (window.testRunner) {
64
                testRunner.dumpAsText();
65
                testRunner.notifyDone();
66
            }
67
        }
68
    </script>
69
</head>
70
<body onload="runTest()">
71
    <div id="composited-layer-to-overlap"></div>
72
    <div id="software-layer-to-promote" class="initial-drop-shadow"></div>
73
    <pre id="console"></pre>
74
</body>
75
</html>
- a/LayoutTests/css3/filters/filter-change-repaint-composited.html -3 / +21 lines
Lines 1-7 a/LayoutTests/css3/filters/filter-change-repaint-composited.html_sec1
1
<!DOCTYPE html>
1
<!DOCTYPE html>
2
<!-- 
2
<!-- 
3
    This tests verifies that filters repaint correctly in composited mode when the filter property is changed.
3
    This tests verifies that filters repaint correctly in composited mode when the filter property is changed.
4
    You should see 5 green rectangles. First 4 of the rectangles have a blue shadow. There should be no red.
4
    You should see 7 green rectangles. First 6 of the rectangles have a blue shadow. There should be no red.
5
-->
5
-->
6
<html>
6
<html>
7
<head>
7
<head>
Lines 9-18 a/LayoutTests/css3/filters/filter-change-repaint-composited.html_sec2
9
        .box {
9
        .box {
10
            /* force a composited layer */
10
            /* force a composited layer */
11
            -webkit-transform: translate3d(0, 0, 0);
11
            -webkit-transform: translate3d(0, 0, 0);
12
            float: left;
12
            height: 50px;
13
            height: 50px;
13
            width: 50px;
14
            width: 50px;
14
            margin-left: 20px;
15
            margin: 50px;
15
            margin-bottom: 60px;
16
            background-color: green;
16
            background-color: green;
17
        }
17
        }
18
        
18
        
Lines 32-37 a/LayoutTests/css3/filters/filter-change-repaint-composited.html_sec3
32
            -webkit-filter: drop-shadow(0px 0px 10px red);
32
            -webkit-filter: drop-shadow(0px 0px 10px red);
33
        }
33
        }
34
34
35
        .composited_from_composited_zero_radius {
36
            -webkit-filter: drop-shadow(0px 0px 10px blue);
37
        }
38
        
39
        .composited_from_composited_zero_radius.before {
40
            -webkit-filter: drop-shadow(0px 0px 0px red);
41
        }
42
43
        .composited_from_composited_offset {
44
            -webkit-filter: drop-shadow(0px 0px 10px blue);
45
        }
46
        
47
        .composited_from_composited_offset.before {
48
            -webkit-filter: drop-shadow(-100px -100px 10px red);
49
        }
50
35
        .composited_from_software {
51
        .composited_from_software {
36
            -webkit-filter: drop-shadow(0px 0px 10px blue);
52
            -webkit-filter: drop-shadow(0px 0px 10px blue);
37
        }
53
        }
Lines 74-79 a/LayoutTests/css3/filters/filter-change-repaint-composited.html_sec4
74
<body onload="runRepaintTest()">
90
<body onload="runRepaintTest()">
75
    <div class="box composited_from_none before"></div>
91
    <div class="box composited_from_none before"></div>
76
    <div class="box composited_from_composited before"></div>
92
    <div class="box composited_from_composited before"></div>
93
    <div class="box composited_from_composited_zero_radius before"></div>
94
    <div class="box composited_from_composited_offset before"></div>
77
    <div class="box composited_from_software before"></div>
95
    <div class="box composited_from_software before"></div>
78
    <div class="box software_from_composited before"></div>
96
    <div class="box software_from_composited before"></div>
79
    <div class="box none_from_composited before"></div>
97
    <div class="box none_from_composited before"></div>
- a/LayoutTests/platform/chromium/TestExpectations +3 lines
Lines 3225-3230 webkit.org/b/94492 [ Win ] css3/filters/custom/filter-repaint-custom-clipped.htm a/LayoutTests/platform/chromium/TestExpectations_sec1
3225
webkit.org/b/94492 [ Win ] css3/filters/custom/filter-repaint-custom.html [ ImageOnlyFailure ]
3225
webkit.org/b/94492 [ Win ] css3/filters/custom/filter-repaint-custom.html [ ImageOnlyFailure ]
3226
webkit.org/b/94492 [ Win ] css3/filters/custom/filter-repaint-custom-rotated.html [ ImageOnlyFailure ]
3226
webkit.org/b/94492 [ Win ] css3/filters/custom/filter-repaint-custom-rotated.html [ ImageOnlyFailure ]
3227
3227
3228
# Following test needs rebaseline
3229
webkit.org/b/110362 [ Linux Win ] css3/filters/filter-change-repaint-composited.html [ ImageOnlyFailure ]
3230
3228
webkit.org/b/106044 [ Win7 ] css3/filters/effect-invert.html [ ImageOnlyFailure Pass ]
3231
webkit.org/b/106044 [ Win7 ] css3/filters/effect-invert.html [ ImageOnlyFailure Pass ]
3229
3232
3230
webkit.org/b/95581 http/tests/xmlhttprequest/zero-length-response.html [ Pass Timeout ]
3233
webkit.org/b/95581 http/tests/xmlhttprequest/zero-length-response.html [ Pass Timeout ]
- a/LayoutTests/platform/chromium/compositing/filters/sw-nested-shadow-overlaps-hw-nested-shadow-expected.txt +22 lines
Line 0 a/LayoutTests/platform/chromium/compositing/filters/sw-nested-shadow-overlaps-hw-nested-shadow-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 2
8
        (GraphicsLayer
9
          (position 205.00 205.00)
10
          (anchor 0.78 0.78)
11
          (bounds 225.00 225.00)
12
          (drawsContent 1)
13
        )
14
        (GraphicsLayer
15
          (bounds 225.00 225.00)
16
          (drawsContent 1)
17
        )
18
      )
19
    )
20
  )
21
)
22
- a/LayoutTests/platform/chromium/compositing/filters/sw-shadow-overlaps-hw-shadow-expected.txt +22 lines
Line 0 a/LayoutTests/platform/chromium/compositing/filters/sw-shadow-overlaps-hw-shadow-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 2
8
        (GraphicsLayer
9
          (position 105.00 105.00)
10
          (anchor 0.60 0.60)
11
          (bounds 125.00 125.00)
12
          (drawsContent 1)
13
        )
14
        (GraphicsLayer
15
          (bounds 125.00 125.00)
16
          (drawsContent 1)
17
        )
18
      )
19
    )
20
  )
21
)
22
- a/LayoutTests/platform/chromium/css3/filters/composited-layer-bounds-after-sw-blur-animation-expected.txt +18 lines
Line 0 a/LayoutTests/platform/chromium/css3/filters/composited-layer-bounds-after-sw-blur-animation-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 30.00 30.00)
10
          (anchor 0.48 0.48)
11
          (bounds 250.00 250.00)
12
          (drawsContent 1)
13
        )
14
      )
15
    )
16
  )
17
)
18
- a/LayoutTests/platform/chromium/css3/filters/composited-layer-bounds-with-composited-blur-expected.txt +17 lines
Line 0 a/LayoutTests/platform/chromium/css3/filters/composited-layer-bounds-with-composited-blur-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 30.00 30.00)
10
          (bounds 240.00 240.00)
11
          (drawsContent 1)
12
        )
13
      )
14
    )
15
  )
16
)
17
- a/LayoutTests/platform/chromium/css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change-expected.txt +49 lines
Line 0 a/LayoutTests/platform/chromium/css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 50.00 50.00)
10
          (anchor 0.67 0.67)
11
          (bounds 150.00 150.00)
12
          (drawsContent 1)
13
          (children 1
14
            (GraphicsLayer
15
              (position 50.00 50.00)
16
              (bounds 100.00 100.00)
17
              (contentsOpaque 1)
18
            )
19
          )
20
        )
21
      )
22
    )
23
  )
24
)
25
(GraphicsLayer
26
  (bounds 800.00 600.00)
27
  (children 1
28
    (GraphicsLayer
29
      (bounds 800.00 600.00)
30
      (contentsOpaque 1)
31
      (children 1
32
        (GraphicsLayer
33
          (position 50.00 50.00)
34
          (anchor 0.67 0.67)
35
          (bounds 150.00 150.00)
36
          (drawsContent 1)
37
          (children 1
38
            (GraphicsLayer
39
              (position 50.00 50.00)
40
              (bounds 100.00 100.00)
41
              (contentsOpaque 1)
42
            )
43
          )
44
        )
45
      )
46
    )
47
  )
48
)
49
- a/LayoutTests/platform/chromium/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow-expected.txt +38 lines
Line 0 a/LayoutTests/platform/chromium/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 250.00 250.00)
10
          (bounds 100.00 100.00)
11
          (contentsOpaque 1)
12
        )
13
      )
14
    )
15
  )
16
)
17
(GraphicsLayer
18
  (bounds 800.00 600.00)
19
  (children 1
20
    (GraphicsLayer
21
      (bounds 800.00 600.00)
22
      (contentsOpaque 1)
23
      (children 2
24
        (GraphicsLayer
25
          (position 250.00 250.00)
26
          (bounds 100.00 100.00)
27
          (contentsOpaque 1)
28
        )
29
        (GraphicsLayer
30
          (position 100.00 100.00)
31
          (bounds 200.00 200.00)
32
          (drawsContent 1)
33
        )
34
      )
35
    )
36
  )
37
)
38
- a/LayoutTests/platform/chromium/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow-expected.txt +38 lines
Line 0 a/LayoutTests/platform/chromium/css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow-expected.txt_sec1
1
(GraphicsLayer
2
  (bounds 800.00 600.00)
3
  (children 1
4
    (GraphicsLayer
5
      (bounds 800.00 600.00)
6
      (contentsOpaque 1)
7
      (children 1
8
        (GraphicsLayer
9
          (position 250.00 250.00)
10
          (bounds 100.00 100.00)
11
          (contentsOpaque 1)
12
        )
13
      )
14
    )
15
  )
16
)
17
(GraphicsLayer
18
  (bounds 800.00 600.00)
19
  (children 1
20
    (GraphicsLayer
21
      (bounds 800.00 600.00)
22
      (contentsOpaque 1)
23
      (children 2
24
        (GraphicsLayer
25
          (position 250.00 250.00)
26
          (bounds 100.00 100.00)
27
          (contentsOpaque 1)
28
        )
29
        (GraphicsLayer
30
          (position 100.00 100.00)
31
          (bounds 200.00 200.00)
32
          (drawsContent 1)
33
        )
34
      )
35
    )
36
  )
37
)
38
- a/LayoutTests/platform/qt/TestExpectations +8 lines
Lines 1486-1491 css3/images/cross-fade-tiled.html a/LayoutTests/platform/qt/TestExpectations_sec1
1486
# --- new crashing test, bug report needed
1486
# --- new crashing test, bug report needed
1487
css3/filters/effect-reference-hw.html
1487
css3/filters/effect-reference-hw.html
1488
1488
1489
# Need rebaseline after https://bugs.webkit.org/show_bug.cgi?id=109098
1490
css3/filters/filter-change-repaint-composited.html
1491
css3/filters/composited-layer-bounds-after-sw-blur-animation.html
1492
css3/filters/composited-layer-bounds-with-composited-blur.html
1493
css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change.html
1494
css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow.html
1495
css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow.html
1496
1489
# ============================================================================= #
1497
# ============================================================================= #
1490
# failing fast tests
1498
# failing fast tests
1491
# ============================================================================= #
1499
# ============================================================================= #
- a/Source/WTF/ChangeLog +13 lines
Lines 1-3 a/Source/WTF/ChangeLog_sec1
1
2013-04-02  Max Vujovic  <mvujovic@adobe.com>
2
3
        [CSS Filters] Filter outsets clipped on composited layers when filter is applied after first layout
4
        https://bugs.webkit.org/show_bug.cgi?id=109098
5
6
        Reviewed by Dean Jackson.
7
8
        * wtf/Platform.h:
9
            Add flag for HAVE(COMPOSITOR_FILTER_OUTSETS) macro. This is used to check if a
10
            platform's compositor expands layers internally for filter outsets when it applies
11
            filters like drop-shadow and blur. Currently, only CoreAnimation does has this
12
            capability.
13
1
2013-04-02  Yury Semikhatsky  <yurys@chromium.org>
14
2013-04-02  Yury Semikhatsky  <yurys@chromium.org>
2
15
3
        Web Inspector: memory instrumentation for external arrays is broken
16
        Web Inspector: memory instrumentation for external arrays is broken
- a/Source/WTF/wtf/Platform.h +6 lines
Lines 924-929 a/Source/WTF/wtf/Platform.h_sec1
924
#define WTF_USE_ACCELERATED_COMPOSITING 1
924
#define WTF_USE_ACCELERATED_COMPOSITING 1
925
#endif
925
#endif
926
926
927
/* FIXME: When all platforms' compositors can compute their own filter outsets, we should remove this define. 
928
   https://bugs.webkit.org/show_bug.cgi?id=112830 */
929
#if USE(CG)
930
#define HAVE_COMPOSITOR_FILTER_OUTSETS 1
931
#endif
932
927
#if ENABLE(WEBGL) && !defined(WTF_USE_3D_GRAPHICS)
933
#if ENABLE(WEBGL) && !defined(WTF_USE_3D_GRAPHICS)
928
#define WTF_USE_3D_GRAPHICS 1
934
#define WTF_USE_3D_GRAPHICS 1
929
#endif
935
#endif
- a/Source/WebCore/ChangeLog +86 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2013-04-02  Max Vujovic  <mvujovic@adobe.com>
2
3
        [CSS Filters] Filter outsets clipped on composited layers when filter is applied after first layout
4
        https://bugs.webkit.org/show_bug.cgi?id=109098
5
6
        Reviewed by Dean Jackson.
7
8
        This patch addresses the following issues:
9
        (1) Compositors who can compute their own filter outsets don't need WebKit to inflate the
10
            composited layer bounds. Eventually, all platforms' compositors should be able to
11
            compute their own filter outsets.
12
        (2) When filter outsets change, we need to update composited layer bounds if the filters are
13
            painted in software.
14
        (3) When filter outsets change, we need to recompute the overlap map to promote the correct
15
            layers to composited layers on all platforms.
16
17
        Tests: css3/filters/composited-layer-bounds-after-sw-blur-animation.html
18
               css3/filters/composited-layer-bounds-with-composited-blur.html
19
               css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change.html
20
               css3/filters/composited-layer-promotion-after-outset-overlap-change-using-composited-shadow.html
21
               css3/filters/composited-layer-promotion-after-outset-overlap-change-using-sw-shadow.html
22
23
        * platform/graphics/IntRectExtent.h:
24
        (WebCore::IntRectExtent::isZero):
25
        (IntRectExtent):
26
27
            Make isZero public on IntRectExtent.
28
29
        * rendering/RenderLayer.cpp:
30
        (WebCore::hasOrHadFilters):
31
32
            Helper function used to exit early from filters related code.
33
34
        (WebCore::RenderLayer::updateFilters):
35
36
            Move filter updating code from RenderLayer::styleChanged into this new method.
37
38
            This method calls RenderLayerBacking::updateFilters instead of
39
            RenderLayerBacking::updateGraphicsLayerGeometry. RenderLayerBacking::updateFilters lets
40
            us know whether there was a filter paint mode change (i.e. the filters were painted in
41
            software and are now painted in the compositor, or vice-versa). We need to know this
42
            earlier, in RenderLayer::styleChanged, because we may need to rebuild the compositing
43
            layers due to a filter paint mode change.
44
45
        (WebCore::RenderLayer::styleChanged):
46
47
            Add a condition for filters for setCompositingLayersNeedRebuild. If the filter outsets
48
            on a layer changed, we need to rebuild the compositing layers because there could be new
49
            overlap. Likewise, if there are or were filter outsets and the filter paint mode changed
50
            the layer bounds (and child positions) may have changed. In either case, we don't
51
            rebuild the compositing layers if there is an accelerated filter animation running.
52
53
            Remove old code to detect a filter paint mode change from the end of
54
            RenderLayer::styleChanged because it could never be executed. The old code counted on
55
            RenderLayerBacking::canCompositeFilters to change on its own, but it doesn't change
56
            unless updateFilters gets called. Thus, we could never enter the if statement that
57
            calls setBackingNeedsRepaint.
58
59
        * rendering/RenderLayerBacking.cpp:
60
        (WebCore::RenderLayerBacking::updateFilters):
61
62
            Now return true if there was a filter paint mode change, so RenderLayer::styleChanged
63
            can decide if it should rebuild the compositing layers.
64
65
            Call updateOrRemoveFilterEffectRenderer and setContentsNeedDisplay if there was a
66
            render mode change. We need to either destroy or create the software renderer and we
67
            need to repaint the layer contents if there was a render mode change.
68
69
        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
70
71
            Don't call updateFilters here. Call it earlier in RenderLayer::styleChanged, for reasons
72
            explained above.
73
74
        * rendering/RenderLayerBacking.h:
75
        (RenderLayerBacking):
76
77
            Make updateFilters public so RenderLayer::styleChanged can call it.
78
79
        * rendering/RenderLayerCompositor.cpp:
80
        (WebCore::RenderLayerCompositor::calculateCompositedBounds):
81
82
            If the platform's compositor computes filter outsets for its layers internally, do not
83
            inflate WebKit's composited bounds for filter outsets. This results in smaller layers
84
            on Safari. Note that we still need to include filter outsets in layer bounds for other
85
            situations like overlap testing in WebKit and when we're painting filters in software.
86
1
2013-04-02  Andrey Lushnikov  <lushnikov@chromium.org>
87
2013-04-02  Andrey Lushnikov  <lushnikov@chromium.org>
2
88
3
        Web Inspector: Make Source Frame & status bar a layout boundary
89
        Web Inspector: Make Source Frame & status bar a layout boundary
- a/Source/WebCore/platform/graphics/IntRectExtent.h -2 / +2 lines
Lines 66-71 public: a/Source/WebCore/platform/graphics/IntRectExtent.h_sec1
66
    int left() const { return m_left; }
66
    int left() const { return m_left; }
67
    void setLeft(int left) { m_left = left; }
67
    void setLeft(int left) { m_left = left; }
68
68
69
    bool isZero() const { return !left() && !right() && !top() && !bottom(); }
70
69
    void expandRect(LayoutRect& rect) const
71
    void expandRect(LayoutRect& rect) const
70
    {
72
    {
71
        if (isZero())
73
        if (isZero())
Lines 76-83 public: a/Source/WebCore/platform/graphics/IntRectExtent.h_sec2
76
    }
78
    }
77
79
78
private:
80
private:
79
    bool isZero() const { return !left() && !right() && !top() && !bottom(); }
80
81
    int m_top;
81
    int m_top;
82
    int m_right;
82
    int m_right;
83
    int m_bottom;
83
    int m_bottom;
- a/Source/WebCore/rendering/RenderLayer.cpp -14 / +70 lines
Lines 6041-6046 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) a/Source/WebCore/rendering/RenderLayer.cpp_sec1
6041
    }
6041
    }
6042
}
6042
}
6043
6043
6044
#if ENABLE(CSS_FILTERS)
6045
static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle)
6046
{
6047
    ASSERT(newStyle);
6048
    return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter();
6049
}
6050
#endif
6051
6044
#if USE(ACCELERATED_COMPOSITING)
6052
#if USE(ACCELERATED_COMPOSITING)
6045
inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const
6053
inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const
6046
{
6054
{
Lines 6053-6060 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt a/Source/WebCore/rendering/RenderLayer.cpp_sec2
6053
    ASSERT(newStyle);
6061
    ASSERT(newStyle);
6054
    return !isComposited() && oldStyle && (oldStyle->overflowX() != newStyle->overflowX()) && stackingContainer()->hasCompositingDescendant();
6062
    return !isComposited() && oldStyle && (oldStyle->overflowX() != newStyle->overflowX()) && stackingContainer()->hasCompositingDescendant();
6055
}
6063
}
6064
6065
#if ENABLE(CSS_FILTERS)
6066
inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const
6067
{
6068
    if (!hasOrHadFilters(oldStyle, newStyle))
6069
        return false;
6070
6071
    if (renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter)) {
6072
        // When the compositor is performing the filter animation, we shouldn't touch the compositing layers.
6073
        // All of the layers above us should have been promoted to compositing layers already.
6074
        return false;
6075
    }
6076
6077
    FilterOutsets newOutsets = newStyle->filterOutsets();
6078
    if (oldStyle && (oldStyle->filterOutsets() != newOutsets)) {
6079
        // When filter outsets change, we need to:
6080
        // (1) Recompute the overlap map to promote the correct layers to composited layers.
6081
        // (2) Update the composited layer bounds (and child GraphicsLayer positions) on platforms
6082
        //     whose compositors can't compute their own filter outsets.
6083
        return true;
6084
    }
6085
6086
#if HAVE(COMPOSITOR_FILTER_OUTSETS)
6087
    if ((didPaintWithFilters != paintsWithFilters()) && !newOutsets.isZero()) {
6088
        // When the layer used to paint filters in software and now paints filters in the
6089
        // compositor, the compositing layer bounds need to change from including filter outsets to
6090
        // excluding filter outsets, on platforms whose compositors compute their own outsets.
6091
        // Similarly for the reverse change from compositor-painted to software-painted filters.
6092
        return true;
6093
    }
6094
#endif
6095
6096
    return false;
6097
}
6098
#endif // ENABLE(CSS_FILTERS)
6056
#endif // USE(ACCELERATED_COMPOSITING)
6099
#endif // USE(ACCELERATED_COMPOSITING)
6057
6100
6101
#if ENABLE(CSS_FILTERS)
6102
void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle)
6103
{
6104
    if (!hasOrHadFilters(oldStyle, newStyle))
6105
        return;
6106
6107
    updateOrRemoveFilterClients();
6108
#if USE(ACCELERATED_COMPOSITING)
6109
    if (isComposited() && !renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter)) {
6110
        // During an accelerated animation, both WebKit and the compositor animate properties.
6111
        // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation.
6112
        backing()->updateFilters(renderer()->style());
6113
    }
6114
#endif
6115
    updateOrRemoveFilterEffectRenderer();
6116
}
6117
#endif
6118
6058
void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
6119
void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
6059
{
6120
{
6060
    bool isNormalFlowOnly = shouldBeNormalFlowOnly();
6121
    bool isNormalFlowOnly = shouldBeNormalFlowOnly();
Lines 6106-6113 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) a/Source/WebCore/rendering/RenderLayer.cpp_sec3
6106
#if ENABLE(CSS_COMPOSITING)
6167
#if ENABLE(CSS_COMPOSITING)
6107
    updateBlendMode();
6168
    updateBlendMode();
6108
#endif
6169
#endif
6170
6171
#if USE(ACCELERATED_COMPOSITING)
6172
    bool didPaintWithFilters = false;
6173
#endif
6109
#if ENABLE(CSS_FILTERS)
6174
#if ENABLE(CSS_FILTERS)
6110
    updateOrRemoveFilterClients();
6175
    if (paintsWithFilters())
6176
        didPaintWithFilters = true;
6177
    updateFilters(oldStyle, renderer()->style());
6111
#endif
6178
#endif
6112
6179
6113
#if USE(ACCELERATED_COMPOSITING)
6180
#if USE(ACCELERATED_COMPOSITING)
Lines 6116-6138 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) a/Source/WebCore/rendering/RenderLayer.cpp_sec4
6116
    const RenderStyle* newStyle = renderer()->style();
6183
    const RenderStyle* newStyle = renderer()->style();
6117
    if (compositor()->updateLayerCompositingState(this)
6184
    if (compositor()->updateLayerCompositingState(this)
6118
        || needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
6185
        || needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
6119
        || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle))
6186
        || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
6187
        || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintWithFilters))
6120
        compositor()->setCompositingLayersNeedRebuild();
6188
        compositor()->setCompositingLayersNeedRebuild();
6121
    else if (isComposited())
6189
    else if (isComposited())
6122
        backing()->updateGraphicsLayerGeometry();
6190
        backing()->updateGraphicsLayerGeometry();
6123
#endif
6191
#endif
6124
6125
#if ENABLE(CSS_FILTERS)
6126
    updateOrRemoveFilterEffectRenderer();
6127
#if USE(ACCELERATED_COMPOSITING)
6128
    bool backingDidCompositeLayers = isComposited() && backing()->canCompositeFilters();
6129
    if (isComposited() && backingDidCompositeLayers && !backing()->canCompositeFilters()) {
6130
        // The filters used to be drawn by platform code, but now the platform cannot draw them anymore.
6131
        // Fallback to drawing them in software.
6132
        setBackingNeedsRepaint();
6133
    }
6134
#endif
6135
#endif
6136
}
6192
}
6137
6193
6138
void RenderLayer::updateScrollableAreaSet(bool hasOverflow)
6194
void RenderLayer::updateScrollableAreaSet(bool hasOverflow)
- a/Source/WebCore/rendering/RenderLayer.h -1 / +8 lines
Lines 772-778 public: a/Source/WebCore/rendering/RenderLayer.h_sec1
772
    bool needsCompositedScrolling() const;
772
    bool needsCompositedScrolling() const;
773
    bool needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const;
773
    bool needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const;
774
    bool needsCompositingLayersRebuiltForOverflow(const RenderStyle* oldStyle, const RenderStyle* newStyle) const;
774
    bool needsCompositingLayersRebuiltForOverflow(const RenderStyle* oldStyle, const RenderStyle* newStyle) const;
775
#else
775
#if ENABLE(CSS_FILTERS)
776
    bool needsCompositingLayersRebuiltForFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const;
777
#else // !ENABLE(CSS_FILTERS)
778
    bool needsCompositingLayersRebuiltForFilters(const RenderStyle*, const RenderStyle*, bool) const { return false; }
779
#endif // !ENABLE(CSS_FILTERS)
780
#else // !USE(ACCELERATED_COMPOSITING)
776
    bool isComposited() const { return false; }
781
    bool isComposited() const { return false; }
777
    bool hasCompositedMask() const { return false; }
782
    bool hasCompositedMask() const { return false; }
778
    bool usesCompositedScrolling() const { return false; }
783
    bool usesCompositedScrolling() const { return false; }
Lines 817-822 public: a/Source/WebCore/rendering/RenderLayer.h_sec2
817
    
822
    
818
    bool hasFilterInfo() const { return m_hasFilterInfo; }
823
    bool hasFilterInfo() const { return m_hasFilterInfo; }
819
    void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo; }
824
    void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo; }
825
826
    void updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle);
820
#endif
827
#endif
821
828
822
#if !ASSERT_DISABLED
829
#if !ASSERT_DISABLED
- a/Source/WebCore/rendering/RenderLayerBacking.cpp -4 / +14 lines
Lines 366-372 void RenderLayerBacking::updateTransform(const RenderStyle* style) a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec1
366
#if ENABLE(CSS_FILTERS)
366
#if ENABLE(CSS_FILTERS)
367
void RenderLayerBacking::updateFilters(const RenderStyle* style)
367
void RenderLayerBacking::updateFilters(const RenderStyle* style)
368
{
368
{
369
    bool didCompositeFilters = m_canCompositeFilters;
369
    m_canCompositeFilters = m_graphicsLayer->setFilters(owningLayer()->computeFilterOperations(style));
370
    m_canCompositeFilters = m_graphicsLayer->setFilters(owningLayer()->computeFilterOperations(style));
371
    if (didCompositeFilters != m_canCompositeFilters) {
372
        //
373
        // If filters used to be painted in software and are now painted in the compositor, we need to:
374
        // (1) Remove the FilterEffectRenderer, which was used for painting filters in software.
375
        // (2) Repaint the layer contents to remove the software-applied filter because the compositor will apply it.
376
        //
377
        // Similarly, if filters used to be painted in the compositor and are now painted in software, we need to:
378
        // (1) Create a FilterEffectRenderer.
379
        // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it.
380
        //
381
        m_owningLayer->updateOrRemoveFilterEffectRenderer();
382
        setContentsNeedDisplay();
383
    }
370
}
384
}
371
#endif
385
#endif
372
386
Lines 598-607 void RenderLayerBacking::updateGraphicsLayerGeometry() a/Source/WebCore/rendering/RenderLayerBacking.cpp_sec2
598
    // Set opacity, if it is not animating.
612
    // Set opacity, if it is not animating.
599
    if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyOpacity))
613
    if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyOpacity))
600
        updateOpacity(renderer()->style());
614
        updateOpacity(renderer()->style());
601
        
602
#if ENABLE(CSS_FILTERS)
603
    updateFilters(renderer()->style());
604
#endif
605
615
606
#if ENABLE(CSS_COMPOSITING)
616
#if ENABLE(CSS_COMPOSITING)
607
    updateLayerBlendMode(renderer()->style());
617
    updateLayerBlendMode(renderer()->style());
- a/Source/WebCore/rendering/RenderLayerBacking.h -3 / +1 lines
Lines 186-191 public: a/Source/WebCore/rendering/RenderLayerBacking.h_sec1
186
    GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
186
    GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
187
187
188
#if ENABLE(CSS_FILTERS)
188
#if ENABLE(CSS_FILTERS)
189
    void updateFilters(const RenderStyle*);
189
    bool canCompositeFilters() const { return m_canCompositeFilters; }
190
    bool canCompositeFilters() const { return m_canCompositeFilters; }
190
#endif
191
#endif
191
192
Lines 235-243 private: a/Source/WebCore/rendering/RenderLayerBacking.h_sec2
235
236
236
    void updateOpacity(const RenderStyle*);
237
    void updateOpacity(const RenderStyle*);
237
    void updateTransform(const RenderStyle*);
238
    void updateTransform(const RenderStyle*);
238
#if ENABLE(CSS_FILTERS)
239
    void updateFilters(const RenderStyle*);
240
#endif
241
#if ENABLE(CSS_COMPOSITING)
239
#if ENABLE(CSS_COMPOSITING)
242
    void updateLayerBlendMode(const RenderStyle*);
240
    void updateLayerBlendMode(const RenderStyle*);
243
#endif
241
#endif
- a/Source/WebCore/rendering/RenderLayerCompositor.cpp -1 / +8 lines
Lines 760-766 IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* laye a/Source/WebCore/rendering/RenderLayerCompositor.cpp_sec1
760
{
760
{
761
    if (!canBeComposited(layer))
761
    if (!canBeComposited(layer))
762
        return IntRect();
762
        return IntRect();
763
    return layer->calculateLayerBounds(ancestorLayer, 0, RenderLayer::DefaultCalculateLayerBoundsFlags | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask);
763
764
    RenderLayer::CalculateLayerBoundsFlags flags = RenderLayer::DefaultCalculateLayerBoundsFlags | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask;
765
#if ENABLE(CSS_FILTERS) && HAVE(COMPOSITOR_FILTER_OUTSETS)
766
    // If the compositor computes its own filter outsets, don't include them in the composited bounds.
767
    if (!layer->paintsWithFilters())
768
        flags &= ~RenderLayer::IncludeLayerFilterOutsets;
769
#endif
770
    return layer->calculateLayerBounds(ancestorLayer, 0, flags);
764
}
771
}
765
772
766
void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer* /*child*/)
773
void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer* /*child*/)

Return to Bug 109098