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

Side by Side Diff: Source/core/css/CSSPrimitiveValue.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
« no previous file with comments | « Source/core/css/CSSMatrix.cpp ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }; 137 };
138 138
139 // This enum follows the BisonCSSParser::Units enum augmented with UNIT_FREQ UENCY for frequencies. 139 // This enum follows the BisonCSSParser::Units enum augmented with UNIT_FREQ UENCY for frequencies.
140 enum UnitCategory { 140 enum UnitCategory {
141 UNumber, 141 UNumber,
142 UPercent, 142 UPercent,
143 ULength, 143 ULength,
144 UAngle, 144 UAngle,
145 UTime, 145 UTime,
146 UFrequency, 146 UFrequency,
147 UViewportPercentageLength,
148 UResolution, 147 UResolution,
149 UOther 148 UOther
150 }; 149 };
151 static UnitCategory unitCategory(CSSPrimitiveValue::UnitTypes); 150 static UnitCategory unitCategory(CSSPrimitiveValue::UnitTypes);
152 151
153 bool isAngle() const 152 bool isAngle() const
154 { 153 {
155 return m_primitiveUnitType == CSS_DEG 154 return m_primitiveUnitType == CSS_DEG
156 || m_primitiveUnitType == CSS_RAD 155 || m_primitiveUnitType == CSS_RAD
157 || m_primitiveUnitType == CSS_GRAD 156 || m_primitiveUnitType == CSS_GRAD
158 || m_primitiveUnitType == CSS_TURN; 157 || m_primitiveUnitType == CSS_TURN;
159 } 158 }
160 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; } 159 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; }
161 bool isCounter() const { return m_primitiveUnitType == CSS_COUNTER; } 160 bool isCounter() const { return m_primitiveUnitType == CSS_COUNTER; }
162 bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX && m_primitiveUnitType <= CSS_PC; } 161 bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX && m_primitiveUnitType <= CSS_PC; }
163 bool isFontRelativeLength() const 162 bool isFontRelativeLength() const
164 { 163 {
165 return m_primitiveUnitType == CSS_EMS 164 return m_primitiveUnitType == CSS_EMS
166 || m_primitiveUnitType == CSS_EXS 165 || m_primitiveUnitType == CSS_EXS
167 || m_primitiveUnitType == CSS_REMS 166 || m_primitiveUnitType == CSS_REMS
168 || m_primitiveUnitType == CSS_CHS; 167 || m_primitiveUnitType == CSS_CHS;
169 } 168 }
170 bool isLength() const 169 bool isLength() const
171 { 170 {
172 unsigned short type = primitiveType(); 171 unsigned short type = primitiveType();
173 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type = = CSS_CHS; 172 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type = = CSS_CHS || isViewportPercentageLength();
174 } 173 }
175 bool isNumber() const { return primitiveType() == CSS_NUMBER; } 174 bool isNumber() const { return primitiveType() == CSS_NUMBER; }
176 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; } 175 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; }
177 bool isPx() const { return primitiveType() == CSS_PX; } 176 bool isPx() const { return primitiveType() == CSS_PX; }
178 bool isRect() const { return m_primitiveUnitType == CSS_RECT; } 177 bool isRect() const { return m_primitiveUnitType == CSS_RECT; }
179 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; } 178 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; }
180 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; } 179 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; }
181 bool isString() const { return m_primitiveUnitType == CSS_STRING; } 180 bool isString() const { return m_primitiveUnitType == CSS_STRING; }
182 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit Type == CSS_MS; } 181 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit Type == CSS_MS; }
183 bool isURI() const { return m_primitiveUnitType == CSS_URI; } 182 bool isURI() const { return m_primitiveUnitType == CSS_URI; }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; } 305 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; }
307 306
308 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa lueMappings.h 307 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa lueMappings.h
309 308
310 String customCSSText(CSSTextFormattingFlags = QuoteCSSStringIfNeeded) const; 309 String customCSSText(CSSTextFormattingFlags = QuoteCSSStringIfNeeded) const;
311 String customSerializeResolvingVariables(const HashMap<AtomicString, String> &) const; 310 String customSerializeResolvingVariables(const HashMap<AtomicString, String> &) const;
312 bool hasVariableReference() const; 311 bool hasVariableReference() const;
313 312
314 bool isQuirkValue() { return m_isQuirkValue; } 313 bool isQuirkValue() { return m_isQuirkValue; }
315 314
316 Length viewportPercentageLength();
317
318 PassRefPtr<CSSPrimitiveValue> cloneForCSSOM() const; 315 PassRefPtr<CSSPrimitiveValue> cloneForCSSOM() const;
319 void setCSSOMSafe() { m_isCSSOMSafe = true; } 316 void setCSSOMSafe() { m_isCSSOMSafe = true; }
320 317
321 bool equals(const CSSPrimitiveValue&) const; 318 bool equals(const CSSPrimitiveValue&) const;
322 319
323 static UnitTypes canonicalUnitTypeForCategory(UnitCategory); 320 static UnitTypes canonicalUnitTypeForCategory(UnitCategory);
324 static double conversionToCanonicalUnitsScaleFactor(unsigned short unitType) ; 321 static double conversionToCanonicalUnitsScaleFactor(unsigned short unitType) ;
325 322
326 private: 323 private:
327 CSSPrimitiveValue(CSSValueID); 324 CSSPrimitiveValue(CSSValueID);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 CSSBasicShape* shape; 377 CSSBasicShape* shape;
381 CSSCalcValue* calc; 378 CSSCalcValue* calc;
382 } m_value; 379 } m_value;
383 }; 380 };
384 381
385 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 382 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
386 383
387 } // namespace WebCore 384 } // namespace WebCore
388 385
389 #endif // CSSPrimitiveValue_h 386 #endif // CSSPrimitiveValue_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSMatrix.cpp ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698