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

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

Issue 1031223003: SVG doesn't recognize rem units (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Align with review comments Created 5 years, 8 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 8135 matching lines...) Expand 10 before | Expand all | Expand 10 after
8146 return false; 8146 return false;
8147 } 8147 }
8148 8148
8149 if (validPrimitive) { 8149 if (validPrimitive) {
8150 if (id) 8150 if (id)
8151 parsedValue = CSSPrimitiveValue::createIdentifier(id); 8151 parsedValue = CSSPrimitiveValue::createIdentifier(id);
8152 else if (value->unit == CSSPrimitiveValue::CSS_STRING) 8152 else if (value->unit == CSSPrimitiveValue::CSS_STRING)
8153 parsedValue = CSSPrimitiveValue::create(value->string, (CSSPrimitive Value::UnitType) value->unit); 8153 parsedValue = CSSPrimitiveValue::create(value->string, (CSSPrimitive Value::UnitType) value->unit);
8154 else if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ) 8154 else if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
8155 parsedValue = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitType) value->unit); 8155 parsedValue = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitType) value->unit);
8156 else if (value->unit == CSSPrimitiveValue::CSS_REMS)
8157 parsedValue = CSSPrimitiveValue::create(value->fValue, (CSSPrimitive Value::UnitType)value->unit);
8156 else if (value->unit >= CSSParserValue::Q_EMS) 8158 else if (value->unit >= CSSParserValue::Q_EMS)
8157 parsedValue = CSSPrimitiveValue::createAllowingMarginQuirk(value->fV alue, CSSPrimitiveValue::CSS_EMS); 8159 parsedValue = CSSPrimitiveValue::createAllowingMarginQuirk(value->fV alue, CSSPrimitiveValue::CSS_EMS);
8158 if (isCalculation(value)) { 8160 if (isCalculation(value)) {
8159 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri mitiveValue here, ie 8161 // FIXME calc() http://webkit.org/b/16662 : actually create a CSSPri mitiveValue here, ie
8160 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea se()); 8162 // parsedValue = CSSPrimitiveValue::create(m_parsedCalculation.relea se());
8161 m_parsedCalculation.release(); 8163 m_parsedCalculation.release();
8162 parsedValue = nullptr; 8164 parsedValue = nullptr;
8163 } 8165 }
8164 m_valueList->next(); 8166 m_valueList->next();
8165 } 8167 }
(...skipping 10 matching lines...) Expand all
8176 CSSParserValue* value = m_valueList->current(); 8178 CSSParserValue* value = m_valueList->current();
8177 bool validPrimitive = true; 8179 bool validPrimitive = true;
8178 while (value) { 8180 while (value) {
8179 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg, SVGAttri buteMode); 8181 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg, SVGAttri buteMode);
8180 if (!validPrimitive) 8182 if (!validPrimitive)
8181 break; 8183 break;
8182 if (value->id) 8184 if (value->id)
8183 ret->append(CSSPrimitiveValue::createIdentifier(value->id)); 8185 ret->append(CSSPrimitiveValue::createIdentifier(value->id));
8184 else if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ) 8186 else if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
8185 ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveVa lue::UnitType) value->unit)); 8187 ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveVa lue::UnitType) value->unit));
8188 else if (value->unit == CSSPrimitiveValue::CSS_REMS)
8189 ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveVa lue::UnitType)value->unit));
8186 value = m_valueList->next(); 8190 value = m_valueList->next();
8187 bool commaConsumed = consumeComma(m_valueList); 8191 bool commaConsumed = consumeComma(m_valueList);
8188 value = m_valueList->current(); 8192 value = m_valueList->current();
8189 if (commaConsumed && !value) 8193 if (commaConsumed && !value)
8190 return nullptr; 8194 return nullptr;
8191 } 8195 }
8192 if (!validPrimitive) 8196 if (!validPrimitive)
8193 return nullptr; 8197 return nullptr;
8194 return ret.release(); 8198 return ret.release();
8195 } 8199 }
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
8480 } 8484 }
8481 } 8485 }
8482 8486
8483 if (!list->length()) 8487 if (!list->length())
8484 return nullptr; 8488 return nullptr;
8485 8489
8486 return list.release(); 8490 return list.release();
8487 } 8491 }
8488 8492
8489 } // namespace blink 8493 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698