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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h

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
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h
index e404ef65c614cd2cb476a38b9f45699938cc5675..d20a4abcb1487cd7f85366140ba1143a490f8111 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h
@@ -135,15 +135,15 @@ T StyleBuilderConverter::convertLineWidth(StyleResolverState& state, const CSSVa
if (valueID == CSSValueThick)
return 5;
if (valueID == CSSValueInvalid) {
- // Any original result that was >= 1 should not be allowed to fall below 1.
- // This keeps border lines from vanishing.
- T result = primitiveValue.computeLength<T>(state.cssToLengthConversionData());
- if (state.style()->effectiveZoom() < 1.0f && result < 1.0) {
- T originalLength = primitiveValue.computeLength<T>(state.cssToLengthConversionData().copyWithAdjustedZoom(1.0));
- if (originalLength >= 1.0)
- return 1.0;
- }
- return result;
+ // FIXME: We are moving to use the full page zoom implementation to handle high-dpi.
+ // In that case specyfing a border-width of less than 1px would result in a border that is one device pixel thick.
+ // With this change that would instead be rounded up to 2 device pixels.
+ // Consider clamping it to device pixels or zoom adjusted CSS pixels instead of raw CSS pixels.
+ // Reference crbug.com/485650 and crbug.com/382483
+ double result = primitiveValue.computeLength<double>(state.cssToLengthConversionData());
+ if (result > 0.0 && result < 1.0)
+ return 1.0;
+ return clampTo<T>(roundForImpreciseConversion<T>(result), defaultMinimumForClamp<T>(), defaultMaximumForClamp<T>());
}
ASSERT_NOT_REACHED();
return 0;
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698