| Differences between
and this patch
- a/Source/WebCore/ChangeLog +21 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2014-04-03  Ion Rosca  <rosca@adobe.com>
2
3
        [CSS Blending] Add compositing reason for isolation.
4
        https://bugs.webkit.org/show_bug.cgi?id=131153
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        There are 2 reasons involving blend modes for a layer to be composited:
9
        1) the layer has blend mode and has composited descendants: CompositingReasonBlendingWithCompositedDescendants.
10
        2) the layer has to isolate composited blending descendants: CompositingReasonIsolatesCompositedBlendingDescendants
11
12
        Test: inspector-protocol/layers/layers-blending-compositing-reasons.html
13
14
        * inspector/InspectorLayerTreeAgent.cpp:
15
        (WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer):
16
        * inspector/protocol/LayerTree.json:
17
        * rendering/RenderLayerCompositor.cpp:
18
        (WebCore::RenderLayerCompositor::reasonsForCompositing):
19
        (WebCore::RenderLayerCompositor::logReasonsForCompositing):
20
        * rendering/RenderLayerCompositor.h: adding CompositingReasonIsolatesCompositedBlendingDescendants.
21
1
2014-04-02  Ion Rosca  <rosca@adobe.com>
22
2014-04-02  Ion Rosca  <rosca@adobe.com>
2
23
3
        [CSS Blending] Compositing requirements for blending are not computed correctly
24
        [CSS Blending] Compositing requirements for blending are not computed correctly
- a/Source/WebInspectorUI/ChangeLog +11 lines
Lines 1-3 a/Source/WebInspectorUI/ChangeLog_sec1
1
2014-04-03  Ion Rosca  <rosca@adobe.com>
2
3
        [CSS Blending] Add compositing reason for isolation.
4
        https://bugs.webkit.org/show_bug.cgi?id=131153
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * Localizations/en.lproj/localizedStrings.js:
9
        * UserInterface/Views/LayerTreeSidebarPanel.js:
10
        (WebInspector.LayerTreeSidebarPanel.prototype._populateListOfCompositingReasons):
11
1
2014-04-01  Timothy Hatcher  <timothy@apple.com>
12
2014-04-01  Timothy Hatcher  <timothy@apple.com>
2
13
3
        Remove HeapProfiler from the Web Inspector protocol.
14
        Remove HeapProfiler from the Web Inspector protocol.
