OLD | NEW |
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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // FIXME: We are moving to use the full page zoom implementation to handle | 232 // FIXME: We are moving to use the full page zoom implementation to handle |
233 // high-dpi. In that case specyfing a border-width of less than 1px would | 233 // high-dpi. In that case specyfing a border-width of less than 1px would |
234 // result in a border that is one device pixel thick. With this change that | 234 // result in a border that is one device pixel thick. With this change that |
235 // would instead be rounded up to 2 device pixels. Consider clamping it to | 235 // would instead be rounded up to 2 device pixels. Consider clamping it to |
236 // device pixels or zoom adjusted CSS pixels instead of raw CSS pixels. | 236 // device pixels or zoom adjusted CSS pixels instead of raw CSS pixels. |
237 // Reference crbug.com/485650 and crbug.com/382483 | 237 // Reference crbug.com/485650 and crbug.com/382483 |
238 double result = | 238 double result = |
239 primitiveValue.computeLength<double>(state.cssToLengthConversionData()); | 239 primitiveValue.computeLength<double>(state.cssToLengthConversionData()); |
240 if (result > 0.0 && result < 1.0) | 240 if (result > 0.0 && result < 1.0) |
241 return 1.0; | 241 return 1.0; |
242 return clampTo<T>(roundForImpreciseConversion<T>(result), | 242 return clampTo<T>(roundForImpreciseConversion<T>(round(result)), |
243 defaultMinimumForClamp<T>(), defaultMaximumForClamp<T>()); | 243 defaultMinimumForClamp<T>(), defaultMaximumForClamp<T>()); |
244 } | 244 } |
245 | 245 |
246 template <CSSValueID cssValueFor0, CSSValueID cssValueFor100> | 246 template <CSSValueID cssValueFor0, CSSValueID cssValueFor100> |
247 Length StyleBuilderConverter::convertPositionLength(StyleResolverState& state, | 247 Length StyleBuilderConverter::convertPositionLength(StyleResolverState& state, |
248 const CSSValue& value) { | 248 const CSSValue& value) { |
249 if (value.isValuePair()) { | 249 if (value.isValuePair()) { |
250 const CSSValuePair& pair = toCSSValuePair(value); | 250 const CSSValuePair& pair = toCSSValuePair(value); |
251 Length length = StyleBuilderConverter::convertLength(state, pair.second()); | 251 Length length = StyleBuilderConverter::convertLength(state, pair.second()); |
252 if (toCSSIdentifierValue(pair.first()).getValueID() == cssValueFor0) | 252 if (toCSSIdentifierValue(pair.first()).getValueID() == cssValueFor0) |
(...skipping 24 matching lines...) Expand all Loading... |
277 const CSSValue& value) { | 277 const CSSValue& value) { |
278 if (value.isStringValue()) | 278 if (value.isStringValue()) |
279 return AtomicString(toCSSStringValue(value).value()); | 279 return AtomicString(toCSSStringValue(value).value()); |
280 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), IdForNone); | 280 DCHECK_EQ(toCSSIdentifierValue(value).getValueID(), IdForNone); |
281 return nullAtom; | 281 return nullAtom; |
282 } | 282 } |
283 | 283 |
284 } // namespace blink | 284 } // namespace blink |
285 | 285 |
286 #endif | 286 #endif |
OLD | NEW |