| Differences between
and this patch
- a/Source/WebCore/ChangeLog +18 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-02-20  Dean Jackson  <dino@apple.com>
2
3
        Enable compositing when a CSS filter is animating
4
        https://bugs.webkit.org/show_bug.cgi?id=79048
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Now that some systems (e.g. OS X) have both hardware accelerated
9
        CSS filters, and the ability to animate them via the hardware
10
        compositor, all CSS filters should be composited when animating.
11
12
        Test: css3/filters/composited-during-animation.html
13
              css3/filters/composited-during-animation-layertree.html:
14
15
        * rendering/RenderLayerCompositor.cpp:
16
        (WebCore::RenderLayerCompositor::requiresCompositingForAnimation):
17
            Add test for CSSWebKitFilter property.
18
1
2012-03-02  Maciej Stachowiak  <mjs@apple.com>
19
2012-03-02  Maciej Stachowiak  <mjs@apple.com>
2
20
3
        REGRESSION(r97353): Crash when accessing location or history properties inside a navigated window
21
        REGRESSION(r97353): Crash when accessing location or history properties inside a navigated window
- a/Source/WebCore/rendering/RenderLayerCompositor.cpp -1 / +7 lines
Lines 1505-1511 bool RenderLayerCompositor::requiresCompositingForAnimation(RenderObject* render a/Source/WebCore/rendering/RenderLayerCompositor.cpp_sec1
1505
1505
1506
    if (AnimationController* animController = renderer->animation()) {
1506
    if (AnimationController* animController = renderer->animation()) {
1507
        return (animController->isRunningAnimationOnRenderer(renderer, CSSPropertyOpacity) && inCompositingMode())
1507
        return (animController->isRunningAnimationOnRenderer(renderer, CSSPropertyOpacity) && inCompositingMode())
1508
            || animController->isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitTransform);
1508
            || animController->isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitTransform)
1509
#if ENABLE(CSS_FILTERS)
1510
#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION)
1511
            || animController->isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitFilter)
1512
#endif // !SNOW_LEOPARD && !LION
1513
#endif // CSS_FILTERS
1514
            ;
1509
    }
1515
    }
1510
    return false;
1516
    return false;
1511
}
1517
}
- a/LayoutTests/ChangeLog +12 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2012-02-20  Dean Jackson  <dino@apple.com>
2
3
        Enable compositing when a CSS filter is animating
4
        https://bugs.webkit.org/show_bug.cgi?id=79048
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * css3/filters/composited-during-animation-expected.txt: Added.
9
        * css3/filters/composited-during-animation.html: Added.
10
        * css3/filters/composited-during-animation-layertree-expected.txt: Added.
11
        * css3/filters/composited-during-animation-layertree.html:
12
1
2012-03-02  Dirk Pranke  <dpranke@chromium.org>
13
2012-03-02  Dirk Pranke  <dpranke@chromium.org>
2
14
3
        Fix expectation for svg/foreignObject/fO-parent-display-changes.svg.
15
        Fix expectation for svg/foreignObject/fO-parent-display-changes.svg.
- a/LayoutTests/css3/filters/composited-during-animation-expected.txt +20 lines
Line 0 a/LayoutTests/css3/filters/composited-during-animation-expected.txt_sec1
1
        
2
PASS: Element grayscale-box had filter value grayscale(1) before animation.
3
PASS: Element sepia-box had filter value sepia(1) before animation.
4
PASS: Element saturate-box had filter value saturate(1) before animation.
5
PASS: Element huerotate-box had filter value hue-rotate(90deg) before animation.
6
PASS: Element invert-box had filter value invert(1) before animation.
7
PASS: Element opacity-box had filter value opacity(0) before animation.
8
PASS: Element brightness-box had filter value brightness(0) before animation.
9
PASS: Element contrast-box had filter value contrast(0) before animation.
10
PASS: Element blur-box had filter value blur(10px) before animation.
11
PASS - "webkitFilter" property for "grayscale-box" element at 1s saw something close to: grayscale(0.5)
12
PASS - "webkitFilter" property for "sepia-box" element at 1s saw something close to: sepia(0.5)
13
PASS - "webkitFilter" property for "saturate-box" element at 1s saw something close to: saturate(0.5)
14
PASS - "webkitFilter" property for "huerotate-box" element at 1s saw something close to: hue-rotate(90deg)
15
PASS - "webkitFilter" property for "invert-box" element at 1s saw something close to: invert(0.5)
16
PASS - "webkitFilter" property for "opacity-box" element at 1s saw something close to: opacity(0.5)
17
PASS - "webkitFilter" property for "brightness-box" element at 1s saw something close to: brightness(0.5)
18
PASS - "webkitFilter" property for "contrast-box" element at 1s saw something close to: contrast(0.5)
19
PASS - "webkitFilter" property for "blur-box" element at 1s saw something close to: blur(10px)
20
- a/LayoutTests/css3/filters/composited-during-animation-layertree-expected.txt +35 lines
Line 0 a/LayoutTests/css3/filters/composited-during-animation-layertree-expected.txt_sec1
1
   
