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

Side by Side Diff: Source/core/css/parser/CSSParserValues.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: Rebase 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 /* 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 if (token.valueEqualsIgnoringCase("url")) { 51 if (token.valueEqualsIgnoringCase("url")) {
52 range.consume(); 52 range.consume();
53 const CSSParserToken& next = range.consumeIncludingWhitespace(); 53 const CSSParserToken& next = range.consumeIncludingWhitespace();
54 if (next.type() == BadStringToken || range.consume().type() != R ightParenthesisToken) { 54 if (next.type() == BadStringToken || range.consume().type() != R ightParenthesisToken) {
55 destroyAndClear(); 55 destroyAndClear();
56 return; 56 return;
57 } 57 }
58 ASSERT(next.type() == StringToken); 58 ASSERT(next.type() == StringToken);
59 value.id = CSSValueInvalid; 59 value.id = CSSValueInvalid;
60 value.isInt = false; 60 value.isInt = false;
61 value.setUnit(CSSPrimitiveValue::UnitType::URI); 61 value.m_unit = CSSParserValue::URI;
62 value.string = next.value(); 62 value.string = next.value();
63 break; 63 break;
64 } 64 }
65 65
66 value.id = CSSValueInvalid; 66 value.id = CSSValueInvalid;
67 value.isInt = false; 67 value.isInt = false;
68 68
69 CSSValueID id = cssValueKeywordID(token.value()); 69 CSSValueID id = cssValueKeywordID(token.value());
70 if (id == CSSValueCalc || id == CSSValueWebkitCalc) { 70 if (id == CSSValueCalc || id == CSSValueWebkitCalc) {
71 value.m_unit = CSSParserValue::CalcFunction; 71 value.m_unit = CSSParserValue::CalcFunction;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 break; 158 break;
159 } 159 }
160 case HashToken: 160 case HashToken:
161 case StringToken: 161 case StringToken:
162 case UrlToken: { 162 case UrlToken: {
163 value.id = CSSValueInvalid; 163 value.id = CSSValueInvalid;
164 value.isInt = false; 164 value.isInt = false;
165 if (token.type() == HashToken) 165 if (token.type() == HashToken)
166 value.m_unit = CSSParserValue::HexColor; 166 value.m_unit = CSSParserValue::HexColor;
167 else if (token.type() == StringToken) 167 else if (token.type() == StringToken)
168 value.setUnit(CSSPrimitiveValue::UnitType::String); 168 value.m_unit = CSSParserValue::String;
169 else 169 else
170 value.setUnit(CSSPrimitiveValue::UnitType::URI); 170 value.m_unit = CSSParserValue::URI;
171 value.string = token.value(); 171 value.string = token.value();
172 break; 172 break;
173 } 173 }
174 case DelimiterToken: 174 case DelimiterToken:
175 value.setFromOperator(token.delimiter()); 175 value.setFromOperator(token.delimiter());
176 break; 176 break;
177 case CommaToken: 177 case CommaToken:
178 value.setFromOperator(','); 178 value.setFromOperator(',');
179 break; 179 break;
180 case LeftBracketToken: 180 case LeftBracketToken:
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 bool CSSParserSelector::hasHostPseudoSelector() const 342 bool CSSParserSelector::hasHostPseudoSelector() const
343 { 343 {
344 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel ector; selector = selector->tagHistory()) { 344 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel ector; selector = selector->tagHistory()) {
345 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext) 345 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext)
346 return true; 346 return true;
347 } 347 }
348 return false; 348 return false;
349 } 349 }
350 350
351 } // namespace blink 351 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698