| OLD | NEW |
| 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 Loading... |
| 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 "platform/FloatConversion.h" | 76 #include "platform/FloatConversion.h" |
| 77 #include "platform/RuntimeEnabledFeatures.h" | 77 #include "platform/RuntimeEnabledFeatures.h" |
| 78 #include "wtf/BitArray.h" | 78 #include "wtf/BitArray.h" |
| 79 #include "wtf/HexNumber.h" | 79 #include "wtf/HexNumber.h" |
| 80 #include "wtf/text/StringBuffer.h" | 80 #include "wtf/text/StringBuffer.h" |
| 81 #include "wtf/text/StringBuilder.h" | 81 #include "wtf/text/StringBuilder.h" |
| 82 #include "wtf/text/StringImpl.h" | 82 #include "wtf/text/StringImpl.h" |
| 83 #include "wtf/text/TextEncoding.h" | 83 #include "wtf/text/TextEncoding.h" |
| 84 #include <limits.h> | 84 #include <limits.h> |
| 85 | 85 |
| (...skipping 8202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8288 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV
alue::CSS_DEG); | 8288 parsedValue = CSSPrimitiveValue::create(value->fValue, CSSPrimitiveV
alue::CSS_DEG); |
| 8289 | 8289 |
| 8290 if (parsedValue) | 8290 if (parsedValue) |
| 8291 m_valueList->next(); | 8291 m_valueList->next(); |
| 8292 } | 8292 } |
| 8293 break; | 8293 break; |
| 8294 | 8294 |
| 8295 case CSSPropertyFill: // <paint> | inherit | 8295 case CSSPropertyFill: // <paint> | inherit |
| 8296 case CSSPropertyStroke: // <paint> | inherit | 8296 case CSSPropertyStroke: // <paint> | inherit |
| 8297 { | 8297 { |
| 8298 if (id == CSSValueNone) { | 8298 if (id == CSSValueNone || id == CSSValueCurrentcolor) { |
| 8299 parsedValue = SVGPaint::createNone(); | 8299 parsedValue = cssValuePool().createIdentifierValue(id); |
| 8300 } else if (id == CSSValueCurrentcolor) { | |
| 8301 parsedValue = SVGPaint::createCurrentColor(); | |
| 8302 } else if (isSystemColor(id)) { | 8300 } else if (isSystemColor(id)) { |
| 8303 parsedValue = SVGPaint::createColor(RenderTheme::theme().systemC
olor(id)); | 8301 parsedValue = cssValuePool().createColorValue(RenderTheme::theme
().systemColor(id).rgb()); |
| 8304 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { | 8302 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { |
| 8305 RGBA32 c = Color::transparent; | 8303 RGBA32 c = Color::transparent; |
| 8306 if (m_valueList->next()) { | 8304 if (m_valueList->next()) { |
| 8305 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea
teSpaceSeparated(); |
| 8306 values->append(CSSPrimitiveValue::create(value->string, CSSP
rimitiveValue::CSS_URI)); |
| 8307 if (parseColorFromValue(m_valueList->current(), c)) | 8307 if (parseColorFromValue(m_valueList->current(), c)) |
| 8308 parsedValue = SVGPaint::createURIAndColor(value->string,
c); | 8308 parsedValue = cssValuePool().createColorValue(c); |
| 8309 else if (m_valueList->current()->id == CSSValueNone) | 8309 else if (m_valueList->current()->id == CSSValueNone || m_val
ueList->current()->id == CSSValueCurrentcolor) |
| 8310 parsedValue = SVGPaint::createURIAndNone(value->string); | 8310 parsedValue = cssValuePool().createIdentifierValue(m_val
ueList->current()->id); |
| 8311 else if (m_valueList->current()->id == CSSValueCurrentcolor) | 8311 if (parsedValue) { |
| 8312 parsedValue = SVGPaint::createURIAndCurrentColor(value->
string); | 8312 values->append(parsedValue); |
| 8313 parsedValue = values; |
| 8314 } |
| 8313 } | 8315 } |
| 8314 if (!parsedValue) | 8316 if (!parsedValue) |
| 8315 parsedValue = SVGPaint::createURI(value->string); | 8317 parsedValue = CSSPrimitiveValue::create(value->string, CSSPr
imitiveValue::CSS_URI); |
| 8316 } else { | 8318 } else { |
| 8317 parsedValue = parseSVGPaint(); | 8319 parsedValue = parseColor(); |
| 8318 } | 8320 } |
| 8319 | 8321 |
| 8320 if (parsedValue) | 8322 if (parsedValue) |
| 8321 m_valueList->next(); | 8323 m_valueList->next(); |
| 8322 } | 8324 } |
| 8323 break; | 8325 break; |
| 8324 | 8326 |
| 8325 case CSSPropertyStopColor: // TODO : icccolor | 8327 case CSSPropertyStopColor: // TODO : icccolor |
| 8326 case CSSPropertyFloodColor: | 8328 case CSSPropertyFloodColor: |
| 8327 case CSSPropertyLightingColor: | 8329 case CSSPropertyLightingColor: |
| 8328 if (isSystemColor(id)) { | 8330 if (isSystemColor(id)) { |
| 8329 parsedValue = cssValuePool().createColorValue(RenderTheme::theme().s
ystemColor(id).rgb()); | 8331 parsedValue = cssValuePool().createColorValue(RenderTheme::theme().s
ystemColor(id).rgb()); |
| 8330 } else if ((id >= CSSValueAqua && id <= CSSValueTransparent) | 8332 } else if ((id >= CSSValueAqua && id <= CSSValueTransparent) |
| 8331 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == C
SSValueGrey) { | 8333 || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == C
SSValueGrey) { |
| 8332 StyleColor styleColor = SVGPaint::colorFromRGBColorString(value->str
ing); | 8334 StyleColor styleColor = BisonCSSParser::colorFromRGBColorString(valu
e->string); |
| 8333 ASSERT(!styleColor.isCurrentColor()); | 8335 ASSERT(!styleColor.isCurrentColor()); |
| 8334 parsedValue = cssValuePool().createColorValue(styleColor.color().rgb
()); | 8336 parsedValue = cssValuePool().createColorValue(styleColor.color().rgb
()); |
| 8335 } else if (id == CSSValueCurrentcolor) { | 8337 } else if (id == CSSValueCurrentcolor) { |
| 8336 parsedValue = cssValuePool().createIdentifierValue(id); | 8338 parsedValue = cssValuePool().createIdentifierValue(id); |
| 8337 } else { // TODO : svgcolor (iccColor) | 8339 } else { // TODO : svgcolor (iccColor) |
| 8338 parsedValue = parseColor(); | 8340 parsedValue = parseColor(); |
| 8339 } | 8341 } |
| 8340 | 8342 |
| 8341 if (parsedValue) | 8343 if (parsedValue) |
| 8342 m_valueList->next(); | 8344 m_valueList->next(); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8449 ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveVa
lue::UnitType) value->unit)); | 8451 ret->append(CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveVa
lue::UnitType) value->unit)); |
| 8450 value = m_valueList->next(); | 8452 value = m_valueList->next(); |
| 8451 if (value && value->unit == CSSParserValue::Operator && value->iValue ==
',') | 8453 if (value && value->unit == CSSParserValue::Operator && value->iValue ==
',') |
| 8452 value = m_valueList->next(); | 8454 value = m_valueList->next(); |
| 8453 } | 8455 } |
| 8454 if (!validPrimitive) | 8456 if (!validPrimitive) |
| 8455 return nullptr; | 8457 return nullptr; |
| 8456 return ret.release(); | 8458 return ret.release(); |
| 8457 } | 8459 } |
| 8458 | 8460 |
| 8459 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSVGPaint() | |
| 8460 { | |
| 8461 RGBA32 c = Color::transparent; | |
| 8462 if (!parseColorFromValue(m_valueList->current(), c)) | |
| 8463 return SVGPaint::createUnknown(); | |
| 8464 return SVGPaint::createColor(Color(c)); | |
| 8465 } | |
| 8466 | |
| 8467 // normal | [ fill || stroke || markers ] | 8461 // normal | [ fill || stroke || markers ] |
| 8468 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const | 8462 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const |
| 8469 { | 8463 { |
| 8470 if (m_valueList->size() > 3) | 8464 if (m_valueList->size() > 3) |
| 8471 return nullptr; | 8465 return nullptr; |
| 8472 | 8466 |
| 8473 CSSParserValue* value = m_valueList->current(); | 8467 CSSParserValue* value = m_valueList->current(); |
| 8474 if (!value) | 8468 if (!value) |
| 8475 return nullptr; | 8469 return nullptr; |
| 8476 | 8470 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8514 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8508 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
| 8515 if (!seenStroke) | 8509 if (!seenStroke) |
| 8516 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8510 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
| 8517 if (!seenMarkers) | 8511 if (!seenMarkers) |
| 8518 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8512 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
| 8519 | 8513 |
| 8520 return parsedValues.release(); | 8514 return parsedValues.release(); |
| 8521 } | 8515 } |
| 8522 | 8516 |
| 8523 } // namespace WebCore | 8517 } // namespace WebCore |
| OLD | NEW |