2
   
3
   
4
  
5
(GraphicsLayer
6
  (bounds 800.00 600.00)
7
  (children 1
8
    (GraphicsLayer
9
      (bounds 800.00 600.00)
10
      (children 4
11
        (GraphicsLayer
12
          (position 18.00 18.00)
13
          (bounds 160.00 90.00)
14
          (drawsContent 1)
15
        )
16
        (GraphicsLayer
17
          (position 18.00 132.00)
18
          (bounds 160.00 90.00)
19
          (drawsContent 1)
20
        )
21
        (GraphicsLayer
22
          (position 18.00 246.00)
23
          (bounds 160.00 90.00)
24
          (drawsContent 1)
25
        )
26
        (GraphicsLayer
27
          (position 18.00 360.00)
28
          (bounds 160.00 90.00)
29
          (drawsContent 1)
30
        )
31
      )
32
    )
33
  )
34
)
35
- a/LayoutTests/css3/filters/composited-during-animation-layertree.html +112 lines
Line 0 a/LayoutTests/css3/filters/composited-during-animation-layertree.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
  <style>
5
    img {
6
        margin: 10px;
7
        -webkit-animation-duration: 5s !important;
8
        -webkit-animation-iteration-count: infinite !important;
9
        -webkit-animation-direction: alternate !important;
10
    }
11
12
    #grayscale-box {
13
        -webkit-animation-name: grayscale-anim;
14
        -webkit-filter: grayscale(1);
15
    }
16
17
    #sepia-box {
18
        -webkit-filter: sepia(1);
19
    }
20
21
    #saturate-box {
22
        -webkit-animation: saturate-anim;
23
        -webkit-filter: saturate(1);
24
    }
25
26
    #huerotate-box {
27
        -webkit-filter: hue-rotate(90deg);
28
    }
29
30
    #invert-box {
31
        -webkit-animation: invert-anim;
32
        -webkit-filter: invert(1);
33
    }
34
35
    #opacity-box {
36
        -webkit-filter: opacity(0);
37
    }
38
39
    #brightness-box {
40
        -webkit-animation: brightness-anim;
41
        -webkit-filter: brightness(0);
42
    }
43
44
    #contrast-box {
45
        -webkit-filter: contrast(0);
46
    }
47
48
49
    @-webkit-keyframes grayscale-anim {
50
        from { -webkit-filter: grayscale(0); }
51
        to   { -webkit-filter: grayscale(1); }
52
    }
53
54
    @-webkit-keyframes saturate-anim {
55
        from { -webkit-filter: saturate(0); }
56
        to   { -webkit-filter: saturate(1); }
57
    }
58
59
    @-webkit-keyframes invert-anim {
60
        from { -webkit-filter: invert(0); }
61
        to   { -webkit-filter: invert(1); }
62
    }
63
64
    @-webkit-keyframes brightness-anim {
65
        from { -webkit-filter: brightness(1); }
66
        to   { -webkit-filter: brightness(0); }
67
    }
68
69
  </style>
70
  <script>
71
      if (window.layoutTestController) {
72
          layoutTestController.waitUntilDone();
73
          layoutTestController.dumpAsText();
74
      }
75
76
      function doTest() {
77
          if (window.layoutTestController) {
78
              document.getElementById('layer-tree').innerText = layoutTestController.layerTreeAsText()
79
              layoutTestController.notifyDone();
80
          }
81
      }
82
      
83
      window.addEventListener("load", doTest, false);
84
  </script>
