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 12 matching lines...) Expand all Loading... |
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 * Boston, MA 02110-1301, USA. | 24 * Boston, MA 02110-1301, USA. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/css/parser/CSSPropertyParser.h" | 28 #include "core/css/parser/CSSPropertyParser.h" |
29 | 29 |
30 #include "core/StylePropertyShorthand.h" | 30 #include "core/StylePropertyShorthand.h" |
31 #include "core/css/CSSBasicShapeValues.h" | 31 #include "core/css/CSSBasicShapeValues.h" |
32 #include "core/css/CSSBorderImage.h" | 32 #include "core/css/CSSBorderImage.h" |
33 #include "core/css/CSSCanvasValue.h" | |
34 #include "core/css/CSSContentDistributionValue.h" | 33 #include "core/css/CSSContentDistributionValue.h" |
35 #include "core/css/CSSCounterValue.h" | 34 #include "core/css/CSSCounterValue.h" |
36 #include "core/css/CSSCrossfadeValue.h" | 35 #include "core/css/CSSCrossfadeValue.h" |
37 #include "core/css/CSSCursorImageValue.h" | 36 #include "core/css/CSSCursorImageValue.h" |
38 #include "core/css/CSSCustomIdentValue.h" | 37 #include "core/css/CSSCustomIdentValue.h" |
39 #include "core/css/CSSFunctionValue.h" | 38 #include "core/css/CSSFunctionValue.h" |
40 #include "core/css/CSSGridLineNamesValue.h" | 39 #include "core/css/CSSGridLineNamesValue.h" |
41 #include "core/css/CSSImageSetValue.h" | 40 #include "core/css/CSSImageSetValue.h" |
42 #include "core/css/CSSImageValue.h" | 41 #include "core/css/CSSImageValue.h" |
43 #include "core/css/CSSPathValue.h" | 42 #include "core/css/CSSPathValue.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 CSSValueID id = val->function->id; | 297 CSSValueID id = val->function->id; |
299 return id == CSSValueLinearGradient | 298 return id == CSSValueLinearGradient |
300 || id == CSSValueRadialGradient | 299 || id == CSSValueRadialGradient |
301 || id == CSSValueRepeatingLinearGradient | 300 || id == CSSValueRepeatingLinearGradient |
302 || id == CSSValueRepeatingRadialGradient | 301 || id == CSSValueRepeatingRadialGradient |
303 || id == CSSValueWebkitLinearGradient | 302 || id == CSSValueWebkitLinearGradient |
304 || id == CSSValueWebkitRadialGradient | 303 || id == CSSValueWebkitRadialGradient |
305 || id == CSSValueWebkitRepeatingLinearGradient | 304 || id == CSSValueWebkitRepeatingLinearGradient |
306 || id == CSSValueWebkitRepeatingRadialGradient | 305 || id == CSSValueWebkitRepeatingRadialGradient |
307 || id == CSSValueWebkitGradient | 306 || id == CSSValueWebkitGradient |
308 || id == CSSValueWebkitCanvas | |
309 || id == CSSValueWebkitCrossFade; | 307 || id == CSSValueWebkitCrossFade; |
310 } | 308 } |
311 | 309 |
312 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseValidPr
imitive(CSSValueID identifier, CSSParserValue* value) | 310 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseValidPr
imitive(CSSValueID identifier, CSSParserValue* value) |
313 { | 311 { |
314 if (identifier) | 312 if (identifier) |
315 return cssValuePool().createIdentifierValue(identifier); | 313 return cssValuePool().createIdentifierValue(identifier); |
316 if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit() <=
CSSPrimitiveValue::UnitType::Kilohertz) | 314 if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit() <=
CSSPrimitiveValue::UnitType::Kilohertz) |
317 return createPrimitiveNumericValue(value); | 315 return createPrimitiveNumericValue(value); |
318 if (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit() <=
CSSPrimitiveValue::UnitType::Chs) | 316 if (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit() <=
CSSPrimitiveValue::UnitType::Chs) |
(...skipping 5396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5715 | 5713 |
5716 if (val->function->id == CSSValueWebkitRepeatingRadialGradient) { | 5714 if (val->function->id == CSSValueWebkitRepeatingRadialGradient) { |
5717 if (m_context.useCounter()) | 5715 if (m_context.useCounter()) |
5718 m_context.useCounter()->count(UseCounter::DeprecatedWebKitRepeatingR
adialGradient); | 5716 m_context.useCounter()->count(UseCounter::DeprecatedWebKitRepeatingR
adialGradient); |
5719 return parseDeprecatedRadialGradient(valueList, value, Repeating); | 5717 return parseDeprecatedRadialGradient(valueList, value, Repeating); |
5720 } | 5718 } |
5721 | 5719 |
5722 if (val->function->id == CSSValueRepeatingRadialGradient) | 5720 if (val->function->id == CSSValueRepeatingRadialGradient) |
5723 return parseRadialGradient(valueList, value, Repeating); | 5721 return parseRadialGradient(valueList, value, Repeating); |
5724 | 5722 |
5725 if (val->function->id == CSSValueWebkitCanvas) | |
5726 return parseCanvas(valueList, value); | |
5727 | |
5728 if (val->function->id == CSSValueWebkitCrossFade) | 5723 if (val->function->id == CSSValueWebkitCrossFade) |
5729 return parseCrossfade(valueList, value); | 5724 return parseCrossfade(valueList, value); |
5730 | 5725 |
5731 return false; | 5726 return false; |
5732 } | 5727 } |
5733 | 5728 |
5734 bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, RefPtrWill
BeRawPtr<CSSValue>& crossfade) | 5729 bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, RefPtrWill
BeRawPtr<CSSValue>& crossfade) |
5735 { | 5730 { |
5736 // Walk the arguments. | 5731 // Walk the arguments. |
5737 CSSParserValueList* args = valueList->current()->function->args.get(); | 5732 CSSParserValueList* args = valueList->current()->function->args.get(); |
(...skipping 29 matching lines...) Expand all Loading... |
5767 else if (value->unit() == CSSPrimitiveValue::UnitType::Number) | 5762 else if (value->unit() == CSSPrimitiveValue::UnitType::Number) |
5768 percentage = cssValuePool().createValue(clampTo<double>(value->fValue, 0
, 1), CSSPrimitiveValue::UnitType::Number); | 5763 percentage = cssValuePool().createValue(clampTo<double>(value->fValue, 0
, 1), CSSPrimitiveValue::UnitType::Number); |
5769 else | 5764 else |
5770 return false; | 5765 return false; |
5771 | 5766 |
5772 crossfade = CSSCrossfadeValue::create(fromImageValue, toImageValue, percenta
ge); | 5767 crossfade = CSSCrossfadeValue::create(fromImageValue, toImageValue, percenta
ge); |
5773 | 5768 |
5774 return true; | 5769 return true; |
5775 } | 5770 } |
5776 | 5771 |
5777 bool CSSPropertyParser::parseCanvas(CSSParserValueList* valueList, RefPtrWillBeR
awPtr<CSSValue>& canvas) | |
5778 { | |
5779 // Walk the arguments. | |
5780 CSSParserValueList* args = valueList->current()->function->args.get(); | |
5781 if (!args || args->size() != 1) | |
5782 return false; | |
5783 | |
5784 // The first argument is the canvas name. It is an identifier. | |
5785 CSSParserValue* value = args->current(); | |
5786 if (!value || value->m_unit != CSSParserValue::Identifier) | |
5787 return false; | |
5788 | |
5789 canvas = CSSCanvasValue::create(value->string); | |
5790 return true; | |
5791 } | |
5792 | |
5793 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseImageSet(CSSParserValue
List* valueList) | 5772 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseImageSet(CSSParserValue
List* valueList) |
5794 { | 5773 { |
5795 CSSParserValue* function = valueList->current(); | 5774 CSSParserValue* function = valueList->current(); |
5796 | 5775 |
5797 if (function->m_unit != CSSParserValue::Function) | 5776 if (function->m_unit != CSSParserValue::Function) |
5798 return nullptr; | 5777 return nullptr; |
5799 | 5778 |
5800 CSSParserValueList* functionArgs = valueList->current()->function->args.get(
); | 5779 CSSParserValueList* functionArgs = valueList->current()->function->args.get(
); |
5801 if (!functionArgs || !functionArgs->size() || !functionArgs->current()) | 5780 if (!functionArgs || !functionArgs->size() || !functionArgs->current()) |
5802 return nullptr; | 5781 return nullptr; |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6676 } | 6655 } |
6677 } | 6656 } |
6678 | 6657 |
6679 if (!list->length()) | 6658 if (!list->length()) |
6680 return nullptr; | 6659 return nullptr; |
6681 | 6660 |
6682 return list.release(); | 6661 return list.release(); |
6683 } | 6662 } |
6684 | 6663 |
6685 } // namespace blink | 6664 } // namespace blink |
OLD | NEW |