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

Side by Side Diff: third_party/WebKit/Source/web/InspectorOverlay.cpp

Issue 1378193002: Devtools[LayoutEditor]: Keep LayoutEditor in sync with a node selected in ElementsPanel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comment Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/web/InspectorOverlay.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 scheduleUpdate(); 330 scheduleUpdate();
331 331
332 if (searchMode != InspectorDOMAgent::NotSearching) { 332 if (searchMode != InspectorDOMAgent::NotSearching) {
333 m_inspectModeHighlightConfig = highlightConfig; 333 m_inspectModeHighlightConfig = highlightConfig;
334 } else { 334 } else {
335 m_hoveredNodeForInspectMode.clear(); 335 m_hoveredNodeForInspectMode.clear();
336 hideHighlight(); 336 hideHighlight();
337 } 337 }
338 } 338 }
339 339
340 void InspectorOverlay::setInspectedNode(Node* node)
341 {
342 if (m_inspectMode != InspectorDOMAgent::ShowLayoutEditor || (m_layoutEditor && m_layoutEditor->element() == node))
343 return;
344
345 if (m_layoutEditor) {
346 m_layoutEditor->commitChanges();
347 m_layoutEditor.clear();
348 }
349 initializeLayoutEditorIfNeeded(node);
350 }
351
340 void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const Inspector HighlightConfig& highlightConfig) 352 void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const Inspector HighlightConfig& highlightConfig)
341 { 353 {
342 m_quadHighlightConfig = highlightConfig; 354 m_quadHighlightConfig = highlightConfig;
343 m_highlightQuad = quad; 355 m_highlightQuad = quad;
344 m_omitTooltip = false; 356 m_omitTooltip = false;
345 scheduleUpdate(); 357 scheduleUpdate();
346 } 358 }
347 359
348 bool InspectorOverlay::isEmpty() 360 bool InspectorOverlay::isEmpty()
349 { 361 {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 bool InspectorOverlay::shouldSearchForNode() 730 bool InspectorOverlay::shouldSearchForNode()
719 { 731 {
720 return m_inspectMode != InspectorDOMAgent::NotSearching && !m_layoutEditor; 732 return m_inspectMode != InspectorDOMAgent::NotSearching && !m_layoutEditor;
721 } 733 }
722 734
723 void InspectorOverlay::inspect(Node* node) 735 void InspectorOverlay::inspect(Node* node)
724 { 736 {
725 if (m_domAgent) 737 if (m_domAgent)
726 m_domAgent->inspect(node); 738 m_domAgent->inspect(node);
727 739
740 initializeLayoutEditorIfNeeded(node);
741 if (m_layoutEditor)
742 hideHighlight();
743 }
744
745 void InspectorOverlay::initializeLayoutEditorIfNeeded(Node* node)
746 {
728 if (node && node->isElementNode() && m_inspectMode == InspectorDOMAgent::Sho wLayoutEditor && !m_layoutEditor) { 747 if (node && node->isElementNode() && m_inspectMode == InspectorDOMAgent::Sho wLayoutEditor && !m_layoutEditor) {
729 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_dom Agent, &overlayMainFrame()->script()); 748 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_dom Agent, &overlayMainFrame()->script());
730 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverr idden(true); 749 toChromeClientImpl(m_webViewImpl->page()->chromeClient()).setCursorOverr idden(true);
731 hideHighlight();
732 } 750 }
733 } 751 }
734 752
735 } // namespace blink 753 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/InspectorOverlay.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698