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

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

Issue 1938343002: Generate a series of nested switch statements to parse CSSPrimitiveValue units. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head Created 4 years, 6 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 ULength, 151 ULength,
152 UAngle, 152 UAngle,
153 UTime, 153 UTime,
154 UFrequency, 154 UFrequency,
155 UResolution, 155 UResolution,
156 UOther 156 UOther
157 }; 157 };
158 static UnitCategory unitTypeToUnitCategory(UnitType); 158 static UnitCategory unitTypeToUnitCategory(UnitType);
159 static float clampToCSSLengthRange(double); 159 static float clampToCSSLengthRange(double);
160 160
161 static void initUnitTable();
162
163 static UnitType fromName(const String& unit);
164
165 static bool isAngle(UnitType unit) 161 static bool isAngle(UnitType unit)
166 { 162 {
167 return unit == UnitType::Degrees 163 return unit == UnitType::Degrees
168 || unit == UnitType::Radians 164 || unit == UnitType::Radians
169 || unit == UnitType::Gradians 165 || unit == UnitType::Gradians
170 || unit == UnitType::Turns; 166 || unit == UnitType::Turns;
171 } 167 }
172 bool isAngle() const { return isAngle(type()); } 168 bool isAngle() const { return isAngle(type()); }
173 bool isFontRelativeLength() const 169 bool isFontRelativeLength() const
174 { 170 {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } m_value; 293 } m_value;
298 }; 294 };
299 295
300 using CSSLengthArray = CSSPrimitiveValue::CSSLengthArray; 296 using CSSLengthArray = CSSPrimitiveValue::CSSLengthArray;
301 297
302 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); 298 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue());
303 299
304 } // namespace blink 300 } // namespace blink
305 301
306 #endif // CSSPrimitiveValue_h 302 #endif // CSSPrimitiveValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698