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

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

Issue 1412103005: Make sure line widths in the range of 0px and 1px are rounded up to 1px for visibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 f1760d084e5beb529ad8c7beb818961d3d64636a..dde8e17743f67a8c20026d210dda62fe83e42953 100644
--- a/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp
@@ -99,6 +99,13 @@ template<typename T> T animatableValueClampTo(const AnimatableValue* value, T mi
return clampTo<T>(roundForImpreciseConversion<T>(toAnimatableDouble(value)->toDouble()), min, max);
}
+template<typename T> T animatableLineWidthClamp(const AnimatableValue* value)
+{
+ double doubleValue = toAnimatableDouble(value)->toDouble();
+ // This matches StyleBuilderConverter::convertLineWidth().
+ return (doubleValue > 0 && doubleValue < 1) ? 1 : animatableValueClampTo<T>(value);
+}
+
LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleResolverState& state, ValueRange range = ValueRangeAll)
{
const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value);
@@ -315,7 +322,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
style->setBorderBottomRightRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative));
return;
case CSSPropertyBorderBottomWidth:
- style->setBorderBottomWidth(animatableValueClampTo<unsigned>(value));
+ style->setBorderBottomWidth(animatableLineWidthClamp<unsigned>(value));
return;
case CSSPropertyBorderImageOutset:
style->setBorderImageOutset(animatableValueToBorderImageLengthBox(value, state));
@@ -335,14 +342,14 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
style->setVisitedLinkBorderLeftColor(toAnimatableColor(value)->visitedLinkColor());
return;
case CSSPropertyBorderLeftWidth:
- style->setBorderLeftWidth(animatableValueClampTo<unsigned>(value));
+ style->setBorderLeftWidth(animatableLineWidthClamp<unsigned>(value));
return;
case CSSPropertyBorderRightColor:
style->setBorderRightColor(toAnimatableColor(value)->color());
style->setVisitedLinkBorderRightColor(toAnimatableColor(value)->visitedLinkColor());
return;
case CSSPropertyBorderRightWidth:
- style->setBorderRightWidth(animatableValueClampTo<unsigned>(value));
+ style->setBorderRightWidth(animatableLineWidthClamp<unsigned>(value));
return;
case CSSPropertyBorderTopColor:
style->setBorderTopColor(toAnimatableColor(value)->color());
@@ -355,7 +362,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
style->setBorderTopRightRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative));
return;
case CSSPropertyBorderTopWidth:
- style->setBorderTopWidth(animatableValueClampTo<unsigned>(value));
+ style->setBorderTopWidth(animatableLineWidthClamp<unsigned>(value));
return;
case CSSPropertyBottom:
style->setBottom(animatableValueToLength(value, state));
@@ -470,7 +477,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
style->setOutlineOffset(animatableValueClampTo<int>(value));
return;
case CSSPropertyOutlineWidth:
- style->setOutlineWidth(animatableValueClampTo<unsigned short>(value));
+ style->setOutlineWidth(animatableLineWidthClamp<unsigned short>(value));
return;
case CSSPropertyPaddingBottom:
style->setPaddingBottom(animatableValueToLength(value, state, ValueRangeNonNegative));
@@ -551,7 +558,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
style->setColumnWidth(clampTo(toAnimatableDouble(value)->toDouble(), std::numeric_limits<float>::epsilon()));
return;
case CSSPropertyWebkitColumnRuleWidth:
- style->setColumnRuleWidth(clampTo<unsigned short>(toAnimatableDouble(value)->toDouble()));
+ style->setColumnRuleWidth(animatableLineWidthClamp<unsigned short>(value));
return;
case CSSPropertyWebkitFilter:
style->setFilter(toAnimatableFilterOperations(value)->operations());

Powered by Google App Engine
This is Rietveld 408576698