Title: [114520] trunk/Source/WebCore
Revision
114520
Author
[email protected]
Date
2012-04-18 10:05:11 -0700 (Wed, 18 Apr 2012)

Log Message

Convert ShadowData and DropShadowFilterOperation to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=84098

Reviewed by Eric Seidel.

Shadows do not flow with the page, so sub-pixel layout doesn't actually offer any benefit that
couldn't have been attained before that conversion. With that in mind, this patch reverts
drop shadow offsets to integers, but also cleans up the code by switching the x/y location pair
to be an IntPoint.

No new tests. No change in behavior.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::valueForFilter):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::collectMatchingRulesForList):
* css/SVGCSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applySVGProperty):
* page/animation/AnimationBase.cpp:
(WebCore::blendFunc):
(WebCore::shadowForBlending):
* platform/animation/AnimationUtilities.h:
(WebCore::blend): New blend function that operates on IntPoints.
(WebCore):
* platform/chromium/support/WebFilterOperations.cpp:
(WebKit::WebDropShadowFilterOperation):
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::DropShadowFilterOperation::blend):
* platform/graphics/filters/FilterOperation.h:
(WebCore::DropShadowFilterOperation::clone):
(WebCore::DropShadowFilterOperation::x):
(WebCore::DropShadowFilterOperation::y):
(WebCore::DropShadowFilterOperation::location): Preserved the comment about lengths.
(WebCore::DropShadowFilterOperation::operator==):
(WebCore::DropShadowFilterOperation::DropShadowFilterOperation):
(DropShadowFilterOperation):
* rendering/RenderBoxModelObject.cpp:
(WebCore::areaCastingShadowInHole): Reverted to integers since this operates on the IntRect from
a RoundedRect.
(WebCore::RenderBoxModelObject::paintBoxShadow): Reduced the complexity and unnecessary conversion
between LayoutUnits and integers by using all integers after we calculate the pixel-snapped
RoundedRect that we use for painting.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::getShadowExtent):
(WebCore::RenderStyle::getShadowHorizontalExtent):
(WebCore::RenderStyle::getShadowVerticalExtent):
* rendering/style/ShadowData.cpp:
(WebCore::ShadowData::ShadowData):
(WebCore::ShadowData::operator==):
(WebCore::calculateShadowExtent):
(WebCore::ShadowData::adjustRectForShadow):
* rendering/style/ShadowData.h:
(WebCore::ShadowData::ShadowData):
(WebCore::ShadowData::x):
(WebCore::ShadowData::y):
(WebCore::ShadowData::location):
(ShadowData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114519 => 114520)


