Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: Source/web/InspectorOverlayImpl.cpp

Issue 1311783003: Devtools[LayoutEditor]: Rework layout-editor workflow (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@resize
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/InspectorOverlayImpl.cpp
diff --git a/Source/web/InspectorOverlayImpl.cpp b/Source/web/InspectorOverlayImpl.cpp
index 9777463d088968175d71e87378620b460d2275fc..70688ad0732c14e929d50b1c810d07e1d254daae 100644
--- a/Source/web/InspectorOverlayImpl.cpp
+++ b/Source/web/InspectorOverlayImpl.cpp
@@ -79,6 +79,7 @@ public:
void resumeUpdates() override { }
void clear() override { }
void setLayoutEditor(PassOwnPtrWillBeRawPtr<LayoutEditor>) override { }
+ void showLayoutEditorForNode(Node*, const InspectorHighlightConfig&) override { };
};
DEFINE_TRACE(InspectorOverlayStub)
@@ -270,20 +271,20 @@ void InspectorOverlayImpl::setInspectModeEnabled(bool enabled)
void InspectorOverlayImpl::hideHighlight()
{
- if (m_layoutEditor)
- m_layoutEditor->setNode(nullptr);
m_highlightNode.clear();
m_eventTargetNode.clear();
m_highlightQuad.clear();
- update();
+
+ if (m_layoutEditor && m_layoutEditor->node())
+ highlightNode(m_layoutEditor->node(), 0, m_layoutEditor->highlightConfig(), false);
+ else
+ update();
}
void InspectorOverlayImpl::highlightNode(Node* node, Node* eventTarget, const InspectorHighlightConfig& highlightConfig, bool omitTooltip)
{
m_nodeHighlightConfig = highlightConfig;
m_highlightNode = node;
- if (m_layoutEditor && highlightConfig.showLayoutEditor)
- m_layoutEditor->setNode(node);
m_eventTargetNode = eventTarget;
m_omitTooltip = omitTooltip;
update();
@@ -363,7 +364,7 @@ void InspectorOverlayImpl::drawNodeHighlight()
RefPtr<JSONObject> highlightJSON = highlight.asJSONObject();
evaluateInOverlay("drawHighlight", highlightJSON.release());
- if (m_layoutEditor && m_nodeHighlightConfig.showLayoutEditor) {
+ if (m_layoutEditor && m_layoutEditor->node() == m_highlightNode) {
RefPtr<JSONObject> layoutEditorInfo = m_layoutEditor->buildJSONInfo();
if (layoutEditorInfo)
evaluateInOverlay("showLayoutEditor", layoutEditorInfo.release());
@@ -539,4 +540,14 @@ void InspectorOverlayImpl::setLayoutEditor(PassOwnPtrWillBeRawPtr<LayoutEditor>
m_overlayHost->setLayoutEditorListener(m_layoutEditor.get());
}
+void InspectorOverlayImpl::showLayoutEditorForNode(Node* node, const InspectorHighlightConfig& highlightConfig)
+{
+ if (!m_layoutEditor)
+ return;
+
+ m_layoutEditor->setNode(node);
+ m_layoutEditor->setHighlightConfig(highlightConfig);
+}
+
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698