| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRe
fPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveVa
lue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdent
icalValues) | 120 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRe
fPtrWillBeRawPtr<CSSPrimitiveValue> first, PassRefPtrWillBeRawPtr<CSSPrimitiveVa
lue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdent
icalValues) |
| 121 { | 121 { |
| 122 return cssValuePool().createValue(Pair::create(first, second, identicalValue
sPolicy)); | 122 return cssValuePool().createValue(Pair::create(first, second, identicalValue
sPolicy)); |
| 123 } | 123 } |
| 124 | 124 |
| 125 class AnimationParseContext { | 125 class AnimationParseContext { |
| 126 public: | 126 public: |
| 127 AnimationParseContext() | 127 AnimationParseContext() |
| 128 : m_animationPropertyKeywordAllowed(true) | 128 : m_animationPropertyKeywordAllowed(true) |
| 129 , m_firstAnimationCommitted(false) | 129 , m_firstAnimationCommitted(false) |
| 130 , m_hasSeenAnimationPropertyKeyword(false) | |
| 131 { | 130 { |
| 132 } | 131 } |
| 133 | 132 |
| 134 void commitFirstAnimation() | 133 void commitFirstAnimation() |
| 135 { | 134 { |
| 136 m_firstAnimationCommitted = true; | 135 m_firstAnimationCommitted = true; |
| 137 } | 136 } |
| 138 | 137 |
| 139 bool hasCommittedFirstAnimation() const | 138 bool hasCommittedFirstAnimation() const |
| 140 { | 139 { |
| 141 return m_firstAnimationCommitted; | 140 return m_firstAnimationCommitted; |
| 142 } | 141 } |
| 143 | 142 |
| 144 void commitAnimationPropertyKeyword() | 143 void commitAnimationPropertyKeyword() |
| 145 { | 144 { |
| 146 m_animationPropertyKeywordAllowed = false; | 145 m_animationPropertyKeywordAllowed = false; |
| 147 } | 146 } |
| 148 | 147 |
| 149 bool animationPropertyKeywordAllowed() const | 148 bool animationPropertyKeywordAllowed() const |
| 150 { | 149 { |
| 151 return m_animationPropertyKeywordAllowed; | 150 return m_animationPropertyKeywordAllowed; |
| 152 } | 151 } |
| 153 | 152 |
| 154 bool hasSeenAnimationPropertyKeyword() const | |
| 155 { | |
| 156 return m_hasSeenAnimationPropertyKeyword; | |
| 157 } | |
| 158 | |
| 159 void sawAnimationPropertyKeyword() | |
| 160 { | |
| 161 m_hasSeenAnimationPropertyKeyword = true; | |
| 162 } | |
| 163 | |
| 164 private: | 153 private: |
| 165 bool m_animationPropertyKeywordAllowed; | 154 bool m_animationPropertyKeywordAllowed; |
| 166 bool m_firstAnimationCommitted; | 155 bool m_firstAnimationCommitted; |
| 167 bool m_hasSeenAnimationPropertyKeyword; | |
| 168 }; | 156 }; |
| 169 | 157 |
| 170 CSSPropertyParser::CSSPropertyParser(OwnPtr<CSSParserValueList>& valueList, | 158 CSSPropertyParser::CSSPropertyParser(OwnPtr<CSSParserValueList>& valueList, |
| 171 const CSSParserContext& context, bool inViewport, bool savedImportant, | 159 const CSSParserContext& context, bool inViewport, bool savedImportant, |
| 172 WillBeHeapVector<CSSProperty, 256>& parsedProperties, bool& hasFontFaceOnlyV
alues) | 160 WillBeHeapVector<CSSProperty, 256>& parsedProperties, bool& hasFontFaceOnlyV
alues) |
| 173 : m_valueList(valueList) | 161 : m_valueList(valueList) |
| 174 , m_context(context) | 162 , m_context(context) |
| 175 , m_inViewport(inViewport) | 163 , m_inViewport(inViewport) |
| 176 , m_important(savedImportant) // See comment in header, should be removed. | 164 , m_important(savedImportant) // See comment in header, should be removed. |
| 177 , m_parsedProperties(parsedProperties) | 165 , m_parsedProperties(parsedProperties) |
| (...skipping 2935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3113 } | 3101 } |
| 3114 | 3102 |
| 3115 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty(Anima
tionParseContext& context) | 3103 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationProperty(Anima
tionParseContext& context) |
| 3116 { | 3104 { |
| 3117 CSSParserValue* value = m_valueList->current(); | 3105 CSSParserValue* value = m_valueList->current(); |
| 3118 if (value->unit != CSSPrimitiveValue::CSS_IDENT) | 3106 if (value->unit != CSSPrimitiveValue::CSS_IDENT) |
| 3119 return nullptr; | 3107 return nullptr; |
| 3120 CSSPropertyID result = cssPropertyID(value->string); | 3108 CSSPropertyID result = cssPropertyID(value->string); |
| 3121 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result)) | 3109 if (result && RuntimeCSSEnabled::isCSSPropertyEnabled(result)) |
| 3122 return cssValuePool().createIdentifierValue(result); | 3110 return cssValuePool().createIdentifierValue(result); |
| 3123 if (equalIgnoringCase(value, "all")) { | 3111 if (equalIgnoringCase(value, "all")) |
| 3124 context.sawAnimationPropertyKeyword(); | |
| 3125 return cssValuePool().createIdentifierValue(CSSValueAll); | 3112 return cssValuePool().createIdentifierValue(CSSValueAll); |
| 3126 } | |
| 3127 if (equalIgnoringCase(value, "none")) { | 3113 if (equalIgnoringCase(value, "none")) { |
| 3128 context.commitAnimationPropertyKeyword(); | 3114 context.commitAnimationPropertyKeyword(); |
| 3129 context.sawAnimationPropertyKeyword(); | |
| 3130 return cssValuePool().createIdentifierValue(CSSValueNone); | 3115 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 3131 } | 3116 } |
| 3132 return nullptr; | 3117 return nullptr; |
| 3133 } | 3118 } |
| 3134 | 3119 |
| 3135 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(RefPtrWillBeRawPtr<C
SSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSVa
lue>& value3) | 3120 bool CSSPropertyParser::parseWebkitTransformOriginShorthand(RefPtrWillBeRawPtr<C
SSValue>& value1, RefPtrWillBeRawPtr<CSSValue>& value2, RefPtrWillBeRawPtr<CSSVa
lue>& value3) |
| 3136 { | 3121 { |
| 3137 parse2ValuesFillPosition(m_valueList.get(), value1, value2); | 3122 parse2ValuesFillPosition(m_valueList.get(), value1, value2); |
| 3138 | 3123 |
| 3139 // now get z | 3124 // now get z |
| (...skipping 3015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6155 m_bottom = val; | 6140 m_bottom = val; |
| 6156 else { | 6141 else { |
| 6157 ASSERT(!m_left); | 6142 ASSERT(!m_left); |
| 6158 m_left = val; | 6143 m_left = val; |
| 6159 } | 6144 } |
| 6160 | 6145 |
| 6161 m_allowNumber = !m_left; | 6146 m_allowNumber = !m_left; |
| 6162 m_allowFinalCommit = true; | 6147 m_allowFinalCommit = true; |
| 6163 } | 6148 } |
| 6164 | 6149 |
| 6165 void setAllowFinalCommit() { m_allowFinalCommit = true; } | |
| 6166 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; } | 6150 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; } |
| 6167 | 6151 |
| 6168 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> commitBorderImageQuad() | 6152 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> commitBorderImageQuad() |
| 6169 { | 6153 { |
| 6170 // We need to clone and repeat values for any omissions. | 6154 // We need to clone and repeat values for any omissions. |
| 6171 ASSERT(m_top); | 6155 ASSERT(m_top); |
| 6172 if (!m_right) { | 6156 if (!m_right) { |
| 6173 m_right = m_top; | 6157 m_right = m_top; |
| 6174 m_bottom = m_top; | 6158 m_bottom = m_top; |
| 6175 m_left = m_top; | 6159 m_left = m_top; |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7274 } | 7258 } |
| 7275 } | 7259 } |
| 7276 expectComma = true; | 7260 expectComma = true; |
| 7277 m_valueList->next(); | 7261 m_valueList->next(); |
| 7278 } | 7262 } |
| 7279 | 7263 |
| 7280 addProperty(CSSPropertyWillChange, values.release(), important); | 7264 addProperty(CSSPropertyWillChange, values.release(), important); |
| 7281 return true; | 7265 return true; |
| 7282 } | 7266 } |
| 7283 | 7267 |
| 7284 bool CSSPropertyParser::isBlendMode(CSSValueID valueID) | |
| 7285 { | |
| 7286 return (valueID >= CSSValueMultiply && valueID <= CSSValueLuminosity) | |
| 7287 || valueID == CSSValueNormal | |
| 7288 || valueID == CSSValueOverlay; | |
| 7289 } | |
| 7290 | |
| 7291 bool CSSPropertyParser::isCompositeOperator(CSSValueID valueID) | |
| 7292 { | |
| 7293 // FIXME: Add CSSValueDestination and CSSValueLighter when the Compositing s
pec updates. | |
| 7294 return valueID >= CSSValueClear && valueID <= CSSValueXor; | |
| 7295 } | |
| 7296 | |
| 7297 static void filterInfoForName(const CSSParserString& name, CSSFilterValue::Filte
rOperationType& filterType, unsigned& maximumArgumentCount) | 7268 static void filterInfoForName(const CSSParserString& name, CSSFilterValue::Filte
rOperationType& filterType, unsigned& maximumArgumentCount) |
| 7298 { | 7269 { |
| 7299 if (equalIgnoringCase(name, "grayscale(")) | 7270 if (equalIgnoringCase(name, "grayscale(")) |
| 7300 filterType = CSSFilterValue::GrayscaleFilterOperation; | 7271 filterType = CSSFilterValue::GrayscaleFilterOperation; |
| 7301 else if (equalIgnoringCase(name, "sepia(")) | 7272 else if (equalIgnoringCase(name, "sepia(")) |
| 7302 filterType = CSSFilterValue::SepiaFilterOperation; | 7273 filterType = CSSFilterValue::SepiaFilterOperation; |
| 7303 else if (equalIgnoringCase(name, "saturate(")) | 7274 else if (equalIgnoringCase(name, "saturate(")) |
| 7304 filterType = CSSFilterValue::SaturateFilterOperation; | 7275 filterType = CSSFilterValue::SaturateFilterOperation; |
| 7305 else if (equalIgnoringCase(name, "hue-rotate(")) | 7276 else if (equalIgnoringCase(name, "hue-rotate(")) |
| 7306 filterType = CSSFilterValue::HueRotateFilterOperation; | 7277 filterType = CSSFilterValue::HueRotateFilterOperation; |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8512 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8483 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
| 8513 if (!seenStroke) | 8484 if (!seenStroke) |
| 8514 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8485 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
| 8515 if (!seenMarkers) | 8486 if (!seenMarkers) |
| 8516 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8487 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
| 8517 | 8488 |
| 8518 return parsedValues.release(); | 8489 return parsedValues.release(); |
| 8519 } | 8490 } |
| 8520 | 8491 |
| 8521 } // namespace WebCore | 8492 } // namespace WebCore |
| OLD | NEW |