OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "core/frame/FrameHost.h" | 28 #include "core/frame/FrameHost.h" |
29 #include "core/layout/Layer.h" | 29 #include "core/layout/Layer.h" |
30 #include "core/layout/LayoutGeometryMap.h" | 30 #include "core/layout/LayoutGeometryMap.h" |
31 #include "core/layout/PaintInfo.h" | 31 #include "core/layout/PaintInfo.h" |
32 #include "core/layout/SubtreeLayoutScope.h" | 32 #include "core/layout/SubtreeLayoutScope.h" |
33 #include "core/layout/svg/LayoutSVGInlineText.h" | 33 #include "core/layout/svg/LayoutSVGInlineText.h" |
34 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 34 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
35 #include "core/layout/svg/LayoutSVGResourceFilter.h" | 35 #include "core/layout/svg/LayoutSVGResourceFilter.h" |
36 #include "core/layout/svg/LayoutSVGResourceMasker.h" | 36 #include "core/layout/svg/LayoutSVGResourceMasker.h" |
| 37 #include "core/layout/svg/LayoutSVGShape.h" |
37 #include "core/layout/svg/LayoutSVGText.h" | 38 #include "core/layout/svg/LayoutSVGText.h" |
38 #include "core/layout/svg/SVGResources.h" | 39 #include "core/layout/svg/SVGResources.h" |
39 #include "core/layout/svg/SVGResourcesCache.h" | 40 #include "core/layout/svg/SVGResourcesCache.h" |
40 #include "core/rendering/svg/RenderSVGRoot.h" | 41 #include "core/rendering/svg/RenderSVGRoot.h" |
41 #include "core/rendering/svg/RenderSVGShape.h" | |
42 #include "core/rendering/svg/RenderSVGViewportContainer.h" | 42 #include "core/rendering/svg/RenderSVGViewportContainer.h" |
43 #include "core/svg/SVGElement.h" | 43 #include "core/svg/SVGElement.h" |
44 #include "platform/geometry/TransformState.h" | 44 #include "platform/geometry/TransformState.h" |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 static inline LayoutRect enclosingIntRectIfNotEmpty(const FloatRect& rect) | 48 static inline LayoutRect enclosingIntRectIfNotEmpty(const FloatRect& rect) |
49 { | 49 { |
50 if (rect.isEmpty()) | 50 if (rect.isEmpty()) |
51 return LayoutRect(); | 51 return LayoutRect(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 strokeBoundingBox = FloatRect(); | 170 strokeBoundingBox = FloatRect(); |
171 | 171 |
172 // When computing the strokeBoundingBox, we use the paintInvalidationRects o
f the container's children so that the container's stroke includes | 172 // When computing the strokeBoundingBox, we use the paintInvalidationRects o
f the container's children so that the container's stroke includes |
173 // the resources applied to the children (such as clips and filters). This a
llows filters applied to containers to correctly bound | 173 // the resources applied to the children (such as clips and filters). This a
llows filters applied to containers to correctly bound |
174 // the children, and also improves inlining of SVG content, as the stroke bo
und is used in that situation also. | 174 // the children, and also improves inlining of SVG content, as the stroke bo
und is used in that situation also. |
175 for (LayoutObject* current = container->slowFirstChild(); current; current =
current->nextSibling()) { | 175 for (LayoutObject* current = container->slowFirstChild(); current; current =
current->nextSibling()) { |
176 if (current->isSVGHiddenContainer()) | 176 if (current->isSVGHiddenContainer()) |
177 continue; | 177 continue; |
178 | 178 |
179 // Don't include elements in the union that do not render. | 179 // Don't include elements in the union that do not render. |
180 if (current->isSVGShape() && toRenderSVGShape(current)->isShapeEmpty()) | 180 if (current->isSVGShape() && toLayoutSVGShape(current)->isShapeEmpty()) |
181 continue; | 181 continue; |
182 | 182 |
183 const AffineTransform& transform = current->localToParentTransform(); | 183 const AffineTransform& transform = current->localToParentTransform(); |
184 updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, curre
nt, | 184 updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, curre
nt, |
185 transform.mapRect(current->objectBoundingBox())); | 185 transform.mapRect(current->objectBoundingBox())); |
186 strokeBoundingBox.unite(transform.mapRect(current->paintInvalidationRect
InLocalCoordinates())); | 186 strokeBoundingBox.unite(transform.mapRect(current->paintInvalidationRect
InLocalCoordinates())); |
187 } | 187 } |
188 | 188 |
189 paintInvalidationBoundingBox = strokeBoundingBox; | 189 paintInvalidationBoundingBox = strokeBoundingBox; |
190 } | 190 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 if (child->isSVGText()) | 241 if (child->isSVGText()) |
242 toLayoutSVGText(child)->setNeedsTextMetricsUpdate(); | 242 toLayoutSVGText(child)->setNeedsTextMetricsUpdate(); |
243 forceLayout = true; | 243 forceLayout = true; |
244 } | 244 } |
245 | 245 |
246 if (layoutSizeChanged) { | 246 if (layoutSizeChanged) { |
247 // When selfNeedsLayout is false and the layout size changed, we hav
e to check whether this child uses relative lengths | 247 // When selfNeedsLayout is false and the layout size changed, we hav
e to check whether this child uses relative lengths |
248 if (SVGElement* element = child->node()->isSVGElement() ? toSVGEleme
nt(child->node()) : 0) { | 248 if (SVGElement* element = child->node()->isSVGElement() ? toSVGEleme
nt(child->node()) : 0) { |
249 if (element->hasRelativeLengths()) { | 249 if (element->hasRelativeLengths()) { |
250 // FIXME: this should be done on invalidation, not during la
yout. | 250 // FIXME: this should be done on invalidation, not during la
yout. |
251 // When the layout size changed and when using relative valu
es tell the RenderSVGShape to update its shape object | 251 // When the layout size changed and when using relative valu
es tell the LayoutSVGShape to update its shape object |
252 if (child->isSVGShape()) { | 252 if (child->isSVGShape()) { |
253 toRenderSVGShape(child)->setNeedsShapeUpdate(); | 253 toLayoutSVGShape(child)->setNeedsShapeUpdate(); |
254 } else if (child->isSVGText()) { | 254 } else if (child->isSVGText()) { |
255 toLayoutSVGText(child)->setNeedsTextMetricsUpdate(); | 255 toLayoutSVGText(child)->setNeedsTextMetricsUpdate(); |
256 toLayoutSVGText(child)->setNeedsPositioningValuesUpdate(
); | 256 toLayoutSVGText(child)->setNeedsPositioningValuesUpdate(
); |
257 } | 257 } |
258 | 258 |
259 forceLayout = true; | 259 forceLayout = true; |
260 } | 260 } |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 510 |
511 layer = layer->parent(); | 511 layer = layer->parent(); |
512 } | 512 } |
513 | 513 |
514 ctm.scale(deviceScaleFactor); | 514 ctm.scale(deviceScaleFactor); |
515 | 515 |
516 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
2)) / 2)); | 516 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
2)) / 2)); |
517 } | 517 } |
518 | 518 |
519 } | 519 } |
OLD | NEW |