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

Side by Side Diff: Source/web/InspectorOverlayImpl.cpp

Issue 1204453002: Devtools: Create layout editor experiment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 5 years, 6 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 | Annotate | Revision Log
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 20 matching lines...) Expand all
31 31
32 #include "bindings/core/v8/ScriptController.h" 32 #include "bindings/core/v8/ScriptController.h"
33 #include "bindings/core/v8/V8InspectorOverlayHost.h" 33 #include "bindings/core/v8/V8InspectorOverlayHost.h"
34 #include "core/dom/Node.h" 34 #include "core/dom/Node.h"
35 #include "core/frame/FrameHost.h" 35 #include "core/frame/FrameHost.h"
36 #include "core/frame/FrameView.h" 36 #include "core/frame/FrameView.h"
37 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
38 #include "core/frame/Settings.h" 38 #include "core/frame/Settings.h"
39 #include "core/input/EventHandler.h" 39 #include "core/input/EventHandler.h"
40 #include "core/inspector/InspectorOverlayHost.h" 40 #include "core/inspector/InspectorOverlayHost.h"
41 #include "core/inspector/LayoutEditor.h"
41 #include "core/loader/EmptyClients.h" 42 #include "core/loader/EmptyClients.h"
42 #include "core/loader/FrameLoadRequest.h" 43 #include "core/loader/FrameLoadRequest.h"
43 #include "core/page/ChromeClient.h" 44 #include "core/page/ChromeClient.h"
44 #include "core/page/Page.h" 45 #include "core/page/Page.h"
45 #include "platform/JSONValues.h" 46 #include "platform/JSONValues.h"
46 #include "platform/ScriptForbiddenScope.h" 47 #include "platform/ScriptForbiddenScope.h"
47 #include "platform/graphics/GraphicsContext.h" 48 #include "platform/graphics/GraphicsContext.h"
48 #include "public/platform/Platform.h" 49 #include "public/platform/Platform.h"
49 #include "public/platform/WebData.h" 50 #include "public/platform/WebData.h"
50 #include "web/WebGraphicsContextImpl.h" 51 #include "web/WebGraphicsContextImpl.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 { 217 {
217 m_inspectModeEnabled = enabled; 218 m_inspectModeEnabled = enabled;
218 update(); 219 update();
219 } 220 }
220 221
221 void InspectorOverlayImpl::hideHighlight() 222 void InspectorOverlayImpl::hideHighlight()
222 { 223 {
223 m_highlightNode.clear(); 224 m_highlightNode.clear();
224 m_eventTargetNode.clear(); 225 m_eventTargetNode.clear();
225 m_highlightQuad.clear(); 226 m_highlightQuad.clear();
227 m_layoutEditor.clear();
226 update(); 228 update();
227 } 229 }
228 230
229 void InspectorOverlayImpl::highlightNode(Node* node, Node* eventTarget, const In spectorHighlightConfig& highlightConfig, bool omitTooltip) 231 void InspectorOverlayImpl::highlightNode(Node* node, Node* eventTarget, const In spectorHighlightConfig& highlightConfig, bool omitTooltip)
230 { 232 {
231 m_nodeHighlightConfig = highlightConfig; 233 m_nodeHighlightConfig = highlightConfig;
232 m_highlightNode = node; 234 m_highlightNode = node;
235 if (highlightConfig.showLayoutEditor)
236 m_layoutEditor = LayoutEditor::create(node);
233 m_eventTargetNode = eventTarget; 237 m_eventTargetNode = eventTarget;
234 m_omitTooltip = omitTooltip; 238 m_omitTooltip = omitTooltip;
235 update(); 239 update();
236 } 240 }
237 241
238 void InspectorOverlayImpl::highlightQuad(PassOwnPtr<FloatQuad> quad, const Inspe ctorHighlightConfig& highlightConfig) 242 void InspectorOverlayImpl::highlightQuad(PassOwnPtr<FloatQuad> quad, const Inspe ctorHighlightConfig& highlightConfig)
239 { 243 {
240 m_quadHighlightConfig = highlightConfig; 244 m_quadHighlightConfig = highlightConfig;
241 m_highlightQuad = quad; 245 m_highlightQuad = quad;
242 m_omitTooltip = false; 246 m_omitTooltip = false;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 303
300 void InspectorOverlayImpl::drawNodeHighlight() 304 void InspectorOverlayImpl::drawNodeHighlight()
301 { 305 {
302 if (!m_highlightNode) 306 if (!m_highlightNode)
303 return; 307 return;
304 308
305 bool appendElementInfo = m_highlightNode->isElementNode() && !m_omitTooltip && m_nodeHighlightConfig.showInfo && m_highlightNode->layoutObject() && m_highli ghtNode->document().frame(); 309 bool appendElementInfo = m_highlightNode->isElementNode() && !m_omitTooltip && m_nodeHighlightConfig.showInfo && m_highlightNode->layoutObject() && m_highli ghtNode->document().frame();
306 InspectorHighlight highlight(m_highlightNode.get(), m_nodeHighlightConfig, a ppendElementInfo); 310 InspectorHighlight highlight(m_highlightNode.get(), m_nodeHighlightConfig, a ppendElementInfo);
307 if (m_eventTargetNode) 311 if (m_eventTargetNode)
308 highlight.appendEventTargetQuads(m_eventTargetNode.get(), m_nodeHighligh tConfig); 312 highlight.appendEventTargetQuads(m_eventTargetNode.get(), m_nodeHighligh tConfig);
309 evaluateInOverlay("drawHighlight", highlight.asJSONObject()); 313
314 RefPtr<JSONObject> highlightJSON = highlight.asJSONObject();
315 if (m_layoutEditor) {
316 RefPtr<JSONObject> wysiwygInfo = m_layoutEditor->buildJSONInfo();
317 if (wysiwygInfo)
318 highlightJSON->setObject("wysiwygInfo", wysiwygInfo.release());
dgozman 2015/06/23 16:45:06 layoutEditorInfo
319 }
320 evaluateInOverlay("drawHighlight", highlightJSON.release());
310 } 321 }
311 322
312 void InspectorOverlayImpl::drawQuadHighlight() 323 void InspectorOverlayImpl::drawQuadHighlight()
313 { 324 {
314 if (!m_highlightQuad) 325 if (!m_highlightQuad)
315 return; 326 return;
316 327
317 InspectorHighlight highlight; 328 InspectorHighlight highlight;
318 highlight.appendQuad(*m_highlightQuad, m_quadHighlightConfig.content, m_quad HighlightConfig.contentOutline); 329 highlight.appendQuad(*m_highlightQuad, m_quadHighlightConfig.content, m_quad HighlightConfig.contentOutline);
319 evaluateInOverlay("drawHighlight", highlight.asJSONObject()); 330 evaluateInOverlay("drawHighlight", highlight.asJSONObject());
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 if (!m_suspendCount++) 477 if (!m_suspendCount++)
467 clear(); 478 clear();
468 } 479 }
469 480
470 void InspectorOverlayImpl::resumeUpdates() 481 void InspectorOverlayImpl::resumeUpdates()
471 { 482 {
472 --m_suspendCount; 483 --m_suspendCount;
473 } 484 }
474 485
475 } // namespace blink 486 } // namespace blink
OLDNEW
« Source/devtools/front_end/main/Main.js ('K') | « Source/web/InspectorOverlayImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698