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 24 matching lines...) Expand all Loading... |
35 #include "core/css/CSSCanvasValue.h" | 35 #include "core/css/CSSCanvasValue.h" |
36 #include "core/css/CSSCrossfadeValue.h" | 36 #include "core/css/CSSCrossfadeValue.h" |
37 #include "core/css/CSSCursorImageValue.h" | 37 #include "core/css/CSSCursorImageValue.h" |
38 #include "core/css/CSSFontFaceSrcValue.h" | 38 #include "core/css/CSSFontFaceSrcValue.h" |
39 #include "core/css/CSSGradientValue.h" | 39 #include "core/css/CSSGradientValue.h" |
40 #include "core/css/CSSImageSetValue.h" | 40 #include "core/css/CSSImageSetValue.h" |
41 #include "core/css/CSSImageValue.h" | 41 #include "core/css/CSSImageValue.h" |
42 #include "core/css/CSSInheritedValue.h" | 42 #include "core/css/CSSInheritedValue.h" |
43 #include "core/css/CSSInitialValue.h" | 43 #include "core/css/CSSInitialValue.h" |
44 #include "core/css/CSSLineBoxContainValue.h" | 44 #include "core/css/CSSLineBoxContainValue.h" |
| 45 #include "core/css/CSSMixFunctionValue.h" |
45 #include "core/css/CSSPrimitiveValue.h" | 46 #include "core/css/CSSPrimitiveValue.h" |
46 #include "core/css/CSSPropertySourceData.h" | 47 #include "core/css/CSSPropertySourceData.h" |
47 #include "core/css/CSSReflectValue.h" | 48 #include "core/css/CSSReflectValue.h" |
| 49 #include "core/css/CSSSVGDocumentValue.h" |
48 #include "core/css/CSSSelector.h" | 50 #include "core/css/CSSSelector.h" |
| 51 #include "core/css/CSSShaderValue.h" |
49 #include "core/css/CSSStyleSheet.h" | 52 #include "core/css/CSSStyleSheet.h" |
50 #include "core/css/CSSTimingFunctionValue.h" | 53 #include "core/css/CSSTimingFunctionValue.h" |
| 54 #include "core/css/CSSTransformValue.h" |
51 #include "core/css/CSSUnicodeRangeValue.h" | 55 #include "core/css/CSSUnicodeRangeValue.h" |
52 #include "core/css/CSSValueList.h" | 56 #include "core/css/CSSValueList.h" |
53 #include "core/css/CSSValuePool.h" | 57 #include "core/css/CSSValuePool.h" |
54 #include "core/css/CSSVariableValue.h" | 58 #include "core/css/CSSVariableValue.h" |
55 #include "core/css/Counter.h" | 59 #include "core/css/Counter.h" |
56 #include "core/css/FontFeatureValue.h" | 60 #include "core/css/FontFeatureValue.h" |
57 #include "core/css/MediaList.h" | 61 #include "core/css/MediaList.h" |
58 #include "core/css/MediaQueryExp.h" | 62 #include "core/css/MediaQueryExp.h" |
59 #include "core/css/Pair.h" | 63 #include "core/css/Pair.h" |
60 #include "core/css/Rect.h" | 64 #include "core/css/Rect.h" |
61 #include "core/css/ShadowValue.h" | 65 #include "core/css/ShadowValue.h" |
62 #include "core/css/StylePropertySet.h" | 66 #include "core/css/StylePropertySet.h" |
63 #include "core/css/StylePropertyShorthand.h" | 67 #include "core/css/StylePropertyShorthand.h" |
64 #include "core/css/StyleRule.h" | 68 #include "core/css/StyleRule.h" |
65 #include "core/css/StyleRuleImport.h" | 69 #include "core/css/StyleRuleImport.h" |
66 #include "core/css/StyleSheetContents.h" | 70 #include "core/css/StyleSheetContents.h" |
67 #include "core/css/WebKitCSSArrayFunctionValue.h" | 71 #include "core/css/WebKitCSSArrayFunctionValue.h" |
68 #include "core/css/WebKitCSSFilterValue.h" | 72 #include "core/css/WebKitCSSFilterValue.h" |
69 #include "core/css/WebKitCSSKeyframeRule.h" | 73 #include "core/css/WebKitCSSKeyframeRule.h" |
70 #include "core/css/WebKitCSSKeyframesRule.h" | 74 #include "core/css/WebKitCSSKeyframesRule.h" |
71 #include "core/css/WebKitCSSMixFunctionValue.h" | |
72 #include "core/css/WebKitCSSSVGDocumentValue.h" | |
73 #include "core/css/WebKitCSSShaderValue.h" | |
74 #include "core/css/WebKitCSSTransformValue.h" | |
75 #include "core/dom/Document.h" | 75 #include "core/dom/Document.h" |
76 #include "core/html/parser/HTMLParserIdioms.h" | 76 #include "core/html/parser/HTMLParserIdioms.h" |
77 #include "core/inspector/InspectorInstrumentation.h" | 77 #include "core/inspector/InspectorInstrumentation.h" |
78 #include "core/page/Page.h" | 78 #include "core/page/Page.h" |
79 #include "core/page/PageConsole.h" | 79 #include "core/page/PageConsole.h" |
80 #include "core/page/Settings.h" | 80 #include "core/page/Settings.h" |
81 #include "core/platform/FloatConversion.h" | 81 #include "core/platform/FloatConversion.h" |
82 #include "core/platform/HashTools.h" | 82 #include "core/platform/HashTools.h" |
83 #include "core/platform/HistogramSupport.h" | 83 #include "core/platform/HistogramSupport.h" |
84 #include "core/rendering/RenderTheme.h" | 84 #include "core/rendering/RenderTheme.h" |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 else if (isValidKeywordPropertyAndValue(propertyId, valueID, parserContext)) | 1084 else if (isValidKeywordPropertyAndValue(propertyId, valueID, parserContext)) |
1085 value = cssValuePool().createIdentifierValue(valueID); | 1085 value = cssValuePool().createIdentifierValue(valueID); |
1086 else | 1086 else |
1087 return false; | 1087 return false; |
1088 | 1088 |
1089 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), impo
rtant)); | 1089 declaration->addParsedProperty(CSSProperty(propertyId, value.release(), impo
rtant)); |
1090 return true; | 1090 return true; |
1091 } | 1091 } |
1092 | 1092 |
1093 template <typename CharacterType> | 1093 template <typename CharacterType> |
1094 static bool parseTransformArguments(WebKitCSSTransformValue* transformValue, Cha
racterType* characters, unsigned length, unsigned start, unsigned expectedCount) | 1094 static bool parseTransformArguments(CSSTransformValue* transformValue, Character
Type* characters, unsigned length, unsigned start, unsigned expectedCount) |
1095 { | 1095 { |
1096 while (expectedCount) { | 1096 while (expectedCount) { |
1097 size_t end = WTF::find(characters, length, expectedCount == 1 ? ')' : ',
', start); | 1097 size_t end = WTF::find(characters, length, expectedCount == 1 ? ')' : ',
', start); |
1098 if (end == notFound || (expectedCount == 1 && end != length - 1)) | 1098 if (end == notFound || (expectedCount == 1 && end != length - 1)) |
1099 return false; | 1099 return false; |
1100 unsigned argumentLength = end - start; | 1100 unsigned argumentLength = end - start; |
1101 CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::CSS_NUMBER; | 1101 CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::CSS_NUMBER; |
1102 double number; | 1102 double number; |
1103 if (!parseSimpleLength(characters + start, argumentLength, unit, number)
) | 1103 if (!parseSimpleLength(characters + start, argumentLength, unit, number)
) |
1104 return false; | 1104 return false; |
(...skipping 12 matching lines...) Expand all Loading... |
1117 return false; | 1117 return false; |
1118 static const unsigned shortestValidTransformStringLength = 12; | 1118 static const unsigned shortestValidTransformStringLength = 12; |
1119 static const unsigned likelyMultipartTransformStringLengthCutoff = 32; | 1119 static const unsigned likelyMultipartTransformStringLengthCutoff = 32; |
1120 if (string.length() < shortestValidTransformStringLength || string.length()
> likelyMultipartTransformStringLengthCutoff) | 1120 if (string.length() < shortestValidTransformStringLength || string.length()
> likelyMultipartTransformStringLengthCutoff) |
1121 return false; | 1121 return false; |
1122 if (!string.startsWith("translate", false)) | 1122 if (!string.startsWith("translate", false)) |
1123 return false; | 1123 return false; |
1124 UChar c9 = toASCIILower(string[9]); | 1124 UChar c9 = toASCIILower(string[9]); |
1125 UChar c10 = toASCIILower(string[10]); | 1125 UChar c10 = toASCIILower(string[10]); |
1126 | 1126 |
1127 WebKitCSSTransformValue::TransformOperationType transformType; | 1127 CSSTransformValue::TransformOperationType transformType; |
1128 unsigned expectedArgumentCount = 1; | 1128 unsigned expectedArgumentCount = 1; |
1129 unsigned argumentStart = 11; | 1129 unsigned argumentStart = 11; |
1130 if (c9 == 'x' && c10 == '(') | 1130 if (c9 == 'x' && c10 == '(') |
1131 transformType = WebKitCSSTransformValue::TranslateXTransformOperation; | 1131 transformType = CSSTransformValue::TranslateXTransformOperation; |
1132 else if (c9 == 'y' && c10 == '(') | 1132 else if (c9 == 'y' && c10 == '(') |
1133 transformType = WebKitCSSTransformValue::TranslateYTransformOperation; | 1133 transformType = CSSTransformValue::TranslateYTransformOperation; |
1134 else if (c9 == 'z' && c10 == '(') | 1134 else if (c9 == 'z' && c10 == '(') |
1135 transformType = WebKitCSSTransformValue::TranslateZTransformOperation; | 1135 transformType = CSSTransformValue::TranslateZTransformOperation; |
1136 else if (c9 == '(') { | 1136 else if (c9 == '(') { |
1137 transformType = WebKitCSSTransformValue::TranslateTransformOperation; | 1137 transformType = CSSTransformValue::TranslateTransformOperation; |
1138 expectedArgumentCount = 2; | 1138 expectedArgumentCount = 2; |
1139 argumentStart = 10; | 1139 argumentStart = 10; |
1140 } else if (c9 == '3' && c10 == 'd' && string[11] == '(') { | 1140 } else if (c9 == '3' && c10 == 'd' && string[11] == '(') { |
1141 transformType = WebKitCSSTransformValue::Translate3DTransformOperation; | 1141 transformType = CSSTransformValue::Translate3DTransformOperation; |
1142 expectedArgumentCount = 3; | 1142 expectedArgumentCount = 3; |
1143 argumentStart = 12; | 1143 argumentStart = 12; |
1144 } else | 1144 } else |
1145 return false; | 1145 return false; |
1146 | 1146 |
1147 RefPtr<WebKitCSSTransformValue> transformValue = WebKitCSSTransformValue::cr
eate(transformType); | 1147 RefPtr<CSSTransformValue> transformValue = CSSTransformValue::create(transfo
rmType); |
1148 bool success; | 1148 bool success; |
1149 if (string.is8Bit()) | 1149 if (string.is8Bit()) |
1150 success = parseTransformArguments(transformValue.get(), string.character
s8(), string.length(), argumentStart, expectedArgumentCount); | 1150 success = parseTransformArguments(transformValue.get(), string.character
s8(), string.length(), argumentStart, expectedArgumentCount); |
1151 else | 1151 else |
1152 success = parseTransformArguments(transformValue.get(), string.character
s16(), string.length(), argumentStart, expectedArgumentCount); | 1152 success = parseTransformArguments(transformValue.get(), string.character
s16(), string.length(), argumentStart, expectedArgumentCount); |
1153 if (!success) | 1153 if (!success) |
1154 return false; | 1154 return false; |
1155 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); | 1155 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); |
1156 result->append(transformValue.release()); | 1156 result->append(transformValue.release()); |
1157 properties->addParsedProperty(CSSProperty(CSSPropertyWebkitTransform, result
.release(), important)); | 1157 properties->addParsedProperty(CSSProperty(CSSPropertyWebkitTransform, result
.release(), important)); |
(...skipping 6506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7664 // Skip the comma and move on to the next argument. | 7664 // Skip the comma and move on to the next argument. |
7665 arg = functionArgs->next(); | 7665 arg = functionArgs->next(); |
7666 } | 7666 } |
7667 | 7667 |
7668 return imageSet.release(); | 7668 return imageSet.release(); |
7669 } | 7669 } |
7670 | 7670 |
7671 class TransformOperationInfo { | 7671 class TransformOperationInfo { |
7672 public: | 7672 public: |
7673 TransformOperationInfo(const CSSParserString& name) | 7673 TransformOperationInfo(const CSSParserString& name) |
7674 : m_type(WebKitCSSTransformValue::UnknownTransformOperation) | 7674 : m_type(CSSTransformValue::UnknownTransformOperation) |
7675 , m_argCount(1) | 7675 , m_argCount(1) |
7676 , m_allowSingleArgument(false) | 7676 , m_allowSingleArgument(false) |
7677 , m_unit(CSSParser::FUnknown) | 7677 , m_unit(CSSParser::FUnknown) |
7678 { | 7678 { |
7679 const UChar* characters; | 7679 const UChar* characters; |
7680 unsigned nameLength = name.length(); | 7680 unsigned nameLength = name.length(); |
7681 | 7681 |
7682 const unsigned longestNameLength = 12; | 7682 const unsigned longestNameLength = 12; |
7683 UChar characterBuffer[longestNameLength]; | 7683 UChar characterBuffer[longestNameLength]; |
7684 if (name.is8Bit()) { | 7684 if (name.is8Bit()) { |
7685 unsigned length = std::min(longestNameLength, nameLength); | 7685 unsigned length = std::min(longestNameLength, nameLength); |
7686 const LChar* characters8 = name.characters8(); | 7686 const LChar* characters8 = name.characters8(); |
7687 for (unsigned i = 0; i < length; ++i) | 7687 for (unsigned i = 0; i < length; ++i) |
7688 characterBuffer[i] = characters8[i]; | 7688 characterBuffer[i] = characters8[i]; |
7689 characters = characterBuffer; | 7689 characters = characterBuffer; |
7690 } else | 7690 } else |
7691 characters = name.characters16(); | 7691 characters = name.characters16(); |
7692 | 7692 |
7693 switch (nameLength) { | 7693 switch (nameLength) { |
7694 case 5: | 7694 case 5: |
7695 // Valid name: skew(. | 7695 // Valid name: skew(. |
7696 if (((characters[0] == 's') || (characters[0] == 'S')) | 7696 if (((characters[0] == 's') || (characters[0] == 'S')) |
7697 & ((characters[1] == 'k') || (characters[1] == 'K')) | 7697 & ((characters[1] == 'k') || (characters[1] == 'K')) |
7698 & ((characters[2] == 'e') || (characters[2] == 'E')) | 7698 & ((characters[2] == 'e') || (characters[2] == 'E')) |
7699 & ((characters[3] == 'w') || (characters[3] == 'W')) | 7699 & ((characters[3] == 'w') || (characters[3] == 'W')) |
7700 & (characters[4] == '(')) { | 7700 & (characters[4] == '(')) { |
7701 m_unit = CSSParser::FAngle; | 7701 m_unit = CSSParser::FAngle; |
7702 m_type = WebKitCSSTransformValue::SkewTransformOperation; | 7702 m_type = CSSTransformValue::SkewTransformOperation; |
7703 m_allowSingleArgument = true; | 7703 m_allowSingleArgument = true; |
7704 m_argCount = 3; | 7704 m_argCount = 3; |
7705 } | 7705 } |
7706 break; | 7706 break; |
7707 case 6: | 7707 case 6: |
7708 // Valid names: skewx(, skewy(, scale(. | 7708 // Valid names: skewx(, skewy(, scale(. |
7709 if ((characters[1] == 'c') || (characters[1] == 'C')) { | 7709 if ((characters[1] == 'c') || (characters[1] == 'C')) { |
7710 if (((characters[0] == 's') || (characters[0] == 'S')) | 7710 if (((characters[0] == 's') || (characters[0] == 'S')) |
7711 & ((characters[2] == 'a') || (characters[2] == 'A')) | 7711 & ((characters[2] == 'a') || (characters[2] == 'A')) |
7712 & ((characters[3] == 'l') || (characters[3] == 'L')) | 7712 & ((characters[3] == 'l') || (characters[3] == 'L')) |
7713 & ((characters[4] == 'e') || (characters[4] == 'E')) | 7713 & ((characters[4] == 'e') || (characters[4] == 'E')) |
7714 & (characters[5] == '(')) { | 7714 & (characters[5] == '(')) { |
7715 m_unit = CSSParser::FNumber; | 7715 m_unit = CSSParser::FNumber; |
7716 m_type = WebKitCSSTransformValue::ScaleTransformOperation; | 7716 m_type = CSSTransformValue::ScaleTransformOperation; |
7717 m_allowSingleArgument = true; | 7717 m_allowSingleArgument = true; |
7718 m_argCount = 3; | 7718 m_argCount = 3; |
7719 } | 7719 } |
7720 } else if (((characters[0] == 's') || (characters[0] == 'S')) | 7720 } else if (((characters[0] == 's') || (characters[0] == 'S')) |
7721 & ((characters[1] == 'k') || (characters[1] == 'K')) | 7721 & ((characters[1] == 'k') || (characters[1] == 'K')) |
7722 & ((characters[2] == 'e') || (characters[2] == 'E')) | 7722 & ((characters[2] == 'e') || (characters[2] == 'E')) |
7723 & ((characters[3] == 'w') || (characters[3] == 'W')) | 7723 & ((characters[3] == 'w') || (characters[3] == 'W')) |
7724 & (characters[5] == '(')) { | 7724 & (characters[5] == '(')) { |
7725 if ((characters[4] == 'x') || (characters[4] == 'X')) { | 7725 if ((characters[4] == 'x') || (characters[4] == 'X')) { |
7726 m_unit = CSSParser::FAngle; | 7726 m_unit = CSSParser::FAngle; |
7727 m_type = WebKitCSSTransformValue::SkewXTransformOperation; | 7727 m_type = CSSTransformValue::SkewXTransformOperation; |
7728 } else if ((characters[4] == 'y') || (characters[4] == 'Y')) { | 7728 } else if ((characters[4] == 'y') || (characters[4] == 'Y')) { |
7729 m_unit = CSSParser::FAngle; | 7729 m_unit = CSSParser::FAngle; |
7730 m_type = WebKitCSSTransformValue::SkewYTransformOperation; | 7730 m_type = CSSTransformValue::SkewYTransformOperation; |
7731 } | 7731 } |
7732 } | 7732 } |
7733 break; | 7733 break; |
7734 case 7: | 7734 case 7: |
7735 // Valid names: matrix(, rotate(, scalex(, scaley(, scalez(. | 7735 // Valid names: matrix(, rotate(, scalex(, scaley(, scalez(. |
7736 if ((characters[0] == 'm') || (characters[0] == 'M')) { | 7736 if ((characters[0] == 'm') || (characters[0] == 'M')) { |
7737 if (((characters[1] == 'a') || (characters[1] == 'A')) | 7737 if (((characters[1] == 'a') || (characters[1] == 'A')) |
7738 & ((characters[2] == 't') || (characters[2] == 'T')) | 7738 & ((characters[2] == 't') || (characters[2] == 'T')) |
7739 & ((characters[3] == 'r') || (characters[3] == 'R')) | 7739 & ((characters[3] == 'r') || (characters[3] == 'R')) |
7740 & ((characters[4] == 'i') || (characters[4] == 'I')) | 7740 & ((characters[4] == 'i') || (characters[4] == 'I')) |
7741 & ((characters[5] == 'x') || (characters[5] == 'X')) | 7741 & ((characters[5] == 'x') || (characters[5] == 'X')) |
7742 & (characters[6] == '(')) { | 7742 & (characters[6] == '(')) { |
7743 m_unit = CSSParser::FNumber; | 7743 m_unit = CSSParser::FNumber; |
7744 m_type = WebKitCSSTransformValue::MatrixTransformOperation; | 7744 m_type = CSSTransformValue::MatrixTransformOperation; |
7745 m_argCount = 11; | 7745 m_argCount = 11; |
7746 } | 7746 } |
7747 } else if ((characters[0] == 'r') || (characters[0] == 'R')) { | 7747 } else if ((characters[0] == 'r') || (characters[0] == 'R')) { |
7748 if (((characters[1] == 'o') || (characters[1] == 'O')) | 7748 if (((characters[1] == 'o') || (characters[1] == 'O')) |
7749 & ((characters[2] == 't') || (characters[2] == 'T')) | 7749 & ((characters[2] == 't') || (characters[2] == 'T')) |
7750 & ((characters[3] == 'a') || (characters[3] == 'A')) | 7750 & ((characters[3] == 'a') || (characters[3] == 'A')) |
7751 & ((characters[4] == 't') || (characters[4] == 'T')) | 7751 & ((characters[4] == 't') || (characters[4] == 'T')) |
7752 & ((characters[5] == 'e') || (characters[5] == 'E')) | 7752 & ((characters[5] == 'e') || (characters[5] == 'E')) |
7753 & (characters[6] == '(')) { | 7753 & (characters[6] == '(')) { |
7754 m_unit = CSSParser::FAngle; | 7754 m_unit = CSSParser::FAngle; |
7755 m_type = WebKitCSSTransformValue::RotateTransformOperation; | 7755 m_type = CSSTransformValue::RotateTransformOperation; |
7756 } | 7756 } |
7757 } else if (((characters[0] == 's') || (characters[0] == 'S')) | 7757 } else if (((characters[0] == 's') || (characters[0] == 'S')) |
7758 & ((characters[1] == 'c') || (characters[1] == 'C')) | 7758 & ((characters[1] == 'c') || (characters[1] == 'C')) |
7759 & ((characters[2] == 'a') || (characters[2] == 'A')) | 7759 & ((characters[2] == 'a') || (characters[2] == 'A')) |
7760 & ((characters[3] == 'l') || (characters[3] == 'L')) | 7760 & ((characters[3] == 'l') || (characters[3] == 'L')) |
7761 & ((characters[4] == 'e') || (characters[4] == 'E')) | 7761 & ((characters[4] == 'e') || (characters[4] == 'E')) |
7762 & (characters[6] == '(')) { | 7762 & (characters[6] == '(')) { |
7763 if ((characters[5] == 'x') || (characters[5] == 'X')) { | 7763 if ((characters[5] == 'x') || (characters[5] == 'X')) { |
7764 m_unit = CSSParser::FNumber; | 7764 m_unit = CSSParser::FNumber; |
7765 m_type = WebKitCSSTransformValue::ScaleXTransformOperation; | 7765 m_type = CSSTransformValue::ScaleXTransformOperation; |
7766 } else if ((characters[5] == 'y') || (characters[5] == 'Y')) { | 7766 } else if ((characters[5] == 'y') || (characters[5] == 'Y')) { |
7767 m_unit = CSSParser::FNumber; | 7767 m_unit = CSSParser::FNumber; |
7768 m_type = WebKitCSSTransformValue::ScaleYTransformOperation; | 7768 m_type = CSSTransformValue::ScaleYTransformOperation; |
7769 } else if ((characters[5] == 'z') || (characters[5] == 'Z')) { | 7769 } else if ((characters[5] == 'z') || (characters[5] == 'Z')) { |
7770 m_unit = CSSParser::FNumber; | 7770 m_unit = CSSParser::FNumber; |
7771 m_type = WebKitCSSTransformValue::ScaleZTransformOperation; | 7771 m_type = CSSTransformValue::ScaleZTransformOperation; |
7772 } | 7772 } |
7773 } | 7773 } |
7774 break; | 7774 break; |
7775 case 8: | 7775 case 8: |
7776 // Valid names: rotatex(, rotatey(, rotatez(, scale3d(. | 7776 // Valid names: rotatex(, rotatey(, rotatez(, scale3d(. |
7777 if ((characters[0] == 's') || (characters[0] == 'S')) { | 7777 if ((characters[0] == 's') || (characters[0] == 'S')) { |
7778 if (((characters[1] == 'c') || (characters[1] == 'C')) | 7778 if (((characters[1] == 'c') || (characters[1] == 'C')) |
7779 & ((characters[2] == 'a') || (characters[2] == 'A')) | 7779 & ((characters[2] == 'a') || (characters[2] == 'A')) |
7780 & ((characters[3] == 'l') || (characters[3] == 'L')) | 7780 & ((characters[3] == 'l') || (characters[3] == 'L')) |
7781 & ((characters[4] == 'e') || (characters[4] == 'E')) | 7781 & ((characters[4] == 'e') || (characters[4] == 'E')) |
7782 & (characters[5] == '3') | 7782 & (characters[5] == '3') |
7783 & ((characters[6] == 'd') || (characters[6] == 'D')) | 7783 & ((characters[6] == 'd') || (characters[6] == 'D')) |
7784 & (characters[7] == '(')) { | 7784 & (characters[7] == '(')) { |
7785 m_unit = CSSParser::FNumber; | 7785 m_unit = CSSParser::FNumber; |
7786 m_type = WebKitCSSTransformValue::Scale3DTransformOperation; | 7786 m_type = CSSTransformValue::Scale3DTransformOperation; |
7787 m_argCount = 5; | 7787 m_argCount = 5; |
7788 } | 7788 } |
7789 } else if (((characters[0] == 'r') || (characters[0] == 'R')) | 7789 } else if (((characters[0] == 'r') || (characters[0] == 'R')) |
7790 & ((characters[1] == 'o') || (characters[1] == 'O')) | 7790 & ((characters[1] == 'o') || (characters[1] == 'O')) |
7791 & ((characters[2] == 't') || (characters[2] == 'T')) | 7791 & ((characters[2] == 't') || (characters[2] == 'T')) |
7792 & ((characters[3] == 'a') || (characters[3] == 'A')) | 7792 & ((characters[3] == 'a') || (characters[3] == 'A')) |
7793 & ((characters[4] == 't') || (characters[4] == 'T')) | 7793 & ((characters[4] == 't') || (characters[4] == 'T')) |
7794 & ((characters[5] == 'e') || (characters[5] == 'E')) | 7794 & ((characters[5] == 'e') || (characters[5] == 'E')) |
7795 & (characters[7] == '(')) { | 7795 & (characters[7] == '(')) { |
7796 if ((characters[6] == 'x') || (characters[6] == 'X')) { | 7796 if ((characters[6] == 'x') || (characters[6] == 'X')) { |
7797 m_unit = CSSParser::FAngle; | 7797 m_unit = CSSParser::FAngle; |
7798 m_type = WebKitCSSTransformValue::RotateXTransformOperation; | 7798 m_type = CSSTransformValue::RotateXTransformOperation; |
7799 } else if ((characters[6] == 'y') || (characters[6] == 'Y')) { | 7799 } else if ((characters[6] == 'y') || (characters[6] == 'Y')) { |
7800 m_unit = CSSParser::FAngle; | 7800 m_unit = CSSParser::FAngle; |
7801 m_type = WebKitCSSTransformValue::RotateYTransformOperation; | 7801 m_type = CSSTransformValue::RotateYTransformOperation; |
7802 } else if ((characters[6] == 'z') || (characters[6] == 'Z')) { | 7802 } else if ((characters[6] == 'z') || (characters[6] == 'Z')) { |
7803 m_unit = CSSParser::FAngle; | 7803 m_unit = CSSParser::FAngle; |
7804 m_type = WebKitCSSTransformValue::RotateZTransformOperation; | 7804 m_type = CSSTransformValue::RotateZTransformOperation; |
7805 } | 7805 } |
7806 } | 7806 } |
7807 break; | 7807 break; |
7808 case 9: | 7808 case 9: |
7809 // Valid names: matrix3d(, rotate3d(. | 7809 // Valid names: matrix3d(, rotate3d(. |
7810 if ((characters[0] == 'm') || (characters[0] == 'M')) { | 7810 if ((characters[0] == 'm') || (characters[0] == 'M')) { |
7811 if (((characters[1] == 'a') || (characters[1] == 'A')) | 7811 if (((characters[1] == 'a') || (characters[1] == 'A')) |
7812 & ((characters[2] == 't') || (characters[2] == 'T')) | 7812 & ((characters[2] == 't') || (characters[2] == 'T')) |
7813 & ((characters[3] == 'r') || (characters[3] == 'R')) | 7813 & ((characters[3] == 'r') || (characters[3] == 'R')) |
7814 & ((characters[4] == 'i') || (characters[4] == 'I')) | 7814 & ((characters[4] == 'i') || (characters[4] == 'I')) |
7815 & ((characters[5] == 'x') || (characters[5] == 'X')) | 7815 & ((characters[5] == 'x') || (characters[5] == 'X')) |
7816 & (characters[6] == '3') | 7816 & (characters[6] == '3') |
7817 & ((characters[7] == 'd') || (characters[7] == 'D')) | 7817 & ((characters[7] == 'd') || (characters[7] == 'D')) |
7818 & (characters[8] == '(')) { | 7818 & (characters[8] == '(')) { |
7819 m_unit = CSSParser::FNumber; | 7819 m_unit = CSSParser::FNumber; |
7820 m_type = WebKitCSSTransformValue::Matrix3DTransformOperation
; | 7820 m_type = CSSTransformValue::Matrix3DTransformOperation; |
7821 m_argCount = 31; | 7821 m_argCount = 31; |
7822 } | 7822 } |
7823 } else if (((characters[0] == 'r') || (characters[0] == 'R')) | 7823 } else if (((characters[0] == 'r') || (characters[0] == 'R')) |
7824 & ((characters[1] == 'o') || (characters[1] == 'O')) | 7824 & ((characters[1] == 'o') || (characters[1] == 'O')) |
7825 & ((characters[2] == 't') || (characters[2] == 'T')) | 7825 & ((characters[2] == 't') || (characters[2] == 'T')) |
7826 & ((characters[3] == 'a') || (characters[3] == 'A')) | 7826 & ((characters[3] == 'a') || (characters[3] == 'A')) |
7827 & ((characters[4] == 't') || (characters[4] == 'T')) | 7827 & ((characters[4] == 't') || (characters[4] == 'T')) |
7828 & ((characters[5] == 'e') || (characters[5] == 'E')) | 7828 & ((characters[5] == 'e') || (characters[5] == 'E')) |
7829 & (characters[6] == '3') | 7829 & (characters[6] == '3') |
7830 & ((characters[7] == 'd') || (characters[7] == 'D')) | 7830 & ((characters[7] == 'd') || (characters[7] == 'D')) |
7831 & (characters[8] == '(')) { | 7831 & (characters[8] == '(')) { |
7832 m_unit = CSSParser::FNumber; | 7832 m_unit = CSSParser::FNumber; |
7833 m_type = WebKitCSSTransformValue::Rotate3DTransformOperation; | 7833 m_type = CSSTransformValue::Rotate3DTransformOperation; |
7834 m_argCount = 7; | 7834 m_argCount = 7; |
7835 } | 7835 } |
7836 break; | 7836 break; |
7837 case 10: | 7837 case 10: |
7838 // Valid name: translate(. | 7838 // Valid name: translate(. |
7839 if (((characters[0] == 't') || (characters[0] == 'T')) | 7839 if (((characters[0] == 't') || (characters[0] == 'T')) |
7840 & ((characters[1] == 'r') || (characters[1] == 'R')) | 7840 & ((characters[1] == 'r') || (characters[1] == 'R')) |
7841 & ((characters[2] == 'a') || (characters[2] == 'A')) | 7841 & ((characters[2] == 'a') || (characters[2] == 'A')) |
7842 & ((characters[3] == 'n') || (characters[3] == 'N')) | 7842 & ((characters[3] == 'n') || (characters[3] == 'N')) |
7843 & ((characters[4] == 's') || (characters[4] == 'S')) | 7843 & ((characters[4] == 's') || (characters[4] == 'S')) |
7844 & ((characters[5] == 'l') || (characters[5] == 'L')) | 7844 & ((characters[5] == 'l') || (characters[5] == 'L')) |
7845 & ((characters[6] == 'a') || (characters[6] == 'A')) | 7845 & ((characters[6] == 'a') || (characters[6] == 'A')) |
7846 & ((characters[7] == 't') || (characters[7] == 'T')) | 7846 & ((characters[7] == 't') || (characters[7] == 'T')) |
7847 & ((characters[8] == 'e') || (characters[8] == 'E')) | 7847 & ((characters[8] == 'e') || (characters[8] == 'E')) |
7848 & (characters[9] == '(')) { | 7848 & (characters[9] == '(')) { |
7849 m_unit = CSSParser::FLength | CSSParser::FPercent; | 7849 m_unit = CSSParser::FLength | CSSParser::FPercent; |
7850 m_type = WebKitCSSTransformValue::TranslateTransformOperation; | 7850 m_type = CSSTransformValue::TranslateTransformOperation; |
7851 m_allowSingleArgument = true; | 7851 m_allowSingleArgument = true; |
7852 m_argCount = 3; | 7852 m_argCount = 3; |
7853 } | 7853 } |
7854 break; | 7854 break; |
7855 case 11: | 7855 case 11: |
7856 // Valid names: translatex(, translatey(, translatez(. | 7856 // Valid names: translatex(, translatey(, translatez(. |
7857 if (((characters[0] == 't') || (characters[0] == 'T')) | 7857 if (((characters[0] == 't') || (characters[0] == 'T')) |
7858 & ((characters[1] == 'r') || (characters[1] == 'R')) | 7858 & ((characters[1] == 'r') || (characters[1] == 'R')) |
7859 & ((characters[2] == 'a') || (characters[2] == 'A')) | 7859 & ((characters[2] == 'a') || (characters[2] == 'A')) |
7860 & ((characters[3] == 'n') || (characters[3] == 'N')) | 7860 & ((characters[3] == 'n') || (characters[3] == 'N')) |
7861 & ((characters[4] == 's') || (characters[4] == 'S')) | 7861 & ((characters[4] == 's') || (characters[4] == 'S')) |
7862 & ((characters[5] == 'l') || (characters[5] == 'L')) | 7862 & ((characters[5] == 'l') || (characters[5] == 'L')) |
7863 & ((characters[6] == 'a') || (characters[6] == 'A')) | 7863 & ((characters[6] == 'a') || (characters[6] == 'A')) |
7864 & ((characters[7] == 't') || (characters[7] == 'T')) | 7864 & ((characters[7] == 't') || (characters[7] == 'T')) |
7865 & ((characters[8] == 'e') || (characters[8] == 'E')) | 7865 & ((characters[8] == 'e') || (characters[8] == 'E')) |
7866 & (characters[10] == '(')) { | 7866 & (characters[10] == '(')) { |
7867 if ((characters[9] == 'x') || (characters[9] == 'X')) { | 7867 if ((characters[9] == 'x') || (characters[9] == 'X')) { |
7868 m_unit = CSSParser::FLength | CSSParser::FPercent; | 7868 m_unit = CSSParser::FLength | CSSParser::FPercent; |
7869 m_type = WebKitCSSTransformValue::TranslateXTransformOperati
on; | 7869 m_type = CSSTransformValue::TranslateXTransformOperation; |
7870 } else if ((characters[9] == 'y') || (characters[9] == 'Y')) { | 7870 } else if ((characters[9] == 'y') || (characters[9] == 'Y')) { |
7871 m_unit = CSSParser::FLength | CSSParser::FPercent; | 7871 m_unit = CSSParser::FLength | CSSParser::FPercent; |
7872 m_type = WebKitCSSTransformValue::TranslateYTransformOperati
on; | 7872 m_type = CSSTransformValue::TranslateYTransformOperation; |
7873 } else if ((characters[9] == 'z') || (characters[9] == 'Z')) { | 7873 } else if ((characters[9] == 'z') || (characters[9] == 'Z')) { |
7874 m_unit = CSSParser::FLength | CSSParser::FPercent; | 7874 m_unit = CSSParser::FLength | CSSParser::FPercent; |
7875 m_type = WebKitCSSTransformValue::TranslateZTransformOperati
on; | 7875 m_type = CSSTransformValue::TranslateZTransformOperation; |
7876 } | 7876 } |
7877 } | 7877 } |
7878 break; | 7878 break; |
7879 case 12: | 7879 case 12: |
7880 // Valid names: perspective(, translate3d(. | 7880 // Valid names: perspective(, translate3d(. |
7881 if ((characters[0] == 'p') || (characters[0] == 'P')) { | 7881 if ((characters[0] == 'p') || (characters[0] == 'P')) { |
7882 if (((characters[1] == 'e') || (characters[1] == 'E')) | 7882 if (((characters[1] == 'e') || (characters[1] == 'E')) |
7883 & ((characters[2] == 'r') || (characters[2] == 'R')) | 7883 & ((characters[2] == 'r') || (characters[2] == 'R')) |
7884 & ((characters[3] == 's') || (characters[3] == 'S')) | 7884 & ((characters[3] == 's') || (characters[3] == 'S')) |
7885 & ((characters[4] == 'p') || (characters[4] == 'P')) | 7885 & ((characters[4] == 'p') || (characters[4] == 'P')) |
7886 & ((characters[5] == 'e') || (characters[5] == 'E')) | 7886 & ((characters[5] == 'e') || (characters[5] == 'E')) |
7887 & ((characters[6] == 'c') || (characters[6] == 'C')) | 7887 & ((characters[6] == 'c') || (characters[6] == 'C')) |
7888 & ((characters[7] == 't') || (characters[7] == 'T')) | 7888 & ((characters[7] == 't') || (characters[7] == 'T')) |
7889 & ((characters[8] == 'i') || (characters[8] == 'I')) | 7889 & ((characters[8] == 'i') || (characters[8] == 'I')) |
7890 & ((characters[9] == 'v') || (characters[9] == 'V')) | 7890 & ((characters[9] == 'v') || (characters[9] == 'V')) |
7891 & ((characters[10] == 'e') || (characters[10] == 'E')) | 7891 & ((characters[10] == 'e') || (characters[10] == 'E')) |
7892 & (characters[11] == '(')) { | 7892 & (characters[11] == '(')) { |
7893 m_unit = CSSParser::FNumber; | 7893 m_unit = CSSParser::FNumber; |
7894 m_type = WebKitCSSTransformValue::PerspectiveTransformOperat
ion; | 7894 m_type = CSSTransformValue::PerspectiveTransformOperation; |
7895 } | 7895 } |
7896 } else if (((characters[0] == 't') || (characters[0] == 'T')) | 7896 } else if (((characters[0] == 't') || (characters[0] == 'T')) |
7897 & ((characters[1] == 'r') || (characters[1] == 'R')) | 7897 & ((characters[1] == 'r') || (characters[1] == 'R')) |
7898 & ((characters[2] == 'a') || (characters[2] == 'A')) | 7898 & ((characters[2] == 'a') || (characters[2] == 'A')) |
7899 & ((characters[3] == 'n') || (characters[3] == 'N')) | 7899 & ((characters[3] == 'n') || (characters[3] == 'N')) |
7900 & ((characters[4] == 's') || (characters[4] == 'S')) | 7900 & ((characters[4] == 's') || (characters[4] == 'S')) |
7901 & ((characters[5] == 'l') || (characters[5] == 'L')) | 7901 & ((characters[5] == 'l') || (characters[5] == 'L')) |
7902 & ((characters[6] == 'a') || (characters[6] == 'A')) | 7902 & ((characters[6] == 'a') || (characters[6] == 'A')) |
7903 & ((characters[7] == 't') || (characters[7] == 'T')) | 7903 & ((characters[7] == 't') || (characters[7] == 'T')) |
7904 & ((characters[8] == 'e') || (characters[8] == 'E')) | 7904 & ((characters[8] == 'e') || (characters[8] == 'E')) |
7905 & (characters[9] == '3') | 7905 & (characters[9] == '3') |
7906 & ((characters[10] == 'd') || (characters[10] == 'D')) | 7906 & ((characters[10] == 'd') || (characters[10] == 'D')) |
7907 & (characters[11] == '(')) { | 7907 & (characters[11] == '(')) { |
7908 m_unit = CSSParser::FLength | CSSParser::FPercent; | 7908 m_unit = CSSParser::FLength | CSSParser::FPercent; |
7909 m_type = WebKitCSSTransformValue::Translate3DTransformOperation; | 7909 m_type = CSSTransformValue::Translate3DTransformOperation; |
7910 m_argCount = 5; | 7910 m_argCount = 5; |
7911 } | 7911 } |
7912 break; | 7912 break; |
7913 } // end switch () | 7913 } // end switch () |
7914 } | 7914 } |
7915 | 7915 |
7916 WebKitCSSTransformValue::TransformOperationType type() const { return m_type
; } | 7916 CSSTransformValue::TransformOperationType type() const { return m_type; } |
7917 unsigned argCount() const { return m_argCount; } | 7917 unsigned argCount() const { return m_argCount; } |
7918 CSSParser::Units unit() const { return m_unit; } | 7918 CSSParser::Units unit() const { return m_unit; } |
7919 | 7919 |
7920 bool unknown() const { return m_type == WebKitCSSTransformValue::UnknownTran
sformOperation; } | 7920 bool unknown() const { return m_type == CSSTransformValue::UnknownTransformO
peration; } |
7921 bool hasCorrectArgCount(unsigned argCount) { return m_argCount == argCount |
| (m_allowSingleArgument && argCount == 1); } | 7921 bool hasCorrectArgCount(unsigned argCount) { return m_argCount == argCount |
| (m_allowSingleArgument && argCount == 1); } |
7922 | 7922 |
7923 private: | 7923 private: |
7924 WebKitCSSTransformValue::TransformOperationType m_type; | 7924 CSSTransformValue::TransformOperationType m_type; |
7925 unsigned m_argCount; | 7925 unsigned m_argCount; |
7926 bool m_allowSingleArgument; | 7926 bool m_allowSingleArgument; |
7927 CSSParser::Units m_unit; | 7927 CSSParser::Units m_unit; |
7928 }; | 7928 }; |
7929 | 7929 |
7930 PassRefPtr<CSSValueList> CSSParser::parseTransform() | 7930 PassRefPtr<CSSValueList> CSSParser::parseTransform() |
7931 { | 7931 { |
7932 if (!m_valueList) | 7932 if (!m_valueList) |
7933 return 0; | 7933 return 0; |
7934 | 7934 |
(...skipping 21 matching lines...) Expand all Loading... |
7956 | 7956 |
7957 // See if the specified primitive is one we understand. | 7957 // See if the specified primitive is one we understand. |
7958 TransformOperationInfo info(value->function->name); | 7958 TransformOperationInfo info(value->function->name); |
7959 if (info.unknown()) | 7959 if (info.unknown()) |
7960 return 0; | 7960 return 0; |
7961 | 7961 |
7962 if (!info.hasCorrectArgCount(args->size())) | 7962 if (!info.hasCorrectArgCount(args->size())) |
7963 return 0; | 7963 return 0; |
7964 | 7964 |
7965 // The transform is a list of functional primitives that specify transform o
perations. | 7965 // The transform is a list of functional primitives that specify transform o
perations. |
7966 // We collect a list of WebKitCSSTransformValues, where each value specifies
a single operation. | 7966 // We collect a list of CSSTransformValues, where each value specifies a sin
gle operation. |
7967 | 7967 |
7968 // Create the new WebKitCSSTransformValue for this operation and add it to o
ur list. | 7968 // Create the new CSSTransformValue for this operation and add it to our lis
t. |
7969 RefPtr<WebKitCSSTransformValue> transformValue = WebKitCSSTransformValue::cr
eate(info.type()); | 7969 RefPtr<CSSTransformValue> transformValue = CSSTransformValue::create(info.ty
pe()); |
7970 | 7970 |
7971 // Snag our values. | 7971 // Snag our values. |
7972 CSSParserValue* a = args->current(); | 7972 CSSParserValue* a = args->current(); |
7973 unsigned argNumber = 0; | 7973 unsigned argNumber = 0; |
7974 while (a) { | 7974 while (a) { |
7975 CSSParser::Units unit = info.unit(); | 7975 CSSParser::Units unit = info.unit(); |
7976 | 7976 |
7977 if (info.type() == WebKitCSSTransformValue::Rotate3DTransformOperation &
& argNumber == 3) { | 7977 if (info.type() == CSSTransformValue::Rotate3DTransformOperation && argN
umber == 3) { |
7978 // 4th param of rotate3d() is an angle rather than a bare number, va
lidate it as such | 7978 // 4th param of rotate3d() is an angle rather than a bare number, va
lidate it as such |
7979 if (!validUnit(a, FAngle, CSSStrictMode)) | 7979 if (!validUnit(a, FAngle, CSSStrictMode)) |
7980 return 0; | 7980 return 0; |
7981 } else if (info.type() == WebKitCSSTransformValue::Translate3DTransformO
peration && argNumber == 2) { | 7981 } else if (info.type() == CSSTransformValue::Translate3DTransformOperati
on && argNumber == 2) { |
7982 // 3rd param of translate3d() cannot be a percentage | 7982 // 3rd param of translate3d() cannot be a percentage |
7983 if (!validUnit(a, FLength, CSSStrictMode)) | 7983 if (!validUnit(a, FLength, CSSStrictMode)) |
7984 return 0; | 7984 return 0; |
7985 } else if (info.type() == WebKitCSSTransformValue::TranslateZTransformOp
eration && !argNumber) { | 7985 } else if (info.type() == CSSTransformValue::TranslateZTransformOperatio
n && !argNumber) { |
7986 // 1st param of translateZ() cannot be a percentage | 7986 // 1st param of translateZ() cannot be a percentage |
7987 if (!validUnit(a, FLength, CSSStrictMode)) | 7987 if (!validUnit(a, FLength, CSSStrictMode)) |
7988 return 0; | 7988 return 0; |
7989 } else if (info.type() == WebKitCSSTransformValue::PerspectiveTransformO
peration && !argNumber) { | 7989 } else if (info.type() == CSSTransformValue::PerspectiveTransformOperati
on && !argNumber) { |
7990 // 1st param of perspective() must be a non-negative number (depreca
ted) or length. | 7990 // 1st param of perspective() must be a non-negative number (depreca
ted) or length. |
7991 if (!validUnit(a, FNumber | FLength | FNonNeg, CSSStrictMode)) | 7991 if (!validUnit(a, FNumber | FLength | FNonNeg, CSSStrictMode)) |
7992 return 0; | 7992 return 0; |
7993 } else if (!validUnit(a, unit, CSSStrictMode)) | 7993 } else if (!validUnit(a, unit, CSSStrictMode)) |
7994 return 0; | 7994 return 0; |
7995 | 7995 |
7996 // Add the value to the current transform operation. | 7996 // Add the value to the current transform operation. |
7997 transformValue->append(createPrimitiveNumericValue(a)); | 7997 transformValue->append(createPrimitiveNumericValue(a)); |
7998 | 7998 |
7999 a = args->next(); | 7999 a = args->next(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8088 | 8088 |
8089 if (!isComma(nextParserValue)) | 8089 if (!isComma(nextParserValue)) |
8090 return 0; | 8090 return 0; |
8091 | 8091 |
8092 arrayArgsParserValueList->next(); | 8092 arrayArgsParserValueList->next(); |
8093 } | 8093 } |
8094 | 8094 |
8095 return arrayFunction; | 8095 return arrayFunction; |
8096 } | 8096 } |
8097 | 8097 |
8098 PassRefPtr<WebKitCSSMixFunctionValue> CSSParser::parseMixFunction(CSSParserValue
* value) | 8098 PassRefPtr<CSSMixFunctionValue> CSSParser::parseMixFunction(CSSParserValue* valu
e) |
8099 { | 8099 { |
8100 ASSERT(value->unit == CSSParserValue::Function && value->function); | 8100 ASSERT(value->unit == CSSParserValue::Function && value->function); |
8101 | 8101 |
8102 if (!equalIgnoringCase(value->function->name, "mix(")) | 8102 if (!equalIgnoringCase(value->function->name, "mix(")) |
8103 return 0; | 8103 return 0; |
8104 | 8104 |
8105 CSSParserValueList* argsList = value->function->args.get(); | 8105 CSSParserValueList* argsList = value->function->args.get(); |
8106 if (!argsList) | 8106 if (!argsList) |
8107 return 0; | 8107 return 0; |
8108 | 8108 |
8109 unsigned numArgs = argsList->size(); | 8109 unsigned numArgs = argsList->size(); |
8110 if (numArgs < 1 || numArgs > 3) | 8110 if (numArgs < 1 || numArgs > 3) |
8111 return 0; | 8111 return 0; |
8112 | 8112 |
8113 RefPtr<WebKitCSSMixFunctionValue> mixFunction = WebKitCSSMixFunctionValue::c
reate(); | 8113 RefPtr<CSSMixFunctionValue> mixFunction = CSSMixFunctionValue::create(); |
8114 | 8114 |
8115 bool hasBlendMode = false; | 8115 bool hasBlendMode = false; |
8116 bool hasAlphaCompositing = false; | 8116 bool hasAlphaCompositing = false; |
8117 CSSParserValue* arg; | 8117 CSSParserValue* arg; |
8118 while ((arg = argsList->current())) { | 8118 while ((arg = argsList->current())) { |
8119 RefPtr<CSSValue> value; | 8119 RefPtr<CSSValue> value; |
8120 | 8120 |
8121 unsigned argNumber = argsList->currentIndex(); | 8121 unsigned argNumber = argsList->currentIndex(); |
8122 if (!argNumber) { | 8122 if (!argNumber) { |
8123 if (arg->unit == CSSPrimitiveValue::CSS_URI) { | 8123 if (arg->unit == CSSPrimitiveValue::CSS_URI) { |
8124 KURL shaderURL = completeURL(arg->string); | 8124 KURL shaderURL = completeURL(arg->string); |
8125 value = WebKitCSSShaderValue::create(shaderURL.string()); | 8125 value = CSSShaderValue::create(shaderURL.string()); |
8126 } | 8126 } |
8127 } else if (argNumber == 1 || argNumber == 2) { | 8127 } else if (argNumber == 1 || argNumber == 2) { |
8128 if (!hasBlendMode && isBlendMode(arg->id)) { | 8128 if (!hasBlendMode && isBlendMode(arg->id)) { |
8129 hasBlendMode = true; | 8129 hasBlendMode = true; |
8130 value = cssValuePool().createIdentifierValue(arg->id); | 8130 value = cssValuePool().createIdentifierValue(arg->id); |
8131 } else if (!hasAlphaCompositing && isCompositeOperator(arg->id)) { | 8131 } else if (!hasAlphaCompositing && isCompositeOperator(arg->id)) { |
8132 hasAlphaCompositing = true; | 8132 hasAlphaCompositing = true; |
8133 value = cssValuePool().createIdentifierValue(arg->id); | 8133 value = cssValuePool().createIdentifierValue(arg->id); |
8134 } | 8134 } |
8135 } | 8135 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8293 // 1. Parse the shader URLs: <vertex-shader>[wsp<fragment-shader>] | 8293 // 1. Parse the shader URLs: <vertex-shader>[wsp<fragment-shader>] |
8294 RefPtr<CSSValueList> shadersList = CSSValueList::createSpaceSeparated(); | 8294 RefPtr<CSSValueList> shadersList = CSSValueList::createSpaceSeparated(); |
8295 bool hadAtLeastOneCustomShader = false; | 8295 bool hadAtLeastOneCustomShader = false; |
8296 CSSParserValue* arg; | 8296 CSSParserValue* arg; |
8297 while ((arg = argsList->current())) { | 8297 while ((arg = argsList->current())) { |
8298 RefPtr<CSSValue> value; | 8298 RefPtr<CSSValue> value; |
8299 if (arg->id == CSSValueNone) | 8299 if (arg->id == CSSValueNone) |
8300 value = cssValuePool().createIdentifierValue(CSSValueNone); | 8300 value = cssValuePool().createIdentifierValue(CSSValueNone); |
8301 else if (arg->unit == CSSPrimitiveValue::CSS_URI) { | 8301 else if (arg->unit == CSSPrimitiveValue::CSS_URI) { |
8302 KURL shaderURL = completeURL(arg->string); | 8302 KURL shaderURL = completeURL(arg->string); |
8303 value = WebKitCSSShaderValue::create(shaderURL.string()); | 8303 value = CSSShaderValue::create(shaderURL.string()); |
8304 hadAtLeastOneCustomShader = true; | 8304 hadAtLeastOneCustomShader = true; |
8305 } else if (argsList->currentIndex() == 1 && arg->unit == CSSParserValue:
:Function) { | 8305 } else if (argsList->currentIndex() == 1 && arg->unit == CSSParserValue:
:Function) { |
8306 if (!(value = parseMixFunction(arg))) | 8306 if (!(value = parseMixFunction(arg))) |
8307 return 0; | 8307 return 0; |
8308 hadAtLeastOneCustomShader = true; | 8308 hadAtLeastOneCustomShader = true; |
8309 } | 8309 } |
8310 | 8310 |
8311 if (!value) | 8311 if (!value) |
8312 break; | 8312 break; |
8313 shadersList->append(value.release()); | 8313 shadersList->append(value.release()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8398 RefPtr<CSSValue> parsedTransformValue = parseTransformValue(value); | 8398 RefPtr<CSSValue> parsedTransformValue = parseTransformValue(value); |
8399 if (!parsedTransformValue) | 8399 if (!parsedTransformValue) |
8400 return 0; | 8400 return 0; |
8401 | 8401 |
8402 list->append(parsedTransformValue.release()); | 8402 list->append(parsedTransformValue.release()); |
8403 } | 8403 } |
8404 | 8404 |
8405 return list.release(); | 8405 return list.release(); |
8406 } | 8406 } |
8407 | 8407 |
8408 PassRefPtr<WebKitCSSShaderValue> CSSParser::parseFilterRuleSrcUriAndFormat(CSSPa
rserValueList* valueList) | 8408 PassRefPtr<CSSShaderValue> CSSParser::parseFilterRuleSrcUriAndFormat(CSSParserVa
lueList* valueList) |
8409 { | 8409 { |
8410 CSSParserValue* value = valueList->current(); | 8410 CSSParserValue* value = valueList->current(); |
8411 ASSERT(value && value->unit == CSSPrimitiveValue::CSS_URI); | 8411 ASSERT(value && value->unit == CSSPrimitiveValue::CSS_URI); |
8412 RefPtr<WebKitCSSShaderValue> shaderValue = WebKitCSSShaderValue::create(comp
leteURL(value->string)); | 8412 RefPtr<CSSShaderValue> shaderValue = CSSShaderValue::create(completeURL(valu
e->string)); |
8413 | 8413 |
8414 value = valueList->next(); | 8414 value = valueList->next(); |
8415 if (value && value->unit == CSSParserValue::Function && equalIgnoringCase(va
lue->function->name, "format(")) { | 8415 if (value && value->unit == CSSParserValue::Function && equalIgnoringCase(va
lue->function->name, "format(")) { |
8416 CSSParserValueList* args = value->function->args.get(); | 8416 CSSParserValueList* args = value->function->args.get(); |
8417 if (!args || args->size() != 1) | 8417 if (!args || args->size() != 1) |
8418 return 0; | 8418 return 0; |
8419 | 8419 |
8420 CSSParserValue* arg = args->current(); | 8420 CSSParserValue* arg = args->current(); |
8421 if (arg->unit != CSSPrimitiveValue::CSS_STRING) | 8421 if (arg->unit != CSSPrimitiveValue::CSS_STRING) |
8422 return 0; | 8422 return 0; |
8423 | 8423 |
8424 shaderValue->setFormat(arg->string); | 8424 shaderValue->setFormat(arg->string); |
8425 valueList->next(); | 8425 valueList->next(); |
8426 } | 8426 } |
8427 | 8427 |
8428 return shaderValue.release(); | 8428 return shaderValue.release(); |
8429 } | 8429 } |
8430 | 8430 |
8431 bool CSSParser::parseFilterRuleSrc() | 8431 bool CSSParser::parseFilterRuleSrc() |
8432 { | 8432 { |
8433 RefPtr<CSSValueList> srcList = CSSValueList::createCommaSeparated(); | 8433 RefPtr<CSSValueList> srcList = CSSValueList::createCommaSeparated(); |
8434 | 8434 |
8435 CSSParserValue* value = m_valueList->current(); | 8435 CSSParserValue* value = m_valueList->current(); |
8436 while (value) { | 8436 while (value) { |
8437 if (value->unit != CSSPrimitiveValue::CSS_URI) | 8437 if (value->unit != CSSPrimitiveValue::CSS_URI) |
8438 return false; | 8438 return false; |
8439 | 8439 |
8440 RefPtr<WebKitCSSShaderValue> shaderValue = parseFilterRuleSrcUriAndForma
t(m_valueList.get()); | 8440 RefPtr<CSSShaderValue> shaderValue = parseFilterRuleSrcUriAndFormat(m_va
lueList.get()); |
8441 if (!shaderValue) | 8441 if (!shaderValue) |
8442 return false; | 8442 return false; |
8443 srcList->append(shaderValue.release()); | 8443 srcList->append(shaderValue.release()); |
8444 | 8444 |
8445 if (!acceptCommaOperator(m_valueList.get())) | 8445 if (!acceptCommaOperator(m_valueList.get())) |
8446 return false; | 8446 return false; |
8447 | 8447 |
8448 value = m_valueList->current(); | 8448 value = m_valueList->current(); |
8449 } | 8449 } |
8450 | 8450 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8569 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { | 8569 for (CSSParserValue* value = m_valueList->current(); value; value = m_valueL
ist->next()) { |
8570 if (value->unit != CSSPrimitiveValue::CSS_URI && (value->unit != CSSPars
erValue::Function || !value->function)) | 8570 if (value->unit != CSSPrimitiveValue::CSS_URI && (value->unit != CSSPars
erValue::Function || !value->function)) |
8571 return 0; | 8571 return 0; |
8572 | 8572 |
8573 WebKitCSSFilterValue::FilterOperationType filterType = WebKitCSSFilterVa
lue::UnknownFilterOperation; | 8573 WebKitCSSFilterValue::FilterOperationType filterType = WebKitCSSFilterVa
lue::UnknownFilterOperation; |
8574 | 8574 |
8575 // See if the specified primitive is one we understand. | 8575 // See if the specified primitive is one we understand. |
8576 if (value->unit == CSSPrimitiveValue::CSS_URI) { | 8576 if (value->unit == CSSPrimitiveValue::CSS_URI) { |
8577 RefPtr<WebKitCSSFilterValue> referenceFilterValue = WebKitCSSFilterV
alue::create(WebKitCSSFilterValue::ReferenceFilterOperation); | 8577 RefPtr<WebKitCSSFilterValue> referenceFilterValue = WebKitCSSFilterV
alue::create(WebKitCSSFilterValue::ReferenceFilterOperation); |
8578 list->append(referenceFilterValue); | 8578 list->append(referenceFilterValue); |
8579 referenceFilterValue->append(WebKitCSSSVGDocumentValue::create(value
->string)); | 8579 referenceFilterValue->append(CSSSVGDocumentValue::create(value->stri
ng)); |
8580 } else { | 8580 } else { |
8581 const CSSParserString name = value->function->name; | 8581 const CSSParserString name = value->function->name; |
8582 unsigned maximumArgumentCount = 1; | 8582 unsigned maximumArgumentCount = 1; |
8583 | 8583 |
8584 filterInfoForName(name, filterType, maximumArgumentCount); | 8584 filterInfoForName(name, filterType, maximumArgumentCount); |
8585 | 8585 |
8586 if (filterType == WebKitCSSFilterValue::UnknownFilterOperation) | 8586 if (filterType == WebKitCSSFilterValue::UnknownFilterOperation) |
8587 return 0; | 8587 return 0; |
8588 | 8588 |
8589 if (filterType == WebKitCSSFilterValue::CustomFilterOperation) { | 8589 if (filterType == WebKitCSSFilterValue::CustomFilterOperation) { |
(...skipping 3147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11737 { | 11737 { |
11738 // The tokenizer checks for the construct of an+b. | 11738 // The tokenizer checks for the construct of an+b. |
11739 // However, since the {ident} rule precedes the {nth} rule, some of those | 11739 // However, since the {ident} rule precedes the {nth} rule, some of those |
11740 // tokens are identified as string literal. Furthermore we need to accept | 11740 // tokens are identified as string literal. Furthermore we need to accept |
11741 // "odd" and "even" which does not match to an+b. | 11741 // "odd" and "even" which does not match to an+b. |
11742 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11742 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11743 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11743 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11744 } | 11744 } |
11745 | 11745 |
11746 } | 11746 } |
OLD | NEW |