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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 { 128 {
129 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value); 129 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
130 CSSValueID valueID = primitiveValue.getValueID(); 130 CSSValueID valueID = primitiveValue.getValueID();
131 if (valueID == CSSValueThin) 131 if (valueID == CSSValueThin)
132 return 1; 132 return 1;
133 if (valueID == CSSValueMedium) 133 if (valueID == CSSValueMedium)
134 return 3; 134 return 3;
135 if (valueID == CSSValueThick) 135 if (valueID == CSSValueThick)
136 return 5; 136 return 5;
137 if (valueID == CSSValueInvalid) { 137 if (valueID == CSSValueInvalid) {
138 // Any original result that was >= 1 should not be allowed to fall below 1. 138 double result = primitiveValue.computeLength<double>(state.cssToLengthCo nversionData());
eae 2015/11/02 03:02:02 I'd argue that a border that is specified to be 0.
eae 2015/11/02 03:14:46 It's probably more important to match the other br
139 // This keeps border lines from vanishing. 139 if (result > 0.0 && result < 1.0)
140 T result = primitiveValue.computeLength<T>(state.cssToLengthConversionDa ta()); 140 return 1.0;
141 if (state.style()->effectiveZoom() < 1.0f && result < 1.0) { 141 return clampTo<T>(roundForImpreciseConversion<T>(result), defaultMinimum ForClamp<T>(), defaultMaximumForClamp<T>());
142 T originalLength = primitiveValue.computeLength<T>(state.cssToLength ConversionData().copyWithAdjustedZoom(1.0));
143 if (originalLength >= 1.0)
144 return 1.0;
145 }
146 return result;
147 } 142 }
148 ASSERT_NOT_REACHED(); 143 ASSERT_NOT_REACHED();
149 return 0; 144 return 0;
150 } 145 }
151 146
152 template <CSSValueID IdForNone> 147 template <CSSValueID IdForNone>
153 AtomicString StyleBuilderConverter::convertString(StyleResolverState&, const CSS Value& value) 148 AtomicString StyleBuilderConverter::convertString(StyleResolverState&, const CSS Value& value)
154 { 149 {
155 if (value.isStringValue()) 150 if (value.isStringValue())
156 return AtomicString(toCSSStringValue(value).value()); 151 return AtomicString(toCSSStringValue(value).value());
157 ASSERT(toCSSPrimitiveValue(value).getValueID() == IdForNone); 152 ASSERT(toCSSPrimitiveValue(value).getValueID() == IdForNone);
158 return nullAtom; 153 return nullAtom;
159 } 154 }
160 155
161 } // namespace blink 156 } // namespace blink
162 157
163 #endif 158 #endif
OLDNEW
« 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