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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 | 209 |
| 210 CSSPrimitiveValue::UnitType CSSPrimitiveValue::primitiveType() const | 210 CSSPrimitiveValue::UnitType CSSPrimitiveValue::primitiveType() const |
| 211 { | 211 { |
| 212 if (m_primitiveUnitType == CSS_PROPERTY_ID || m_primitiveUnitType == CSS_VAL UE_ID) | 212 if (m_primitiveUnitType == CSS_PROPERTY_ID || m_primitiveUnitType == CSS_VAL UE_ID) |
| 213 return CSS_IDENT; | 213 return CSS_IDENT; |
| 214 | 214 |
| 215 if (m_primitiveUnitType != CSS_CALC) | 215 if (m_primitiveUnitType != CSS_CALC) |
| 216 return static_cast<UnitType>(m_primitiveUnitType); | 216 return static_cast<UnitType>(m_primitiveUnitType); |
| 217 | 217 |
| 218 switch (m_value.calc->category()) { | 218 switch (m_value.calc->category()) { |
| 219 case CalcAngle: | |
| 220 return CSS_DEG; | |
| 221 case CalcFrequency: | |
| 222 return CSS_HZ; | |
| 219 case CalcNumber: | 223 case CalcNumber: |
| 220 return CSS_NUMBER; | 224 return CSS_NUMBER; |
| 221 case CalcPercent: | 225 case CalcPercent: |
| 222 return CSS_PERCENTAGE; | 226 return CSS_PERCENTAGE; |
| 223 case CalcLength: | 227 case CalcLength: |
| 224 return CSS_PX; | 228 return CSS_PX; |
| 225 case CalcPercentNumber: | 229 case CalcPercentNumber: |
| 226 return CSS_CALC_PERCENTAGE_WITH_NUMBER; | 230 return CSS_CALC_PERCENTAGE_WITH_NUMBER; |
| 227 case CalcPercentLength: | 231 case CalcPercentLength: |
| 228 return CSS_CALC_PERCENTAGE_WITH_LENGTH; | 232 return CSS_CALC_PERCENTAGE_WITH_LENGTH; |
| 233 case CalcTime: | |
| 234 return CSS_MS; | |
| 229 case CalcOther: | 235 case CalcOther: |
| 230 return CSS_UNKNOWN; | 236 return CSS_UNKNOWN; |
| 231 } | 237 } |
| 232 return CSS_UNKNOWN; | 238 return CSS_UNKNOWN; |
| 233 } | 239 } |
| 234 | 240 |
| 235 static const AtomicString& propertyName(CSSPropertyID propertyID) | 241 static const AtomicString& propertyName(CSSPropertyID propertyID) |
| 236 { | 242 { |
| 237 ASSERT_ARG(propertyID, propertyID >= 0); | 243 ASSERT_ARG(propertyID, propertyID >= 0); |
| 238 ASSERT_ARG(propertyID, (propertyID >= firstCSSProperty && propertyID < first CSSProperty + numCSSProperties)); | 244 ASSERT_ARG(propertyID, (propertyID >= firstCSSProperty && propertyID < first CSSProperty + numCSSProperties)); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 { | 544 { |
| 539 switch (m_primitiveUnitType) { | 545 switch (m_primitiveUnitType) { |
| 540 case CSS_DEG: | 546 case CSS_DEG: |
| 541 return getDoubleValue(); | 547 return getDoubleValue(); |
| 542 case CSS_RAD: | 548 case CSS_RAD: |
| 543 return rad2deg(getDoubleValue()); | 549 return rad2deg(getDoubleValue()); |
| 544 case CSS_GRAD: | 550 case CSS_GRAD: |
| 545 return grad2deg(getDoubleValue()); | 551 return grad2deg(getDoubleValue()); |
| 546 case CSS_TURN: | 552 case CSS_TURN: |
| 547 return turn2deg(getDoubleValue()); | 553 return turn2deg(getDoubleValue()); |
| 554 case CSS_CALC: | |
|
alancutter (OOO until 2018)
2014/07/02 05:56:10
Similar comments as for computeTime(), this should
| |
| 555 return getDoubleValue(); | |
| 548 default: | 556 default: |
| 549 ASSERT_NOT_REACHED(); | 557 ASSERT_NOT_REACHED(); |
| 550 return 0; | 558 return 0; |
| 551 } | 559 } |
| 552 } | 560 } |
| 553 | 561 |
| 554 template<> int CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData) | 562 template<> int CSSPrimitiveValue::computeLength(const CSSToLengthConversionData& conversionData) |
| 555 { | 563 { |
| 556 return roundForImpreciseConversion<int>(computeLengthDouble(conversionData)) ; | 564 return roundForImpreciseConversion<int>(computeLengthDouble(conversionData)) ; |
| 557 } | 565 } |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1432 case CSS_SHAPE: | 1440 case CSS_SHAPE: |
| 1433 visitor->trace(m_value.shape); | 1441 visitor->trace(m_value.shape); |
| 1434 break; | 1442 break; |
| 1435 default: | 1443 default: |
| 1436 break; | 1444 break; |
| 1437 } | 1445 } |
| 1438 CSSValue::traceAfterDispatch(visitor); | 1446 CSSValue::traceAfterDispatch(visitor); |
| 1439 } | 1447 } |
| 1440 | 1448 |
| 1441 } // namespace WebCore | 1449 } // namespace WebCore |
| OLD | NEW |