Chromium Code Reviews| Index: third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp |
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp |
| index c02151fa90407b36ee8d2c2c3a97e1f41638a982..c61f5800baf916ec85bda88ba6fee43923337ed6 100644 |
| --- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp |
| +++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp |
| @@ -2375,8 +2375,13 @@ int InspectorCSSAgent::getStyleIndexForNode( |
| CSSComputedStyleDeclaration::create(node, true); |
| Vector<String> style; |
| + // WTF::HashMap refuses to allow you to insert an empty vector :( |
| + style.append("dummy value"); |
|
Sami
2016/10/26 17:15:23
Would it be hard to fix this in WTF::HashMap? (I w
dgozman
2016/10/26 17:24:39
There should be a possibility with some magic bool
alex clarke (OOO till 29th)
2016/10/26 21:18:49
Possibly, I'm not sure how though. Honestly WTF::
|
| for (const auto& pair : cssPropertyWhitelist) { |
| - style.append(computedStyleInfo->getPropertyValue(pair.second)); |
| + String value = computedStyleInfo->getPropertyValue(pair.second); |
| + if (value.isEmpty()) |
| + continue; |
|
dgozman
2016/10/26 17:24:39
If you skip values in resulting array, how does cl
alex clarke (OOO till 29th)
2016/10/26 21:18:49
We send the key as well as the value, see:
styleP
|
| + style.append(value); |
| } |
| ComputedStylesMap::iterator it = styleToIndexMap.find(style); |
| @@ -2387,9 +2392,10 @@ int InspectorCSSAgent::getStyleIndexForNode( |
| std::unique_ptr<protocol::Array<protocol::CSS::CSSComputedStyleProperty>> |
| styleProperties = |
| protocol::Array<protocol::CSS::CSSComputedStyleProperty>::create(); |
| - for (size_t i = 0; i < style.size(); i++) { |
| + // Skip the dummy value... |
| + for (size_t i = 1; i < style.size(); i++) { |
| styleProperties->addItem(protocol::CSS::CSSComputedStyleProperty::create() |
| - .setName(cssPropertyWhitelist[i].first) |
| + .setName(cssPropertyWhitelist[i - 1].first) |
| .setValue(style[i]) |
| .build()); |
| } |
| @@ -2434,10 +2440,12 @@ void InspectorCSSAgent::visitLayoutTreeNodes( |
| if (!layoutObject) |
| continue; |
| - int backendNodeId = DOMNodeIds::idForNode(node); |
| + int nodeId = m_domAgent->boundNodeId(node); |
|
dgozman
2016/10/26 17:24:39
This requires the node to be already pushed to the
alex clarke (OOO till 29th)
2016/10/26 21:18:49
What I want to do is join the results of DOM.getDo
|
| + if (!nodeId) |
| + continue; |
| std::unique_ptr<protocol::CSS::LayoutTreeNode> layoutTreeNode = |
| protocol::CSS::LayoutTreeNode::create() |
| - .setBackendNodeId(backendNodeId) |
| + .setNodeId(nodeId) |
| .setStyleIndex(getStyleIndexForNode( |
| node, cssPropertyWhitelist, styleToIndexMap, computedStyles)) |
| .setBoundingBox(buildRectForFloatRect( |