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

Side by Side Diff: Source/core/css/resolver/StyleBuilderConverter.h

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rename browser zoom to page zoom Created 6 years, 11 months 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
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « Source/core/css/resolver/MatchedPropertiesCache.cpp ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698