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

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

Issue 1181023004: Move rem handling out of CSSParserValues.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Another attempt Created 5 years, 4 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 14 matching lines...) Expand all
25 #include "core/css/CSSSelectorList.h" 25 #include "core/css/CSSSelectorList.h"
26 #include "core/css/parser/CSSParserToken.h" 26 #include "core/css/parser/CSSParserToken.h"
27 #include "core/css/parser/CSSParserTokenRange.h" 27 #include "core/css/parser/CSSParserTokenRange.h"
28 #include "core/css/parser/CSSPropertyParser.h" 28 #include "core/css/parser/CSSPropertyParser.h"
29 #include "core/html/parser/HTMLParserIdioms.h" 29 #include "core/html/parser/HTMLParserIdioms.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 using namespace WTF; 33 using namespace WTF;
34 34
35 CSSParserValueList::CSSParserValueList(CSSParserTokenRange range, bool& usesRemU nits) 35 CSSParserValueList::CSSParserValueList(CSSParserTokenRange range)
36 : m_current(0) 36 : m_current(0)
37 { 37 {
38 usesRemUnits = false;
39 Vector<CSSParserValueList*> stack; 38 Vector<CSSParserValueList*> stack;
40 Vector<int> bracketCounts; 39 Vector<int> bracketCounts;
41 stack.append(this); 40 stack.append(this);
42 bracketCounts.append(0); 41 bracketCounts.append(0);
43 while (!range.atEnd()) { 42 while (!range.atEnd()) {
44 ASSERT(stack.size() == bracketCounts.size()); 43 ASSERT(stack.size() == bracketCounts.size());
45 ASSERT(!stack.isEmpty()); 44 ASSERT(!stack.isEmpty());
46 const CSSParserToken& token = range.peek(); 45 const CSSParserToken& token = range.peek();
47 if (token.type() != FunctionToken) 46 if (token.type() != FunctionToken)
48 range.consume(); 47 range.consume();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 number.isInt = (token.numericValueType() == IntegerValueType); 132 number.isInt = (token.numericValueType() == IntegerValueType);
134 list->addValue(number); 133 list->addValue(number);
135 134
136 CSSParserValue unit; 135 CSSParserValue unit;
137 unit.string = token.value(); 136 unit.string = token.value();
138 unit.m_unit = CSSParserValue::Identifier; 137 unit.m_unit = CSSParserValue::Identifier;
139 list->addValue(unit); 138 list->addValue(unit);
140 139
141 break; 140 break;
142 } 141 }
143 if (token.unitType() == CSSPrimitiveValue::UnitType::Rems)
144 usesRemUnits = true;
145 // fallthrough 142 // fallthrough
146 case NumberToken: 143 case NumberToken:
147 case PercentageToken: 144 case PercentageToken:
148 if (!std::isfinite(token.numericValue())) { 145 if (!std::isfinite(token.numericValue())) {
149 destroyAndClear(); 146 destroyAndClear();
150 return; 147 return;
151 } 148 }
152 value.setFromNumber(token.numericValue(), token.unitType()); 149 value.setFromNumber(token.numericValue(), token.unitType());
153 value.isInt = (token.numericValueType() == IntegerValueType); 150 value.isInt = (token.numericValueType() == IntegerValueType);
154 break; 151 break;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 bool CSSParserSelector::hasHostPseudoSelector() const 342 bool CSSParserSelector::hasHostPseudoSelector() const
346 { 343 {
347 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()) {
348 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext) 345 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext)
349 return true; 346 return true;
350 } 347 }
351 return false; 348 return false;
352 } 349 }
353 350
354 } // namespace blink 351 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserValues.h ('k') | Source/core/css/parser/CSSParserValuesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698