Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 1306823004: Split out String, URI and CustomIdent from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_out_attr_values
Patch Set: Fixing tests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698