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

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

Issue 240063003: Revert "A sizes attribute parser" (https://codereview.chromium.org/224733011) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; } 189 bool isAttr() const { return m_primitiveUnitType == CSS_ATTR; }
190 bool isCounter() const { return m_primitiveUnitType == CSS_COUNTER; } 190 bool isCounter() const { return m_primitiveUnitType == CSS_COUNTER; }
191 bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX && m_primitiveUnitType <= CSS_PC; } 191 bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX && m_primitiveUnitType <= CSS_PC; }
192 bool isFontRelativeLength() const 192 bool isFontRelativeLength() const
193 { 193 {
194 return m_primitiveUnitType == CSS_EMS 194 return m_primitiveUnitType == CSS_EMS
195 || m_primitiveUnitType == CSS_EXS 195 || m_primitiveUnitType == CSS_EXS
196 || m_primitiveUnitType == CSS_REMS 196 || m_primitiveUnitType == CSS_REMS
197 || m_primitiveUnitType == CSS_CHS; 197 || m_primitiveUnitType == CSS_CHS;
198 } 198 }
199 static bool isViewportPercentageLength(unsigned short type) { return type >= CSS_VW && type <= CSS_VMAX; } 199 bool isLength() const
200 static bool isLength(unsigned short type)
201 { 200 {
202 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type = = CSS_CHS || isViewportPercentageLength(type); 201 unsigned short type = primitiveType();
202 return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type = = CSS_CHS || isViewportPercentageLength();
203 } 203 }
204 bool isLength() const { return isLength(primitiveType()); }
205 bool isNumber() const { return primitiveType() == CSS_NUMBER; } 204 bool isNumber() const { return primitiveType() == CSS_NUMBER; }
206 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; } 205 bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; }
207 bool isPx() const { return primitiveType() == CSS_PX; } 206 bool isPx() const { return primitiveType() == CSS_PX; }
208 bool isRect() const { return m_primitiveUnitType == CSS_RECT; } 207 bool isRect() const { return m_primitiveUnitType == CSS_RECT; }
209 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; } 208 bool isRGBColor() const { return m_primitiveUnitType == CSS_RGBCOLOR; }
210 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; } 209 bool isShape() const { return m_primitiveUnitType == CSS_SHAPE; }
211 bool isString() const { return m_primitiveUnitType == CSS_STRING; } 210 bool isString() const { return m_primitiveUnitType == CSS_STRING; }
212 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit Type == CSS_MS; } 211 bool isTime() const { return m_primitiveUnitType == CSS_S || m_primitiveUnit Type == CSS_MS; }
213 bool isURI() const { return m_primitiveUnitType == CSS_URI; } 212 bool isURI() const { return m_primitiveUnitType == CSS_URI; }
214 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; } 213 bool isCalculated() const { return m_primitiveUnitType == CSS_CALC; }
215 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_NUMBER; } 214 bool isCalculatedPercentageWithNumber() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_NUMBER; }
216 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_LENGTH; } 215 bool isCalculatedPercentageWithLength() const { return primitiveType() == CS S_CALC_PERCENTAGE_WITH_LENGTH; }
217 bool isDotsPerInch() const { return primitiveType() == CSS_DPI; } 216 bool isDotsPerInch() const { return primitiveType() == CSS_DPI; }
218 bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; } 217 bool isDotsPerPixel() const { return primitiveType() == CSS_DPPX; }
219 bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; } 218 bool isDotsPerCentimeter() const { return primitiveType() == CSS_DPCM; }
220 bool isResolution() const 219 bool isResolution() const
221 { 220 {
222 unsigned short type = primitiveType(); 221 unsigned short type = primitiveType();
223 return type >= CSS_DPPX && type <= CSS_DPCM; 222 return type >= CSS_DPPX && type <= CSS_DPCM;
224 } 223 }
224 bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_ VW && m_primitiveUnitType <= CSS_VMAX; }
225 bool isFlex() const { return primitiveType() == CSS_FR; } 225 bool isFlex() const { return primitiveType() == CSS_FR; }
226 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; } 226 bool isValueID() const { return m_primitiveUnitType == CSS_VALUE_ID; }
227 bool colorIsDerivedFromElement() const; 227 bool colorIsDerivedFromElement() const;
228 228
229 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID) 229 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSValueID valueID)
230 { 230 {
231 return adoptRefWillBeRefCountedGarbageCollected(new CSSPrimitiveValue(va lueID)); 231 return adoptRefWillBeRefCountedGarbageCollected(new CSSPrimitiveValue(va lueID));
232 } 232 }
233 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert yID propertyID) 233 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createIdentifier(CSSPropert yID propertyID)
234 { 234 {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } m_value; 436 } m_value;
437 }; 437 };
438 438
439 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; 439 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray;
440 440
441 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 441 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
442 442
443 } // namespace WebCore 443 } // namespace WebCore
444 444
445 #endif // CSSPrimitiveValue_h 445 #endif // CSSPrimitiveValue_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698