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

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

Issue 1169803004: Make __qems a CSSPrimitiveValue unit type (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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 value->unit = (unitflags & FLength) ? CSSPrimitiveValue::CSS_PX : CS SPrimitiveValue::CSS_DEG; 248 value->unit = (unitflags & FLength) ? CSSPrimitiveValue::CSS_PX : CS SPrimitiveValue::CSS_DEG;
249 return true; 249 return true;
250 } 250 }
251 if ((unitflags & FInteger) && value->isInt) 251 if ((unitflags & FInteger) && value->isInt)
252 return true; 252 return true;
253 if ((unitflags & FPositiveInteger) && value->isInt && value->fValue > 0) 253 if ((unitflags & FPositiveInteger) && value->isInt && value->fValue > 0)
254 return true; 254 return true;
255 return false; 255 return false;
256 case CSSPrimitiveValue::CSS_PERCENTAGE: 256 case CSSPrimitiveValue::CSS_PERCENTAGE:
257 return unitflags & FPercent; 257 return unitflags & FPercent;
258 case CSSParserValue::Q_EMS: 258 case CSSPrimitiveValue::CSS_QEM:
259 if (cssParserMode != UASheetMode) 259 if (cssParserMode != UASheetMode)
260 return false; 260 return false;
261 /* fallthrough intentional */ 261 /* fallthrough intentional */
262 case CSSPrimitiveValue::CSS_EMS: 262 case CSSPrimitiveValue::CSS_EMS:
263 case CSSPrimitiveValue::CSS_REMS: 263 case CSSPrimitiveValue::CSS_REMS:
264 case CSSPrimitiveValue::CSS_CHS: 264 case CSSPrimitiveValue::CSS_CHS:
265 case CSSPrimitiveValue::CSS_EXS: 265 case CSSPrimitiveValue::CSS_EXS:
266 case CSSPrimitiveValue::CSS_PX: 266 case CSSPrimitiveValue::CSS_PX:
267 case CSSPrimitiveValue::CSS_CM: 267 case CSSPrimitiveValue::CSS_CM:
268 case CSSPrimitiveValue::CSS_MM: 268 case CSSPrimitiveValue::CSS_MM:
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (identifier) 384 if (identifier)
385 return cssValuePool().createIdentifierValue(identifier); 385 return cssValuePool().createIdentifierValue(identifier);
386 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ) 386 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ)
387 return createPrimitiveNumericValue(value); 387 return createPrimitiveNumericValue(value);
388 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS) 388 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS)
389 return createPrimitiveNumericValue(value); 389 return createPrimitiveNumericValue(value);
390 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV alue::CSS_VMAX) 390 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV alue::CSS_VMAX)
391 return createPrimitiveNumericValue(value); 391 return createPrimitiveNumericValue(value);
392 if (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiv eValue::CSS_DPCM) 392 if (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiv eValue::CSS_DPCM)
393 return createPrimitiveNumericValue(value); 393 return createPrimitiveNumericValue(value);
394 if (value->unit >= CSSParserValue::Q_EMS) 394 if (value->unit == CSSPrimitiveValue::CSS_QEM)
395 return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPr imitiveValue::CSS_EMS); 395 return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPr imitiveValue::CSS_EMS);
396 if (isCalculation(value)) 396 if (isCalculation(value))
397 return CSSPrimitiveValue::create(m_parsedCalculation.release()); 397 return CSSPrimitiveValue::create(m_parsedCalculation.release());
398 398
399 return nullptr; 399 return nullptr;
400 } 400 }
401 401
402 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, PassRe fPtrWillBeRawPtr<CSSValue> prpValue, bool important) 402 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, PassRe fPtrWillBeRawPtr<CSSValue> prpValue, bool important)
403 { 403 {
404 const StylePropertyShorthand& shorthand = shorthandForProperty(propId); 404 const StylePropertyShorthand& shorthand = shorthandForProperty(propId);
(...skipping 7732 matching lines...) Expand 10 before | Expand all | Expand 10 after
8137 8137
8138 if (validPrimitive) { 8138 if (validPrimitive) {
8139 if (id) 8139 if (id)
8140 parsedValue = CSSPrimitiveValue::createIdentifier(id); 8140 parsedValue = CSSPrimitiveValue::createIdentifier(id);
8141 else if (value->unit == CSSPrimitiveValue::CSS_STRING) 8141 else if (value->unit == CSSPrimitiveValue::CSS_STRING)
8142 parsedValue = CSSPrimitiveValue::create(value->string, (CSSPrimitive Value::UnitType) value->unit); 8142 parsedValue = CSSPrimitiveValue::create(value->string, (CSSPrimitive Value::UnitType) value->unit);
8143 else if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ) 8143 else if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
8144 parsedValue = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitType) value->unit); 8144 parsedValue = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitType) value->unit);
8145 else if (value->unit == CSSPrimitiveValue::CSS_REMS || value->unit == CS SPrimitiveValue::CSS_CHS) 8145 else if (value->unit == CSSPrimitiveValue::CSS_REMS || value->unit == CS SPrimitiveValue::CSS_CHS)
8146 parsedValue = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitType)value->unit); 8146 parsedValue = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitType)value->unit);
8147 else if (value->unit >= CSSParserValue::Q_EMS) 8147 else if (value->unit == CSSPrimitiveValue::CSS_QEM)
8148 parsedValue = CSSPrimitiveValue::createAllowingMarginQuirk(value->fV alue, CSSPrimitiveValue::CSS_EMS); 8148 parsedValue = CSSPrimitiveValue::createAllowingMarginQuirk(value->fV alue, CSSPrimitiveValue::CSS_EMS);
8149 if (isCalculation(value)) { 8149 if (isCalculation(value)) {
8150 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri mitiveValue here, ie 8150 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri mitiveValue here, ie
8151 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea se()); 8151 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea se());
8152 m_parsedCalculation.release(); 8152 m_parsedCalculation.release();
8153 parsedValue = nullptr; 8153 parsedValue = nullptr;
8154 } 8154 }
8155 m_valueList->next(); 8155 m_valueList->next();
8156 } 8156 }
8157 if (!parsedValue || (m_valueList->current() && !inShorthand())) 8157 if (!parsedValue || (m_valueList->current() && !inShorthand()))
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
8477 } 8477 }
8478 } 8478 }
8479 8479
8480 if (!list->length()) 8480 if (!list->length())
8481 return nullptr; 8481 return nullptr;
8482 8482
8483 return list.release(); 8483 return list.release();
8484 } 8484 }
8485 8485
8486 } // namespace blink 8486 } // namespace blink
OLDNEW
« Source/core/css/CSSPrimitiveValue.cpp ('K') | « Source/core/css/parser/CSSParserValues.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698