Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 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 * | 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 m_values.append(*(valueList.valueAt(i))); | 81 m_values.append(*(valueList.valueAt(i))); |
| 82 valueList.clear(); | 82 valueList.clear(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 PassRefPtrWillBeRawPtr<CSSValue> CSSParserValue::createCSSValue() | 85 PassRefPtrWillBeRawPtr<CSSValue> CSSParserValue::createCSSValue() |
| 86 { | 86 { |
| 87 RefPtrWillBeRawPtr<CSSValue> parsedValue; | 87 RefPtrWillBeRawPtr<CSSValue> parsedValue; |
| 88 if (id) | 88 if (id) |
| 89 return CSSPrimitiveValue::createIdentifier(id); | 89 return CSSPrimitiveValue::createIdentifier(id); |
| 90 | 90 |
| 91 if (unit == CSSParserValue::Operator) { | 91 // FIXME: Why do we have these special-case ifs outside of the switch? |
|
esprehn
2014/03/23 06:14:49
The switch is over CSSPrimitiveValue PrimitiveUnit
| |
| 92 RefPtrWillBeRawPtr<CSSPrimitiveValue> primitiveValue = CSSPrimitiveValue ::createParserOperator(iValue); | 92 if (unit == CSSParserValue::Operator) |
| 93 primitiveValue->setPrimitiveType(CSSPrimitiveValue::CSS_PARSER_OPERATOR) ; | 93 return CSSPrimitiveValue::createParserOperator(iValue); |
| 94 return primitiveValue; | 94 if (unit == CSSParserValue::Function) |
| 95 } | |
| 96 if (unit == CSSParserValue::Function) { | |
| 97 return CSSFunctionValue::create(function); | 95 return CSSFunctionValue::create(function); |
| 98 } | |
| 99 if (unit == CSSParserValue::ValueList) | 96 if (unit == CSSParserValue::ValueList) |
| 100 return CSSValueList::createFromParserValueList(valueList); | 97 return CSSValueList::createFromParserValueList(valueList); |
| 101 if (unit >= CSSParserValue::Q_EMS) | 98 if (unit >= CSSParserValue::Q_EMS) |
| 102 return CSSPrimitiveValue::createAllowingMarginQuirk(fValue, CSSPrimitive Value::CSS_EMS); | 99 return CSSPrimitiveValue::createAllowingMarginQuirk(fValue, CSSPrimitive Value::CSS_EMS); |
| 103 | 100 |
| 104 CSSPrimitiveValue::UnitTypes primitiveUnit = static_cast<CSSPrimitiveValue:: UnitTypes>(unit); | 101 CSSPrimitiveValue::UnitTypes primitiveUnit = static_cast<CSSPrimitiveValue:: UnitTypes>(unit); |
| 105 switch (primitiveUnit) { | 102 switch (primitiveUnit) { |
| 106 case CSSPrimitiveValue::CSS_IDENT: | 103 case CSSPrimitiveValue::CSS_IDENT: |
| 107 case CSSPrimitiveValue::CSS_PROPERTY_ID: | 104 case CSSPrimitiveValue::CSS_PROPERTY_ID: |
| 108 case CSSPrimitiveValue::CSS_VALUE_ID: | 105 case CSSPrimitiveValue::CSS_VALUE_ID: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 case CSSPrimitiveValue::CSS_DIMENSION: | 139 case CSSPrimitiveValue::CSS_DIMENSION: |
| 143 case CSSPrimitiveValue::CSS_ATTR: | 140 case CSSPrimitiveValue::CSS_ATTR: |
| 144 case CSSPrimitiveValue::CSS_COUNTER: | 141 case CSSPrimitiveValue::CSS_COUNTER: |
| 145 case CSSPrimitiveValue::CSS_RECT: | 142 case CSSPrimitiveValue::CSS_RECT: |
| 146 case CSSPrimitiveValue::CSS_RGBCOLOR: | 143 case CSSPrimitiveValue::CSS_RGBCOLOR: |
| 147 case CSSPrimitiveValue::CSS_DPPX: | 144 case CSSPrimitiveValue::CSS_DPPX: |
| 148 case CSSPrimitiveValue::CSS_DPI: | 145 case CSSPrimitiveValue::CSS_DPI: |
| 149 case CSSPrimitiveValue::CSS_DPCM: | 146 case CSSPrimitiveValue::CSS_DPCM: |
| 150 case CSSPrimitiveValue::CSS_PAIR: | 147 case CSSPrimitiveValue::CSS_PAIR: |
| 151 case CSSPrimitiveValue::CSS_UNICODE_RANGE: | 148 case CSSPrimitiveValue::CSS_UNICODE_RANGE: |
| 152 case CSSPrimitiveValue::CSS_PARSER_OPERATOR: | |
| 153 case CSSPrimitiveValue::CSS_PARSER_INTEGER: | 149 case CSSPrimitiveValue::CSS_PARSER_INTEGER: |
| 154 case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER: | 150 case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER: |
| 151 case CSSPrimitiveValue::CSS_PARSER_OPERATOR: | |
| 155 case CSSPrimitiveValue::CSS_COUNTER_NAME: | 152 case CSSPrimitiveValue::CSS_COUNTER_NAME: |
| 156 case CSSPrimitiveValue::CSS_SHAPE: | 153 case CSSPrimitiveValue::CSS_SHAPE: |
| 157 case CSSPrimitiveValue::CSS_QUAD: | 154 case CSSPrimitiveValue::CSS_QUAD: |
| 158 case CSSPrimitiveValue::CSS_CALC: | 155 case CSSPrimitiveValue::CSS_CALC: |
| 159 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER: | 156 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER: |
| 160 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH: | 157 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH: |
| 161 return nullptr; | 158 return nullptr; |
| 162 } | 159 } |
| 163 | 160 |
| 164 ASSERT_NOT_REACHED(); | 161 ASSERT_NOT_REACHED(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 { | 259 { |
| 263 CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); | 260 CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); |
| 264 do { | 261 do { |
| 265 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoAncestor) | 262 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoAncestor) |
| 266 return true; | 263 return true; |
| 267 } while ((selector = selector->tagHistory())); | 264 } while ((selector = selector->tagHistory())); |
| 268 return false; | 265 return false; |
| 269 } | 266 } |
| 270 | 267 |
| 271 } // namespace WebCore | 268 } // namespace WebCore |
| OLD | NEW |