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