--- trunk/Source/WebCore/ChangeLog	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/ChangeLog	2012-04-18 17:05:11 UTC (rev 114520)
@@ -1,3 +1,63 @@
+2012-04-18  Levi Weintraub  <[email protected]>
+
+        Convert ShadowData and DropShadowFilterOperation to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=84098
+
+        Reviewed by Eric Seidel.
+
+        Shadows do not flow with the page, so sub-pixel layout doesn't actually offer any benefit that
+        couldn't have been attained before that conversion. With that in mind, this patch reverts
+        drop shadow offsets to integers, but also cleans up the code by switching the x/y location pair
+        to be an IntPoint.
+
+        No new tests. No change in behavior.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::valueForFilter):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::collectMatchingRulesForList):
+        * css/SVGCSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applySVGProperty):
+        * page/animation/AnimationBase.cpp:
+        (WebCore::blendFunc):
+        (WebCore::shadowForBlending):
+        * platform/animation/AnimationUtilities.h:
+        (WebCore::blend): New blend function that operates on IntPoints.
+        (WebCore):
+        * platform/chromium/support/WebFilterOperations.cpp:
+        (WebKit::WebDropShadowFilterOperation):
+        * platform/graphics/filters/FilterOperation.cpp:
+        (WebCore::DropShadowFilterOperation::blend):
+        * platform/graphics/filters/FilterOperation.h:
+        (WebCore::DropShadowFilterOperation::clone):
+        (WebCore::DropShadowFilterOperation::x):
+        (WebCore::DropShadowFilterOperation::y):
+        (WebCore::DropShadowFilterOperation::location): Preserved the comment about lengths.
+        (WebCore::DropShadowFilterOperation::operator==):
+        (WebCore::DropShadowFilterOperation::DropShadowFilterOperation):
+        (DropShadowFilterOperation):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::areaCastingShadowInHole): Reverted to integers since this operates on the IntRect from
+        a RoundedRect.
+        (WebCore::RenderBoxModelObject::paintBoxShadow): Reduced the complexity and unnecessary conversion
+        between LayoutUnits and integers by using all integers after we calculate the pixel-snapped
+        RoundedRect that we use for painting.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::getShadowExtent):
+        (WebCore::RenderStyle::getShadowHorizontalExtent):
+        (WebCore::RenderStyle::getShadowVerticalExtent):
+        * rendering/style/ShadowData.cpp:
+        (WebCore::ShadowData::ShadowData):
+        (WebCore::ShadowData::operator==):
+        (WebCore::calculateShadowExtent):
+        (WebCore::ShadowData::adjustRectForShadow):
+        * rendering/style/ShadowData.h:
+        (WebCore::ShadowData::ShadowData):
+        (WebCore::ShadowData::x):
+        (WebCore::ShadowData::y):
+        (WebCore::ShadowData::location):
+        (ShadowData):
+
 2012-04-17  Kentaro Hara  <[email protected]>
 
         [V8] Add an optional Isolate argument to wrap()

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (114519 => 114520)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-04-18 17:05:11 UTC (rev 114520)
@@ -825,7 +825,7 @@
             DropShadowFilterOperation* dropShadowOperation = static_cast<DropShadowFilterOperation*>(filterOperation);
             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::DropShadowFilterOperation);
             // We want our computed style to look like that of a text shadow (has neither spread nor inset style).
-            ShadowData shadowData = ShadowData(dropShadowOperation->x(), dropShadowOperation->y(), dropShadowOperation->stdDeviation(), 0, Normal, false, dropShadowOperation->color());
+            ShadowData shadowData = ShadowData(dropShadowOperation->location(), dropShadowOperation->stdDeviation(), 0, Normal, false, dropShadowOperation->color());
             filterValue->append(valueForShadow(&shadowData, CSSPropertyTextShadow, style));
             break;
         }

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (114519 => 114520)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-04-18 17:05:11 UTC (rev 114520)
@@ -3450,7 +3450,7 @@
             else if (m_style)
                 color = m_style->color();
 
-            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(x, y, blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent));
+            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent));
             if (id == CSSPropertyTextShadow)
                 m_style->setTextShadow(shadowData.release(), i.index()); // add to the list if this is not the first entry
             else
@@ -5714,14 +5714,14 @@
                 continue;
 
             ShadowValue* item = static_cast<ShadowValue*>(cssValue);
-            int x = item->x->computeLength<int>(style, rootStyle, zoomFactor);
-            int y = item->y->computeLength<int>(style, rootStyle, zoomFactor);
+            IntPoint location(item->x->computeLength<int>(style, rootStyle, zoomFactor),
+                              item->y->computeLength<int>(style, rootStyle, zoomFactor));
             int blur = item->blur ? item->blur->computeLength<int>(style, rootStyle, zoomFactor) : 0;
             Color color;
             if (item->color)
                 color = colorFromPrimitiveValue(item->color.get());
 
-            operations.operations().append(DropShadowFilterOperation::create(x, y, blur, color.isValid() ? color : Color::transparent, operationType));
+            operations.operations().append(DropShadowFilterOperation::create(location, blur, color.isValid() ? color : Color::transparent, operationType));
             break;
         }
         case WebKitCSSFilterValue::UnknownFilterOperation:

Modified: trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp (114519 => 114520)


--- trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/css/SVGCSSStyleSelector.cpp	2012-04-18 17:05:11 UTC (rev 114520)
@@ -571,8 +571,8 @@
             if (!firstValue->isShadowValue())
                 return;
             ShadowValue* item = static_cast<ShadowValue*>(firstValue);
-            int x = item->x->computeLength<int>(style(), m_rootElementStyle);
-            int y = item->y->computeLength<int>(style(), m_rootElementStyle);
+            IntPoint location(item->x->computeLength<int>(style(), m_rootElementStyle),
+                              item->y->computeLength<int>(style(), m_rootElementStyle));
             int blur = item->blur ? item->blur->computeLength<int>(style(), m_rootElementStyle) : 0;
             Color color;
             if (item->color)
@@ -582,7 +582,7 @@
             ASSERT(!item->spread);
             ASSERT(!item->style);
 
-            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(x, y, blur, 0, Normal, false, color.isValid() ? color : Color::transparent));
+            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(location, blur, 0, Normal, false, color.isValid() ? color : Color::transparent));
             svgstyle->setShadow(shadowData.release());
             return;
         }

Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (114519 => 114520)


--- trunk/Source/WebCore/page/animation/AnimationBase.cpp	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp	2012-04-18 17:05:11 UTC (rev 114520)
@@ -135,8 +135,7 @@
     if (from->style() != to->style())
         return adoptPtr(new ShadowData(*to));
 
-    return adoptPtr(new ShadowData(blend(from->x(), to->x(), progress),
-                                   blend(from->y(), to->y(), progress), 
+    return adoptPtr(new ShadowData(blend(from->location(), to->location(), progress), 
                                    blend(from->blur(), to->blur(), progress),
                                    blend(from->spread(), to->spread(), progress),
                                    blendFunc(anim, from->style(), to->style(), progress),
@@ -494,11 +493,11 @@
 
 static inline const ShadowData* shadowForBlending(const ShadowData* srcShadow, const ShadowData* otherShadow)
 {
-    DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (0, 0, 0, 0, Normal, false, Color::transparent));
-    DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (0, 0, 0, 0, Inset, false, Color::transparent));
+    DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal, false, Color::transparent));
+    DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, Inset, false, Color::transparent));
 
-    DEFINE_STATIC_LOCAL(ShadowData, defaultWebKitBoxShadowData, (0, 0, 0, 0, Normal, true, Color::transparent));
-    DEFINE_STATIC_LOCAL(ShadowData, defaultInsetWebKitBoxShadowData, (0, 0, 0, 0, Inset, true, Color::transparent));
+    DEFINE_STATIC_LOCAL(ShadowData, defaultWebKitBoxShadowData, (IntPoint(), 0, 0, Normal, true, Color::transparent));
+    DEFINE_STATIC_LOCAL(ShadowData, defaultInsetWebKitBoxShadowData, (IntPoint(), 0, 0, Inset, true, Color::transparent));
 
     if (srcShadow)
         return srcShadow;

Modified: trunk/Source/WebCore/platform/animation/AnimationUtilities.h (114519 => 114520)


--- trunk/Source/WebCore/platform/animation/AnimationUtilities.h	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/platform/animation/AnimationUtilities.h	2012-04-18 17:05:11 UTC (rev 114520)
@@ -27,6 +27,7 @@
 #define AnimationUtilities_h
 
 #include "FractionalLayoutUnit.h"
+#include "IntPoint.h"
 #include <wtf/MathExtras.h>
 
 namespace WebCore {
@@ -56,6 +57,12 @@
     return from + (to - from) * progress;
 }
 
+inline IntPoint blend(const IntPoint& from, const IntPoint& to, double progress)
+{
+    return IntPoint(blend(from.x(), to.x(), progress),
+                    blend(from.y(), to.y(), progress));
+}
+
 } // namespace WebCore
 
 #endif // AnimationUtilities_h

Modified: trunk/Source/WebCore/platform/chromium/support/WebFilterOperation.cpp (114519 => 114520)


