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

Unified Diff: Source/core/rendering/InlineTextBox.cpp

Issue 23241010: Support subpixel values for text-shadow and box-shadow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: missed a virtual test Created 7 years 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
Index: Source/core/rendering/InlineTextBox.cpp
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp
index 60a35deccf1253ac5df7bbcae293e5ccc1ae2019..7cac3b83f45f1b33caab4236bf8a8c3ba6553e22 100644
--- a/Source/core/rendering/InlineTextBox.cpp
+++ b/Source/core/rendering/InlineTextBox.cpp
@@ -402,8 +402,8 @@ static void paintTextWithShadows(GraphicsContext* context,
DrawLooper drawLooper;
for (size_t i = shadowList->shadows().size(); i--; ) {
const ShadowData& shadow = shadowList->shadows()[i];
- int shadowX = horizontal ? shadow.x() : shadow.y();
- int shadowY = horizontal ? shadow.y() : -shadow.x();
+ float shadowX = horizontal ? shadow.x() : shadow.y();
+ float shadowY = horizontal ? shadow.y() : -shadow.x();
FloatSize offset(shadowX, shadowY);
drawLooper.addShadow(offset, shadow.blur(), renderer->resolveColor(shadow.color()),
DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresAlpha);
@@ -1089,18 +1089,18 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint&
const float textDecorationThickness = std::max(1.f, styleToUse->computedFontSize() / 10.f);
context->setStrokeThickness(textDecorationThickness);
- int extraOffset = 0;
+ float extraOffset = 0;
if (!linesAreOpaque && shadowCount > 1) {
FloatRect clipRect(localOrigin, FloatSize(width, baseline + 2));
for (size_t i = shadowCount; i--; ) {
const ShadowData& s = shadowList->shadows()[i];
FloatRect shadowRect(localOrigin, FloatSize(width, baseline + 2));
shadowRect.inflate(s.blur());
- int shadowX = isHorizontal() ? s.x() : s.y();
- int shadowY = isHorizontal() ? s.y() : -s.x();
+ float shadowX = isHorizontal() ? s.x() : s.y();
+ float shadowY = isHorizontal() ? s.y() : -s.x();
shadowRect.move(shadowX, shadowY);
clipRect.unite(shadowRect);
- extraOffset = max(extraOffset, max(0, shadowY) + s.blur());
+ extraOffset = max(extraOffset, max(0.0f, shadowY) + s.blur());
}
context->clip(clipRect);
extraOffset += baseline + 2;
@@ -1116,8 +1116,8 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint&
extraOffset = 0;
}
const ShadowData& shadow = shadowList->shadows()[i];
- int shadowX = isHorizontal() ? shadow.x() : shadow.y();
- int shadowY = isHorizontal() ? shadow.y() : -shadow.x();
+ float shadowX = isHorizontal() ? shadow.x() : shadow.y();
+ float shadowY = isHorizontal() ? shadow.y() : -shadow.x();
context->setShadow(FloatSize(shadowX, shadowY - extraOffset), shadow.blur(), shadow.color());
}

Powered by Google App Engine
This is Rietveld 408576698