OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSPropertyParser.h" | 6 #include "core/css/parser/CSSPropertyParser.h" |
7 | 7 |
8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
9 #include "core/css/CSSCalculationValue.h" | 9 #include "core/css/CSSCalculationValue.h" |
10 #include "core/css/CSSValuePool.h" | 10 #include "core/css/CSSValuePool.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return true; | 70 return true; |
71 } | 71 } |
72 | 72 |
73 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeIdent(CSSParserTokenRang
e& range) | 73 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeIdent(CSSParserTokenRang
e& range) |
74 { | 74 { |
75 if (range.peek().type() != IdentToken) | 75 if (range.peek().type() != IdentToken) |
76 return nullptr; | 76 return nullptr; |
77 return cssValuePool().createIdentifierValue(range.consumeIncludingWhitespace
().id()); | 77 return cssValuePool().createIdentifierValue(range.consumeIncludingWhitespace
().id()); |
78 } | 78 } |
79 | 79 |
80 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeCustomIdent(CSSParserTok
enRange& range) | 80 static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> consumeCustomIdent(CSSParserT
okenRange& range) |
81 { | 81 { |
82 if (range.peek().type() != IdentToken) | 82 if (range.peek().type() != IdentToken) |
83 return nullptr; | 83 return nullptr; |
84 return cssValuePool().createValue(range.consumeIncludingWhitespace().value()
, CSSPrimitiveValue::UnitType::CustomIdentifier); | 84 return CSSCustomIdentValue::create(range.consumeIncludingWhitespace().value(
)); |
85 } | 85 } |
86 | 86 |
87 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeString(CSSParserTokenRan
ge& range) | 87 static PassRefPtrWillBeRawPtr<CSSStringValue> consumeString(CSSParserTokenRange&
range) |
88 { | 88 { |
89 if (range.peek().type() != StringToken) | 89 if (range.peek().type() != StringToken) |
90 return nullptr; | 90 return nullptr; |
91 return cssValuePool().createValue(range.consumeIncludingWhitespace().value()
, CSSPrimitiveValue::UnitType::String); | 91 return CSSStringValue::create(range.consumeIncludingWhitespace().value()); |
92 } | 92 } |
93 | 93 |
94 // Methods for consuming non-shorthand properties starts here. | 94 // Methods for consuming non-shorthand properties starts here. |
95 static PassRefPtrWillBeRawPtr<CSSValue> consumeWillChange(CSSParserTokenRange& r
ange) | 95 static PassRefPtrWillBeRawPtr<CSSValue> consumeWillChange(CSSParserTokenRange& r
ange) |
96 { | 96 { |
97 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); | 97 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); |
98 if (range.peek().id() == CSSValueAuto) { | 98 if (range.peek().id() == CSSValueAuto) { |
99 // FIXME: This will be read back as an empty string instead of auto | 99 // FIXME: This will be read back as an empty string instead of auto |
100 return values.release(); | 100 return values.release(); |
101 } | 101 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 if (range.atEnd()) | 136 if (range.atEnd()) |
137 break; | 137 break; |
138 if (!consumeCommaIncludingWhitespace(range)) | 138 if (!consumeCommaIncludingWhitespace(range)) |
139 return nullptr; | 139 return nullptr; |
140 } | 140 } |
141 | 141 |
142 return values.release(); | 142 return values.release(); |
143 } | 143 } |
144 | 144 |
145 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumePage(CSSParserTokenRange
& range) | 145 static PassRefPtrWillBeRawPtr<CSSValue> consumePage(CSSParserTokenRange& range) |
146 { | 146 { |
147 if (range.peek().id() == CSSValueAuto) | 147 if (range.peek().id() == CSSValueAuto) |
148 return consumeIdent(range); | 148 return consumeIdent(range); |
149 return consumeCustomIdent(range); | 149 return consumeCustomIdent(range); |
150 } | 150 } |
151 | 151 |
152 // [ <string> <string> ]+ | none | 152 // [ <string> <string> ]+ | none |
153 static PassRefPtrWillBeRawPtr<CSSValue> consumeQuotes(CSSParserTokenRange& range
) | 153 static PassRefPtrWillBeRawPtr<CSSValue> consumeQuotes(CSSParserTokenRange& range
) |
154 { | 154 { |
155 if (range.peek().id() == CSSValueNone) | 155 if (range.peek().id() == CSSValueNone) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important); | 231 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important); |
232 addProperty(CSSPropertyOverflowY, overflowYValue.release(), important); | 232 addProperty(CSSPropertyOverflowY, overflowYValue.release(), important); |
233 return true; | 233 return true; |
234 } | 234 } |
235 default: | 235 default: |
236 return false; | 236 return false; |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 } // namespace blink | 240 } // namespace blink |
OLD | NEW |