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

Side by Side Diff: Source/core/css/CSSPrimitiveValue.h

Issue 973623002: Fix serialization of content property to always quote (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add another method Created 5 years, 9 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 * (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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 CSS_IN = 8, 82 CSS_IN = 8,
83 CSS_PT = 9, 83 CSS_PT = 9,
84 CSS_PC = 10, 84 CSS_PC = 10,
85 CSS_DEG = 11, 85 CSS_DEG = 11,
86 CSS_RAD = 12, 86 CSS_RAD = 12,
87 CSS_GRAD = 13, 87 CSS_GRAD = 13,
88 CSS_MS = 14, 88 CSS_MS = 14,
89 CSS_S = 15, 89 CSS_S = 15,
90 CSS_HZ = 16, 90 CSS_HZ = 16,
91 CSS_KHZ = 17, 91 CSS_KHZ = 17,
92 CSS_STRING = 19, 92 CSS_CUSTOM_IDENT = 19,
93 CSS_URI = 20, 93 CSS_URI = 20,
94 CSS_IDENT = 21, 94 CSS_IDENT = 21,
95 CSS_ATTR = 22, 95 CSS_ATTR = 22,
96 CSS_COUNTER = 23, 96 CSS_COUNTER = 23,
97 CSS_RECT = 24, 97 CSS_RECT = 24,
98 CSS_RGBCOLOR = 25, 98 CSS_RGBCOLOR = 25,
99 // From CSS Values and Units. Viewport-percentage Lengths (vw/vh/vmin/vm ax). 99 // From CSS Values and Units. Viewport-percentage Lengths (vw/vh/vmin/vm ax).
100 CSS_VW = 26, 100 CSS_VW = 26,
101 CSS_VH = 27, 101 CSS_VH = 27,
102 CSS_VMIN = 28, 102 CSS_VMIN = 28,
(...skipping 16 matching lines...) Expand all
119 // This is used by the CSS Shapes draft 119 // This is used by the CSS Shapes draft
120 CSS_SHAPE = 111, 120 CSS_SHAPE = 111,
121 121
122 // Used by border images. 122 // Used by border images.
123 CSS_QUAD = 112, 123 CSS_QUAD = 112,
124 124
125 CSS_CALC = 113, 125 CSS_CALC = 113,
126 CSS_CALC_PERCENTAGE_WITH_NUMBER = 114, 126 CSS_CALC_PERCENTAGE_WITH_NUMBER = 114,
127 CSS_CALC_PERCENTAGE_WITH_LENGTH = 115, 127 CSS_CALC_PERCENTAGE_WITH_LENGTH = 115,
128 128
129 CSS_STRING = 116,
130
129 CSS_PROPERTY_ID = 117, 131 CSS_PROPERTY_ID = 117,
130 CSS_VALUE_ID = 118 132 CSS_VALUE_ID = 118
131 }; 133 };
132 134
133 enum LengthUnitType { 135 enum LengthUnitType {
134 UnitTypePixels = 0, 136 UnitTypePixels = 0,
135 UnitTypePercentage, 137 UnitTypePercentage,
136 UnitTypeFontSize, 138 UnitTypeFontSize,
137 UnitTypeFontXSize, 139 UnitTypeFontXSize,
138 UnitTypeRootFontSize, 140 UnitTypeRootFontSize,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 { 194 {
193 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type = = CSS_CHS || isViewportPercentageLength(type); 195 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type = = CSS_CHS || isViewportPercentageLength(type);
194 } 196 }
195 bool isLength() const { return isLength(primitiveType()); } 197 bool isLength() const { return isLength(primitiveType()); }
196 bool isNumber() const { return primitiveType() == CSS_NUMBER; } 198 bool isNumber() const { return primitiveType() == CSS_NUMBER; }
197 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; } 199 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; }
198 bool isPx() const { return primitiveType() == CSS_PX; } 200 bool isPx() const { return primitiveType() == CSS_PX; }
199 bool isRect() const { return m_primitiveUnitType == CSS_RECT; } 201 bool isRect() const { return m_primitiveUnitType == CSS_RECT; }
200 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; } 202 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; }
201 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; } 203 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; }
202 bool isString() const { return m_primitiveUnitType == CSS_STRING; } 204 bool isString() const { return m_primitiveUnitType == CSS_CUSTOM_IDENT || m_ primitiveUnitType == CSS_STRING; }
203 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit Type == CSS_MS; } 205 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit Type == CSS_MS; }
204 bool isURI() const { return m_primitiveUnitType == CSS_URI; } 206 bool isURI() const { return m_primitiveUnitType == CSS_URI; }
205 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; } 207 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; }
206 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_NUMBER; } 208 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_NUMBER; }
207 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_LENGTH; } 209 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_LENGTH; }
208 static bool isDotsPerInch(UnitType type) { return type == CSS_DPI; } 210 static bool isDotsPerInch(UnitType type) { return type == CSS_DPI; }
209 static bool isDotsPerPixel(UnitType type) { return type == CSS_DPPX; } 211 static bool isDotsPerPixel(UnitType type) { return type == CSS_DPPX; }
210 static bool isDotsPerCentimeter(UnitType type) { return type == CSS_DPCM; } 212 static bool isDotsPerCentimeter(UnitType type) { return type == CSS_DPCM; }
211 static bool isResolution(UnitType type) { return type >= CSS_DPPX && type <= CSS_DPCM; } 213 static bool isResolution(UnitType type) { return type >= CSS_DPPX && type <= CSS_DPCM; }
212 bool isFlex() const { return primitiveType() == CSS_FR; } 214 bool isFlex() const { return primitiveType() == CSS_FR; }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 CSSBasicShape* getShapeValue() const { return m_primitiveUnitType != CSS_SHA PE ? 0 : m_value.shape; } 309 CSSBasicShape* getShapeValue() const { return m_primitiveUnitType != CSS_SHA PE ? 0 : m_value.shape; }
308 310
309 CSSCalcValue* cssCalcValue() const { return m_primitiveUnitType != CSS_CALC ? 0 : m_value.calc; } 311 CSSCalcValue* cssCalcValue() const { return m_primitiveUnitType != CSS_CALC ? 0 : m_value.calc; }
310 312
311 CSSPropertyID getPropertyID() const { return m_primitiveUnitType == CSS_PROP ERTY_ID ? m_value.propertyID : CSSPropertyInvalid; } 313 CSSPropertyID getPropertyID() const { return m_primitiveUnitType == CSS_PROP ERTY_ID ? m_value.propertyID : CSSPropertyInvalid; }
312 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; } 314 CSSValueID getValueID() const { return m_primitiveUnitType == CSS_VALUE_ID ? m_value.valueID : CSSValueInvalid; }
313 315
314 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa lueMappings.h 316 template<typename T> inline operator T() const; // Defined in CSSPrimitiveVa lueMappings.h
315 317
316 static const char* unitTypeToString(UnitType); 318 static const char* unitTypeToString(UnitType);
317 String customCSSText(CSSTextFormattingFlags = QuoteCSSStringIfNeeded) const; 319 String customCSSText() const;
318 320
319 bool isQuirkValue() { return m_isQuirkValue; } 321 bool isQuirkValue() { return m_isQuirkValue; }
320 322
321 bool equals(const CSSPrimitiveValue&) const; 323 bool equals(const CSSPrimitiveValue&) const;
322 324
323 DECLARE_TRACE_AFTER_DISPATCH(); 325 DECLARE_TRACE_AFTER_DISPATCH();
324 326
325 static UnitType canonicalUnitTypeForCategory(UnitCategory); 327 static UnitType canonicalUnitTypeForCategory(UnitCategory);
326 static double conversionToCanonicalUnitsScaleFactor(UnitType); 328 static double conversionToCanonicalUnitsScaleFactor(UnitType);
327 329
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 }; 389 };
388 390
389 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; 391 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray;
390 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray; 392 typedef CSSPrimitiveValue::CSSLengthTypeArray CSSLengthTypeArray;
391 393
392 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 394 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
393 395
394 } // namespace blink 396 } // namespace blink
395 397
396 #endif // CSSPrimitiveValue_h 398 #endif // CSSPrimitiveValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698