Chromium Code Reviews| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 case CSSPrimitiveValue::CSS_UNICODE_RANGE: | 105 case CSSPrimitiveValue::CSS_UNICODE_RANGE: |
| 106 case CSSPrimitiveValue::CSS_UNKNOWN: | 106 case CSSPrimitiveValue::CSS_UNKNOWN: |
| 107 case CSSPrimitiveValue::CSS_URI: | 107 case CSSPrimitiveValue::CSS_URI: |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 ASSERT_NOT_REACHED(); | 111 ASSERT_NOT_REACHED(); |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| 114 | 114 |
| 115 CSSPrimitiveValue::UnitTable createUnitTable() | |
| 116 { | |
| 117 CSSPrimitiveValue::UnitTable table; | |
| 118 table.set(String("em"), CSSPrimitiveValue::CSS_EMS); | |
| 119 table.set(String("ex"), CSSPrimitiveValue::CSS_EXS); | |
| 120 table.set(String("px"), CSSPrimitiveValue::CSS_PX); | |
| 121 table.set(String("cm"), CSSPrimitiveValue::CSS_CM); | |
| 122 table.set(String("mm"), CSSPrimitiveValue::CSS_MM); | |
| 123 table.set(String("in"), CSSPrimitiveValue::CSS_IN); | |
| 124 table.set(String("pt"), CSSPrimitiveValue::CSS_PT); | |
| 125 table.set(String("pc"), CSSPrimitiveValue::CSS_PC); | |
| 126 table.set(String("deg"), CSSPrimitiveValue::CSS_DEG); | |
| 127 table.set(String("rad"), CSSPrimitiveValue::CSS_RAD); | |
| 128 table.set(String("grad"), CSSPrimitiveValue::CSS_GRAD); | |
| 129 table.set(String("ms"), CSSPrimitiveValue::CSS_MS); | |
| 130 table.set(String("s"), CSSPrimitiveValue::CSS_S); | |
| 131 table.set(String("hz"), CSSPrimitiveValue::CSS_HZ); | |
| 132 table.set(String("khz"), CSSPrimitiveValue::CSS_KHZ); | |
| 133 table.set(String("dpi"), CSSPrimitiveValue::CSS_DPI); | |
| 134 table.set(String("dpcm"), CSSPrimitiveValue::CSS_DPCM); | |
| 135 table.set(String("dppx"), CSSPrimitiveValue::CSS_DPPX); | |
| 136 table.set(String("vw"), CSSPrimitiveValue::CSS_VW); | |
| 137 table.set(String("vh"), CSSPrimitiveValue::CSS_VH); | |
| 138 table.set(String("vmax"), CSSPrimitiveValue::CSS_VMIN); | |
| 139 table.set(String("vmin"), CSSPrimitiveValue::CSS_VMAX); | |
| 140 return table; | |
| 141 } | |
| 142 | |
| 143 CSSPrimitiveValue::UnitTable& CSSPrimitiveValue::getUnitTable() | |
|
eseidel
2014/03/15 00:09:24
No "get", and it looks like you may just want a CS
| |
| 144 { | |
| 145 DEFINE_STATIC_LOCAL(UnitTable, unitTable, (createUnitTable())); | |
| 146 return unitTable; | |
| 147 } | |
| 148 | |
| 115 CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitCategory(CSSPrimitiveValu e::UnitTypes type) | 149 CSSPrimitiveValue::UnitCategory CSSPrimitiveValue::unitCategory(CSSPrimitiveValu e::UnitTypes type) |
| 116 { | 150 { |
| 117 // 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 |
| 118 // 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). |
| 119 switch (type) { | 153 switch (type) { |
| 120 case CSS_NUMBER: | 154 case CSS_NUMBER: |
| 121 return CSSPrimitiveValue::UNumber; | 155 return CSSPrimitiveValue::UNumber; |
| 122 case CSS_PERCENTAGE: | 156 case CSS_PERCENTAGE: |
| 123 return CSSPrimitiveValue::UPercent; | 157 return CSSPrimitiveValue::UPercent; |
| 124 case CSS_PX: | 158 case CSS_PX: |
| (...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1281 case CSS_SHAPE: | 1315 case CSS_SHAPE: |
| 1282 visitor->trace(m_value.shape); | 1316 visitor->trace(m_value.shape); |
| 1283 break; | 1317 break; |
| 1284 default: | 1318 default: |
| 1285 break; | 1319 break; |
| 1286 } | 1320 } |
| 1287 CSSValue::traceAfterDispatch(visitor); | 1321 CSSValue::traceAfterDispatch(visitor); |
| 1288 } | 1322 } |
| 1289 | 1323 |
| 1290 } // namespace WebCore | 1324 } // namespace WebCore |
| OLD | NEW |