 Chromium Code Reviews
 Chromium Code Reviews Issue 23241010:
  Support subpixel values for text-shadow and box-shadow  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 23241010:
  Support subpixel values for text-shadow and box-shadow  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| Index: Source/core/rendering/style/ShadowList.cpp | 
| diff --git a/Source/core/rendering/style/ShadowList.cpp b/Source/core/rendering/style/ShadowList.cpp | 
| index 675effec90bcd16241bfcfb6b90478343ebb3a90..527dff48f5d184db91434e76a5e342e557abe220 100644 | 
| --- a/Source/core/rendering/style/ShadowList.cpp | 
| +++ b/Source/core/rendering/style/ShadowList.cpp | 
| @@ -32,11 +32,10 @@ | 
| #include "core/rendering/style/ShadowList.h" | 
| #include "platform/geometry/FloatRect.h" | 
| -#include "platform/geometry/LayoutRect.h" | 
| namespace WebCore { | 
| -static inline void calculateShadowExtent(const ShadowList* shadowList, int additionalOutlineSize, int& shadowLeft, int& shadowRight, int& shadowTop, int& shadowBottom) | 
| +static inline void calculateShadowExtent(const ShadowList* shadowList, float additionalOutlineSize, float& shadowLeft, float& shadowRight, float& shadowTop, float& shadowBottom) | 
| { | 
| ASSERT(shadowList); | 
| size_t shadowCount = shadowList->shadows().size(); | 
| @@ -44,7 +43,7 @@ static inline void calculateShadowExtent(const ShadowList* shadowList, int addit | 
| const ShadowData& shadow = shadowList->shadows()[i]; | 
| if (shadow.style() == Inset) | 
| continue; | 
| - int blurAndSpread = shadow.blur() + shadow.spread() + additionalOutlineSize; | 
| + float blurAndSpread = shadow.blur() + shadow.spread() + additionalOutlineSize; | 
| shadowLeft = std::min(shadow.x() - blurAndSpread, shadowLeft); | 
| shadowRight = std::max(shadow.x() + blurAndSpread, shadowRight); | 
| shadowTop = std::min(shadow.y() - blurAndSpread, shadowTop); | 
| @@ -52,12 +51,12 @@ static inline void calculateShadowExtent(const ShadowList* shadowList, int addit | 
| } | 
| } | 
| -void ShadowList::adjustRectForShadow(LayoutRect& rect, int additionalOutlineSize) const | 
| +void ShadowList::adjustRectForShadow(LayoutRect& rect, LayoutUnit additionalOutlineSize) const | 
| 
cbiesinger
2014/01/15 21:27:40
Turns out we do need both versions; rendering/svg/
 | 
| { | 
| - int shadowLeft = 0; | 
| - int shadowRight = 0; | 
| - int shadowTop = 0; | 
| - int shadowBottom = 0; | 
| + float shadowLeft = 0; | 
| + float shadowRight = 0; | 
| + float shadowTop = 0; | 
| + float shadowBottom = 0; | 
| calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom); | 
| rect.move(shadowLeft, shadowTop); | 
| @@ -65,12 +64,12 @@ void ShadowList::adjustRectForShadow(LayoutRect& rect, int additionalOutlineSize | 
| rect.setHeight(rect.height() - shadowTop + shadowBottom); | 
| } | 
| -void ShadowList::adjustRectForShadow(FloatRect& rect, int additionalOutlineSize) const | 
| +void ShadowList::adjustRectForShadow(FloatRect& rect, float additionalOutlineSize) const | 
| { | 
| - int shadowLeft = 0; | 
| - int shadowRight = 0; | 
| - int shadowTop = 0; | 
| - int shadowBottom = 0; | 
| + float shadowLeft = 0; | 
| + float shadowRight = 0; | 
| + float shadowTop = 0; | 
| + float shadowBottom = 0; | 
| calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom); | 
| rect.move(shadowLeft, shadowTop); | 
| @@ -87,8 +86,8 @@ PassRefPtr<ShadowList> ShadowList::blend(const ShadowList* from, const ShadowLis | 
| ShadowDataVector shadows; | 
| - DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (IntPoint(), 0, 0, Normal, Color::transparent)); | 
| - DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (IntPoint(), 0, 0, Inset, Color::transparent)); | 
| + DEFINE_STATIC_LOCAL(ShadowData, defaultShadowData, (FloatPoint(), 0, 0, Normal, Color::transparent)); | 
| + DEFINE_STATIC_LOCAL(ShadowData, defaultInsetShadowData, (FloatPoint(), 0, 0, Inset, Color::transparent)); | 
| size_t maxLength = std::max(fromLength, toLength); | 
| for (size_t i = 0; i < maxLength; ++i) { |