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

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: Give SVGPaintType a new home 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 8121 matching lines...) Expand 10 before | Expand all | Expand 10 after
8201 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV alue::CSS_DEG); 8202 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV alue::CSS_DEG);
8202 8203
8203 if (parsedValue) 8204 if (parsedValue)
8204 m_valueList->next(); 8205 m_valueList->next();
8205 } 8206 }
8206 break; 8207 break;
8207 8208
8208 case CSSPropertyFill: // <paint> | inherit 8209 case CSSPropertyFill: // <paint> | inherit
8209 case CSSPropertyStroke: // <paint> | inherit 8210 case CSSPropertyStroke: // <paint> | inherit
8210 { 8211 {
8211 if (id == CSSValueNone) { 8212 if (id == CSSValueNone || id == CSSValueCurrentcolor) {
8212 parsedValue = SVGPaint::createNone(); 8213 parsedValue = cssValuePool().createIdentifierValue(id);
8213 } else if (id == CSSValueCurrentcolor) {
8214 parsedValue = SVGPaint::createCurrentColor();
8215 } else if (isSystemColor(id)) { 8214 } else if (isSystemColor(id)) {
8216 parsedValue = SVGPaint::createColor(RenderTheme::theme().systemC olor(id)); 8215 parsedValue = cssValuePool().createColorValue(RenderTheme::theme ().systemColor(id).rgb());
8217 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { 8216 } else if (value->unit == CSSPrimitiveValue::CSS_URI) {
8218 RGBA32 c = Color::transparent; 8217 RGBA32 c = Color::transparent;
8219 if (m_valueList->next()) { 8218 if (m_valueList->next()) {
8219 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea teSpaceSeparated();
8220 values->append(CSSPrimitiveValue::create(value->string, CSSP rimitiveValue::CSS_URI));
8220 if (parseColorFromValue(m_valueList->current(), c)) 8221 if (parseColorFromValue(m_valueList->current(), c))
8221 parsedValue = SVGPaint::createURIAndColor(value->string, c); 8222 parsedValue = cssValuePool().createColorValue(c);
8222 else if (m_valueList->current()->id == CSSValueNone) 8223 else if (m_valueList->current()->id == CSSValueNone)
8223 parsedValue = SVGPaint::createURIAndNone(value->string); 8224 parsedValue = cssValuePool().createIdentifierValue(m_val ueList->current()->id);
8224 else if (m_valueList->current()->id == CSSValueCurrentcolor) 8225 else if (m_valueList->current()->id == CSSValueCurrentcolor)
krit 2014/07/01 06:01:55 You combine none and current color above, why not
8225 parsedValue = SVGPaint::createURIAndCurrentColor(value-> string); 8226 parsedValue = cssValuePool().createIdentifierValue(m_val ueList->current()->id);
8227 if (parsedValue) {
8228 values->append(parsedValue);
8229 parsedValue = values;
8230 }
8226 } 8231 }
8227 if (!parsedValue) 8232 if (!parsedValue)
8228 parsedValue = SVGPaint::createURI(value->string); 8233 parsedValue = CSSPrimitiveValue::create(value->string, CSSPr imitiveValue::CSS_URI);
8229 } else { 8234 } else {
8230 parsedValue = parseSVGPaint(); 8235 parsedValue = parseColor();
8231 } 8236 }
8232 8237
8233 if (parsedValue) 8238 if (parsedValue)
8234 m_valueList->next(); 8239 m_valueList->next();
8235 } 8240 }
8236 break; 8241 break;
8237 8242
8238 case CSSPropertyStopColor: // TODO : icccolor 8243 case CSSPropertyStopColor: // TODO : icccolor
8239 case CSSPropertyFloodColor: 8244 case CSSPropertyFloodColor:
8240 case CSSPropertyLightingColor: 8245 case CSSPropertyLightingColor:
8241 if (isSystemColor(id)) { 8246 if (isSystemColor(id)) {
8242 parsedValue = cssValuePool().createColorValue(RenderTheme::theme().s ystemColor(id).rgb()); 8247 parsedValue = cssValuePool().createColorValue(RenderTheme::theme().s ystemColor(id).rgb());
8243 } else if ((id >= CSSValueAqua && id <= CSSValueTransparent) 8248 } else if ((id >= CSSValueAqua && id <= CSSValueTransparent)
8244 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == C SSValueGrey) { 8249 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == C SSValueGrey) {
8245 StyleColor styleColor = SVGPaint::colorFromRGBColorString(value->str ing); 8250 StyleColor styleColor = BisonCSSParser::colorFromRGBColorString(valu e->string);
8246 ASSERT(!styleColor.isCurrentColor()); 8251 ASSERT(!styleColor.isCurrentColor());
8247 parsedValue = cssValuePool().createColorValue(styleColor.color().rgb ()); 8252 parsedValue = cssValuePool().createColorValue(styleColor.color().rgb ());
8248 } else if (id == CSSValueCurrentcolor) { 8253 } else if (id == CSSValueCurrentcolor) {
8249 parsedValue = cssValuePool().createIdentifierValue(id); 8254 parsedValue = cssValuePool().createIdentifierValue(id);
8250 } else { // TODO : svgcolor (iccColor) 8255 } else { // TODO : svgcolor (iccColor)
8251 parsedValue = parseColor(); 8256 parsedValue = parseColor();
8252 } 8257 }
8253 8258
8254 if (parsedValue) 8259 if (parsedValue)
8255 m_valueList->next(); 8260 m_valueList->next();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
8362 ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveVa lue::UnitType) value->unit)); 8367 ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveVa lue::UnitType) value->unit));
8363 value = m_valueList->next(); 8368 value = m_valueList->next();
8364 if (value && value->unit == CSSParserValue::Operator && value->iValue == ',') 8369 if (value && value->unit == CSSParserValue::Operator && value->iValue == ',')
8365 value = m_valueList->next(); 8370 value = m_valueList->next();
8366 } 8371 }
8367 if (!validPrimitive) 8372 if (!validPrimitive)
8368 return nullptr; 8373 return nullptr;
8369 return ret.release(); 8374 return ret.release();
8370 } 8375 }
8371 8376
8372 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSVGPaint()
8373 {
8374 RGBA32 c = Color::transparent;
8375 if (!parseColorFromValue(m_valueList->current(), c))
8376 return SVGPaint::createUnknown();
8377 return SVGPaint::createColor(Color(c));
8378 }
8379
8380 // normal | [ fill || stroke || markers ] 8377 // normal | [ fill || stroke || markers ]
8381 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const 8378 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const
8382 { 8379 {
8383 if (m_valueList->size() > 3) 8380 if (m_valueList->size() > 3)
8384 return nullptr; 8381 return nullptr;
8385 8382
8386 CSSParserValue* value = m_valueList->current(); 8383 CSSParserValue* value = m_valueList->current();
8387 if (!value) 8384 if (!value)
8388 return nullptr; 8385 return nullptr;
8389 8386
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
8427 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8424 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8428 if (!seenStroke) 8425 if (!seenStroke)
8429 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8426 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8430 if (!seenMarkers) 8427 if (!seenMarkers)
8431 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8428 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8432 8429
8433 return parsedValues.release(); 8430 return parsedValues.release();
8434 } 8431 }
8435 8432
8436 } // namespace WebCore 8433 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698