85
</head>
86
<body>
87
88
<!-- Every third image below is animating, and thus might
89
     get a compositing layer. Every 3n+1 element is not animating but
90
     has a static filter, and shouldn't need a compositing layer.
91
     Every 3n+2 element is a purely static image, and shouldn't
92
     even be a layer -->
93
<img src="resources/reference.png" id="grayscale-box">
94
<img src="resources/reference.png" id="sepia-box">
95
<img src="resources/reference.png">
96
<br>
97
<img src="resources/reference.png" id="saturate-box">
98
<img src="resources/reference.png" id="huerotate-box">
99
<img src="resources/reference.png">
100
<br>
101
<img src="resources/reference.png" id="invert-box">
102
<img src="resources/reference.png" id="opacity-box">
103
<img src="resources/reference.png">
104
<br>
105
<img src="resources/reference.png" id="brightness-box">
106
<img src="resources/reference.png" id="contrast-box">
107
<img src="resources/reference.png">
108
109
<pre id="layer-tree">Layer tree goes here in DRT</pre>
110
111
</body>
112
</html>
- a/LayoutTests/css3/filters/composited-during-animation.html +187 lines
Line 0 a/LayoutTests/css3/filters/composited-during-animation.html_sec1
1
<!DOCTYPE html>
2
3
<html>
4
<head>
5
  <style>
6
    img {
7
        margin: 10px;
8
    }
9
10
    .animating img {
11
        -webkit-animation-duration: 2s !important;
12
        -webkit-animation-timing-function: linear !important;
13
    }
14
15
    #grayscale-box {
16
        -webkit-animation-name: grayscale-anim;
17
        -webkit-filter: grayscale(1);
18
    }
19
20
    #sepia-box {
21
        -webkit-animation: sepia-anim;
22
        -webkit-filter: sepia(1);
23
    }
24
25
    #saturate-box {
26
        -webkit-animation: saturate-anim;
27
        -webkit-filter: saturate(1);
28
    }
29
30
    #huerotate-box {
31
        -webkit-animation: huerotate-anim;
32
        -webkit-filter: hue-rotate(90deg);
33
    }
34
35
    #invert-box {
36
        -webkit-animation: invert-anim;
37
        -webkit-filter: invert(1);
38
    }
39
40
    #opacity-box {
41
        -webkit-animation: opacity-anim;
42
        -webkit-filter: opacity(0);
43
    }
44
45
    #brightness-box {
46
        -webkit-animation: brightness-anim;
47
        -webkit-filter: brightness(0);
48
    }
49
50
    #contrast-box {
51
        -webkit-animation: contrast-anim;
52
        -webkit-filter: contrast(0);
53
    }
54
55
    #blur-box {
56
        -webkit-animation: blur-anim;
57
        -webkit-filter: blur(10px);
58
    }
59
60
61
    @-webkit-keyframes grayscale-anim {
62
        from { -webkit-filter: grayscale(0); }
63
        to   { -webkit-filter: grayscale(1); }
64
    }
65
66
    @-webkit-keyframes sepia-anim {
67
        from { -webkit-filter: sepia(0); }
68
        to   { -webkit-filter: sepia(1); }
69
    }
70
71
    @-webkit-keyframes saturate-anim {
72
        from { -webkit-filter: saturate(0); }
73
        to   { -webkit-filter: saturate(1); }
74
    }
75
76
    @-webkit-keyframes huerotate-anim {
77
        from { -webkit-filter: hue-rotate(0); }
78
        to   { -webkit-filter: hue-rotate(180deg); }
79
    }
80
81
    @-webkit-keyframes invert-anim {
82
        from { -webkit-filter: invert(0); }
83
        to   { -webkit-filter: invert(1); }
84
    }
85
86
    @-webkit-keyframes opacity-anim {
87
        from { -webkit-filter: opacity(1); }
88
        to   { -webkit-filter: opacity(0); }
89
    }
90
91
    @-webkit-keyframes brightness-anim {
92
        from { -webkit-filter: brightness(1); }
93
        to   { -webkit-filter: brightness(0); }
94
    }
95
96
    @-webkit-keyframes contrast-anim {
97
        from { -webkit-filter: contrast(1); }
98
        to   { -webkit-filter: contrast(0); }
99
    }
