| 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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 if (primitiveValue.isLength()) { | 843 if (primitiveValue.isLength()) { |
| 844 return primitiveValue.computeLength<Length>( | 844 return primitiveValue.computeLength<Length>( |
| 845 lineHeightToLengthConversionData(state)); | 845 lineHeightToLengthConversionData(state)); |
| 846 } | 846 } |
| 847 if (primitiveValue.isPercentage()) { | 847 if (primitiveValue.isPercentage()) { |
| 848 return Length( | 848 return Length( |
| 849 (state.style()->computedFontSize() * primitiveValue.getIntValue()) / | 849 (state.style()->computedFontSize() * primitiveValue.getIntValue()) / |
| 850 100.0, | 850 100.0, |
| 851 Fixed); | 851 Fixed); |
| 852 } | 852 } |
| 853 if (primitiveValue.isNumber()) | 853 if (primitiveValue.isNumber()) { |
| 854 return Length(primitiveValue.getDoubleValue() * 100.0, Percent); | 854 return Length(clampTo<float>(primitiveValue.getDoubleValue() * 100.0), |
| 855 Percent); |
| 856 } |
| 855 if (primitiveValue.isCalculated()) { | 857 if (primitiveValue.isCalculated()) { |
| 856 Length zoomedLength = Length(primitiveValue.cssCalcValue()->toCalcValue( | 858 Length zoomedLength = Length(primitiveValue.cssCalcValue()->toCalcValue( |
| 857 lineHeightToLengthConversionData(state))); | 859 lineHeightToLengthConversionData(state))); |
| 858 return Length( | 860 return Length( |
| 859 valueForLength(zoomedLength, | 861 valueForLength(zoomedLength, |
| 860 LayoutUnit(state.style()->computedFontSize())), | 862 LayoutUnit(state.style()->computedFontSize())), |
| 861 Fixed); | 863 Fixed); |
| 862 } | 864 } |
| 863 } | 865 } |
| 864 | 866 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 // Instead of the actual zoom, use 1 to avoid potential rounding errors | 1297 // Instead of the actual zoom, use 1 to avoid potential rounding errors |
| 1296 Length length = primitiveValue.convertToLength( | 1298 Length length = primitiveValue.convertToLength( |
| 1297 state.cssToLengthConversionData().copyWithAdjustedZoom(1)); | 1299 state.cssToLengthConversionData().copyWithAdjustedZoom(1)); |
| 1298 return *CSSPrimitiveValue::create(length, 1); | 1300 return *CSSPrimitiveValue::create(length, 1); |
| 1299 } | 1301 } |
| 1300 } | 1302 } |
| 1301 return value; | 1303 return value; |
| 1302 } | 1304 } |
| 1303 | 1305 |
| 1304 } // namespace blink | 1306 } // namespace blink |
| OLD | NEW |