| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 LayoutRect SVGRenderSupport::clippedOverflowRectForRepaint(const RenderObject* o
bject, const RenderLayerModelObject* repaintContainer) | 46 LayoutRect SVGRenderSupport::clippedOverflowRectForRepaint(const RenderObject* o
bject, const RenderLayerModelObject* repaintContainer) |
| 47 { | 47 { |
| 48 // Return early for any cases where we don't actually paint | 48 // Return early for any cases where we don't actually paint |
| 49 if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->h
asVisibleContent()) | 49 if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->h
asVisibleContent()) |
| 50 return LayoutRect(); | 50 return LayoutRect(); |
| 51 | 51 |
| 52 // Pass our local paint rect to computeRectForRepaint() which will | 52 // Pass our local paint rect to computeRectForRepaint() which will |
| 53 // map to parent coords and recurse up the parent chain. | 53 // map to parent coords and recurse up the parent chain. |
| 54 FloatRect repaintRect = object->repaintRectInLocalCoordinates(); | 54 FloatRect repaintRect = object->paintInvalidationRectInLocalCoordinates(); |
| 55 object->computeFloatRectForRepaint(repaintContainer, repaintRect); | 55 object->computeFloatRectForPaintInvalidation(repaintContainer, repaintRect); |
| 56 return enclosingLayoutRect(repaintRect); | 56 return enclosingLayoutRect(repaintRect); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void SVGRenderSupport::computeFloatRectForRepaint(const RenderObject* object, co
nst RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed
) | 59 void SVGRenderSupport::computeFloatRectForRepaint(const RenderObject* object, co
nst RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed
) |
| 60 { | 60 { |
| 61 repaintRect.inflate(object->style()->outlineWidth()); | 61 repaintRect.inflate(object->style()->outlineWidth()); |
| 62 | 62 |
| 63 // Translate to coords in our parent renderer, and then call computeFloatRec
tForRepaint() on our parent. | 63 // Translate to coords in our parent renderer, and then call computeFloatRec
tForPaintInvalidation() on our parent. |
| 64 repaintRect = object->localToParentTransform().mapRect(repaintRect); | 64 repaintRect = object->localToParentTransform().mapRect(repaintRect); |
| 65 object->parent()->computeFloatRectForRepaint(repaintContainer, repaintRect,
fixed); | 65 object->parent()->computeFloatRectForPaintInvalidation(repaintContainer, rep
aintRect, fixed); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, const Ren
derLayerModelObject* repaintContainer, TransformState& transformState, bool* was
Fixed) | 68 void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, const Ren
derLayerModelObject* repaintContainer, TransformState& transformState, bool* was
Fixed) |
| 69 { | 69 { |
| 70 transformState.applyTransform(object->localToParentTransform()); | 70 transformState.applyTransform(object->localToParentTransform()); |
| 71 | 71 |
| 72 RenderObject* parent = object->parent(); | 72 RenderObject* parent = object->parent(); |
| 73 | 73 |
| 74 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderB
oxTransform | 74 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderB
oxTransform |
| 75 // to map an element from SVG viewport coordinates to CSS box coordinates. | 75 // to map an element from SVG viewport coordinates to CSS box coordinates. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 103 bool SVGRenderSupport::parentTransformDidChange(RenderObject* object) | 103 bool SVGRenderSupport::parentTransformDidChange(RenderObject* object) |
| 104 { | 104 { |
| 105 // When a parent container is transformed in SVG, all children will be paint
ed automatically | 105 // When a parent container is transformed in SVG, all children will be paint
ed automatically |
| 106 // so we are able to skip redundant repaint checks. | 106 // so we are able to skip redundant repaint checks. |
| 107 RenderObject* parent = object->parent(); | 107 RenderObject* parent = object->parent(); |
| 108 return !(parent && parent->isSVGContainer() && toRenderSVGContainer(parent)-
>didTransformToRootUpdate()); | 108 return !(parent && parent->isSVGContainer() && toRenderSVGContainer(parent)-
>didTransformToRootUpdate()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool SVGRenderSupport::checkForSVGRepaintDuringLayout(RenderObject* object) | 111 bool SVGRenderSupport::checkForSVGRepaintDuringLayout(RenderObject* object) |
| 112 { | 112 { |
| 113 if (!object->checkForRepaintDuringLayout()) | 113 if (!object->checkForPaintInvalidationDuringLayout()) |
| 114 return false; | 114 return false; |
| 115 | 115 |
| 116 return parentTransformDidChange(object); | 116 return parentTransformDidChange(object); |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Update a bounding box taking into account the validity of the other bounding
box. | 119 // Update a bounding box taking into account the validity of the other bounding
box. |
| 120 inline void SVGRenderSupport::updateObjectBoundingBox(FloatRect& objectBoundingB
ox, bool& objectBoundingBoxValid, RenderObject* other, FloatRect otherBoundingBo
x) | 120 inline void SVGRenderSupport::updateObjectBoundingBox(FloatRect& objectBoundingB
ox, bool& objectBoundingBoxValid, RenderObject* other, FloatRect otherBoundingBo
x) |
| 121 { | 121 { |
| 122 bool otherValid = other->isSVGContainer() ? toRenderSVGContainer(other)->isO
bjectBoundingBoxValid() : true; | 122 bool otherValid = other->isSVGContainer() ? toRenderSVGContainer(other)->isO
bjectBoundingBoxValid() : true; |
| 123 if (!otherValid) | 123 if (!otherValid) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 141 // When computing the strokeBoundingBox, we use the repaintRects of the cont
ainer's children so that the container's stroke includes | 141 // When computing the strokeBoundingBox, we use the repaintRects of the cont
ainer's children so that the container's stroke includes |
| 142 // the resources applied to the children (such as clips and filters). This a
llows filters applied to containers to correctly bound | 142 // the resources applied to the children (such as clips and filters). This a
llows filters applied to containers to correctly bound |
| 143 // the children, and also improves inlining of SVG content, as the stroke bo
und is used in that situation also. | 143 // the children, and also improves inlining of SVG content, as the stroke bo
und is used in that situation also. |
| 144 for (RenderObject* current = container->slowFirstChild(); current; current =
current->nextSibling()) { | 144 for (RenderObject* current = container->slowFirstChild(); current; current =
current->nextSibling()) { |
| 145 if (current->isSVGHiddenContainer()) | 145 if (current->isSVGHiddenContainer()) |
| 146 continue; | 146 continue; |
| 147 | 147 |
| 148 const AffineTransform& transform = current->localToParentTransform(); | 148 const AffineTransform& transform = current->localToParentTransform(); |
| 149 updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, curre
nt, | 149 updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, curre
nt, |
| 150 transform.mapRect(current->objectBoundingBox())); | 150 transform.mapRect(current->objectBoundingBox())); |
| 151 strokeBoundingBox.unite(transform.mapRect(current->repaintRectInLocalCoo
rdinates())); | 151 strokeBoundingBox.unite(transform.mapRect(current->paintInvalidationRect
InLocalCoordinates())); |
| 152 } | 152 } |
| 153 | 153 |
| 154 repaintBoundingBox = strokeBoundingBox; | 154 repaintBoundingBox = strokeBoundingBox; |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool SVGRenderSupport::paintInfoIntersectsRepaintRect(const FloatRect& localRepa
intRect, const AffineTransform& localTransform, const PaintInfo& paintInfo) | 157 bool SVGRenderSupport::paintInfoIntersectsRepaintRect(const FloatRect& localRepa
intRect, const AffineTransform& localTransform, const PaintInfo& paintInfo) |
| 158 { | 158 { |
| 159 return localTransform.mapRect(localRepaintRect).intersects(paintInfo.rect); | 159 return localTransform.mapRect(localRepaintRect).intersects(paintInfo.rect); |
| 160 } | 160 } |
| 161 | 161 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 } | 398 } |
| 399 | 399 |
| 400 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) | 400 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) |
| 401 { | 401 { |
| 402 ASSERT(object->isText()); | 402 ASSERT(object->isText()); |
| 403 // <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
. |
| 404 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty
Text(); | 404 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty
Text(); |
| 405 } | 405 } |
| 406 | 406 |
| 407 } | 407 } |
| OLD | NEW |