--- trunk/Source/WebCore/platform/chromium/support/WebFilterOperation.cpp	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/platform/chromium/support/WebFilterOperation.cpp	2012-04-18 17:05:11 UTC (rev 114520)
@@ -50,7 +50,7 @@
 
 PassRefPtr<WebCore::FilterOperation> WebDropShadowFilterOperation::toFilterOperation() const
 {
-    return DropShadowFilterOperation::create(x, y, stdDeviation, color, FilterOperation::DROP_SHADOW);
+    return DropShadowFilterOperation::create(IntPoint(x, y), stdDeviation, color, FilterOperation::DROP_SHADOW);
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp (114519 => 114520)


--- trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp	2012-04-18 17:05:11 UTC (rev 114520)
@@ -133,21 +133,18 @@
 
     if (blendToPassthrough)
         return DropShadowFilterOperation::create(
-            WebCore::blend(m_x, 0, progress),
-            WebCore::blend(m_y, 0, progress),
+            WebCore::blend(m_location, IntPoint(), progress),
             WebCore::blend(m_stdDeviation, 0, progress),
             WebCore::blend(m_color, Color(Color::transparent), progress),
             m_type);
 
     const DropShadowFilterOperation* fromOp = static_cast<const DropShadowFilterOperation*>(from);
-    int fromX = fromOp ? fromOp->x() : 0;
-    int fromY = fromOp ? fromOp->y() : 0;
+    IntPoint fromLocation = fromOp ? fromOp->location() : IntPoint();
     int fromStdDeviation = fromOp ? fromOp->stdDeviation() : 0;
     Color fromColor = fromOp ? fromOp->color() : Color(Color::transparent);
     
     return DropShadowFilterOperation::create(
-        WebCore::blend(fromX, m_x, progress),
-        WebCore::blend(fromY, m_y, progress),
+        WebCore::blend(fromLocation, m_location, progress),
         WebCore::blend(fromStdDeviation, m_stdDeviation, progress),
         WebCore::blend(fromColor, m_color, progress), m_type);
 }

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h (114519 => 114520)


--- trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h	2012-04-18 17:05:11 UTC (rev 114520)
@@ -338,18 +338,19 @@
 
 class DropShadowFilterOperation : public FilterOperation {
 public:
-    static PassRefPtr<DropShadowFilterOperation> create(int x, int y, int stdDeviation, Color color, OperationType type)
+    static PassRefPtr<DropShadowFilterOperation> create(const IntPoint& location, int stdDeviation, Color color, OperationType type)
     {
-        return adoptRef(new DropShadowFilterOperation(x, y, stdDeviation, color, type));
+        return adoptRef(new DropShadowFilterOperation(location, stdDeviation, color, type));
     }
 
     virtual PassRefPtr<FilterOperation> clone() const
     {
-        return adoptRef(new DropShadowFilterOperation(m_x, m_y, m_stdDeviation, m_color, m_type));
+        return adoptRef(new DropShadowFilterOperation(m_location, m_stdDeviation, m_color, m_type));
     }
 
-    int x() const { return m_x; }
-    int y() const { return m_y; }
+    int x() const { return m_location.x(); }
+    int y() const { return m_location.y(); }
+    IntPoint location() const { return m_location; }
     int stdDeviation() const { return m_stdDeviation; }
     Color color() const { return m_color; }
 
@@ -365,20 +366,18 @@
         if (!isSameType(o))
             return false;
         const DropShadowFilterOperation* other = static_cast<const DropShadowFilterOperation*>(&o);
-        return m_x == other->m_x && m_y == other->m_y && m_stdDeviation == other->m_stdDeviation && m_color == other->m_color;
+        return m_location == other->m_location && m_stdDeviation == other->m_stdDeviation && m_color == other->m_color;
     }
 
-    DropShadowFilterOperation(int x, int y, int stdDeviation, Color color, OperationType type)
+    DropShadowFilterOperation(const IntPoint& location, int stdDeviation, Color color, OperationType type)
         : FilterOperation(type)
-        , m_x(x)
-        , m_y(y)
+        , m_location(location)
         , m_stdDeviation(stdDeviation)
         , m_color(color)
     {
     }
 
