Changeset 147538 in webkit
- Timestamp:
- Apr 3, 2013 4:06:49 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r147536 r147538 1 2013-04-03 Antoine Quint <graouts@apple.com> 2 3 Web Inspector: crash in WebCore::InspectorLayerTreeAgent::buildObjectForLayer if a layer is created for an anonymous RenderObject (:first-letter) 4 https://bugs.webkit.org/show_bug.cgi?id=113768 5 6 Reviewed by Timothy Hatcher. 7 8 * inspector-protocol/layers/layers-anonymous-expected.txt: Added. 9 * inspector-protocol/layers/layers-anonymous.html: Added. 10 New test for layers created for CSS anonymous boxes or blocks. 11 12 * inspector-protocol/layers/layers-generated-content.html: 13 Update test to use the "pseudoElement" property instead of "pseudoClass" 14 which was the previous, less accurate name. 15 1 16 2013-04-03 Zoltan Arvai <zarvai@inf.u-szeged.hu> 2 17 -
trunk/LayoutTests/inspector-protocol/layers/layers-anonymous.html
r147536 r147538 46 46 function gotLayerTree(result) 47 47 { 48 var beforeLayers = []; 49 var afterLayers = []; 50 result.layers.forEach(function (layer) { 51 if (!layer.isGeneratedContent) 52 return; 53 54 if (layer.pseudoClass === "before") 55 beforeLayers.push(layer); 56 if (layer.pseudoClass === "after") 57 afterLayers.push(layer); 48 var anonymousLayers = result.layers.filter(function (layer) { 49 return layer.isAnonymous; 58 50 }); 59 51 60 52 logTestName("Check layers"); 61 53 62 assert("Expected number of ::before layers", beforeLayers.length, 1); 63 assert("The sole ::before layer has a pseudo element", beforeLayers[0].pseudoElementId !== "", true); 64 65 assert("Expected number of ::after layers", afterLayers.length, 2); 66 assert("The first ::after layer has a pseudo element", afterLayers[0].pseudoElementId !== "", true); 67 assert("The second ::after layer has a pseudo element", afterLayers[1].pseudoElementId !== "", true); 68 assert("The second ::after layer is a reflection", afterLayers[1].isReflection, true); 69 assert("The two ::after layers have the same node id", afterLayers[0].nodeId, afterLayers[1].nodeId); 70 assert("The two ::after layers have the same pseudo element id", afterLayers[0].pseudoElementId, afterLayers[1].pseudoElementId); 71 72 assert("The non-reflection generated generated layers have the same node id", beforeLayers[0].nodeId, afterLayers[0].nodeId); 73 assert("The non-reflection generated layers have different pseudo element ids", beforeLayers[0].pseudoElementId !== afterLayers[0].pseudoElementId, true); 54 assert("Expected number of anonymous layers", anonymousLayers.length, 1); 55 assert("The sole anonymous layer has a non-zero node id", anonymousLayers[0].nodeId !== 0, true); 56 assert("The sole anonymous layer has a :first-letter pseudo-element", anonymousLayers[0].pseudoElement === "first-letter", true); 74 57 75 58 var node; 76 var nodeId = beforeLayers[0].nodeId;59 var nodeId = anonymousLayers[0].nodeId; 77 60 for (var i = 0, count = nodes.length; i < count; ++i) { 78 61 if (nodes[i].nodeId === nodeId) { … … 82 65 } 83 66 84 logTestName("Check generatingnode");67 logTestName("Check node"); 85 68 86 assert(" Generating node was found", !!node, true);87 assert(" Generating node has expected localName", node.localName, "div");88 assert(" Generating node has id", node.attributes[0], "id");89 assert(" Generating node has expected id", node.attributes[1], "generator");69 assert("Node was found", !!node, true); 70 assert("Node has expected localName", node.localName, "p"); 71 assert("Node has id", node.attributes[0], "id"); 72 assert("Node has expected id", node.attributes[1], "first-letter"); 90 73 91 74 InspectorTest.completeTest(); … … 142 125 </script> 143 126 <style type="text/css"> 144 145 #generator::before,146 #generator::after {147 position: absolute;148 width: 100px;149 height: 100px;150 background-color: black;151 -webkit-transform: translateZ(0);152 content: "";153 }154 127 155 #generator::after { 156 -webkit-box-reflect:below 1px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.5, transparent), to(white)); 128 #first-letter::first-letter { 129 float: left; 130 -webkit-backface-visibility: hidden; 157 131 } 158 132 … … 161 135 <body> 162 136 163 < div id="generator"></div>137 <p id="first-letter">This is a test</p> 164 138 165 139 </body> -
trunk/LayoutTests/inspector-protocol/layers/layers-generated-content.html
r145057 r147538 52 52 return; 53 53 54 if (layer.pseudo Class=== "before")54 if (layer.pseudoElement === "before") 55 55 beforeLayers.push(layer); 56 if (layer.pseudo Class=== "after")56 if (layer.pseudoElement === "after") 57 57 afterLayers.push(layer); 58 58 }); -
trunk/Source/WebCore/ChangeLog
r147535 r147538 1 2013-04-03 Antoine Quint <graouts@apple.com> 2 3 Web Inspector: crash in WebCore::InspectorLayerTreeAgent::buildObjectForLayer if a layer is created for an anonymous RenderObject (:first-letter) 4 https://bugs.webkit.org/show_bug.cgi?id=113768 5 6 The InspectorLayerTreeAgent now knows how to deal with anonymous RenderObjects 7 for the :first-letter and :first-line pseudo-elements. 8 9 Reviewed by Timothy Hatcher. 10 11 Test: inspector-protocol/layers/layers-anonymous.html 12 13 * inspector/Inspector.json: 14 Change the Layer type in the LayerTree domain to have more accurate terminology 15 (pseudo-element vs. pseudo-class) and a new optional isAnonymous flag for layers 16 associated to anonymous RenderObjects. 17 18 * inspector/InspectorLayerTreeAgent.cpp: 19 (WebCore::InspectorLayerTreeAgent::buildObjectForLayer): 20 Check for anonymous RenderObjects and set the parent renderer's node as the node 21 for this layer since anonymous renderers have the Document as their node and this 22 would not be satisfactory to show in a front-end. We also check for anonymous 23 RenderObjects for the :first-letter and :first-line pseudo-elements and set them 24 in the pseudoElement property of the Layer object created such that a front-end 25 could correctly identify what type of pseudo-element for the associated node 26 yielded this layer. 27 28 (WebCore::InspectorLayerTreeAgent::idForNode): 29 Here we fix the actual crash by first checking if the node provided is null and 30 returning 0 if there's no such node. This ensures that any scenario where there 31 is no node associated with the RenderObject simply informs of the front-end that 32 no such node exists and we do not crash. 33 1 34 2013-04-03 Alexander Pavlov <apavlov@chromium.org> 2 35 -
trunk/Source/WebCore/inspector/Inspector.json
r147428 r147538 3740 3740 { "name": "isReflection", "type": "boolean", "optional": true, "description": "Indicates whether this layer was used to provide a reflection for the element." }, 3741 3741 { "name": "isGeneratedContent", "type": "boolean", "optional": true, "description": "Indicates whether the layer is attached to a pseudo element that is CSS generated content." }, 3742 { "name": "isAnonymous", "type": "boolean", "optional": true, "description": "Indicates whether the layer was created for a CSS anonymous block or box." }, 3742 3743 { "name": "pseudoElementId", "$ref": "PseudoElementId", "optional": true, "description": "The id for the pseudo element associated with this layer." }, 3743 { "name": "pseudo Class", "type": "string", "optional": true, "description": "The name of the CSS pseudo-class that prompted the layer's contentto be generated." }3744 { "name": "pseudoElement", "type": "string", "optional": true, "description": "The name of the CSS pseudo-element that prompted the layer to be generated." } 3744 3745 ] 3745 3746 }, -
trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp
r145136 r147538 166 166 bool isReflection = renderLayer->isReflection(); 167 167 bool isGenerated = (isReflection ? renderer->parent() : renderer)->isBeforeOrAfterContent(); 168 bool isAnonymous = renderer->isAnonymous(); 168 169 169 170 if (isReflection && isGenerated) … … 171 172 else if (isGenerated) 172 173 node = renderer->generatingNode(); 173 else if (isReflection )174 else if (isReflection || isAnonymous) 174 175 node = renderer->parent()->node(); 175 176 … … 195 196 layerObject->setPseudoElementId(bindPseudoElement(static_cast<PseudoElement*>(renderer->node()))); 196 197 if (renderer->isBeforeContent()) 197 layerObject->setPseudo Class("before");198 layerObject->setPseudoElement("before"); 198 199 else if (renderer->isAfterContent()) 199 layerObject->setPseudoClass("after"); 200 layerObject->setPseudoElement("after"); 201 } 202 203 if (isAnonymous) { 204 layerObject->setIsAnonymous(true); 205 if (RenderStyle* style = renderer->style()) { 206 if (style->styleType() == FIRST_LETTER) 207 layerObject->setPseudoElement("first-letter"); 208 else if (style->styleType() == FIRST_LINE) 209 layerObject->setPseudoElement("first-line"); 210 } 200 211 } 201 212 … … 205 216 int InspectorLayerTreeAgent::idForNode(ErrorString* errorString, Node* node) 206 217 { 218 if (!node) 219 return 0; 220 207 221 InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent(); 208 222
Note: See TracChangeset
for help on using the changeset viewer.