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

Unified Diff: Source/core/inspector/InspectorDOMAgent.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/core/inspector/InspectorDOMAgent.cpp
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index ef5031e94b2cf942e502c76bccbd6d3f22b4b70e..d89dc1d3a7bec13be275ea665994b043e0510042 100644
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -317,6 +317,7 @@ InspectorDOMAgent::InspectorDOMAgent(InspectorPageAgent* pageAgent, InjectedScri
, m_searchingForNode(NotSearching)
, m_suppressAttributeModifiedEvent(false)
, m_backendNodeIdToInspect(0)
+ , m_layoutEditorEnabled(false)
{
}
@@ -1127,7 +1128,7 @@ void InspectorDOMAgent::discardSearchResults(ErrorString*, const String& searchI
bool InspectorDOMAgent::handleMousePress()
{
- if (m_searchingForNode == NotSearching)
+ if (m_searchingForNode == NotSearching || (m_searchingForNode == SearchingInLayoutEditor && m_layoutEditorEnabled))
return false;
if (m_hoveredNodeForInspectMode) {
@@ -1140,7 +1141,7 @@ bool InspectorDOMAgent::handleMousePress()
bool InspectorDOMAgent::handleGestureEvent(LocalFrame* frame, const PlatformGestureEvent& event)
{
- if (m_searchingForNode == NotSearching || event.type() != PlatformEvent::GestureTap)
+ if (m_searchingForNode == NotSearching || event.type() != PlatformEvent::GestureTap || (m_searchingForNode == SearchingInLayoutEditor && m_layoutEditorEnabled))
return false;
Node* node = hoveredNodeForEvent(frame, event, false);
if (node && m_inspectModeHighlightConfig) {
@@ -1153,7 +1154,7 @@ bool InspectorDOMAgent::handleGestureEvent(LocalFrame* frame, const PlatformGest
bool InspectorDOMAgent::handleTouchEvent(LocalFrame* frame, const PlatformTouchEvent& event)
{
- if (m_searchingForNode == NotSearching)
+ if (m_searchingForNode == NotSearching || (m_searchingForNode == SearchingInLayoutEditor && m_layoutEditorEnabled))
pfeldman 2015/08/25 21:25:29 extract method please
sergeyv 2015/08/26 02:25:49 Done.
return false;
Node* node = hoveredNodeForEvent(frame, event, false);
if (node && m_inspectModeHighlightConfig) {
@@ -1182,11 +1183,17 @@ void InspectorDOMAgent::inspect(Node* inspectedNode)
}
frontend()->inspectNodeRequested(backendNodeId);
+
+ if (m_searchingForNode == SearchingInLayoutEditor) {
+ m_layoutEditorEnabled = true;
+ m_overlay->setInspectModeEnabled(false);
+ m_overlay->showLayoutEditorForNode(node, *m_inspectModeHighlightConfig.get());
+ }
}
bool InspectorDOMAgent::handleMouseMove(LocalFrame* frame, const PlatformMouseEvent& event)
{
- if (m_searchingForNode == NotSearching)
+ if (m_searchingForNode == NotSearching || (m_searchingForNode == SearchingInLayoutEditor && m_layoutEditorEnabled))
return false;
if (!frame->view() || !frame->contentLayoutObject())
@@ -1227,6 +1234,7 @@ void InspectorDOMAgent::setSearchingForNode(ErrorString* errorString, SearchMode
} else {
m_hoveredNodeForInspectMode.clear();
hideHighlight(errorString);
+ m_overlay->showLayoutEditorForNode(nullptr, m_inspectModeHighlightConfig ? *m_inspectModeHighlightConfig : InspectorHighlightConfig());
}
}
@@ -1247,9 +1255,6 @@ PassOwnPtr<InspectorHighlightConfig> InspectorDOMAgent::highlightConfigFromInspe
bool showExtensionLines = false; // Default: false (do not show extension lines).
highlightInspectorObject->getBoolean("showExtensionLines", &showExtensionLines);
highlightConfig->showExtensionLines = showExtensionLines;
- bool showLayoutEditor = false;
- highlightInspectorObject->getBoolean("showLayoutEditor", &showLayoutEditor);
- highlightConfig->showLayoutEditor = showLayoutEditor;
bool displayAsMaterial = false;
highlightInspectorObject->getBoolean("displayAsMaterial", &displayAsMaterial);
highlightConfig->displayAsMaterial = displayAsMaterial;
@@ -1265,11 +1270,22 @@ PassOwnPtr<InspectorHighlightConfig> InspectorDOMAgent::highlightConfigFromInspe
return highlightConfig.release();
}
-void InspectorDOMAgent::setInspectModeEnabled(ErrorString* errorString, bool enabled, const bool* inspectUAShadowDOM, const RefPtr<JSONObject>* highlightConfig)
+void InspectorDOMAgent::setInspectModeEnabled(ErrorString* errorString, bool enabled, const String* mode, const RefPtr<JSONObject>* highlightConfig)
pfeldman 2015/08/25 21:25:29 There should be a node passed here, right?
sergeyv 2015/08/26 02:25:49 Yes, I'll add it in a separate patch.
{
if (enabled && !pushDocumentUponHandlelessOperation(errorString))
return;
- SearchMode searchMode = enabled ? (asBool(inspectUAShadowDOM) ? SearchingForUAShadow : SearchingForNormal) : NotSearching;
+ SearchMode searchMode = SearchingForNormal;
+ if (!enabled) {
+ searchMode = NotSearching;
+ } else if (!mode) {
+ searchMode = SearchingForNormal;
+ } else if (*mode == "showUAShadowDOM") {
+ searchMode = SearchingForUAShadow;
+ } else if (*mode == "showLayoutEditor") {
+ searchMode = SearchingInLayoutEditor;
+ m_layoutEditorEnabled = false;
pfeldman 2015/08/25 21:25:29 it will be enabled when the node comes as a parame
sergeyv 2015/08/26 02:25:49 Yep
+ }
+
setSearchingForNode(errorString, searchMode, highlightConfig ? highlightConfig->get() : nullptr);
}
@@ -2221,6 +2237,20 @@ bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorSt
return true;
}
+void InspectorDOMAgent::resumeSearchingForNode(Node* startNode)
+{
+ if (m_searchingForNode != SearchingInLayoutEditor)
+ return;
+
+ m_layoutEditorEnabled = false;
+ m_overlay->setInspectModeEnabled(true);
+ if (startNode && m_inspectModeHighlightConfig) {
+ m_hoveredNodeForInspectMode = startNode;
+ m_overlay->highlightNode(startNode, 0, *m_inspectModeHighlightConfig, false);
+ }
+
+}
+
DEFINE_TRACE(InspectorDOMAgent)
{
visitor->trace(m_domListener);

Powered by Google App Engine
This is Rietveld 408576698