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

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

Issue 1157463002: Simplify UnicodeRangeToken handling (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 5 years, 7 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
« no previous file with comments | « Source/core/css/parser/CSSParserValues.h ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 case NumberToken: 155 case NumberToken:
156 case PercentageToken: 156 case PercentageToken:
157 if (!std::isfinite(token.numericValue())) { 157 if (!std::isfinite(token.numericValue())) {
158 destroyAndClear(); 158 destroyAndClear();
159 return; 159 return;
160 } 160 }
161 value.setFromNumber(token.numericValue(), token.unitType()); 161 value.setFromNumber(token.numericValue(), token.unitType());
162 value.isInt = (token.numericValueType() == IntegerValueType); 162 value.isInt = (token.numericValueType() == IntegerValueType);
163 break; 163 break;
164 case UnicodeRangeToken: { 164 case UnicodeRangeToken: {
165 value.id = CSSValueInvalid;
166 value.isInt = false;
167 value.m_unicodeRange.start = token.unicodeRangeStart();
168 value.m_unicodeRange.end = token.unicodeRangeEnd();
165 value.unit = CSSParserValue::UnicodeRange; 169 value.unit = CSSParserValue::UnicodeRange;
166 CSSParserValueList* list = new CSSParserValueList;
167 value.valueList = list;
168 value.id = CSSValueInvalid;
169
170 CSSParserValue start;
171 start.setFromNumber(token.unicodeRangeStart());
172 start.isInt = true;
173 list->addValue(start);
174
175 CSSParserValue end;
176 end.setFromNumber(token.unicodeRangeEnd());
177 end.isInt = true;
178 list->addValue(end);
179 break; 170 break;
180 } 171 }
181 case HashToken: 172 case HashToken:
182 // FIXME: Move this logic to the property parser 173 // FIXME: Move this logic to the property parser
183 // This check prevents us from allowing #red and similar 174 // This check prevents us from allowing #red and similar
184 for (size_t i = 0; i < token.value().length(); ++i) { 175 for (size_t i = 0; i < token.value().length(); ++i) {
185 if (!isASCIIHexDigit(token.value()[i])) { 176 if (!isASCIIHexDigit(token.value()[i])) {
186 destroyAndClear(); 177 destroyAndClear();
187 return; 178 return;
188 } 179 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 bool CSSParserSelector::hasHostPseudoSelector() const 366 bool CSSParserSelector::hasHostPseudoSelector() const
376 { 367 {
377 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel ector; selector = selector->tagHistory()) { 368 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel ector; selector = selector->tagHistory()) {
378 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext) 369 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext)
379 return true; 370 return true;
380 } 371 }
381 return false; 372 return false;
382 } 373 }
383 374
384 } // namespace blink 375 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserValues.h ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698