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

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: Testing Created 6 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 | 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 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 String InspectorOverlay::getHighlightJSONForNode(Node* node)
caseq 2014/10/24 13:31:44 Can we return JSONObject for better reuse? It's ne
dgozman 2014/10/24 14:45:21 Done.
841 {
842 HighlightConfig config;
caseq 2014/10/24 13:31:44 So we end up with a set of path that are all the s
dgozman 2014/10/24 14:45:21 Nice idea! Done.
843 config.showInfo = true;
844 config.showRulers = true;
845 config.showExtensionLines = true;
846 Highlight highlight;
847 appendPathsForShapeOutside(highlight, config, node);
848 buildNodeHighlight(*node, config, &highlight);
849 RefPtr<JSONObject> json(highlight.asJSONObject());
850 return json->toPrettyJSONString();
851 }
852
836 void InspectorOverlay::freePage() 853 void InspectorOverlay::freePage()
837 { 854 {
838 if (m_overlayPage) { 855 if (m_overlayPage) {
839 m_overlayPage->willBeDestroyed(); 856 m_overlayPage->willBeDestroyed();
840 m_overlayPage.clear(); 857 m_overlayPage.clear();
841 } 858 }
842 m_overlayChromeClient.clear(); 859 m_overlayChromeClient.clear();
843 m_timer.stop(); 860 m_timer.stop();
844 861
845 // This will clear internal structures and issue update to the client. Safe to call last. 862 // This will clear internal structures and issue update to the client. Safe to call last.
846 hideHighlight(); 863 hideHighlight();
847 } 864 }
848 865
849 void InspectorOverlay::startedRecordingProfile() 866 void InspectorOverlay::startedRecordingProfile()
850 { 867 {
851 if (!m_activeProfilerCount++) 868 if (!m_activeProfilerCount++)
852 freePage(); 869 freePage();
853 } 870 }
854 871
855 } // namespace blink 872 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698