Diff
Modified: trunk/LayoutTests/ChangeLog (144823 => 144824)
--- trunk/LayoutTests/ChangeLog 2013-03-05 22:47:02 UTC (rev 144823)
+++ trunk/LayoutTests/ChangeLog 2013-03-05 22:48:54 UTC (rev 144824)
@@ -1,3 +1,18 @@
+2013-03-05 Antoine Quint <grao...@apple.com>
+
+ Web Inspector: identify reflection layers in LayerTreeAgent
+ https://bugs.webkit.org/show_bug.cgi?id=111419
+
+ New test for reflection layers and an updated output for the
+ existing layersForNode() test since we changed the coordinates
+ for the "bounds" property to be absolute instead of local.
+
+ Reviewed by Dean Jackson.
+
+ * inspector-protocol/layers/layers-for-node-expected.txt:
+ * inspector-protocol/layers/layers-reflected-content-expected.txt: Added.
+ * inspector-protocol/layers/layers-reflected-content.html: Added.
+
2013-03-05 Alok Priyadarshi <al...@chromium.org>
Rebaseline text output for opaque GraphicsLayers
Modified: trunk/LayoutTests/inspector-protocol/layers/layers-for-node-expected.txt (144823 => 144824)
--- trunk/LayoutTests/inspector-protocol/layers/layers-for-node-expected.txt 2013-03-05 22:47:02 UTC (rev 144823)
+++ trunk/LayoutTests/inspector-protocol/layers/layers-for-node-expected.txt 2013-03-05 22:48:54 UTC (rev 144824)
@@ -34,8 +34,8 @@
"layerId": "string",
"nodeId": "number",
"bounds": {
- "x": 0,
- "y": 0,
+ "x": 25,
+ "y": 25,
"width": 50,
"height": 50
},
@@ -52,8 +52,8 @@
"layerId": "string",
"nodeId": "number",
"bounds": {
- "x": 0,
- "y": 0,
+ "x": 50,
+ "y": 50,
"width": 50,
"height": 50
},
@@ -70,7 +70,7 @@
"layerId": "string",
"nodeId": "number",
"bounds": {
- "x": 0,
+ "x": 200,
"y": 0,
"width": 100,
"height": 100
@@ -88,8 +88,8 @@
"layerId": "string",
"nodeId": "number",
"bounds": {
- "x": 0,
- "y": 0,
+ "x": 225,
+ "y": 25,
"width": 50,
"height": 50
},
@@ -153,8 +153,8 @@
"layerId": "string",
"nodeId": "number",
"bounds": {
- "x": 0,
- "y": 0,
+ "x": 25,
+ "y": 25,
"width": 50,
"height": 50
},
@@ -171,8 +171,8 @@
"layerId": "string",
"nodeId": "number",
"bounds": {
- "x": 0,
- "y": 0,
+ "x": 50,
+ "y": 50,
"width": 50,
"height": 50
},
@@ -189,7 +189,7 @@
"layerId": "string",
"nodeId": "number",
"bounds": {
- "x": 0,
+ "x": 200,
"y": 0,
"width": 100,
"height": 100
@@ -207,8 +207,8 @@
"layerId": "string",
"nodeId": "number",
"bounds": {
- "x": 0,
- "y": 0,
+ "x": 225,
+ "y": 25,
"width": 50,
"height": 50
},
@@ -243,8 +243,8 @@
"layerId": "string",
"nodeId": "number",
"bounds": {
- "x": 0,
- "y": 0,
+ "x": 25,
+ "y": 25,
"width": 50,
"height": 50
},
Added: trunk/LayoutTests/inspector-protocol/layers/layers-reflected-content-expected.txt (0 => 144824)
--- trunk/LayoutTests/inspector-protocol/layers/layers-reflected-content-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector-protocol/layers/layers-reflected-content-expected.txt 2013-03-05 22:48:54 UTC (rev 144824)
@@ -0,0 +1,26 @@
+
+=== Enable the LayerTree agent ===
+
+PASS
+
+=== Get the Document ===
+
+PASS
+
+=== Get the layer tree ===
+
+PASS
+
+=== Check layers ===
+
+PASS: Expected number of reflected layers.
+PASS: First reflected layer has a node.
+
+=== Check reflected node ===
+
+PASS: Node for layer was found.
+PASS: Node has expected localName.
+PASS: Node has expected number of attributes.
+PASS: Node has CSS class.
+PASS: Node has expected CSS class.
+
Added: trunk/LayoutTests/inspector-protocol/layers/layers-reflected-content.html (0 => 144824)
--- trunk/LayoutTests/inspector-protocol/layers/layers-reflected-content.html (rev 0)
+++ trunk/LayoutTests/inspector-protocol/layers/layers-reflected-content.html 2013-03-05 22:48:54 UTC (rev 144824)
@@ -0,0 +1,149 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<script type="text/_javascript_">
+
+function test()
+{
+
+ var nodes;
+
+ InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
+
+ enableLayerTreeAgent();
+
+ function enableLayerTreeAgent(result)
+ {
+ step({
+ name: "Enable the LayerTree agent",
+ command: "LayerTree.enable",
+ parameters: {},
+ callback: getDocument
+ });
+ };
+
+ function getDocument()
+ {
+ // We must first get the document so that later on we may get sensible nodeIds.
+ step({
+ name: "Get the Document",
+ command: "DOM.getDocument",
+ parameters: {},
+ callback: getLayerTree
+ });
+ };
+
+ function getLayerTree(result)
+ {
+ step({
+ name: "Get the layer tree",
+ command: "LayerTree.layersForNode",
+ parameters: {"nodeId": result.root.nodeId},
+ callback: gotLayerTree
+ });
+ };
+
+ function gotLayerTree(result)
+ {
+ var reflectedLayers = result.layers.filter(function(layer) {
+ return layer.isReflection;
+ });
+
+ logTestName("Check layers");
+
+ assert("Expected number of reflected layers", reflectedLayers.length, 1);
+ assert("First reflected layer has a node", reflectedLayers[0].nodeId > 0, true);
+
+
+ logTestName("Check reflected node");
+
+ var node;
+ var nodeId = reflectedLayers[0].nodeId;
+ for (var i = 0, count = nodes.length; i < count; ++i) {
+ if (nodes[i].nodeId === nodeId) {
+ node = nodes[i];
+ break;
+ }
+ }
+
+ assert("Node for layer was found", !!node, true);
+ assert("Node has expected localName", node.localName, "div");
+ assert("Node has expected number of attributes", node.attributes.length, 2);
+ assert("Node has CSS class", node.attributes[0], "class");
+ assert("Node has expected CSS class", node.attributes[1], "reflected composited");
+
+ InspectorTest.completeTest();
+ };
+
+ function setChildNodes (messageObject) {
+ nodes = messageObject.params.nodes;
+ };
+
+ function step(test)
+ {
+ if (test.callback)
+ logTestName(test.name);
+ runCommand(test);
+ };
+
+ function logTestName(name)
+ {
+ InspectorTest.log("\n=== " + name + " ===\n");
+ };
+
+ function runCommand(command)
+ {
+ InspectorTest.sendCommand(command.command, command.parameters, function(messageObject) {
+ if (messageObject.hasOwnProperty("error")) {
+ InspectorTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
+ InspectorTest.completeTest();
+ return;
+ }
+
+ if (command.name)
+ InspectorTest.log("PASS");
+
+ if (command.callback)
+ command.callback(messageObject.result);
+ });
+ };
+
+ function assert(name, actual, expected)
+ {
+ if (expected === actual)
+ InspectorTest.log("PASS: " + name + ".");
+ else
+ InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
+ };
+
+};
+
+window.addEventListener("DOMContentLoaded", function()
+{
+ runTest();
+}, false);
+
+</script>
+<style type="text/css">
+
+ .reflected {
+ position: absolute;
+ width: 100px;
+ height: 100px;
+ background-color: black;
+ -webkit-box-reflect: below;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+
+</style>
+</head>
+<body>
+
+ <div class="reflected"></div>
+ <div class="reflected composited"></div>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (144823 => 144824)
--- trunk/Source/WebCore/ChangeLog 2013-03-05 22:47:02 UTC (rev 144823)
+++ trunk/Source/WebCore/ChangeLog 2013-03-05 22:48:54 UTC (rev 144824)
@@ -1,3 +1,25 @@
+2013-03-05 Antoine Quint <grao...@apple.com>
+
+ Web Inspector: identify reflection layers in LayerTreeAgent
+ https://bugs.webkit.org/show_bug.cgi?id=111419
+
+ We add a new property "isReflection" to the Layer objects returned
+ to the front-end to indicate whether the layer was created to host
+ the reflection for an element. When this new property is true, the
+ "nodeId" property is set to point to the reflected element's node
+ id, since there is no node per-se directly associated with this layer.
+ We also change the "bounds" property to return absolute page coordinates
+ such that the front-end can use this information to highlight that
+ region in the page since metrics would otherwise be unavailable.
+
+ Reviewed by Dean Jackson.
+
+ Test: inspector-protocol/layers/layers-reflected-content.html
+
+ * inspector/Inspector.json:
+ * inspector/InspectorLayerTreeAgent.cpp:
+ (WebCore::InspectorLayerTreeAgent::buildObjectForLayer):
+
2013-03-05 pe...@outlook.com <pe...@outlook.com>
[WinCairo] Compile fix after r144024.
Modified: trunk/Source/WebCore/inspector/Inspector.json (144823 => 144824)
--- trunk/Source/WebCore/inspector/Inspector.json 2013-03-05 22:47:02 UTC (rev 144823)
+++ trunk/Source/WebCore/inspector/Inspector.json 2013-03-05 22:48:54 UTC (rev 144824)
@@ -3663,11 +3663,12 @@
"properties": [
{ "name": "layerId", "$ref": "LayerId", "description": "The unique id for this layer." },
{ "name": "nodeId", "$ref": "DOM.NodeId", "description": "The id for the node associated with this layer." },
- { "name": "bounds", "$ref": "IntRect", "description": "Bounds of the layer." },
+ { "name": "bounds", "$ref": "IntRect", "description": "Bounds of the layer in absolute page coordinates." },
{ "name": "paintCount", "type": "integer", "description": "Indicates how many time this layer has painted." },
{ "name": "memory", "type": "integer", "description": "Estimated memory used by this layer." },
{ "name": "compositedBounds", "$ref": "IntRect", "description": "The bounds of the composited layer." },
- { "name": "isInShadowTree", "type": "boolean", "optional": true, "description": "Indicates whether this layer is associated with an element hosted in a shadow tree." }
+ { "name": "isInShadowTree", "type": "boolean", "optional": true, "description": "Indicates whether this layer is associated with an element hosted in a shadow tree." },
+ { "name": "isReflection", "type": "boolean", "optional": true, "description": "Indicates whether this layer was used to provide a reflection for the element." }
]
}
],
Modified: trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp (144823 => 144824)
--- trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp 2013-03-05 22:47:02 UTC (rev 144823)
+++ trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp 2013-03-05 22:48:54 UTC (rev 144824)
@@ -150,14 +150,17 @@
PassRefPtr<TypeBuilder::LayerTree::Layer> InspectorLayerTreeAgent::buildObjectForLayer(ErrorString* errorString, RenderLayer* renderLayer)
{
- Node* node = renderLayer->renderer()->node();
+ bool isReflection = renderLayer->isReflection();
+
+ RenderObject* renderer = renderLayer->renderer();
RenderLayerBacking* backing = renderLayer->backing();
+ Node* node = isReflection ? renderer->parent()->node() : renderer->node();
// Basic set of properties.
RefPtr<TypeBuilder::LayerTree::Layer> layerObject = TypeBuilder::LayerTree::Layer::create()
.setLayerId(bind(renderLayer))
.setNodeId(idForNode(errorString, node))
- .setBounds(buildObjectForIntRect(enclosingIntRect(renderLayer->localBoundingBox())))
+ .setBounds(buildObjectForIntRect(enclosingIntRect(renderer->absoluteBoundingBoxRect())))
.setMemory(backing->backingStoreMemoryEstimate())
.setCompositedBounds(buildObjectForIntRect(backing->compositedBounds()))
.setPaintCount(backing->graphicsLayer()->repaintCount());
@@ -165,6 +168,9 @@
if (node && node->shadowHost())
layerObject->setIsInShadowTree(true);
+ if (isReflection)
+ layerObject->setIsReflection(true);
+
return layerObject;
}