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

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

Issue 2640143005: Support subpixel layout for borders. (Closed)
Patch Set: Rebaselined tests. Created 3 years, 10 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 97d0bf45f000bfeb95e81df3908fd38824c823c5..8e62d549e182395d9f8d5300735b7eaa95f8025c 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) {
@@ -360,8 +370,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(
@@ -388,8 +397,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());
@@ -397,8 +405,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());
@@ -414,8 +421,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));
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSProperties.json5 ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698