| 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 |
| 11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 13 * | 13 * |
| 14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
| 18 * | 18 * |
| 19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
| 20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
| 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/rendering/svg/SVGRenderSupport.h" | 26 #include "core/rendering/svg/SVGRenderSupport.h" |
| 27 | 27 |
| 28 #include "core/layout/Layer.h" |
| 28 #include "core/rendering/PaintInfo.h" | 29 #include "core/rendering/PaintInfo.h" |
| 29 #include "core/rendering/RenderGeometryMap.h" | 30 #include "core/rendering/RenderGeometryMap.h" |
| 30 #include "core/rendering/RenderLayer.h" | |
| 31 #include "core/rendering/SubtreeLayoutScope.h" | 31 #include "core/rendering/SubtreeLayoutScope.h" |
| 32 #include "core/rendering/svg/RenderSVGInlineText.h" | 32 #include "core/rendering/svg/RenderSVGInlineText.h" |
| 33 #include "core/rendering/svg/RenderSVGResourceClipper.h" | 33 #include "core/rendering/svg/RenderSVGResourceClipper.h" |
| 34 #include "core/rendering/svg/RenderSVGResourceFilter.h" | 34 #include "core/rendering/svg/RenderSVGResourceFilter.h" |
| 35 #include "core/rendering/svg/RenderSVGResourceMasker.h" | 35 #include "core/rendering/svg/RenderSVGResourceMasker.h" |
| 36 #include "core/rendering/svg/RenderSVGRoot.h" | 36 #include "core/rendering/svg/RenderSVGRoot.h" |
| 37 #include "core/rendering/svg/RenderSVGShape.h" | 37 #include "core/rendering/svg/RenderSVGShape.h" |
| 38 #include "core/rendering/svg/RenderSVGText.h" | 38 #include "core/rendering/svg/RenderSVGText.h" |
| 39 #include "core/rendering/svg/RenderSVGViewportContainer.h" | 39 #include "core/rendering/svg/RenderSVGViewportContainer.h" |
| 40 #include "core/rendering/svg/SVGResources.h" | 40 #include "core/rendering/svg/SVGResources.h" |
| 41 #include "core/rendering/svg/SVGResourcesCache.h" | 41 #include "core/rendering/svg/SVGResourcesCache.h" |
| 42 #include "core/svg/SVGElement.h" | 42 #include "core/svg/SVGElement.h" |
| 43 #include "platform/geometry/TransformState.h" | 43 #include "platform/geometry/TransformState.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 static inline LayoutRect enclosingIntRectIfNotEmpty(const FloatRect& rect) | 47 static inline LayoutRect enclosingIntRectIfNotEmpty(const FloatRect& rect) |
| 48 { | 48 { |
| 49 if (rect.isEmpty()) | 49 if (rect.isEmpty()) |
| 50 return LayoutRect(); | 50 return LayoutRect(); |
| 51 return enclosingIntRect(rect); | 51 return enclosingIntRect(rect); |
| 52 } | 52 } |
| 53 | 53 |
| 54 LayoutRect SVGRenderSupport::clippedOverflowRectForPaintInvalidation(const Rende
rObject* object, const RenderLayerModelObject* paintInvalidationContainer, const
PaintInvalidationState* paintInvalidationState) | 54 LayoutRect SVGRenderSupport::clippedOverflowRectForPaintInvalidation(const Rende
rObject* object, const LayoutLayerModelObject* paintInvalidationContainer, const
PaintInvalidationState* paintInvalidationState) |
| 55 { | 55 { |
| 56 // Return early for any cases where we don't actually paint | 56 // Return early for any cases where we don't actually paint |
| 57 if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->h
asVisibleContent()) | 57 if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->h
asVisibleContent()) |
| 58 return LayoutRect(); | 58 return LayoutRect(); |
| 59 | 59 |
| 60 // Pass our local paint rect to computeRectForPaintInvalidation() which will | 60 // Pass our local paint rect to computeRectForPaintInvalidation() which will |
| 61 // map to parent coords and recurse up the parent chain. | 61 // map to parent coords and recurse up the parent chain. |
| 62 FloatRect paintInvalidationRect = object->paintInvalidationRectInLocalCoordi
nates(); | 62 FloatRect paintInvalidationRect = object->paintInvalidationRectInLocalCoordi
nates(); |
| 63 paintInvalidationRect.inflate(object->style()->outlineWidth()); | 63 paintInvalidationRect.inflate(object->style()->outlineWidth()); |
| 64 | 64 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 parent = parent->parent(); | 96 parent = parent->parent(); |
| 97 } while (!parent->isSVGRoot()); | 97 } while (!parent->isSVGRoot()); |
| 98 | 98 |
| 99 const RenderSVGRoot& svgRoot = toRenderSVGRoot(*parent); | 99 const RenderSVGRoot& svgRoot = toRenderSVGRoot(*parent); |
| 100 | 100 |
| 101 paintInvalidationRect = svgRoot.localToBorderBoxTransform().mapRect(paintInv
alidationRect); | 101 paintInvalidationRect = svgRoot.localToBorderBoxTransform().mapRect(paintInv
alidationRect); |
| 102 rect = enclosingIntRectIfNotEmpty(paintInvalidationRect); | 102 rect = enclosingIntRectIfNotEmpty(paintInvalidationRect); |
| 103 return svgRoot; | 103 return svgRoot; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, const Ren
derLayerModelObject* paintInvalidationContainer, TransformState& transformState,
bool* wasFixed, const PaintInvalidationState* paintInvalidationState) | 106 void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, const Lay
outLayerModelObject* paintInvalidationContainer, TransformState& transformState,
bool* wasFixed, const PaintInvalidationState* paintInvalidationState) |
| 107 { | 107 { |
| 108 transformState.applyTransform(object->localToParentTransform()); | 108 transformState.applyTransform(object->localToParentTransform()); |
| 109 | 109 |
| 110 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 110 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
| 111 // |svgTransform| contains localToBorderBoxTransform mentioned below. | 111 // |svgTransform| contains localToBorderBoxTransform mentioned below. |
| 112 transformState.applyTransform(paintInvalidationState->svgTransform()); | 112 transformState.applyTransform(paintInvalidationState->svgTransform()); |
| 113 transformState.move(paintInvalidationState->paintOffset()); | 113 transformState.move(paintInvalidationState->paintOffset()); |
| 114 return; | 114 return; |
| 115 } | 115 } |
| 116 | 116 |
| 117 RenderObject* parent = object->parent(); | 117 RenderObject* parent = object->parent(); |
| 118 | 118 |
| 119 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderB
oxTransform | 119 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderB
oxTransform |
| 120 // to map an element from SVG viewport coordinates to CSS box coordinates. | 120 // to map an element from SVG viewport coordinates to CSS box coordinates. |
| 121 // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates. | 121 // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates. |
| 122 if (parent->isSVGRoot()) | 122 if (parent->isSVGRoot()) |
| 123 transformState.applyTransform(toRenderSVGRoot(parent)->localToBorderBoxT
ransform()); | 123 transformState.applyTransform(toRenderSVGRoot(parent)->localToBorderBoxT
ransform()); |
| 124 | 124 |
| 125 MapCoordinatesFlags mode = UseTransforms; | 125 MapCoordinatesFlags mode = UseTransforms; |
| 126 parent->mapLocalToContainer(paintInvalidationContainer, transformState, mode
, wasFixed, paintInvalidationState); | 126 parent->mapLocalToContainer(paintInvalidationContainer, transformState, mode
, wasFixed, paintInvalidationState); |
| 127 } | 127 } |
| 128 | 128 |
| 129 const RenderObject* SVGRenderSupport::pushMappingToContainer(const RenderObject*
object, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geom
etryMap) | 129 const RenderObject* SVGRenderSupport::pushMappingToContainer(const RenderObject*
object, const LayoutLayerModelObject* ancestorToStopAt, RenderGeometryMap& geom
etryMap) |
| 130 { | 130 { |
| 131 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != object); | 131 ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != object); |
| 132 | 132 |
| 133 RenderObject* parent = object->parent(); | 133 RenderObject* parent = object->parent(); |
| 134 | 134 |
| 135 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderB
oxTransform | 135 // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderB
oxTransform |
| 136 // to map an element from SVG viewport coordinates to CSS box coordinates. | 136 // to map an element from SVG viewport coordinates to CSS box coordinates. |
| 137 // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates. | 137 // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates. |
| 138 if (parent->isSVGRoot()) { | 138 if (parent->isSVGRoot()) { |
| 139 TransformationMatrix matrix(object->localToParentTransform()); | 139 TransformationMatrix matrix(object->localToParentTransform()); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 return false; | 454 return false; |
| 455 return willIsolateBlendingDescendantsForStyle(object->style()); | 455 return willIsolateBlendingDescendantsForStyle(object->style()); |
| 456 } | 456 } |
| 457 | 457 |
| 458 bool SVGRenderSupport::isIsolationRequired(const RenderObject* object) | 458 bool SVGRenderSupport::isIsolationRequired(const RenderObject* object) |
| 459 { | 459 { |
| 460 return willIsolateBlendingDescendantsForObject(object) && object->hasNonIsol
atedBlendingDescendants(); | 460 return willIsolateBlendingDescendantsForObject(object) && object->hasNonIsol
atedBlendingDescendants(); |
| 461 } | 461 } |
| 462 | 462 |
| 463 } | 463 } |
| OLD | NEW |