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

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: Rebase on dgozman changes 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 4c5a11ce3cc0c2a2ae69f613361c10af1ad703be..4ed693cbfccad1a8cd245a6984e26995c291b83c 100644
--- a/Source/web/InspectorOverlayImpl.cpp
+++ b/Source/web/InspectorOverlayImpl.cpp
@@ -164,9 +164,9 @@ DEFINE_TRACE(InspectorOverlayImpl)
visitor->trace(m_layoutEditor);
}
-void InspectorOverlayImpl::init(InspectorCSSAgent* cssAgent, InspectorDebuggerAgent* debuggerAgent)
+void InspectorOverlayImpl::init(InspectorCSSAgent* cssAgent, InspectorDebuggerAgent* debuggerAgent, InspectorDOMAgent* domAgent)
{
- m_layoutEditor = LayoutEditor::create(cssAgent);
+ m_layoutEditor = LayoutEditor::create(cssAgent, domAgent);
m_debuggerAgent = debuggerAgent;
m_overlayHost->setListener(this);
}
@@ -239,20 +239,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();
@@ -324,7 +324,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());
@@ -502,6 +502,11 @@ void InspectorOverlayImpl::overlayEndedPropertyChange()
m_layoutEditor->overlayEndedPropertyChange();
}
+void InspectorOverlayImpl::clearSelection(bool commitChanges)
+{
+ m_layoutEditor->clearSelection(commitChanges);
+}
+
void InspectorOverlayImpl::profilingStarted()
{
if (!m_suspendCount++)
@@ -528,4 +533,14 @@ void InspectorOverlayImpl::setShowViewportSizeOnResize(bool show, bool showGrid)
m_drawViewSizeWithGrid = showGrid;
}
+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