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

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: Created 5 years, 6 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 unsigned calcDepth = 0; 42 unsigned calcDepth = 0;
44 while (!range.atEnd()) { 43 while (!range.atEnd()) {
45 ASSERT(stack.size() == bracketCounts.size()); 44 ASSERT(stack.size() == bracketCounts.size());
46 ASSERT(!stack.isEmpty()); 45 ASSERT(!stack.isEmpty());
47 const CSSParserToken& token = range.consume(); 46 const CSSParserToken& token = range.consume();
48 CSSParserValue value; 47 CSSParserValue value;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 number.isInt = (token.numericValueType() == IntegerValueType); 135 number.isInt = (token.numericValueType() == IntegerValueType);
137 list->addValue(number); 136 list->addValue(number);
138 137
139 CSSParserValue unit; 138 CSSParserValue unit;
140 unit.string = token.value(); 139 unit.string = token.value();
141 unit.unit = CSSPrimitiveValue::CSS_IDENT; 140 unit.unit = CSSPrimitiveValue::CSS_IDENT;
142 list->addValue(unit); 141 list->addValue(unit);
143 142
144 break; 143 break;
145 } 144 }
146 if (token.unitType() == CSSPrimitiveValue::CSS_REMS)
147 usesRemUnits = true;
148 // fallthrough 145 // fallthrough
149 case NumberToken: 146 case NumberToken:
150 case PercentageToken: 147 case PercentageToken:
151 if (!std::isfinite(token.numericValue())) { 148 if (!std::isfinite(token.numericValue())) {
152 destroyAndClear(); 149 destroyAndClear();
153 return; 150 return;
154 } 151 }
155 value.setFromNumber(token.numericValue(), token.unitType()); 152 value.setFromNumber(token.numericValue(), token.unitType());
156 value.isInt = (token.numericValueType() == IntegerValueType); 153 value.isInt = (token.numericValueType() == IntegerValueType);
157 break; 154 break;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 bool CSSParserSelector::hasHostPseudoSelector() const 348 bool CSSParserSelector::hasHostPseudoSelector() const
352 { 349 {
353 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel ector; selector = selector->tagHistory()) { 350 for (CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); sel ector; selector = selector->tagHistory()) {
354 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext) 351 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoHostContext)
355 return true; 352 return true;
356 } 353 }
357 return false; 354 return false;
358 } 355 }
359 356
360 } // namespace blink 357 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698