- a/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp +3 lines
Lines 298-303 void InspectorLayerTreeAgent::reasonsForCompositingLayer(ErrorString* errorStrin a/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp_sec1
298
    if (reasonsBitmask & CompositingReasonBlendingWithCompositedDescendants)
298
    if (reasonsBitmask & CompositingReasonBlendingWithCompositedDescendants)
299
        compositingReasons->setBlendingWithCompositedDescendants(true);
299
        compositingReasons->setBlendingWithCompositedDescendants(true);
300
300
301
    if (reasonsBitmask & CompositingReasonIsolatesCompositedBlendingDescendants)
302
        compositingReasons->setIsolatesCompositedBlendingDescendants(true);
303
301
    if (reasonsBitmask & CompositingReasonPerspective)
304
    if (reasonsBitmask & CompositingReasonPerspective)
302
        compositingReasons->setPerspective(true);
305
        compositingReasons->setPerspective(true);
303
306
- a/Source/WebCore/inspector/protocol/LayerTree.json +1 lines
Lines 67-72 a/Source/WebCore/inspector/protocol/LayerTree.json_sec1
67
                { "name": "reflectionWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a reflection and composited descendants." },
67
                { "name": "reflectionWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a reflection and composited descendants." },
68
                { "name": "filterWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with CSS filters applied and composited descendants." },
68
                { "name": "filterWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with CSS filters applied and composited descendants." },
69
                { "name": "blendingWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with CSS blending applied and composited descendants." },
69
                { "name": "blendingWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with CSS blending applied and composited descendants." },
70
                { "name": "isolatesCompositedBlendingDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element isolating compositing descendants having CSS blending applied." },
70
                { "name": "perspective", "type": "boolean", "optional": true, "description": "Composition due to association with an element with perspective applied." },
71
                { "name": "perspective", "type": "boolean", "optional": true, "description": "Composition due to association with an element with perspective applied." },
71
                { "name": "preserve3D", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"transform-style: preserve-3d\" style." },
72
                { "name": "preserve3D", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"transform-style: preserve-3d\" style." },
72
                { "name": "root", "type": "boolean", "optional": true, "description": "Composition due to association with the root element." },
73
                { "name": "root", "type": "boolean", "optional": true, "description": "Composition due to association with the root element." },
- a/Source/WebCore/rendering/RenderLayerCompositor.cpp -1 / +9 lines
Lines 2127-2132 CompositingReasons RenderLayerCompositor::reasonsForCompositing(const RenderLaye a/Source/WebCore/rendering/RenderLayerCompositor.cpp_sec1
2127
2127
2128
#if ENABLE(CSS_COMPOSITING)
2128
#if ENABLE(CSS_COMPOSITING)
2129
        if (layer.isolatesCompositedBlending())
2129
        if (layer.isolatesCompositedBlending())
2130
            reasons |= CompositingReasonIsolatesCompositedBlendingDescendants;
2131
2132
        if (layer.hasBlendMode())
2130
            reasons |= CompositingReasonBlendingWithCompositedDescendants;
2133
            reasons |= CompositingReasonBlendingWithCompositedDescendants;
2131
#endif
2134
#endif
2132
2135
Lines 2202-2211 const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer& l a/Source/WebCore/rendering/RenderLayerCompositor.cpp_sec2
2202
2205
2203
    if (reasons & CompositingReasonFilterWithCompositedDescendants)
2206
    if (reasons & CompositingReasonFilterWithCompositedDescendants)
2204
        return "filter with composited descendants";
2207
        return "filter with composited descendants";
2205
            
2208
2209
#if ENABLE(CSS_COMPOSITING)
2206
    if (reasons & CompositingReasonBlendingWithCompositedDescendants)
2210
    if (reasons & CompositingReasonBlendingWithCompositedDescendants)
2207
        return "blending with composited descendants";
2211
        return "blending with composited descendants";
2208
2212
2213
    if (reasons & CompositingReasonIsolatesCompositedBlendingDescendants)
2214
        return "isolates composited blending descendants";
2215
#endif
2216
2209
    if (reasons & CompositingReasonPerspective)
2217
    if (reasons & CompositingReasonPerspective)
2210
        return "perspective";
2218
        return "perspective";
2211
2219
- a/Source/WebCore/rendering/RenderLayerCompositor.h -1 / +2 lines
Lines 80-86 enum { a/Source/WebCore/rendering/RenderLayerCompositor.h_sec1
80
    CompositingReasonBlendingWithCompositedDescendants      = 1 << 20,
80
    CompositingReasonBlendingWithCompositedDescendants      = 1 << 20,
81
    CompositingReasonPerspective                            = 1 << 21,
81
    CompositingReasonPerspective                            = 1 << 21,
82
    CompositingReasonPreserve3D                             = 1 << 22,
82
    CompositingReasonPreserve3D                             = 1 << 22,
83
    CompositingReasonRoot                                   = 1 << 23
83
    CompositingReasonRoot                                   = 1 << 23,
84
    CompositingReasonIsolatesCompositedBlendingDescendants  = 1 << 24,
84
};
85
};
85
typedef unsigned CompositingReasons;
86
typedef unsigned CompositingReasons;
86
87
- a/Source/WebInspectorUI/UserInterface/Views/LayerTreeSidebarPanel.js +2 lines
Lines 432-437 WebInspector.LayerTreeSidebarPanel.prototype = { a/Source/WebInspectorUI/UserInterface/Views/LayerTreeSidebarPanel.js_sec1
432
            addReason(WebInspector.UIString("Element has CSS filters applied and composited descendants"));
432
            addReason(WebInspector.UIString("Element has CSS filters applied and composited descendants"));
433
        if (compositingReasons.blendingWithCompositedDescendants)
433
        if (compositingReasons.blendingWithCompositedDescendants)
434
            addReason(WebInspector.UIString("Element has CSS blending applied and composited descendants"));
434
            addReason(WebInspector.UIString("Element has CSS blending applied and composited descendants"));
435
        if (compositingReasons.isolatesCompositedBlendingDescendants)
436
            addReason(WebInspector.UIString("Element isolates composited descendants having CSS blending applied"));
435
        if (compositingReasons.perspective)
437
        if (compositingReasons.perspective)
436
            addReason(WebInspector.UIString("Element has perspective applied"));
438
            addReason(WebInspector.UIString("Element has perspective applied"));
437
        if (compositingReasons.preserve3D)
439
        if (compositingReasons.preserve3D)
- a/LayoutTests/ChangeLog +10 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2014-04-03  Ion Rosca  <rosca@adobe.com>
2
3
        [CSS Blending] Add compositing reason for isolation.
4
        https://bugs.webkit.org/show_bug.cgi?id=131153
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * inspector-protocol/layers/layers-blending-compositing-reasons-expected.txt: Added.
9
        * inspector-protocol/layers/layers-blending-compositing-reasons.html: Added.
10
1
2014-04-02  Ion Rosca  <rosca@adobe.com>
11
2014-04-02  Ion Rosca  <rosca@adobe.com>
2
12
3
        [CSS Blending] Compositing requirements for blending are not computed correctly
13
        [CSS Blending] Compositing requirements for blending are not computed correctly
- a/LayoutTests/inspector-protocol/layers/layers-blending-compositing-reasons-expected.txt +18 lines
Line 0 a/LayoutTests/inspector-protocol/layers/layers-blending-compositing-reasons-expected.txt_sec1
1
2
=== Enable the LayerTree agent ===
3
4
PASS
5
6
=== Get the Document ===
7
8
PASS
9
10
=== Get the layer tree ===
11
12
PASS
13
14
=== Check layers' reasons for compositing ===
15
16
PASS: <div id="isolating"> is composition due to isolating compositing descendants having CSS blending applied.
17
PASS: <div id="blending"> is composited due having CSS blending applied and composited descendants.
18
- a/LayoutTests/inspector-protocol/layers/layers-blending-compositing-reasons.html +167 lines
Line 0 a/LayoutTests/inspector-protocol/layers/layers-blending-compositing-reasons.html_sec1
1
<html>
2
<head>
3
<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
4
<script type="text/javascript">
5
6
function test()
7
{
8
9
    var nodes = [];
10
 
11
    InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
12
13
    enableLayerTreeAgent();
14
    
15
    function enableLayerTreeAgent(result)
16
    {
17
        step({
18
            name: "Enable the LayerTree agent",
19
            command: "LayerTree.enable",
20
            parameters: {},
21
            callback: getDocument
22
        });
23
    };
24
25
    function getDocument()
26
    {
27
        // We must first get the document so that later on we may get sensible nodeIds.
28
        step({
29
            name: "Get the Document",
30
            command: "DOM.getDocument",
31
            parameters: {},
32
            callback: getLayerTree
33
        });
34
    };
35
36
    function getLayerTree(result)
37
    {
38
        step({
39
            name: "Get the layer tree",
40
            command: "LayerTree.layersForNode",
41
            parameters: {"nodeId": result.root.nodeId},
42
            callback: gotLayerTree
43
        });
44
    };
45
46
    function gotLayerTree(result)
47
    {
48
        logTestName("Check layers' reasons for compositing")
49
        
50
        var layers = result.layers;
51
52
        var nodesById = {};
53
        nodes.forEach(function(node) {
54
            nodesById[node.nodeId] = node;
55
        });
56
57
        var count = 0;
58
        
59
        function hasId(node, id) {
60
            return node && node.attributes && node.attributes[0] === "id" && node.attributes[1] === id;
61
        }
62
        
63
        function dumpReasons(layer, compositingReasons) {
64
            var node = nodesById[layer.nodeId];
65
66
            if (hasId(node, "blending")) {
67
                assert(
68
                    "<div id=\"blending\"> is composited due having CSS blending applied and composited descendants",
69
                    compositingReasons.blendingWithCompositedDescendants,
70
                    true);
71
            } else if (hasId(node, "isolating")) {
72
                assert(
73
                    "<div id=\"isolating\"> is composition due to isolating compositing descendants having CSS blending applied",
74
                    compositingReasons.isolatesCompositedBlendingDescendants,
75
                    true);
76
            }
77
78
            if (++count === layers.length)
79
                InspectorTest.completeTest();
80
        };
81
82
        layers.forEach(function (layer) {
83
            runCommand({
84
                command: "LayerTree.reasonsForCompositingLayer",
85
                parameters: {"layerId": layer.layerId},
86
                callback: function(result) {
87
                    dumpReasons(layer, result.compositingReasons);
88
                }
89
            });
90
        });
91
    };
92
93
    function setChildNodes (messageObject) {
94
        messageObject.params.nodes.forEach(function (node) {
95
            nodes.push(node);
96
        })
97
    };
98
99
    function step(test)
100
    {
101
        if (test.callback)
102
            logTestName(test.name);
103
        runCommand(test);
104
    };
105
106
    function logTestName(name)
107
    {
108
        InspectorTest.log("\n=== " + name + " ===\n");
109
    };
110
111
    function runCommand(command)
112
    {
113
        InspectorTest.sendCommand(command.command, command.parameters, function(messageObject) {
114
            if (messageObject.hasOwnProperty("error")) {
115
                InspectorTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
116
                InspectorTest.completeTest();
117
                return;
118
            }
119
120
            if (command.name)
121
                InspectorTest.log("PASS");
122
123
            if (command.callback)
124
                command.callback(messageObject.result);
125
        });
126
    };
127
128
    function assert(name, actual, expected)
129
    {
130
        if (expected === actual)
131
            InspectorTest.log("PASS: " + name + ".");
132
        else
133
            InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
134
    };
135
136
};
137
138
window.addEventListener("DOMContentLoaded", function()
139
{
140
    runTest();
141
}, false);
142
143
</script>
144
<style type="text/css">
145
      
146
    #isolating {
147
        -webkit-isolation: isolate;
148
    }
149
150
    #blending {
151
        -webkit-mix-blend-mode: difference;
152
    }
153
154
    #composited {
155
        -webkit-transform: translateZ(0);
156
    }
157
158
</style>
159
</head>
160
<body>
161
    <div id="isolating">
162
        <div id="blending">
163
            <div id="composited"></div>
164
        </div>
165
    </div>
166
</body>
167
</html>

Return to Bug 131153