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

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

Issue 11366221: Merge 133885 - Web Inspector: Add option to disable rulers (Elements panel) (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 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
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 static void buildNodeHighlight(Node* node, const HighlightConfig& highlightConfi g, Highlight* highlight) 104 static void buildNodeHighlight(Node* node, const HighlightConfig& highlightConfi g, Highlight* highlight)
105 { 105 {
106 RenderObject* renderer = node->renderer(); 106 RenderObject* renderer = node->renderer();
107 Frame* containingFrame = node->document()->frame(); 107 Frame* containingFrame = node->document()->frame();
108 108
109 if (!renderer || !containingFrame) 109 if (!renderer || !containingFrame)
110 return; 110 return;
111 111
112 highlight->setColors(highlightConfig); 112 highlight->setDataFromConfig(highlightConfig);
113 FrameView* containingView = containingFrame->view(); 113 FrameView* containingView = containingFrame->view();
114 FrameView* mainView = containingFrame->page()->mainFrame()->view(); 114 FrameView* mainView = containingFrame->page()->mainFrame()->view();
115 IntRect boundingBox = pixelSnappedIntRect(containingView->contentsToRootView (renderer->absoluteBoundingBoxRect())); 115 IntRect boundingBox = pixelSnappedIntRect(containingView->contentsToRootView (renderer->absoluteBoundingBoxRect()));
116 boundingBox.move(mainView->scrollOffset()); 116 boundingBox.move(mainView->scrollOffset());
117 IntRect titleAnchorBox = boundingBox; 117 IntRect titleAnchorBox = boundingBox;
118 118
119 // RenderSVGRoot should be highlighted through the isBox() code path, all ot her SVG elements should just dump their absoluteQuads(). 119 // RenderSVGRoot should be highlighted through the isBox() code path, all ot her SVG elements should just dump their absoluteQuads().
120 #if ENABLE(SVG) 120 #if ENABLE(SVG)
121 bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRoot(); 121 bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRoot();
122 #else 122 #else
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 highlight->quads.append(absBorderQuad); 179 highlight->quads.append(absBorderQuad);
180 highlight->quads.append(absPaddingQuad); 180 highlight->quads.append(absPaddingQuad);
181 highlight->quads.append(absContentQuad); 181 highlight->quads.append(absContentQuad);
182 } 182 }
183 } 183 }
184 184
185 static void buildRectHighlight(Page* page, IntRect* rect, const HighlightConfig& highlightConfig, Highlight *highlight) 185 static void buildRectHighlight(Page* page, IntRect* rect, const HighlightConfig& highlightConfig, Highlight *highlight)
186 { 186 {
187 if (!page) 187 if (!page)
188 return; 188 return;
189 highlight->setColors(highlightConfig); 189 highlight->setDataFromConfig(highlightConfig);
190 FloatRect highlightRect(*rect); 190 FloatRect highlightRect(*rect);
191 highlight->type = HighlightTypeRects; 191 highlight->type = HighlightTypeRects;
192 highlight->quads.append(highlightRect); 192 highlight->quads.append(highlightRect);
193 } 193 }
194 194
195 } // anonymous namespace 195 } // anonymous namespace
196 196
197 InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client) 197 InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client)
198 : m_page(page) 198 : m_page(page)
199 , m_client(client) 199 , m_client(client)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 return array.release(); 329 return array.release();
330 } 330 }
331 331
332 static PassRefPtr<InspectorObject> buildObjectForHighlight(FrameView* mainView, const Highlight& highlight) 332 static PassRefPtr<InspectorObject> buildObjectForHighlight(FrameView* mainView, const Highlight& highlight)
333 { 333 {
334 RefPtr<InspectorObject> object = InspectorObject::create(); 334 RefPtr<InspectorObject> object = InspectorObject::create();
335 RefPtr<InspectorArray> array = InspectorArray::create(); 335 RefPtr<InspectorArray> array = InspectorArray::create();
336 for (size_t i = 0; i < highlight.quads.size(); ++i) 336 for (size_t i = 0; i < highlight.quads.size(); ++i)
337 array->pushArray(buildArrayForQuad(highlight.quads[i])); 337 array->pushArray(buildArrayForQuad(highlight.quads[i]));
338 object->setArray("quads", array.release()); 338 object->setArray("quads", array.release());
339 object->setBoolean("showRulers", highlight.showRulers);
339 object->setString("contentColor", highlight.contentColor.serialized()); 340 object->setString("contentColor", highlight.contentColor.serialized());
340 object->setString("contentOutlineColor", highlight.contentOutlineColor.seria lized()); 341 object->setString("contentOutlineColor", highlight.contentOutlineColor.seria lized());
341 object->setString("paddingColor", highlight.paddingColor.serialized()); 342 object->setString("paddingColor", highlight.paddingColor.serialized());
342 object->setString("borderColor", highlight.borderColor.serialized()); 343 object->setString("borderColor", highlight.borderColor.serialized());
343 object->setString("marginColor", highlight.marginColor.serialized()); 344 object->setString("marginColor", highlight.marginColor.serialized());
344 345
345 FloatRect visibleRect = mainView->visibleContentRect(); 346 FloatRect visibleRect = mainView->visibleContentRect();
346 if (!mainView->delegatesScrolling()) { 347 if (!mainView->delegatesScrolling()) {
347 object->setNumber("scrollX", visibleRect.x()); 348 object->setNumber("scrollX", visibleRect.x());
348 object->setNumber("scrollY", visibleRect.y()); 349 object->setNumber("scrollY", visibleRect.y());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 info.addMember(m_nodeHighlightConfig); 511 info.addMember(m_nodeHighlightConfig);
511 info.addMember(m_highlightRect); 512 info.addMember(m_highlightRect);
512 info.addMember(m_overlayPage); 513 info.addMember(m_overlayPage);
513 info.addMember(m_rectHighlightConfig); 514 info.addMember(m_rectHighlightConfig);
514 info.addMember(m_size); 515 info.addMember(m_size);
515 } 516 }
516 517
517 } // namespace WebCore 518 } // namespace WebCore
518 519
519 #endif // ENABLE(INSPECTOR) 520 #endif // ENABLE(INSPECTOR)
OLDNEW
« no previous file with comments | « Source/WebCore/inspector/InspectorOverlay.h ('k') | Source/WebCore/inspector/InspectorOverlayPage.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698