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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // map to parent coords and recurse up the parent chain. | 55 // map to parent coords and recurse up the parent chain. |
56 FloatRect paintInvalidationRect = object->paintInvalidationRectInLocalCoordi
nates(); | 56 FloatRect paintInvalidationRect = object->paintInvalidationRectInLocalCoordi
nates(); |
57 object->computeFloatRectForPaintInvalidation(paintInvalidationContainer, pai
ntInvalidationRect, paintInvalidationState); | 57 object->computeFloatRectForPaintInvalidation(paintInvalidationContainer, pai
ntInvalidationRect, paintInvalidationState); |
58 return enclosingLayoutRect(paintInvalidationRect); | 58 return enclosingLayoutRect(paintInvalidationRect); |
59 } | 59 } |
60 | 60 |
61 void SVGRenderSupport::computeFloatRectForPaintInvalidation(const RenderObject*
object, const RenderLayerModelObject* paintInvalidationContainer, FloatRect& pai
ntInvalidationRect, const PaintInvalidationState* paintInvalidationState) | 61 void SVGRenderSupport::computeFloatRectForPaintInvalidation(const RenderObject*
object, const RenderLayerModelObject* paintInvalidationContainer, FloatRect& pai
ntInvalidationRect, const PaintInvalidationState* paintInvalidationState) |
62 { | 62 { |
63 paintInvalidationRect.inflate(object->style()->outlineWidth()); | 63 paintInvalidationRect.inflate(object->style()->outlineWidth()); |
64 | 64 |
| 65 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
| 66 // Compute accumulated SVG transform and apply to local paint rect. |
| 67 AffineTransform transform = paintInvalidationState->svgTransform() * obj
ect->localToParentTransform(); |
| 68 paintInvalidationRect = transform.mapRect(paintInvalidationRect); |
| 69 // FIXME: These are quirks carried forward from RenderSVGRoot::computeFl
oatRectForPaintInvalidation. |
| 70 LayoutRect rect; |
| 71 if (!paintInvalidationRect.isEmpty()) |
| 72 rect = enclosingIntRect(paintInvalidationRect); |
| 73 // Offset by SVG root paint offset and apply clipping as needed. |
| 74 rect.move(paintInvalidationState->paintOffset()); |
| 75 if (paintInvalidationState->isClipped()) |
| 76 rect.intersect(paintInvalidationState->clipRect()); |
| 77 paintInvalidationRect = rect; |
| 78 return; |
| 79 } |
| 80 |
65 // Translate to coords in our parent renderer, and then call computeFloatRec
tForPaintInvalidation() on our parent. | 81 // Translate to coords in our parent renderer, and then call computeFloatRec
tForPaintInvalidation() on our parent. |
66 paintInvalidationRect = object->localToParentTransform().mapRect(paintInvali
dationRect); | 82 paintInvalidationRect = object->localToParentTransform().mapRect(paintInvali
dationRect); |
67 object->parent()->computeFloatRectForPaintInvalidation(paintInvalidationCont
ainer, paintInvalidationRect, paintInvalidationState); | 83 object->parent()->computeFloatRectForPaintInvalidation(paintInvalidationCont
ainer, paintInvalidationRect, paintInvalidationState); |
68 } | 84 } |
69 | 85 |
70 void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, const Ren
derLayerModelObject* paintInvalidationContainer, TransformState& transformState,
bool* wasFixed, const PaintInvalidationState* paintInvalidationState) | 86 void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, const Ren
derLayerModelObject* paintInvalidationContainer, TransformState& transformState,
bool* wasFixed, const PaintInvalidationState* paintInvalidationState) |
71 { | 87 { |
72 transformState.applyTransform(object->localToParentTransform()); | 88 transformState.applyTransform(object->localToParentTransform()); |
73 | 89 |
| 90 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
| 91 // |svgTransform| contains localToBorderBoxTransform mentioned below. |
| 92 transformState.applyTransform(paintInvalidationState->svgTransform()); |
| 93 transformState.move(paintInvalidationState->paintOffset()); |
| 94 return; |
| 95 } |
| 96 |
74 RenderObject* parent = object->parent(); | 97 RenderObject* parent = object->parent(); |
75 | 98 |
76 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderB
oxTransform | 99 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderB
oxTransform |
77 // to map an element from SVG viewport coordinates to CSS box coordinates. | 100 // to map an element from SVG viewport coordinates to CSS box coordinates. |
78 // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates. | 101 // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates. |
79 if (parent->isSVGRoot()) | 102 if (parent->isSVGRoot()) |
80 transformState.applyTransform(toRenderSVGRoot(parent)->localToBorderBoxT
ransform()); | 103 transformState.applyTransform(toRenderSVGRoot(parent)->localToBorderBoxT
ransform()); |
81 | 104 |
82 MapCoordinatesFlags mode = UseTransforms; | 105 MapCoordinatesFlags mode = UseTransforms; |
83 parent->mapLocalToContainer(paintInvalidationContainer, transformState, mode
, wasFixed, paintInvalidationState); | 106 parent->mapLocalToContainer(paintInvalidationContainer, transformState, mode
, wasFixed, paintInvalidationState); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 } | 399 } |
377 | 400 |
378 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) | 401 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) |
379 { | 402 { |
380 ASSERT(object->isText()); | 403 ASSERT(object->isText()); |
381 // <br> is marked as text, but is not handled by the SVG rendering code-path
. | 404 // <br> is marked as text, but is not handled by the SVG rendering code-path
. |
382 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty
Text(); | 405 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty
Text(); |
383 } | 406 } |
384 | 407 |
385 } | 408 } |
OLD | NEW |