diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp index e8827c4733..79580885bd 100644 --- a/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/style/SVGRenderStyle.cpp @@ -8,8 +8,6 @@ Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org) Copyright (C) 2002 Apple Computer, Inc. - This file is part of the KDE project - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -32,11 +30,14 @@ #include "CSSPrimitiveValue.h" #include "CSSValueList.h" +#include "IntRect.h" #include "NodeRenderStyle.h" #include "RenderObject.h" #include "RenderStyle.h" #include "SVGStyledElement.h" +using namespace std; + namespace WebCore { SVGRenderStyle::SVGRenderStyle() @@ -143,6 +144,56 @@ float SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* v return primitive->computeLengthFloat(const_cast<RenderStyle*>(item->style()), item->document()->documentElement()->renderStyle()); } + +static void getSVGShadowExtent(ShadowData* shadow, int& top, int& right, int& bottom, int& left) +{ + top = 0; + right = 0; + bottom = 0; + left = 0; + + int blurAndSpread = shadow->blur + shadow->spread; + + top = min(top, shadow->y - blurAndSpread); + right = max(right, shadow->x + blurAndSpread); + bottom = max(bottom, shadow->y + blurAndSpread); + left = min(left, shadow->x - blurAndSpread); +} + +void SVGRenderStyle::inflateForShadow(IntRect& repaintRect) const +{ + ShadowData* svgShadow = shadow(); + if (!svgShadow) + return; + + FloatRect repaintFloatRect = FloatRect(repaintRect); + inflateForShadow(repaintFloatRect); + repaintRect = enclosingIntRect(repaintFloatRect); +} + +void SVGRenderStyle::inflateForShadow(FloatRect& repaintRect) const +{ + ShadowData* svgShadow = shadow(); + if (!svgShadow) + return; + + int shadowTop; + int shadowRight; + int shadowBottom; + int shadowLeft; + getSVGShadowExtent(svgShadow, shadowTop, shadowRight, shadowBottom, shadowLeft); + + int overflowLeft = repaintRect.x() + shadowLeft; + int overflowRight = repaintRect.right() + shadowRight; + int overflowTop = repaintRect.y() + shadowTop; + int overflowBottom = repaintRect.bottom() + shadowBottom; + + repaintRect.setX(overflowLeft); + repaintRect.setY(overflowTop); + repaintRect.setWidth(overflowRight - overflowLeft); + repaintRect.setHeight(overflowBottom - overflowTop); +} + } #endif // ENABLE(SVG) |