-    int m_x; // FIXME: x and y should be Lengths?
-    int m_y;
+    IntPoint m_location; // FIXME: should location be in Lengths?
     int m_stdDeviation;
     Color m_color;
 };

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (114519 => 114520)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-04-18 17:05:11 UTC (rev 114520)
@@ -2814,16 +2814,16 @@
     return true;
 }
 
-static inline LayoutRect areaCastingShadowInHole(const LayoutRect& holeRect, int shadowBlur, int shadowSpread, const LayoutSize& shadowOffset)
+static inline IntRect areaCastingShadowInHole(const IntRect& holeRect, int shadowBlur, int shadowSpread, const IntSize& shadowOffset)
 {
-    LayoutRect bounds(holeRect);
+    IntRect bounds(holeRect);
     
     bounds.inflate(shadowBlur);
 
     if (shadowSpread < 0)
         bounds.inflate(-shadowSpread);
     
-    LayoutRect offsetBounds = bounds;
+    IntRect offsetBounds = bounds;
     offsetBounds.move(-shadowOffset);
     return unionRect(bounds, offsetBounds);
 }
@@ -2846,9 +2846,9 @@
         if (shadow->style() != shadowStyle)
             continue;
 
-        LayoutSize shadowOffset(shadow->x(), shadow->y());
-        LayoutUnit shadowBlur = shadow->blur();
-        LayoutUnit shadowSpread = shadow->spread();
+        IntSize shadowOffset(shadow->x(), shadow->y());
+        int shadowBlur = shadow->blur();
+        int shadowSpread = shadow->spread();
         
         if (shadowOffset.isZero() && !shadowBlur && !shadowSpread)
             continue;
@@ -2861,7 +2861,7 @@
             if (fillRect.isEmpty())
                 continue;
 
-            LayoutRect shadowRect(border.rect());
+            IntRect shadowRect(border.rect());
             shadowRect.inflate(shadowBlur + shadowSpread);
             shadowRect.move(shadowOffset);
 
@@ -2870,7 +2870,7 @@
 
             // Move the fill just outside the clip, adding 1 pixel separation so that the fill does not
             // bleed in (due to antialiasing) if the context is transformed.
-            LayoutSize extraOffset(paintRect.width() + max<LayoutUnit>(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0);
+            IntSize extraOffset(paintRect.pixelSnappedWidth() + max(0, shadowOffset.width()) + shadowBlur + 2 * shadowSpread + 1, 0);
             shadowOffset -= extraOffset;
             fillRect.move(extraOffset);
 
@@ -2901,7 +2901,7 @@
                     context->fillRoundedRect(fillRect, Color::black, s->colorSpace());
                 }
             } else {
-                LayoutRect rectToClipOut = border.rect();
+                IntRect rectToClipOut = border.rect();
 
                 // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
                 // when painting the shadow. On the other hand, it introduces subpixel gaps along the
@@ -2916,12 +2916,12 @@
                 }
 
                 if (!rectToClipOut.isEmpty())
