| 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 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 | 2074 |
| 2075 // auto | <identifier> | 2075 // auto | <identifier> |
| 2076 bool CSSPropertyParser::parsePage(CSSPropertyID propId, bool important) | 2076 bool CSSPropertyParser::parsePage(CSSPropertyID propId, bool important) |
| 2077 { | 2077 { |
| 2078 ASSERT(propId == CSSPropertyPage); | 2078 ASSERT(propId == CSSPropertyPage); |
| 2079 | 2079 |
| 2080 if (m_valueList->size() != 1) | 2080 if (m_valueList->size() != 1) |
| 2081 return false; | 2081 return false; |
| 2082 | 2082 |
| 2083 CSSParserValue* value = m_valueList->current(); | 2083 CSSParserValue* value = m_valueList->current(); |
| 2084 if (!value) | 2084 ASSERT(value); |
| 2085 return false; | |
| 2086 | 2085 |
| 2087 if (value->id == CSSValueAuto) { | 2086 if (value->id == CSSValueAuto) { |
| 2088 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | 2087 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); |
| 2089 return true; | 2088 return true; |
| 2090 } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) { | 2089 } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) { |
| 2091 addProperty(propId, createPrimitiveStringValue(value), important); | 2090 addProperty(propId, createPrimitiveStringValue(value), important); |
| 2092 return true; | 2091 return true; |
| 2093 } | 2092 } |
| 2094 return false; | 2093 return false; |
| 2095 } | 2094 } |
| 2096 | 2095 |
| 2097 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] | 2096 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] |
| 2098 bool CSSPropertyParser::parseSize(CSSPropertyID propId, bool important) | 2097 bool CSSPropertyParser::parseSize(CSSPropertyID propId, bool important) |
| 2099 { | 2098 { |
| 2100 ASSERT(propId == CSSPropertySize); | 2099 ASSERT(propId == CSSPropertySize); |
| 2101 | 2100 |
| 2102 if (m_valueList->size() > 2) | 2101 if (m_valueList->size() > 2) |
| 2103 return false; | 2102 return false; |
| 2104 | 2103 |
| 2105 CSSParserValue* value = m_valueList->current(); | 2104 CSSParserValue* value = m_valueList->current(); |
| 2106 if (!value) | 2105 ASSERT(value); |
| 2107 return false; | |
| 2108 | 2106 |
| 2109 RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSep
arated(); | 2107 RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSep
arated(); |
| 2110 | 2108 |
| 2111 // First parameter. | 2109 // First parameter. |
| 2112 SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value,
None); | 2110 SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value,
None); |
| 2113 if (paramType == None) | 2111 if (paramType == None) |
| 2114 return false; | 2112 return false; |
| 2115 | 2113 |
| 2116 // Second parameter, if any. | 2114 // Second parameter, if any. |
| 2117 value = m_valueList->next(); | 2115 value = m_valueList->next(); |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4113 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter | 4111 return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
| 4114 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart | 4112 || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFle
xStart |
| 4115 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; | 4113 || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; |
| 4116 } | 4114 } |
| 4117 | 4115 |
| 4118 bool CSSPropertyParser::parseLegacyPosition(CSSPropertyID propId, bool important
) | 4116 bool CSSPropertyParser::parseLegacyPosition(CSSPropertyID propId, bool important
) |
| 4119 { | 4117 { |
| 4120 // [ legacy && [ left | right | center ] | 4118 // [ legacy && [ left | right | center ] |
| 4121 | 4119 |
| 4122 CSSParserValue* value = m_valueList->current(); | 4120 CSSParserValue* value = m_valueList->current(); |
| 4123 if (!value) | 4121 ASSERT(value); |
| 4124 return false; | |
| 4125 | 4122 |
| 4126 if (value->id == CSSValueLegacy) { | 4123 if (value->id == CSSValueLegacy) { |
| 4127 value = m_valueList->next(); | 4124 value = m_valueList->next(); |
| 4128 if (!value) | 4125 if (!value) |
| 4129 return false; | 4126 return false; |
| 4130 if (value->id != CSSValueCenter && value->id != CSSValueLeft && value->i
d != CSSValueRight) | 4127 if (value->id != CSSValueCenter && value->id != CSSValueLeft && value->i
d != CSSValueRight) |
| 4131 return false; | 4128 return false; |
| 4132 } else if (value->id == CSSValueCenter || value->id == CSSValueLeft || value
->id == CSSValueRight) { | 4129 } else if (value->id == CSSValueCenter || value->id == CSSValueLeft || value
->id == CSSValueRight) { |
| 4133 if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy
) | 4130 if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy
) |
| 4134 return false; | 4131 return false; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4190 } | 4187 } |
| 4191 | 4188 |
| 4192 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId,
bool important) | 4189 bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId,
bool important) |
| 4193 { | 4190 { |
| 4194 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi
tion>? ] | 4191 // auto | stretch | <baseline-position> | [<item-position> && <overflow-posi
tion>? ] |
| 4195 // <baseline-position> = baseline | last-baseline; | 4192 // <baseline-position> = baseline | last-baseline; |
| 4196 // <item-position> = center | start | end | self-start | self-end | flex-sta
rt | flex-end | left | right; | 4193 // <item-position> = center | start | end | self-start | self-end | flex-sta
rt | flex-end | left | right; |
| 4197 // <overflow-position> = true | safe | 4194 // <overflow-position> = true | safe |
| 4198 | 4195 |
| 4199 CSSParserValue* value = m_valueList->current(); | 4196 CSSParserValue* value = m_valueList->current(); |
| 4200 if (!value) | 4197 ASSERT(value); |
| 4201 return false; | |
| 4202 | 4198 |
| 4203 if (value->id == CSSValueAuto || value->id == CSSValueStretch || isBaselineP
ositionKeyword(value->id)) { | 4199 if (value->id == CSSValueAuto || value->id == CSSValueStretch || isBaselineP
ositionKeyword(value->id)) { |
| 4204 if (m_valueList->next()) | 4200 if (m_valueList->next()) |
| 4205 return false; | 4201 return false; |
| 4206 | 4202 |
| 4207 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); | 4203 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp
ortant); |
| 4208 return true; | 4204 return true; |
| 4209 } | 4205 } |
| 4210 | 4206 |
| 4211 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = nullptr; | 4207 RefPtrWillBeRawPtr<CSSPrimitiveValue> position = nullptr; |
| (...skipping 3764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7976 } | 7972 } |
| 7977 | 7973 |
| 7978 bool CSSPropertyParser::isSystemColor(int id) | 7974 bool CSSPropertyParser::isSystemColor(int id) |
| 7979 { | 7975 { |
| 7980 return (id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSS
ValueMenu; | 7976 return (id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSS
ValueMenu; |
| 7981 } | 7977 } |
| 7982 | 7978 |
| 7983 bool CSSPropertyParser::parseSVGValue(CSSPropertyID propId, bool important) | 7979 bool CSSPropertyParser::parseSVGValue(CSSPropertyID propId, bool important) |
| 7984 { | 7980 { |
| 7985 CSSParserValue* value = m_valueList->current(); | 7981 CSSParserValue* value = m_valueList->current(); |
| 7986 if (!value) | 7982 ASSERT(value); |
| 7987 return false; | |
| 7988 | 7983 |
| 7989 CSSValueID id = value->id; | 7984 CSSValueID id = value->id; |
| 7990 | 7985 |
| 7991 bool validPrimitive = false; | 7986 bool validPrimitive = false; |
| 7992 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; | 7987 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
| 7993 | 7988 |
| 7994 switch (propId) { | 7989 switch (propId) { |
| 7995 /* The comment to the right defines all valid value of these | 7990 /* The comment to the right defines all valid value of these |
| 7996 * properties as defined in SVG 1.1, Appendix N. Property index */ | 7991 * properties as defined in SVG 1.1, Appendix N. Property index */ |
| 7997 case CSSPropertyAlignmentBaseline: | 7992 case CSSPropertyAlignmentBaseline: |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8266 return ret.release(); | 8261 return ret.release(); |
| 8267 } | 8262 } |
| 8268 | 8263 |
| 8269 // normal | [ fill || stroke || markers ] | 8264 // normal | [ fill || stroke || markers ] |
| 8270 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const | 8265 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const |
| 8271 { | 8266 { |
| 8272 if (m_valueList->size() > 3) | 8267 if (m_valueList->size() > 3) |
| 8273 return nullptr; | 8268 return nullptr; |
| 8274 | 8269 |
| 8275 CSSParserValue* value = m_valueList->current(); | 8270 CSSParserValue* value = m_valueList->current(); |
| 8276 if (!value) | 8271 ASSERT(value); |
| 8277 return nullptr; | |
| 8278 | 8272 |
| 8279 RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSep
arated(); | 8273 RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSep
arated(); |
| 8280 | 8274 |
| 8281 // The default paint-order is: Fill, Stroke, Markers. | 8275 // The default paint-order is: Fill, Stroke, Markers. |
| 8282 bool seenFill = false, seenStroke = false, seenMarkers = false; | 8276 bool seenFill = false, seenStroke = false, seenMarkers = false; |
| 8283 | 8277 |
| 8284 for (; value; value = m_valueList->next()) { | 8278 for (; value; value = m_valueList->next()) { |
| 8285 switch (value->id) { | 8279 switch (value->id) { |
| 8286 case CSSValueNormal: | 8280 case CSSValueNormal: |
| 8287 // normal inside [fill || stroke || markers] not valid | 8281 // normal inside [fill || stroke || markers] not valid |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8578 } | 8572 } |
| 8579 } | 8573 } |
| 8580 | 8574 |
| 8581 if (!list->length()) | 8575 if (!list->length()) |
| 8582 return nullptr; | 8576 return nullptr; |
| 8583 | 8577 |
| 8584 return list.release(); | 8578 return list.release(); |
| 8585 } | 8579 } |
| 8586 | 8580 |
| 8587 } // namespace blink | 8581 } // namespace blink |
| OLD | NEW |