Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1540)

Unified Diff: Source/core/rendering/style/ShadowList.cpp

Issue 23241010: Support subpixel values for text-shadow and box-shadow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed review comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/style/ShadowList.h ('k') | Source/platform/animation/AnimationUtilities.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8874d2494cb59967186a978da22e4ca0c560729c 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,25 +51,19 @@ static inline void calculateShadowExtent(const ShadowList* shadowList, int addit
}
}
-void ShadowList::adjustRectForShadow(LayoutRect& rect, int additionalOutlineSize) const
+void ShadowList::adjustRectForShadow(LayoutRect& rect, float additionalOutlineSize) const
{
- int shadowLeft = 0;
- int shadowRight = 0;
- int shadowTop = 0;
- int shadowBottom = 0;
- calculateShadowExtent(this, additionalOutlineSize, shadowLeft, shadowRight, shadowTop, shadowBottom);
-
- rect.move(shadowLeft, shadowTop);
- rect.setWidth(rect.width() - shadowLeft + shadowRight);
- rect.setHeight(rect.height() - shadowTop + shadowBottom);
+ FloatRect floatRect(rect);
+ adjustRectForShadow(floatRect);
+ rect = LayoutRect(floatRect);
}
-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 +80,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) {
« no previous file with comments | « Source/core/rendering/style/ShadowList.h ('k') | Source/platform/animation/AnimationUtilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698