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

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

Issue 189913012: Merge SVGColor into SVGPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix system color test 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
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 8239 matching lines...) Expand 10 before | Expand all | Expand 10 after
8250 } 8250 }
8251 8251
8252 if (parsedValue) 8252 if (parsedValue)
8253 m_valueList->next(); 8253 m_valueList->next();
8254 } 8254 }
8255 break; 8255 break;
8256 8256
8257 case CSSPropertyStopColor: // TODO : icccolor 8257 case CSSPropertyStopColor: // TODO : icccolor
8258 case CSSPropertyFloodColor: 8258 case CSSPropertyFloodColor:
8259 case CSSPropertyLightingColor: 8259 case CSSPropertyLightingColor:
8260 if (isSystemColor(id)) 8260 if (isSystemColor(id)) {
8261 parsedValue = SVGColor::createFromColor(RenderTheme::theme().systemC olor(id)); 8261 parsedValue = cssValuePool().createColorValue(RenderTheme::theme().s ystemColor(id).rgb());
8262 else if ((id >= CSSValueAqua && id <= CSSValueTransparent) 8262 } else if ((id >= CSSValueAqua && id <= CSSValueTransparent)
8263 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == C SSValueGrey) 8263 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == C SSValueGrey) {
8264 parsedValue = SVGColor::createFromString(value->string); 8264 StyleColor styleColor = SVGPaint::colorFromRGBColorString(value->str ing);
8265 else if (id == CSSValueCurrentcolor) 8265 ASSERT(!styleColor.isCurrentColor());
8266 parsedValue = SVGColor::createCurrentColor(); 8266 parsedValue = cssValuePool().createColorValue(styleColor.color().rgb ());
8267 else // TODO : svgcolor (iccColor) 8267 } else if (id == CSSValueCurrentcolor) {
8268 parsedValue = parseSVGColor(); 8268 parsedValue = cssValuePool().createIdentifierValue(id);
8269 } else { // TODO : svgcolor (iccColor)
8270 parsedValue = parseColor();
8271 }
8269 8272
8270 if (parsedValue) 8273 if (parsedValue)
8271 m_valueList->next(); 8274 m_valueList->next();
8272 8275
8273 break; 8276 break;
8274 8277
8275 case CSSPropertyPaintOrder: 8278 case CSSPropertyPaintOrder:
8276 if (!RuntimeEnabledFeatures::svgPaintOrderEnabled()) 8279 if (!RuntimeEnabledFeatures::svgPaintOrderEnabled())
8277 return false; 8280 return false;
8278 8281
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
8396 } 8399 }
8397 8400
8398 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSVGPaint() 8401 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSVGPaint()
8399 { 8402 {
8400 RGBA32 c = Color::transparent; 8403 RGBA32 c = Color::transparent;
8401 if (!parseColorFromValue(m_valueList->current(), c)) 8404 if (!parseColorFromValue(m_valueList->current(), c))
8402 return SVGPaint::createUnknown(); 8405 return SVGPaint::createUnknown();
8403 return SVGPaint::createColor(Color(c)); 8406 return SVGPaint::createColor(Color(c));
8404 } 8407 }
8405 8408
8406 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSVGColor()
8407 {
8408 RGBA32 c = Color::transparent;
8409 if (!parseColorFromValue(m_valueList->current(), c))
8410 return nullptr;
8411 return SVGColor::createFromColor(Color(c));
8412 }
8413
8414 // normal | [ fill || stroke || markers ] 8409 // normal | [ fill || stroke || markers ]
8415 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const 8410 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const
8416 { 8411 {
8417 if (m_valueList->size() > 3) 8412 if (m_valueList->size() > 3)
8418 return nullptr; 8413 return nullptr;
8419 8414
8420 CSSParserValue* value = m_valueList->current(); 8415 CSSParserValue* value = m_valueList->current();
8421 if (!value) 8416 if (!value)
8422 return nullptr; 8417 return nullptr;
8423 8418
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
8461 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8456 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8462 if (!seenStroke) 8457 if (!seenStroke)
8463 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8458 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8464 if (!seenMarkers) 8459 if (!seenMarkers)
8465 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8460 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8466 8461
8467 return parsedValues.release(); 8462 return parsedValues.release();
8468 } 8463 }
8469 8464
8470 } // namespace WebCore 8465 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698