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 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2363 | 2363 |
2364 // Used to parse colors for -webkit-gradient(...). | 2364 // Used to parse colors for -webkit-gradient(...). |
2365 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseDeprecatedGrad
ientStopColor(const CSSParserValue* value) | 2365 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseDeprecatedGrad
ientStopColor(const CSSParserValue* value) |
2366 { | 2366 { |
2367 // Disallow currentcolor. | 2367 // Disallow currentcolor. |
2368 if (value->id == CSSValueCurrentcolor) | 2368 if (value->id == CSSValueCurrentcolor) |
2369 return nullptr; | 2369 return nullptr; |
2370 return parseGradientStopColor(value); | 2370 return parseGradientStopColor(value); |
2371 } | 2371 } |
2372 | 2372 |
2373 // Used to parse <color> for SVG properties. | |
2374 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseSVGColor(const
CSSParserValue* value) | |
2375 { | |
2376 CSSValueID id = value->id; | |
2377 if (id == CSSValueCurrentcolor) | |
2378 return cssValuePool().createIdentifierValue(id); | |
2379 if ((id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSSVal
ueMenu) | |
2380 return cssValuePool().createColorValue(LayoutTheme::theme().systemColor(
id).rgb()); | |
2381 RGBA32 c = Color::transparent; | |
2382 if (!parseColorFromValue(value, c)) | |
2383 return nullptr; | |
2384 return cssValuePool().createColorValue(c); | |
2385 } | |
2386 | |
2387 bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill
BeRawPtr<CSSValue>& value) | 2373 bool CSSPropertyParser::parseFillImage(CSSParserValueList* valueList, RefPtrWill
BeRawPtr<CSSValue>& value) |
2388 { | 2374 { |
2389 if (valueList->current()->id == CSSValueNone) { | 2375 if (valueList->current()->id == CSSValueNone) { |
2390 value = cssValuePool().createIdentifierValue(CSSValueNone); | 2376 value = cssValuePool().createIdentifierValue(CSSValueNone); |
2391 return true; | 2377 return true; |
2392 } | 2378 } |
2393 if (valueList->current()->unit == CSSPrimitiveValue::CSS_URI) { | 2379 if (valueList->current()->unit == CSSPrimitiveValue::CSS_URI) { |
2394 value = createCSSImageValueWithReferrer(valueList->current()->string, co
mpleteURL(valueList->current()->string)); | 2380 value = createCSSImageValueWithReferrer(valueList->current()->string, co
mpleteURL(valueList->current()->string)); |
2395 return true; | 2381 return true; |
2396 } | 2382 } |
(...skipping 5446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7843 { | 7829 { |
7844 if (id == CSSValueNone) { | 7830 if (id == CSSValueNone) { |
7845 parsedValue = cssValuePool().createIdentifierValue(id); | 7831 parsedValue = cssValuePool().createIdentifierValue(id); |
7846 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { | 7832 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { |
7847 if (m_valueList->next()) { | 7833 if (m_valueList->next()) { |
7848 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea
teSpaceSeparated(); | 7834 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::crea
teSpaceSeparated(); |
7849 values->append(CSSPrimitiveValue::create(value->string, CSSP
rimitiveValue::CSS_URI)); | 7835 values->append(CSSPrimitiveValue::create(value->string, CSSP
rimitiveValue::CSS_URI)); |
7850 if (m_valueList->current()->id == CSSValueNone) | 7836 if (m_valueList->current()->id == CSSValueNone) |
7851 parsedValue = cssValuePool().createIdentifierValue(m_val
ueList->current()->id); | 7837 parsedValue = cssValuePool().createIdentifierValue(m_val
ueList->current()->id); |
7852 else | 7838 else |
7853 parsedValue = parseSVGColor(m_valueList->current()); | 7839 parsedValue = parseColor(m_valueList->current()); |
7854 if (parsedValue) { | 7840 if (parsedValue) { |
7855 values->append(parsedValue); | 7841 values->append(parsedValue); |
7856 parsedValue = values; | 7842 parsedValue = values; |
7857 } | 7843 } |
7858 } | 7844 } |
7859 if (!parsedValue) | 7845 if (!parsedValue) |
7860 parsedValue = CSSPrimitiveValue::create(value->string, CSSPr
imitiveValue::CSS_URI); | 7846 parsedValue = CSSPrimitiveValue::create(value->string, CSSPr
imitiveValue::CSS_URI); |
7861 } else { | 7847 } else { |
7862 parsedValue = parseSVGColor(m_valueList->current()); | 7848 parsedValue = parseColor(m_valueList->current()); |
7863 } | 7849 } |
7864 | 7850 |
7865 if (parsedValue) | 7851 if (parsedValue) |
7866 m_valueList->next(); | 7852 m_valueList->next(); |
7867 } | 7853 } |
7868 break; | 7854 break; |
7869 | 7855 |
7870 case CSSPropertyStopColor: // TODO : icccolor | 7856 case CSSPropertyStopColor: // TODO : icccolor |
7871 case CSSPropertyFloodColor: | 7857 case CSSPropertyFloodColor: |
7872 case CSSPropertyLightingColor: | 7858 case CSSPropertyLightingColor: |
7873 parsedValue = parseSVGColor(m_valueList->current()); | 7859 parsedValue = parseColor(m_valueList->current()); |
7874 if (parsedValue) | 7860 if (parsedValue) |
7875 m_valueList->next(); | 7861 m_valueList->next(); |
7876 | 7862 |
7877 break; | 7863 break; |
7878 | 7864 |
7879 case CSSPropertyPaintOrder: | 7865 case CSSPropertyPaintOrder: |
7880 if (m_valueList->size() == 1 && id == CSSValueNormal) | 7866 if (m_valueList->size() == 1 && id == CSSValueNormal) |
7881 validPrimitive = true; | 7867 validPrimitive = true; |
7882 else if ((parsedValue = parsePaintOrder())) | 7868 else if ((parsedValue = parsePaintOrder())) |
7883 m_valueList->next(); | 7869 m_valueList->next(); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8281 } | 8267 } |
8282 } | 8268 } |
8283 | 8269 |
8284 if (!list->length()) | 8270 if (!list->length()) |
8285 return nullptr; | 8271 return nullptr; |
8286 | 8272 |
8287 return list.release(); | 8273 return list.release(); |
8288 } | 8274 } |
8289 | 8275 |
8290 } // namespace blink | 8276 } // namespace blink |
OLD | NEW |