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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 m_values.insert(i, v); | 61 m_values.insert(i, v); |
62 } | 62 } |
63 | 63 |
64 void CSSParserValueList::stealValues(CSSParserValueList& valueList) | 64 void CSSParserValueList::stealValues(CSSParserValueList& valueList) |
65 { | 65 { |
66 for (unsigned i = 0; i < valueList.size(); ++i) | 66 for (unsigned i = 0; i < valueList.size(); ++i) |
67 m_values.append(*(valueList.valueAt(i))); | 67 m_values.append(*(valueList.valueAt(i))); |
68 valueList.clearAndLeakValues(); | 68 valueList.clearAndLeakValues(); |
69 } | 69 } |
70 | 70 |
71 PassRefPtrWillBeRawPtr<CSSValue> CSSParserValue::createCSSValue() | |
72 { | |
73 if (id) | |
74 return CSSPrimitiveValue::createIdentifier(id); | |
75 | |
76 if (unit == CSSParserValue::Operator) | |
77 return CSSPrimitiveValue::createParserOperator(iValue); | |
78 if (unit == CSSParserValue::Function) | |
79 return CSSFunctionValue::create(function); | |
80 if (unit == CSSParserValue::ValueList) | |
81 return CSSValueList::createFromParserValueList(valueList); | |
82 if (unit >= CSSParserValue::Q_EMS) | |
83 return CSSPrimitiveValue::createAllowingMarginQuirk(fValue, CSSPrimitive
Value::CSS_EMS); | |
84 | |
85 CSSPrimitiveValue::UnitType primitiveUnit = static_cast<CSSPrimitiveValue::U
nitType>(unit); | |
86 switch (primitiveUnit) { | |
87 case CSSPrimitiveValue::CSS_IDENT: | |
88 case CSSPrimitiveValue::CSS_PROPERTY_ID: | |
89 case CSSPrimitiveValue::CSS_VALUE_ID: | |
90 return CSSPrimitiveValue::create(string, CSSPrimitiveValue::CSS_PARSER_I
DENTIFIER); | |
91 case CSSPrimitiveValue::CSS_NUMBER: | |
92 return CSSPrimitiveValue::create(fValue, isInt ? CSSPrimitiveValue::CSS_
PARSER_INTEGER : CSSPrimitiveValue::CSS_NUMBER); | |
93 case CSSPrimitiveValue::CSS_STRING: | |
94 case CSSPrimitiveValue::CSS_URI: | |
95 case CSSPrimitiveValue::CSS_PARSER_HEXCOLOR: | |
96 return CSSPrimitiveValue::create(string, primitiveUnit); | |
97 case CSSPrimitiveValue::CSS_PERCENTAGE: | |
98 case CSSPrimitiveValue::CSS_EMS: | |
99 case CSSPrimitiveValue::CSS_EXS: | |
100 case CSSPrimitiveValue::CSS_PX: | |
101 case CSSPrimitiveValue::CSS_CM: | |
102 case CSSPrimitiveValue::CSS_MM: | |
103 case CSSPrimitiveValue::CSS_IN: | |
104 case CSSPrimitiveValue::CSS_PT: | |
105 case CSSPrimitiveValue::CSS_PC: | |
106 case CSSPrimitiveValue::CSS_DEG: | |
107 case CSSPrimitiveValue::CSS_RAD: | |
108 case CSSPrimitiveValue::CSS_GRAD: | |
109 case CSSPrimitiveValue::CSS_MS: | |
110 case CSSPrimitiveValue::CSS_S: | |
111 case CSSPrimitiveValue::CSS_HZ: | |
112 case CSSPrimitiveValue::CSS_KHZ: | |
113 case CSSPrimitiveValue::CSS_VW: | |
114 case CSSPrimitiveValue::CSS_VH: | |
115 case CSSPrimitiveValue::CSS_VMIN: | |
116 case CSSPrimitiveValue::CSS_VMAX: | |
117 case CSSPrimitiveValue::CSS_TURN: | |
118 case CSSPrimitiveValue::CSS_REMS: | |
119 case CSSPrimitiveValue::CSS_CHS: | |
120 case CSSPrimitiveValue::CSS_FR: | |
121 return CSSPrimitiveValue::create(fValue, primitiveUnit); | |
122 case CSSPrimitiveValue::CSS_UNKNOWN: | |
123 case CSSPrimitiveValue::CSS_DIMENSION: | |
124 case CSSPrimitiveValue::CSS_ATTR: | |
125 case CSSPrimitiveValue::CSS_COUNTER: | |
126 case CSSPrimitiveValue::CSS_RECT: | |
127 case CSSPrimitiveValue::CSS_RGBCOLOR: | |
128 case CSSPrimitiveValue::CSS_DPPX: | |
129 case CSSPrimitiveValue::CSS_DPI: | |
130 case CSSPrimitiveValue::CSS_DPCM: | |
131 case CSSPrimitiveValue::CSS_PAIR: | |
132 case CSSPrimitiveValue::CSS_UNICODE_RANGE: | |
133 case CSSPrimitiveValue::CSS_PARSER_INTEGER: | |
134 case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER: | |
135 case CSSPrimitiveValue::CSS_PARSER_OPERATOR: | |
136 case CSSPrimitiveValue::CSS_COUNTER_NAME: | |
137 case CSSPrimitiveValue::CSS_SHAPE: | |
138 case CSSPrimitiveValue::CSS_QUAD: | |
139 case CSSPrimitiveValue::CSS_CALC: | |
140 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER: | |
141 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH: | |
142 return nullptr; | |
143 } | |
144 | |
145 ASSERT_NOT_REACHED(); | |
146 return nullptr; | |
147 } | |
148 | |
149 CSSParserSelector::CSSParserSelector() | 71 CSSParserSelector::CSSParserSelector() |
150 : m_selector(adoptPtr(new CSSSelector())) | 72 : m_selector(adoptPtr(new CSSSelector())) |
151 { | 73 { |
152 } | 74 } |
153 | 75 |
154 CSSParserSelector::CSSParserSelector(const QualifiedName& tagQName) | 76 CSSParserSelector::CSSParserSelector(const QualifiedName& tagQName) |
155 : m_selector(adoptPtr(new CSSSelector(tagQName))) | 77 : m_selector(adoptPtr(new CSSSelector(tagQName))) |
156 { | 78 { |
157 } | 79 } |
158 | 80 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 bool CSSParserSelector::hasHostPseudoSelector() const | 152 bool CSSParserSelector::hasHostPseudoSelector() const |
231 { | 153 { |
232 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel
ector; selector = selector->tagHistory()) { | 154 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel
ector; selector = selector->tagHistory()) { |
233 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud
oType() == CSSSelector::PseudoHostContext) | 155 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud
oType() == CSSSelector::PseudoHostContext) |
234 return true; | 156 return true; |
235 } | 157 } |
236 return false; | 158 return false; |
237 } | 159 } |
238 | 160 |
239 } // namespace blink | 161 } // namespace blink |
OLD | NEW |