100
101
    @-webkit-keyframes blur-anim {
102
        from { -webkit-filter: blur(0); }
103
        to   { -webkit-filter: blur(20px); }
104
    }
105
106
  </style>
107
  <script src="../../animations/resources/animation-test-helpers.js"></script>
108
  <script type="text/javascript">
109
110
    const preExpectedValues = [
111
        // [element-id, property, expected-value]
112
        ["grayscale-box", "webkitFilter", 'grayscale(1)'],
113
        ["sepia-box", "webkitFilter", 'sepia(1)'],
114
        ["saturate-box", "webkitFilter", 'saturate(1)'],
115
        ["huerotate-box", "webkitFilter", 'hue-rotate(90deg)'],
116
        ["invert-box", "webkitFilter", 'invert(1)'],
117
        ["opacity-box", "webkitFilter", 'opacity(0)'],
118
        ["brightness-box", "webkitFilter", 'brightness(0)'],
119
        ["contrast-box", "webkitFilter", 'contrast(0)'],
120
        ["blur-box", "webkitFilter", 'blur(10px)'],
121
    ];
122
123
    const expectedValues = [
124
        // [animation-name, time, element-id, property, expected-value, tolerance]
125
        ["grayscale-anim",  1, "grayscale-box", "webkitFilter", 'grayscale(0.5)', 0.15],
126
        ["sepia-anim",  1, "sepia-box", "webkitFilter", 'sepia(0.5)', 0.15],
127
        ["saturate-anim",  1, "saturate-box", "webkitFilter", 'saturate(0.5)', 0.15],
128
        ["huerotate-anim",  1, "huerotate-box", "webkitFilter", 'hue-rotate(90deg)', 20],
129
        ["invert-anim",  1, "invert-box", "webkitFilter", 'invert(0.5)', 0.15],
130
        ["opacity-anim",  1, "opacity-box", "webkitFilter", 'opacity(0.5)', 0.15],
131
        ["brightness-anim",  1, "brightness-box", "webkitFilter", 'brightness(0.5)', 0.15],
132
        ["contrast-anim",  1, "contrast-box", "webkitFilter", 'contrast(0.5)', 0.15],
133
        ["blur-anim",  1, "blur-box", "webkitFilter", 'blur(10px)', 4],
134
    ];
135
136
    function runPreTest() {
137
        var preResult = "";
138
139
        for (var i=0; i < preExpectedValues.length; i++) {
140
            var id = preExpectedValues[i][0];
141
            var prop = preExpectedValues[i][1];
142
            var expected = preExpectedValues[i][2];
143
            var element = document.getElementById(id);
144
            var computedStyle = window.getComputedStyle(element)[prop];
145
            if (computedStyle == expected)
146
              preResult += "PASS: Element " + id + " had filter value " + expected + " before animation.<br>";
147
            else
148
              preResult += "FAIL: Element " + id + " had filter value " + computedStyle + " rather than " + expected + " before animation.<br>";
149
        }
150
        document.getElementById("preresult").innerHTML = preResult;
151
      
152
        // Completed the pre-animation tests. Now start the animation.
153
        setTimeout(function () {
154
            document.body.className = "animating";
155
            runAnimationTest(expectedValues);
156
        }, 0);
157
    }
158
    
159
    if (window.layoutTestController) {
160
        layoutTestController.dumpAsText();
161
        layoutTestController.waitUntilDone();
162
    }
163
    
164
    window.addEventListener("load", runPreTest, false);
165
  </script>
166
</head>
167
<body>
168
169
<img src="resources/reference.png" id="grayscale-box">
170
<img src="resources/reference.png" id="sepia-box">
171
<img src="resources/reference.png" id="saturate-box">
172
<img src="resources/reference.png" id="huerotate-box">
173
<img src="resources/reference.png" id="invert-box">
174
<img src="resources/reference.png" id="opacity-box">
175
<img src="resources/reference.png" id="brightness-box">
176
<img src="resources/reference.png" id="contrast-box">
177
<img src="resources/reference.png" id="blur-box">
178
179
<!-- this result element is filled in the script above, before the animations start -->
180
<div id="preresult">
181
</div>
182
183
<!-- this result element is filled by the animation test system -->
184
<div id="result">
185
</div>
186
</body>
187
</html>

Return to Bug 79048