-                    context->clipOut(pixelSnappedIntRect(rectToClipOut));
+                    context->clipOut(rectToClipOut);
                 context->fillRect(fillRect.rect(), Color::black, s->colorSpace());
             }
         } else {
             // Inset shadow.
-            LayoutRect holeRect(border.rect());
+            IntRect holeRect(border.rect());
             holeRect.inflate(-shadowSpread);
 
             if (holeRect.isEmpty()) {
@@ -2934,11 +2934,11 @@
 
             if (!includeLogicalLeftEdge) {
                 if (isHorizontal) {
-                    holeRect.move(-max<LayoutUnit>(shadowOffset.width(), 0) - shadowBlur, 0);
-                    holeRect.setWidth(holeRect.width() + max<LayoutUnit>(shadowOffset.width(), 0) + shadowBlur);
+                    holeRect.move(-max(shadowOffset.width(), 0) - shadowBlur, 0);
+                    holeRect.setWidth(holeRect.width() + max(shadowOffset.width(), 0) + shadowBlur);
                 } else {
-                    holeRect.move(0, -max<LayoutUnit>(shadowOffset.height(), 0) - shadowBlur);
-                    holeRect.setHeight(holeRect.height() + max<LayoutUnit>(shadowOffset.height(), 0) + shadowBlur);
+                    holeRect.move(0, -max(shadowOffset.height(), 0) - shadowBlur);
+                    holeRect.setHeight(holeRect.height() + max(shadowOffset.height(), 0) + shadowBlur);
                 }
             }
             if (!includeLogicalRightEdge) {
@@ -2950,8 +2950,8 @@
 
             Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255);
 
-            LayoutRect outerRect = areaCastingShadowInHole(border.rect(), shadowBlur, shadowSpread, shadowOffset);
-            RoundedRect roundedHole(pixelSnappedIntRect(holeRect), border.radii());
+            IntRect outerRect = areaCastingShadowInHole(border.rect(), shadowBlur, shadowSpread, shadowOffset);
+            RoundedRect roundedHole(holeRect, border.radii());
 
             GraphicsContextStateSaver stateSaver(*context);
             if (hasBorderRadius) {
@@ -2962,7 +2962,7 @@
             } else
                 context->clip(border.rect());
 
-            LayoutSize extraOffset(2 * paintRect.width() + max<LayoutUnit>(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0);
+            IntSize extraOffset(2 * paintRect.pixelSnappedWidth() + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0);
             context->translate(extraOffset.width(), extraOffset.height());
             shadowOffset -= extraOffset;
 
@@ -2971,7 +2971,7 @@
             else
                 context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
 
-            context->fillRectWithRoundedHole(pixelSnappedIntRect(outerRect), roundedHole, fillColor, s->colorSpace());
+            context->fillRectWithRoundedHole(outerRect, roundedHole, fillColor, s->colorSpace());
         }
     }
 }

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (114519 => 114520)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2012-04-18 17:05:11 UTC (rev 114520)
@@ -1169,10 +1169,10 @@
             continue;
         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);
+        top = min<LayoutUnit>(top, shadow->y() - blurAndSpread);
+        right = max<LayoutUnit>(right, shadow->x() + blurAndSpread);
+        bottom = max<LayoutUnit>(bottom, shadow->y() + blurAndSpread);
+        left = min<LayoutUnit>(left, shadow->x() - blurAndSpread);
     }
 }
 
@@ -1186,8 +1186,8 @@
             continue;
         int blurAndSpread = shadow->blur() + shadow->spread();
 
-        left = min(left, shadow->x() - blurAndSpread);
-        right = max(right, shadow->x() + blurAndSpread);
+        left = min<LayoutUnit>(left, shadow->x() - blurAndSpread);
+        right = max<LayoutUnit>(right, shadow->x() + blurAndSpread);
     }
 }
 
@@ -1201,8 +1201,8 @@
             continue;
         int blurAndSpread = shadow->blur() + shadow->spread();
 
-        top = min(top, shadow->y() - blurAndSpread);
-        bottom = max(bottom, shadow->y() + blurAndSpread);
+        top = min<LayoutUnit>(top, shadow->y() - blurAndSpread);
+        bottom = max<LayoutUnit>(bottom, shadow->y() + blurAndSpread);
     }
 }
 

Modified: trunk/Source/WebCore/rendering/style/ShadowData.cpp (114519 => 114520)


--- trunk/Source/WebCore/rendering/style/ShadowData.cpp	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/rendering/style/ShadowData.cpp	2012-04-18 17:05:11 UTC (rev 114520)
@@ -27,8 +27,7 @@
 namespace WebCore {
 
 ShadowData::ShadowData(const ShadowData& o)
-    : m_x(o.m_x)
-    , m_y(o.m_y)
+    : m_location(o.m_location)
     , m_blur(o.m_blur)
     , m_spread(o.m_spread)
     , m_color(o.m_color)
@@ -44,8 +43,7 @@
         || (m_next && o.m_next && *m_next != *o.m_next))
         return false;
     
