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

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

Issue 209353004: Remove mutation foot-gun from CSSPrimitiveValue (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/css/CSSPrimitiveValue.h » ('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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 for (unsigned int i = 0; i < valueList.size(); ++i) 80 for (unsigned int i = 0; i < valueList.size(); ++i)
81 m_values.append(*(valueList.valueAt(i))); 81 m_values.append(*(valueList.valueAt(i)));
82 valueList.clear(); 82 valueList.clear();
83 } 83 }
84 84
85 PassRefPtrWillBeRawPtr<CSSValue> CSSParserValue::createCSSValue() 85 PassRefPtrWillBeRawPtr<CSSValue> CSSParserValue::createCSSValue()
86 { 86 {
87 if (id) 87 if (id)
88 return CSSPrimitiveValue::createIdentifier(id); 88 return CSSPrimitiveValue::createIdentifier(id);
89 89
90 if (unit == CSSParserValue::Operator) { 90 if (unit == CSSParserValue::Operator)
91 RefPtrWillBeRawPtr<CSSPrimitiveValue> primitiveValue = CSSPrimitiveValue ::createParserOperator(iValue); 91 return CSSPrimitiveValue::createParserOperator(iValue);
92 primitiveValue->setPrimitiveType(CSSPrimitiveValue::CSS_PARSER_OPERATOR) ; 92 if (unit == CSSParserValue::Function)
93 return primitiveValue;
94 }
95 if (unit == CSSParserValue::Function) {
96 return CSSFunctionValue::create(function); 93 return CSSFunctionValue::create(function);
97 }
98 if (unit == CSSParserValue::ValueList) 94 if (unit == CSSParserValue::ValueList)
99 return CSSValueList::createFromParserValueList(valueList); 95 return CSSValueList::createFromParserValueList(valueList);
100 if (unit >= CSSParserValue::Q_EMS) 96 if (unit >= CSSParserValue::Q_EMS)
101 return CSSPrimitiveValue::createAllowingMarginQuirk(fValue, CSSPrimitive Value::CSS_EMS); 97 return CSSPrimitiveValue::createAllowingMarginQuirk(fValue, CSSPrimitive Value::CSS_EMS);
102 98
103 CSSPrimitiveValue::UnitTypes primitiveUnit = static_cast<CSSPrimitiveValue:: UnitTypes>(unit); 99 CSSPrimitiveValue::UnitTypes primitiveUnit = static_cast<CSSPrimitiveValue:: UnitTypes>(unit);
104 switch (primitiveUnit) { 100 switch (primitiveUnit) {
105 case CSSPrimitiveValue::CSS_IDENT: 101 case CSSPrimitiveValue::CSS_IDENT:
106 case CSSPrimitiveValue::CSS_PROPERTY_ID: 102 case CSSPrimitiveValue::CSS_PROPERTY_ID:
107 case CSSPrimitiveValue::CSS_VALUE_ID: 103 case CSSPrimitiveValue::CSS_VALUE_ID:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 case CSSPrimitiveValue::CSS_DIMENSION: 137 case CSSPrimitiveValue::CSS_DIMENSION:
142 case CSSPrimitiveValue::CSS_ATTR: 138 case CSSPrimitiveValue::CSS_ATTR:
143 case CSSPrimitiveValue::CSS_COUNTER: 139 case CSSPrimitiveValue::CSS_COUNTER:
144 case CSSPrimitiveValue::CSS_RECT: 140 case CSSPrimitiveValue::CSS_RECT:
145 case CSSPrimitiveValue::CSS_RGBCOLOR: 141 case CSSPrimitiveValue::CSS_RGBCOLOR:
146 case CSSPrimitiveValue::CSS_DPPX: 142 case CSSPrimitiveValue::CSS_DPPX:
147 case CSSPrimitiveValue::CSS_DPI: 143 case CSSPrimitiveValue::CSS_DPI:
148 case CSSPrimitiveValue::CSS_DPCM: 144 case CSSPrimitiveValue::CSS_DPCM:
149 case CSSPrimitiveValue::CSS_PAIR: 145 case CSSPrimitiveValue::CSS_PAIR:
150 case CSSPrimitiveValue::CSS_UNICODE_RANGE: 146 case CSSPrimitiveValue::CSS_UNICODE_RANGE:
151 case CSSPrimitiveValue::CSS_PARSER_OPERATOR:
152 case CSSPrimitiveValue::CSS_PARSER_INTEGER: 147 case CSSPrimitiveValue::CSS_PARSER_INTEGER:
153 case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER: 148 case CSSPrimitiveValue::CSS_PARSER_IDENTIFIER:
149 case CSSPrimitiveValue::CSS_PARSER_OPERATOR:
154 case CSSPrimitiveValue::CSS_COUNTER_NAME: 150 case CSSPrimitiveValue::CSS_COUNTER_NAME:
155 case CSSPrimitiveValue::CSS_SHAPE: 151 case CSSPrimitiveValue::CSS_SHAPE:
156 case CSSPrimitiveValue::CSS_QUAD: 152 case CSSPrimitiveValue::CSS_QUAD:
157 case CSSPrimitiveValue::CSS_CALC: 153 case CSSPrimitiveValue::CSS_CALC:
158 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER: 154 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER:
159 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH: 155 case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH:
160 return nullptr; 156 return nullptr;
161 } 157 }
162 158
163 ASSERT_NOT_REACHED(); 159 ASSERT_NOT_REACHED();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 { 257 {
262 CSSParserSelector* selector = const_cast<CSSParserSelector*>(this); 258 CSSParserSelector* selector = const_cast<CSSParserSelector*>(this);
263 do { 259 do {
264 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoAncestor) 260 if (selector->pseudoType() == CSSSelector::PseudoHost || selector->pseud oType() == CSSSelector::PseudoAncestor)
265 return true; 261 return true;
266 } while ((selector = selector->tagHistory())); 262 } while ((selector = selector->tagHistory()));
267 return false; 263 return false;
268 } 264 }
269 265
270 } // namespace WebCore 266 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSPrimitiveValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698