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

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

Issue 361543002: Remove SVGPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix tests Created 6 years, 5 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "core/css/CSSTimingFunctionValue.h" 60 #include "core/css/CSSTimingFunctionValue.h"
61 #include "core/css/CSSTransformValue.h" 61 #include "core/css/CSSTransformValue.h"
62 #include "core/css/CSSUnicodeRangeValue.h" 62 #include "core/css/CSSUnicodeRangeValue.h"
63 #include "core/css/CSSValueList.h" 63 #include "core/css/CSSValueList.h"
64 #include "core/css/CSSValuePool.h" 64 #include "core/css/CSSValuePool.h"
65 #include "core/css/Counter.h" 65 #include "core/css/Counter.h"
66 #include "core/css/HashTools.h" 66 #include "core/css/HashTools.h"
67 #include "core/css/Pair.h" 67 #include "core/css/Pair.h"
68 #include "core/css/Rect.h" 68 #include "core/css/Rect.h"
69 #include "core/css/RuntimeCSSEnabled.h" 69 #include "core/css/RuntimeCSSEnabled.h"
70 #include "core/css/parser/BisonCSSParser.h"
70 #include "core/css/parser/CSSParserIdioms.h" 71 #include "core/css/parser/CSSParserIdioms.h"
71 #include "core/frame/UseCounter.h" 72 #include "core/frame/UseCounter.h"
72 #include "core/html/parser/HTMLParserIdioms.h" 73 #include "core/html/parser/HTMLParserIdioms.h"
73 #include "core/inspector/InspectorInstrumentation.h" 74 #include "core/inspector/InspectorInstrumentation.h"
74 #include "core/rendering/RenderTheme.h" 75 #include "core/rendering/RenderTheme.h"
75 #include "core/svg/SVGPaint.h" 76 #include "core/svg/SVGPaint.h"
76 #include "platform/FloatConversion.h" 77 #include "platform/FloatConversion.h"
77 #include "platform/RuntimeEnabledFeatures.h" 78 #include "platform/RuntimeEnabledFeatures.h"
78 #include "wtf/BitArray.h" 79 #include "wtf/BitArray.h"
79 #include "wtf/HexNumber.h" 80 #include "wtf/HexNumber.h"
(...skipping 8125 matching lines...) Expand 10 before | Expand all | Expand 10 after
8205 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV alue::CSS_DEG); 8206 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV alue::CSS_DEG);
8206 8207
8207 if (parsedValue) 8208 if (parsedValue)
8208 m_valueList->next(); 8209 m_valueList->next();
8209 } 8210 }
8210 break; 8211 break;
8211 8212
8212 case CSSPropertyFill: // <paint> | inherit 8213 case CSSPropertyFill: // <paint> | inherit
8213 case CSSPropertyStroke: // <paint> | inherit 8214 case CSSPropertyStroke: // <paint> | inherit
8214 { 8215 {
8215 if (id == CSSValueNone) { 8216 if (id == CSSValueNone || id == CSSValueCurrentcolor) {
8216 parsedValue = SVGPaint::createNone(); 8217 parsedValue = cssValuePool().createIdentifierValue(id);
8217 } else if (id == CSSValueCurrentcolor) {
8218 parsedValue = SVGPaint::createCurrentColor();
8219 } else if (isSystemColor(id)) { 8218 } else if (isSystemColor(id)) {
8220 parsedValue = SVGPaint::createColor(RenderTheme::theme().systemC olor(id)); 8219 parsedValue = cssValuePool().createColorValue(RenderTheme::theme ().systemColor(id).rgb());
8221 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { 8220 } else if (value->unit == CSSPrimitiveValue::CSS_URI) {
8222 RGBA32 c = Color::transparent; 8221 RGBA32 c = Color::transparent;
8223 if (m_valueList->next()) { 8222 if (m_valueList->next()) {
8223 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea teSpaceSeparated();
8224 values->append(CSSPrimitiveValue::create(value->string, CSSP rimitiveValue::CSS_URI));
8224 if (parseColorFromValue(m_valueList->current(), c)) 8225 if (parseColorFromValue(m_valueList->current(), c))
8225 parsedValue = SVGPaint::createURIAndColor(value->string, c); 8226 parsedValue = cssValuePool().createColorValue(c);
8226 else if (m_valueList->current()->id == CSSValueNone) 8227 else if (m_valueList->current()->id == CSSValueNone)
8227 parsedValue = SVGPaint::createURIAndNone(value->string); 8228 parsedValue = cssValuePool().createIdentifierValue(m_val ueList->current()->id);
8228 else if (m_valueList->current()->id == CSSValueCurrentcolor) 8229 else if (m_valueList->current()->id == CSSValueCurrentcolor)
8229 parsedValue = SVGPaint::createURIAndCurrentColor(value-> string); 8230 parsedValue = cssValuePool().createIdentifierValue(m_val ueList->current()->id);
8231 if (parsedValue) {
8232 values->append(parsedValue);
8233 parsedValue = values;
8234 }
8230 } 8235 }
8231 if (!parsedValue) 8236 if (!parsedValue)
8232 parsedValue = SVGPaint::createURI(value->string); 8237 parsedValue = CSSPrimitiveValue::create(value->string, CSSPr imitiveValue::CSS_URI);
8233 } else { 8238 } else {
8234 parsedValue = parseSVGPaint(); 8239 parsedValue = parseColor();
8235 } 8240 }
8236 8241
8237 if (parsedValue) 8242 if (parsedValue)
8238 m_valueList->next(); 8243 m_valueList->next();
8239 } 8244 }
8240 break; 8245 break;
8241 8246
8242 case CSSPropertyStopColor: // TODO : icccolor 8247 case CSSPropertyStopColor: // TODO : icccolor
8243 case CSSPropertyFloodColor: 8248 case CSSPropertyFloodColor:
8244 case CSSPropertyLightingColor: 8249 case CSSPropertyLightingColor:
8245 if (isSystemColor(id)) { 8250 if (isSystemColor(id)) {
8246 parsedValue = cssValuePool().createColorValue(RenderTheme::theme().s ystemColor(id).rgb()); 8251 parsedValue = cssValuePool().createColorValue(RenderTheme::theme().s ystemColor(id).rgb());
8247 } else if ((id >= CSSValueAqua && id <= CSSValueTransparent) 8252 } else if ((id >= CSSValueAqua && id <= CSSValueTransparent)
8248 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == C SSValueGrey) { 8253 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == C SSValueGrey) {
8249 StyleColor styleColor = SVGPaint::colorFromRGBColorString(value->str ing); 8254 StyleColor styleColor = BisonCSSParser::colorFromRGBColorString(valu e->string);
8250 ASSERT(!styleColor.isCurrentColor()); 8255 ASSERT(!styleColor.isCurrentColor());
8251 parsedValue = cssValuePool().createColorValue(styleColor.color().rgb ()); 8256 parsedValue = cssValuePool().createColorValue(styleColor.color().rgb ());
8252 } else if (id == CSSValueCurrentcolor) { 8257 } else if (id == CSSValueCurrentcolor) {
8253 parsedValue = cssValuePool().createIdentifierValue(id); 8258 parsedValue = cssValuePool().createIdentifierValue(id);
8254 } else { // TODO : svgcolor (iccColor) 8259 } else { // TODO : svgcolor (iccColor)
8255 parsedValue = parseColor(); 8260 parsedValue = parseColor();
8256 } 8261 }
8257 8262
8258 if (parsedValue) 8263 if (parsedValue)
8259 m_valueList->next(); 8264 m_valueList->next();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
8366 ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveVa lue::UnitType) value->unit)); 8371 ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveVa lue::UnitType) value->unit));
8367 value = m_valueList->next(); 8372 value = m_valueList->next();
8368 if (value && value->unit == CSSParserValue::Operator && value->iValue == ',') 8373 if (value && value->unit == CSSParserValue::Operator && value->iValue == ',')
8369 value = m_valueList->next(); 8374 value = m_valueList->next();
8370 } 8375 }
8371 if (!validPrimitive) 8376 if (!validPrimitive)
8372 return nullptr; 8377 return nullptr;
8373 return ret.release(); 8378 return ret.release();
8374 } 8379 }
8375 8380
8376 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSVGPaint()
8377 {
8378 RGBA32 c = Color::transparent;
8379 if (!parseColorFromValue(m_valueList->current(), c))
8380 return SVGPaint::createUnknown();
8381 return SVGPaint::createColor(Color(c));
8382 }
8383
8384 // normal | [ fill || stroke || markers ] 8381 // normal | [ fill || stroke || markers ]
8385 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const 8382 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const
8386 { 8383 {
8387 if (m_valueList->size() > 3) 8384 if (m_valueList->size() > 3)
8388 return nullptr; 8385 return nullptr;
8389 8386
8390 CSSParserValue* value = m_valueList->current(); 8387 CSSParserValue* value = m_valueList->current();
8391 if (!value) 8388 if (!value)
8392 return nullptr; 8389 return nullptr;
8393 8390
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
8431 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8428 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8432 if (!seenStroke) 8429 if (!seenStroke)
8433 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8430 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8434 if (!seenMarkers) 8431 if (!seenMarkers)
8435 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8432 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8436 8433
8437 return parsedValues.release(); 8434 return parsedValues.release();
8438 } 8435 }
8439 8436
8440 } // namespace WebCore 8437 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698