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

Side by Side Diff: Source/core/inspector/InspectorOverlay.cpp

Issue 662603002: [DevTools] Adjust svg elements highlight to the root FrameView origin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed review comments Created 6 years, 1 month 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
« no previous file with comments | « Source/core/inspector/InspectorOverlay.h ('k') | Source/core/testing/Internals.h » ('j') | 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 RenderObject* renderer = node.renderer(); 308 RenderObject* renderer = node.renderer();
309 if (!renderer) 309 if (!renderer)
310 return; 310 return;
311 311
312 highlight->setDataFromConfig(highlightConfig); 312 highlight->setDataFromConfig(highlightConfig);
313 313
314 // RenderSVGRoot should be highlighted through the isBox() code path, all ot her SVG elements should just dump their absoluteQuads(). 314 // RenderSVGRoot should be highlighted through the isBox() code path, all ot her SVG elements should just dump their absoluteQuads().
315 if (renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVG Root()) { 315 if (renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVG Root()) {
316 Vector<FloatQuad> quads; 316 Vector<FloatQuad> quads;
317 renderer->absoluteQuads(quads); 317 renderer->absoluteQuads(quads);
318 for (size_t i = 0; i < quads.size(); ++i) 318 FrameView* containingView = renderer->frameView();
319 for (size_t i = 0; i < quads.size(); ++i) {
320 if (containingView)
321 contentsQuadToScreen(containingView, quads[i]);
319 highlight->appendQuad(quads[i], highlightConfig.content, highlightCo nfig.contentOutline); 322 highlight->appendQuad(quads[i], highlightConfig.content, highlightCo nfig.contentOutline);
323 }
320 return; 324 return;
321 } 325 }
322 326
323 FloatQuad content, padding, border, margin; 327 FloatQuad content, padding, border, margin;
324 if (!buildNodeQuads(renderer, &content, &padding, &border, &margin)) 328 if (!buildNodeQuads(renderer, &content, &padding, &border, &margin))
325 return; 329 return;
326 highlight->appendQuad(content, highlightConfig.content, highlightConfig.cont entOutline); 330 highlight->appendQuad(content, highlightConfig.content, highlightConfig.cont entOutline);
327 highlight->appendQuad(padding, highlightConfig.padding); 331 highlight->appendQuad(padding, highlightConfig.padding);
328 highlight->appendQuad(border, highlightConfig.border); 332 highlight->appendQuad(border, highlightConfig.border);
329 highlight->appendQuad(margin, highlightConfig.margin); 333 highlight->appendQuad(margin, highlightConfig.margin);
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 RefPtr<TypeBuilder::DOM::ShapeOutsideInfo> shapeTypeBuilder = TypeBuilde r::DOM::ShapeOutsideInfo::create() 830 RefPtr<TypeBuilder::DOM::ShapeOutsideInfo> shapeTypeBuilder = TypeBuilde r::DOM::ShapeOutsideInfo::create()
827 .setBounds(buildArrayForQuad(boundsQuad)) 831 .setBounds(buildArrayForQuad(boundsQuad))
828 .setShape(ShapePathBuilder::buildPath(*view, *renderer, *shapeOutsid eInfo, paths.shape)) 832 .setShape(ShapePathBuilder::buildPath(*view, *renderer, *shapeOutsid eInfo, paths.shape))
829 .setMarginShape(ShapePathBuilder::buildPath(*view, *renderer, *shape OutsideInfo, paths.marginShape)); 833 .setMarginShape(ShapePathBuilder::buildPath(*view, *renderer, *shape OutsideInfo, paths.marginShape));
830 model->setShapeOutside(shapeTypeBuilder); 834 model->setShapeOutside(shapeTypeBuilder);
831 } 835 }
832 836
833 return true; 837 return true;
834 } 838 }
835 839
840 PassRefPtr<JSONObject> InspectorOverlay::highlightJSONForNode(Node* node)
841 {
842 HighlightConfig config;
843 config.content = Color(255, 0, 0, 0);
844 config.contentOutline = Color(128, 0, 0, 0);
845 config.padding = Color(0, 255, 0, 0);
846 config.border = Color(0, 0, 255, 0);
847 config.margin = Color(255, 255, 255, 0);
848 config.eventTarget = Color(128, 128, 128, 0);
849 config.shape = Color(0, 0, 0, 0);
850 config.shapeMargin = Color(128, 128, 128, 0);
851 config.showInfo = true;
852 config.showRulers = true;
853 config.showExtensionLines = true;
854 Highlight highlight;
855 appendPathsForShapeOutside(highlight, config, node);
856 buildNodeHighlight(*node, config, &highlight);
857 return highlight.asJSONObject();
858 }
859
836 void InspectorOverlay::freePage() 860 void InspectorOverlay::freePage()
837 { 861 {
838 if (m_overlayPage) { 862 if (m_overlayPage) {
839 m_overlayPage->willBeDestroyed(); 863 m_overlayPage->willBeDestroyed();
840 m_overlayPage.clear(); 864 m_overlayPage.clear();
841 } 865 }
842 m_overlayChromeClient.clear(); 866 m_overlayChromeClient.clear();
843 m_timer.stop(); 867 m_timer.stop();
844 868
845 // This will clear internal structures and issue update to the client. Safe to call last. 869 // This will clear internal structures and issue update to the client. Safe to call last.
846 hideHighlight(); 870 hideHighlight();
847 } 871 }
848 872
849 void InspectorOverlay::startedRecordingProfile() 873 void InspectorOverlay::startedRecordingProfile()
850 { 874 {
851 if (!m_activeProfilerCount++) 875 if (!m_activeProfilerCount++)
852 freePage(); 876 freePage();
853 } 877 }
854 878
855 } // namespace blink 879 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorOverlay.h ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698