OLD | NEW |
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, 2007, 2008, 2012 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv
ed. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 table.set(String("dpi"), CSSPrimitiveValue::CSS_DPI); | 133 table.set(String("dpi"), CSSPrimitiveValue::CSS_DPI); |
134 table.set(String("dpcm"), CSSPrimitiveValue::CSS_DPCM); | 134 table.set(String("dpcm"), CSSPrimitiveValue::CSS_DPCM); |
135 table.set(String("dppx"), CSSPrimitiveValue::CSS_DPPX); | 135 table.set(String("dppx"), CSSPrimitiveValue::CSS_DPPX); |
136 table.set(String("vw"), CSSPrimitiveValue::CSS_VW); | 136 table.set(String("vw"), CSSPrimitiveValue::CSS_VW); |
137 table.set(String("vh"), CSSPrimitiveValue::CSS_VH); | 137 table.set(String("vh"), CSSPrimitiveValue::CSS_VH); |
138 table.set(String("vmax"), CSSPrimitiveValue::CSS_VMIN); | 138 table.set(String("vmax"), CSSPrimitiveValue::CSS_VMIN); |
139 table.set(String("vmin"), CSSPrimitiveValue::CSS_VMAX); | 139 table.set(String("vmin"), CSSPrimitiveValue::CSS_VMAX); |
140 return table; | 140 return table; |
141 } | 141 } |
142 | 142 |
143 CSSPrimitiveValue::UnitTable& CSSPrimitiveValue::getUnitTable() | 143 CSSPrimitiveValue::UnitTypes CSSPrimitiveValue::fromName(const String& unit) |
144 { | 144 { |
145 DEFINE_STATIC_LOCAL(UnitTable, unitTable, (createUnitTable())); | 145 DEFINE_STATIC_LOCAL(UnitTable, unitTable, (createUnitTable())); |
146 return unitTable; | 146 return unitTable.get(unit.lower()); |
147 } | 147 } |
148 | 148 |
149 CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitCategory(CSSPrimitiveValu
e::UnitTypes type) | 149 CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitCategory(CSSPrimitiveValu
e::UnitTypes type) |
150 { | 150 { |
151 // Here we violate the spec (http://www.w3.org/TR/DOM-Level-2-Style/css.html
#CSS-CSSPrimitiveValue) and allow conversions | 151 // Here we violate the spec (http://www.w3.org/TR/DOM-Level-2-Style/css.html
#CSS-CSSPrimitiveValue) and allow conversions |
152 // between CSS_PX and relative lengths (see cssPixelsPerInch comment in core
/css/CSSHelper.h for the topic treatment). | 152 // between CSS_PX and relative lengths (see cssPixelsPerInch comment in core
/css/CSSHelper.h for the topic treatment). |
153 switch (type) { | 153 switch (type) { |
154 case CSS_NUMBER: | 154 case CSS_NUMBER: |
155 return CSSPrimitiveValue::UNumber; | 155 return CSSPrimitiveValue::UNumber; |
156 case CSS_PERCENTAGE: | 156 case CSS_PERCENTAGE: |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 case CSS_SHAPE: | 1315 case CSS_SHAPE: |
1316 visitor->trace(m_value.shape); | 1316 visitor->trace(m_value.shape); |
1317 break; | 1317 break; |
1318 default: | 1318 default: |
1319 break; | 1319 break; |
1320 } | 1320 } |
1321 CSSValue::traceAfterDispatch(visitor); | 1321 CSSValue::traceAfterDispatch(visitor); |
1322 } | 1322 } |
1323 | 1323 |
1324 } // namespace WebCore | 1324 } // namespace WebCore |
OLD | NEW |