-    return m_x == o.m_x
-        && m_y == o.m_y
+    return m_location == o.m_location
         && m_blur == o.m_blur
         && m_spread == o.m_spread
         && m_style == o.m_style
@@ -53,7 +51,7 @@
         && m_isWebkitBoxShadow == o.m_isWebkitBoxShadow;
 }
 
-static inline void calculateShadowExtent(const ShadowData* shadow, int additionalOutlineSize, LayoutUnit& shadowLeft, LayoutUnit& shadowRight, LayoutUnit& shadowTop, LayoutUnit& shadowBottom)
+static inline void calculateShadowExtent(const ShadowData* shadow, int additionalOutlineSize, int& shadowLeft, int& shadowRight, int& shadowTop, int& shadowBottom)
 {
     do {
         int blurAndSpread = shadow->blur() + shadow->spread() + additionalOutlineSize;
@@ -70,10 +68,10 @@
 
 void ShadowData::adjustRectForShadow(LayoutRect& rect, int additionalOutlineSize) const
 {
-    LayoutUnit shadowLeft = 0;
-    LayoutUnit shadowRight = 0;
-    LayoutUnit shadowTop = 0;
-    LayoutUnit shadowBottom = 0;
+    int shadowLeft = 0;
+    int shadowRight = 0;
+    int shadowTop = 0;
+    int shadowBottom = 0;
     calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom);
 
     rect.move(shadowLeft, shadowTop);
@@ -83,10 +81,10 @@
 
 void ShadowData::adjustRectForShadow(FloatRect& rect, int additionalOutlineSize) const
 {
-    LayoutUnit shadowLeft = 0;
-    LayoutUnit shadowRight = 0;
-    LayoutUnit shadowTop = 0;
-    LayoutUnit shadowBottom = 0;
+    int shadowLeft = 0;
+    int shadowRight = 0;
+    int shadowTop = 0;
+    int shadowBottom = 0;
     calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom);
 
     rect.move(shadowLeft, shadowTop);

Modified: trunk/Source/WebCore/rendering/style/ShadowData.h (114519 => 114520)


--- trunk/Source/WebCore/rendering/style/ShadowData.h	2012-04-18 16:53:46 UTC (rev 114519)
+++ trunk/Source/WebCore/rendering/style/ShadowData.h	2012-04-18 17:05:11 UTC (rev 114520)
@@ -40,18 +40,15 @@
     WTF_MAKE_FAST_ALLOCATED;
 public:
     ShadowData()
-        : m_x(0)
-        , m_y(0)
-        , m_blur(0)
+        : m_blur(0)
         , m_spread(0)
         , m_style(Normal)
         , m_isWebkitBoxShadow(false)
     {
     }
 
-    ShadowData(LayoutUnit x, LayoutUnit y, int blur, int spread, ShadowStyle style, bool isWebkitBoxShadow, const Color& color)
-        : m_x(x)
-        , m_y(y)
+    ShadowData(const IntPoint& location, int blur, int spread, ShadowStyle style, bool isWebkitBoxShadow, const Color& color)
+        : m_location(location)
         , m_blur(blur)
         , m_spread(spread)
         , m_color(color)
@@ -68,8 +65,9 @@
         return !(*this == o);
     }
     
-    LayoutUnit x() const { return m_x; }
-    LayoutUnit y() const { return m_y; }
+    int x() const { return m_location.x(); }
+    int y() const { return m_location.y(); }
+    IntPoint location() const { return m_location; }
     int blur() const { return m_blur; }
     int spread() const { return m_spread; }
     ShadowStyle style() const { return m_style; }
@@ -83,8 +81,7 @@
     void adjustRectForShadow(FloatRect&, int additionalOutlineSize = 0) const;
 
 private:
-    LayoutUnit m_x;
-    LayoutUnit m_y;
+    IntPoint m_location;
     int m_blur;
     int m_spread;
     Color m_color;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to