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

Unified Diff: third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp

Issue 2640143005: Support subpixel layout for borders. (Closed)
Patch Set: Created 3 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
Index: third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp b/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp
index 710af227536c2c89fc686705c72fb0a2f8e9d38f..e859ea638ba85ad31cee4811bec8c3a159039580 100644
--- a/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp
@@ -129,6 +129,16 @@ T animatableLineWidthClamp(const AnimatableValue* value,
return (lineWidth > 0 && lineWidth < 1) ? 1 : roundedClampTo<T>(lineWidth);
}
+float animatableLineWidth(const AnimatableValue* value,
+ const StyleResolverState& state) {
+ double lineWidth =
+ toAnimatableLength(value)
+ ->getLength(state.style()->effectiveZoom(), ValueRangeNonNegative)
+ .pixels();
+ // This matches StyleBuilderConverter::convertLineWidth().
+ return (lineWidth > 0 && lineWidth < 1) ? 1 : lineWidth;
+}
+
LengthBox animatableValueToLengthBox(const AnimatableValue* value,
const StyleResolverState& state,
ValueRange range = ValueRangeAll) {
@@ -358,8 +368,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
animatableValueToLengthSize(value, state, ValueRangeNonNegative));
return;
case CSSPropertyBorderBottomWidth:
- style->setBorderBottomWidth(
- animatableLineWidthClamp<unsigned>(value, state));
+ style->setBorderBottomWidth(animatableLineWidth(value, state));
return;
case CSSPropertyBorderImageOutset:
style->setBorderImageOutset(
@@ -386,8 +395,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
toAnimatableColor(value)->visitedLinkColor());
return;
case CSSPropertyBorderLeftWidth:
- style->setBorderLeftWidth(
- animatableLineWidthClamp<unsigned>(value, state));
+ style->setBorderLeftWidth(animatableLineWidth(value, state));
return;
case CSSPropertyBorderRightColor:
style->setBorderRightColor(toAnimatableColor(value)->getColor());
@@ -395,8 +403,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
toAnimatableColor(value)->visitedLinkColor());
return;
case CSSPropertyBorderRightWidth:
- style->setBorderRightWidth(
- animatableLineWidthClamp<unsigned>(value, state));
+ style->setBorderRightWidth(animatableLineWidth(value, state));
return;
case CSSPropertyBorderTopColor:
style->setBorderTopColor(toAnimatableColor(value)->getColor());
@@ -412,8 +419,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
animatableValueToLengthSize(value, state, ValueRangeNonNegative));
return;
case CSSPropertyBorderTopWidth:
- style->setBorderTopWidth(
- animatableLineWidthClamp<unsigned>(value, state));
+ style->setBorderTopWidth(animatableLineWidth(value, state));
return;
case CSSPropertyBottom:
style->setBottom(animatableValueToLength(value, state));

Powered by Google App Engine
This is Rietveld 408576698