| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/inspector/InspectorHighlight.h" | 6 #include "core/inspector/InspectorHighlight.h" |
| 7 | 7 |
| 8 #include "core/dom/ClientRect.h" | 8 #include "core/dom/ClientRect.h" |
| 9 #include "core/dom/PseudoElement.h" | 9 #include "core/dom/PseudoElement.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 return elementInfo; | 211 return elementInfo; |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace | 214 } // namespace |
| 215 | 215 |
| 216 InspectorHighlight::InspectorHighlight() | 216 InspectorHighlight::InspectorHighlight() |
| 217 : m_highlightPaths(JSONArray::create()) | 217 : m_highlightPaths(JSONArray::create()) |
| 218 , m_showRulers(false) | 218 , m_showRulers(false) |
| 219 , m_showExtensionLines(false) | 219 , m_showExtensionLines(false) |
| 220 , m_displayAsMaterial(false) |
| 220 { | 221 { |
| 221 } | 222 } |
| 222 | 223 |
| 223 InspectorHighlightConfig::InspectorHighlightConfig() | 224 InspectorHighlightConfig::InspectorHighlightConfig() |
| 224 : showInfo(false) | 225 : showInfo(false) |
| 225 , showRulers(false) | 226 , showRulers(false) |
| 226 , showExtensionLines(false) | 227 , showExtensionLines(false) |
| 227 , showLayoutEditor(false) | 228 , showLayoutEditor(false) |
| 229 , displayAsMaterial(false) |
| 228 { | 230 { |
| 229 } | 231 } |
| 230 | 232 |
| 231 InspectorHighlight::InspectorHighlight(Node* node, const InspectorHighlightConfi
g& highlightConfig, bool appendElementInfo) | 233 InspectorHighlight::InspectorHighlight(Node* node, const InspectorHighlightConfi
g& highlightConfig, bool appendElementInfo) |
| 232 : m_highlightPaths(JSONArray::create()) | 234 : m_highlightPaths(JSONArray::create()) |
| 233 , m_showRulers(highlightConfig.showRulers) | 235 , m_showRulers(highlightConfig.showRulers) |
| 234 , m_showExtensionLines(highlightConfig.showExtensionLines) | 236 , m_showExtensionLines(highlightConfig.showExtensionLines) |
| 237 , m_displayAsMaterial(highlightConfig.displayAsMaterial) |
| 235 { | 238 { |
| 236 appendPathsForShapeOutside(node, highlightConfig); | 239 appendPathsForShapeOutside(node, highlightConfig); |
| 237 appendNodeHighlight(node, highlightConfig); | 240 appendNodeHighlight(node, highlightConfig); |
| 238 if (appendElementInfo && node->isElementNode()) | 241 if (appendElementInfo && node->isElementNode()) |
| 239 m_elementInfo = buildElementInfo(toElement(node)); | 242 m_elementInfo = buildElementInfo(toElement(node)); |
| 240 } | 243 } |
| 241 | 244 |
| 242 InspectorHighlight::~InspectorHighlight() | 245 InspectorHighlight::~InspectorHighlight() |
| 243 { | 246 { |
| 244 } | 247 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 323 } |
| 321 | 324 |
| 322 PassRefPtr<JSONObject> InspectorHighlight::asJSONObject() const | 325 PassRefPtr<JSONObject> InspectorHighlight::asJSONObject() const |
| 323 { | 326 { |
| 324 RefPtr<JSONObject> object = JSONObject::create(); | 327 RefPtr<JSONObject> object = JSONObject::create(); |
| 325 object->setArray("paths", m_highlightPaths); | 328 object->setArray("paths", m_highlightPaths); |
| 326 object->setBoolean("showRulers", m_showRulers); | 329 object->setBoolean("showRulers", m_showRulers); |
| 327 object->setBoolean("showExtensionLines", m_showExtensionLines); | 330 object->setBoolean("showExtensionLines", m_showExtensionLines); |
| 328 if (m_elementInfo) | 331 if (m_elementInfo) |
| 329 object->setObject("elementInfo", m_elementInfo); | 332 object->setObject("elementInfo", m_elementInfo); |
| 333 object->setBoolean("displayAsMaterial", m_displayAsMaterial); |
| 330 return object.release(); | 334 return object.release(); |
| 331 } | 335 } |
| 332 | 336 |
| 333 // static | 337 // static |
| 334 bool InspectorHighlight::getBoxModel(Node* node, RefPtr<TypeBuilder::DOM::BoxMod
el>& model) | 338 bool InspectorHighlight::getBoxModel(Node* node, RefPtr<TypeBuilder::DOM::BoxMod
el>& model) |
| 335 { | 339 { |
| 336 LayoutObject* layoutObject = node->layoutObject(); | 340 LayoutObject* layoutObject = node->layoutObject(); |
| 337 FrameView* view = node->document().view(); | 341 FrameView* view = node->document().view(); |
| 338 if (!layoutObject || !view) | 342 if (!layoutObject || !view) |
| 339 return false; | 343 return false; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 config.padding = Color(0, 255, 0, 0); | 441 config.padding = Color(0, 255, 0, 0); |
| 438 config.border = Color(0, 0, 255, 0); | 442 config.border = Color(0, 0, 255, 0); |
| 439 config.margin = Color(255, 255, 255, 0); | 443 config.margin = Color(255, 255, 255, 0); |
| 440 config.eventTarget = Color(128, 128, 128, 0); | 444 config.eventTarget = Color(128, 128, 128, 0); |
| 441 config.shape = Color(0, 0, 0, 0); | 445 config.shape = Color(0, 0, 0, 0); |
| 442 config.shapeMargin = Color(128, 128, 128, 0); | 446 config.shapeMargin = Color(128, 128, 128, 0); |
| 443 config.showInfo = true; | 447 config.showInfo = true; |
| 444 config.showRulers = true; | 448 config.showRulers = true; |
| 445 config.showExtensionLines = true; | 449 config.showExtensionLines = true; |
| 446 config.showLayoutEditor = false; | 450 config.showLayoutEditor = false; |
| 451 config.displayAsMaterial = false; |
| 447 return config; | 452 return config; |
| 448 } | 453 } |
| 449 | 454 |
| 450 } // namespace blink | 455 } // namespace blink |
| OLD | NEW |