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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 T StyleBuilderConverter::convertLineWidth(StyleResolverState& state, CSSValue* v
alue) | 66 T StyleBuilderConverter::convertLineWidth(StyleResolverState& state, CSSValue* v
alue) |
67 { | 67 { |
68 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 68 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
69 CSSValueID valueID = primitiveValue->getValueID(); | 69 CSSValueID valueID = primitiveValue->getValueID(); |
70 if (valueID == CSSValueThin) | 70 if (valueID == CSSValueThin) |
71 return 1; | 71 return 1; |
72 if (valueID == CSSValueMedium) | 72 if (valueID == CSSValueMedium) |
73 return 3; | 73 return 3; |
74 if (valueID == CSSValueThick) | 74 if (valueID == CSSValueThick) |
75 return 5; | 75 return 5; |
76 if (primitiveValue->isViewportPercentageLength()) | |
77 return intValueForLength(primitiveValue->viewportPercentageLength(), 0,
state.document().renderView()); | |
78 if (valueID == CSSValueInvalid) { | 76 if (valueID == CSSValueInvalid) { |
79 // Any original result that was >= 1 should not be allowed to fall below
1. | 77 // Any original result that was >= 1 should not be allowed to fall below
1. |
80 // This keeps border lines from vanishing. | 78 // This keeps border lines from vanishing. |
81 T result = primitiveValue->computeLength<T>(state.cssToLengthConversionD
ata()); | 79 T result = primitiveValue->computeLength<T>(state.cssToLengthConversionD
ata()); |
82 if (state.style()->effectiveZoom() < 1.0f && result < 1.0) { | 80 if (state.style()->effectiveZoom() < 1.0f && result < 1.0) { |
83 T originalLength = primitiveValue->computeLength<T>(state.cssToLengt
hConversionData().copyWithAdjustedZoom(1.0)); | 81 T originalLength = primitiveValue->computeLength<T>(state.cssToLengt
hConversionData().copyWithAdjustedZoom(1.0)); |
84 if (originalLength >= 1.0) | 82 if (originalLength >= 1.0) |
85 return 1.0; | 83 return 1.0; |
86 } | 84 } |
87 return result; | 85 return result; |
88 } | 86 } |
89 ASSERT_NOT_REACHED(); | 87 ASSERT_NOT_REACHED(); |
90 return 0; | 88 return 0; |
91 } | 89 } |
92 | 90 |
93 template <CSSValueID IdForNone> | 91 template <CSSValueID IdForNone> |
94 AtomicString StyleBuilderConverter::convertString(StyleResolverState&, CSSValue*
value) | 92 AtomicString StyleBuilderConverter::convertString(StyleResolverState&, CSSValue*
value) |
95 { | 93 { |
96 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 94 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
97 if (primitiveValue->getValueID() == IdForNone) | 95 if (primitiveValue->getValueID() == IdForNone) |
98 return nullAtom; | 96 return nullAtom; |
99 return primitiveValue->getStringValue(); | 97 return primitiveValue->getStringValue(); |
100 } | 98 } |
101 | 99 |
102 } // namespace WebCore | 100 } // namespace WebCore |
103 | 101 |
104 #endif | 102 #endif |
OLD | NEW |