OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 #include "bindings/core/v8/V8InspectorOverlayHost.h" | 34 #include "bindings/core/v8/V8InspectorOverlayHost.h" |
35 #include "core/dom/ClientRect.h" | 35 #include "core/dom/ClientRect.h" |
36 #include "core/dom/Element.h" | 36 #include "core/dom/Element.h" |
37 #include "core/dom/Node.h" | 37 #include "core/dom/Node.h" |
38 #include "core/dom/PseudoElement.h" | 38 #include "core/dom/PseudoElement.h" |
39 #include "core/frame/FrameView.h" | 39 #include "core/frame/FrameView.h" |
40 #include "core/frame/LocalFrame.h" | 40 #include "core/frame/LocalFrame.h" |
41 #include "core/frame/Settings.h" | 41 #include "core/frame/Settings.h" |
42 #include "core/inspector/InspectorClient.h" | 42 #include "core/inspector/InspectorClient.h" |
43 #include "core/inspector/InspectorOverlayHost.h" | 43 #include "core/inspector/InspectorOverlayHost.h" |
| 44 #include "core/layout/LayoutBox.h" |
44 #include "core/layout/LayoutObject.h" | 45 #include "core/layout/LayoutObject.h" |
45 #include "core/layout/shapes/ShapeOutsideInfo.h" | 46 #include "core/layout/shapes/ShapeOutsideInfo.h" |
46 #include "core/layout/style/LayoutStyleConstants.h" | 47 #include "core/layout/style/LayoutStyleConstants.h" |
47 #include "core/loader/EmptyClients.h" | 48 #include "core/loader/EmptyClients.h" |
48 #include "core/loader/FrameLoadRequest.h" | 49 #include "core/loader/FrameLoadRequest.h" |
49 #include "core/page/Chrome.h" | 50 #include "core/page/Chrome.h" |
50 #include "core/page/EventHandler.h" | 51 #include "core/page/EventHandler.h" |
51 #include "core/page/Page.h" | 52 #include "core/page/Page.h" |
52 #include "core/rendering/RenderBox.h" | |
53 #include "core/rendering/RenderInline.h" | 53 #include "core/rendering/RenderInline.h" |
54 #include "platform/JSONValues.h" | 54 #include "platform/JSONValues.h" |
55 #include "platform/PlatformMouseEvent.h" | 55 #include "platform/PlatformMouseEvent.h" |
56 #include "platform/ScriptForbiddenScope.h" | 56 #include "platform/ScriptForbiddenScope.h" |
57 #include "platform/graphics/GraphicsContext.h" | 57 #include "platform/graphics/GraphicsContext.h" |
58 #include "public/platform/Platform.h" | 58 #include "public/platform/Platform.h" |
59 #include "public/platform/WebData.h" | 59 #include "public/platform/WebData.h" |
60 #include "wtf/Vector.h" | 60 #include "wtf/Vector.h" |
61 #include "wtf/text/StringBuilder.h" | 61 #include "wtf/text/StringBuilder.h" |
62 #include <v8.h> | 62 #include <v8.h> |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 return false; | 251 return false; |
252 if (!renderer->isBox() && !renderer->isRenderInline()) | 252 if (!renderer->isBox() && !renderer->isRenderInline()) |
253 return false; | 253 return false; |
254 | 254 |
255 LayoutRect contentBox; | 255 LayoutRect contentBox; |
256 LayoutRect paddingBox; | 256 LayoutRect paddingBox; |
257 LayoutRect borderBox; | 257 LayoutRect borderBox; |
258 LayoutRect marginBox; | 258 LayoutRect marginBox; |
259 | 259 |
260 if (renderer->isBox()) { | 260 if (renderer->isBox()) { |
261 RenderBox* renderBox = toRenderBox(renderer); | 261 LayoutBox* layoutBox = toLayoutBox(renderer); |
262 | 262 |
263 // RenderBox returns the "pure" content area box, exclusive of the scrol
lbars (if present), which also count towards the content area in CSS. | 263 // LayoutBox returns the "pure" content area box, exclusive of the scrol
lbars (if present), which also count towards the content area in CSS. |
264 const int verticalScrollbarWidth = renderBox->verticalScrollbarWidth(); | 264 const int verticalScrollbarWidth = layoutBox->verticalScrollbarWidth(); |
265 const int horizontalScrollbarHeight = renderBox->horizontalScrollbarHeig
ht(); | 265 const int horizontalScrollbarHeight = layoutBox->horizontalScrollbarHeig
ht(); |
266 contentBox = renderBox->contentBoxRect(); | 266 contentBox = layoutBox->contentBoxRect(); |
267 contentBox.setWidth(contentBox.width() + verticalScrollbarWidth); | 267 contentBox.setWidth(contentBox.width() + verticalScrollbarWidth); |
268 contentBox.setHeight(contentBox.height() + horizontalScrollbarHeight); | 268 contentBox.setHeight(contentBox.height() + horizontalScrollbarHeight); |
269 | 269 |
270 paddingBox = renderBox->paddingBoxRect(); | 270 paddingBox = layoutBox->paddingBoxRect(); |
271 paddingBox.setWidth(paddingBox.width() + verticalScrollbarWidth); | 271 paddingBox.setWidth(paddingBox.width() + verticalScrollbarWidth); |
272 paddingBox.setHeight(paddingBox.height() + horizontalScrollbarHeight); | 272 paddingBox.setHeight(paddingBox.height() + horizontalScrollbarHeight); |
273 | 273 |
274 borderBox = renderBox->borderBoxRect(); | 274 borderBox = layoutBox->borderBoxRect(); |
275 | 275 |
276 marginBox = LayoutRect(borderBox.x() - renderBox->marginLeft(), borderBo
x.y() - renderBox->marginTop(), | 276 marginBox = LayoutRect(borderBox.x() - layoutBox->marginLeft(), borderBo
x.y() - layoutBox->marginTop(), |
277 borderBox.width() + renderBox->marginWidth(), borderBox.height() + r
enderBox->marginHeight()); | 277 borderBox.width() + layoutBox->marginWidth(), borderBox.height() + l
ayoutBox->marginHeight()); |
278 } else { | 278 } else { |
279 RenderInline* renderInline = toRenderInline(renderer); | 279 RenderInline* renderInline = toRenderInline(renderer); |
280 | 280 |
281 // RenderInline's bounding box includes paddings and borders, excludes m
argins. | 281 // RenderInline's bounding box includes paddings and borders, excludes m
argins. |
282 borderBox = renderInline->linesBoundingBox(); | 282 borderBox = renderInline->linesBoundingBox(); |
283 paddingBox = LayoutRect(borderBox.x() + renderInline->borderLeft(), bord
erBox.y() + renderInline->borderTop(), | 283 paddingBox = LayoutRect(borderBox.x() + renderInline->borderLeft(), bord
erBox.y() + renderInline->borderTop(), |
284 borderBox.width() - renderInline->borderLeft() - renderInline->borde
rRight(), borderBox.height() - renderInline->borderTop() - renderInline->borderB
ottom()); | 284 borderBox.width() - renderInline->borderLeft() - renderInline->borde
rRight(), borderBox.height() - renderInline->borderTop() - renderInline->borderB
ottom()); |
285 contentBox = LayoutRect(paddingBox.x() + renderInline->paddingLeft(), pa
ddingBox.y() + renderInline->paddingTop(), | 285 contentBox = LayoutRect(paddingBox.x() + renderInline->paddingLeft(), pa
ddingBox.y() + renderInline->paddingTop(), |
286 paddingBox.width() - renderInline->paddingLeft() - renderInline->pad
dingRight(), paddingBox.height() - renderInline->paddingTop() - renderInline->pa
ddingBottom()); | 286 paddingBox.width() - renderInline->paddingLeft() - renderInline->pad
dingRight(), paddingBox.height() - renderInline->paddingTop() - renderInline->pa
ddingBottom()); |
287 // Ignore marginTop and marginBottom for inlines. | 287 // Ignore marginTop and marginBottom for inlines. |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 array->addItem(quad.p3().x()); | 586 array->addItem(quad.p3().x()); |
587 array->addItem(quad.p3().y()); | 587 array->addItem(quad.p3().y()); |
588 array->addItem(quad.p4().x()); | 588 array->addItem(quad.p4().x()); |
589 array->addItem(quad.p4().y()); | 589 array->addItem(quad.p4().y()); |
590 return array.release(); | 590 return array.release(); |
591 } | 591 } |
592 | 592 |
593 static const ShapeOutsideInfo* shapeOutsideInfoForNode(Node* node, Shape::Displa
yPaths* paths, FloatQuad* bounds) | 593 static const ShapeOutsideInfo* shapeOutsideInfoForNode(Node* node, Shape::Displa
yPaths* paths, FloatQuad* bounds) |
594 { | 594 { |
595 LayoutObject* renderer = node->renderer(); | 595 LayoutObject* renderer = node->renderer(); |
596 if (!renderer || !renderer->isBox() || !toRenderBox(renderer)->shapeOutsideI
nfo()) | 596 if (!renderer || !renderer->isBox() || !toLayoutBox(renderer)->shapeOutsideI
nfo()) |
597 return nullptr; | 597 return nullptr; |
598 | 598 |
599 FrameView* containingView = node->document().view(); | 599 FrameView* containingView = node->document().view(); |
600 RenderBox* renderBox = toRenderBox(renderer); | 600 LayoutBox* layoutBox = toLayoutBox(renderer); |
601 const ShapeOutsideInfo* shapeOutsideInfo = renderBox->shapeOutsideInfo(); | 601 const ShapeOutsideInfo* shapeOutsideInfo = layoutBox->shapeOutsideInfo(); |
602 | 602 |
603 shapeOutsideInfo->computedShape().buildDisplayPaths(*paths); | 603 shapeOutsideInfo->computedShape().buildDisplayPaths(*paths); |
604 | 604 |
605 LayoutRect shapeBounds = shapeOutsideInfo->computedShapePhysicalBoundingBox(
); | 605 LayoutRect shapeBounds = shapeOutsideInfo->computedShapePhysicalBoundingBox(
); |
606 *bounds = renderBox->localToAbsoluteQuad(FloatRect(shapeBounds)); | 606 *bounds = layoutBox->localToAbsoluteQuad(FloatRect(shapeBounds)); |
607 contentsQuadToRootFrame(containingView, *bounds); | 607 contentsQuadToRootFrame(containingView, *bounds); |
608 | 608 |
609 return shapeOutsideInfo; | 609 return shapeOutsideInfo; |
610 } | 610 } |
611 | 611 |
612 static void appendPathsForShapeOutside(Highlight& highlight, const HighlightConf
ig& config, Node* node) | 612 static void appendPathsForShapeOutside(Highlight& highlight, const HighlightConf
ig& config, Node* node) |
613 { | 613 { |
614 Shape::DisplayPaths paths; | 614 Shape::DisplayPaths paths; |
615 FloatQuad boundsQuad; | 615 FloatQuad boundsQuad; |
616 | 616 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 hideHighlight(); | 888 hideHighlight(); |
889 } | 889 } |
890 | 890 |
891 void InspectorOverlay::startedRecordingProfile() | 891 void InspectorOverlay::startedRecordingProfile() |
892 { | 892 { |
893 if (!m_activeProfilerCount++) | 893 if (!m_activeProfilerCount++) |
894 freePage(); | 894 freePage(); |
895 } | 895 } |
896 | 896 |
897 } // namespace blink | 897 } // namespace blink |
OLD | NEW |