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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 case CSSPropertyScrollSnapPointsY: | 1115 case CSSPropertyScrollSnapPointsY: |
1116 parsedValue = parseScrollSnapPoints(); | 1116 parsedValue = parseScrollSnapPoints(); |
1117 break; | 1117 break; |
1118 case CSSPropertyScrollSnapCoordinate: | 1118 case CSSPropertyScrollSnapCoordinate: |
1119 parsedValue = parseScrollSnapCoordinate(); | 1119 parsedValue = parseScrollSnapCoordinate(); |
1120 break; | 1120 break; |
1121 case CSSPropertyScrollSnapDestination: | 1121 case CSSPropertyScrollSnapDestination: |
1122 parsedValue = parsePosition(m_valueList); | 1122 parsedValue = parsePosition(m_valueList); |
1123 break; | 1123 break; |
1124 | 1124 |
1125 // none | strict | [ layout || style || paint ] | |
1126 case CSSPropertyContain: | |
1127 parsedValue = parseContain(); | |
1128 break; | |
1129 | |
1125 default: | 1130 default: |
1126 // If you crash here, it's because you added a css property and are not handling it | 1131 // If you crash here, it's because you added a css property and are not handling it |
1127 // in either this switch statement or the one in CSSPropertyParser::pars eSingleValue. | 1132 // in either this switch statement or the one in CSSPropertyParser::pars eSingleValue. |
1128 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId); | 1133 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propId); |
1129 return false; | 1134 return false; |
1130 } | 1135 } |
1131 | 1136 |
1132 if (validPrimitive) { | 1137 if (validPrimitive) { |
1133 parsedValue = parseValidPrimitive(id, value); | 1138 parsedValue = parseValidPrimitive(id, value); |
1134 m_valueList->next(); | 1139 m_valueList->next(); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1460 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate() | 1465 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate() |
1461 { | 1466 { |
1462 if (m_valueList->current()->id == CSSValueNone) { | 1467 if (m_valueList->current()->id == CSSValueNone) { |
1463 m_valueList->next(); | 1468 m_valueList->next(); |
1464 return cssValuePool().createIdentifierValue(CSSValueNone); | 1469 return cssValuePool().createIdentifierValue(CSSValueNone); |
1465 } | 1470 } |
1466 | 1471 |
1467 return parsePositionList(m_valueList); | 1472 return parsePositionList(m_valueList); |
1468 } | 1473 } |
1469 | 1474 |
1475 // none | strict | [ layout || style || paint ] | |
1476 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseContain() | |
Timothy Loh
2015/12/02 02:49:47
This parsing code is wrong (accepts "strict layout
leviw_travelin_and_unemployed
2015/12/03 00:01:59
Changed and moved.
| |
1477 { | |
1478 CSSParserValue* value = m_valueList->current(); | |
1479 if (value->id == CSSValueNone) { | |
1480 m_valueList->next(); | |
1481 return cssValuePool().createIdentifierValue(value->id); | |
1482 } | |
1483 | |
1484 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; | |
1485 bool isValid = true; | |
1486 while (isValid && value) { | |
1487 switch (value->id) { | |
1488 case CSSValuePaint: | |
1489 case CSSValueLayout: | |
1490 case CSSValueStyle: | |
1491 case CSSValueStrict: | |
1492 list->append(cssValuePool().createIdentifierValue(value->id)); | |
1493 break; | |
1494 default: | |
1495 isValid = false; | |
1496 break; | |
1497 } | |
1498 if (isValid) | |
1499 value = m_valueList->next(); | |
1500 } | |
1501 | |
1502 // Values are either valid or in shorthand scope. | |
1503 if (list->length()) | |
1504 return list.release(); | |
1505 return nullptr; | |
1506 } | |
1507 | |
1470 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open -quote | no-close-quote ]+ | inherit | 1508 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open -quote | no-close-quote ]+ | inherit |
1471 // in CSS 2.1 this got somewhat reduced: | 1509 // in CSS 2.1 this got somewhat reduced: |
1472 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu ote ]+ | inherit | 1510 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu ote ]+ | inherit |
1473 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent() | 1511 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseContent() |
1474 { | 1512 { |
1475 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated (); | 1513 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated (); |
1476 | 1514 |
1477 while (CSSParserValue* val = m_valueList->current()) { | 1515 while (CSSParserValue* val = m_valueList->current()) { |
1478 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; | 1516 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr; |
1479 if (val->m_unit == CSSParserValue::URI) { | 1517 if (val->m_unit == CSSParserValue::URI) { |
(...skipping 3828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5308 | 5346 |
5309 return string.is8Bit() ? cssValueKeywordID(string.characters8(), length) : c ssValueKeywordID(string.characters16(), length); | 5347 return string.is8Bit() ? cssValueKeywordID(string.characters8(), length) : c ssValueKeywordID(string.characters16(), length); |
5310 } | 5348 } |
5311 | 5349 |
5312 bool CSSPropertyParser::isSystemColor(CSSValueID id) | 5350 bool CSSPropertyParser::isSystemColor(CSSValueID id) |
5313 { | 5351 { |
5314 return (id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSS ValueMenu; | 5352 return (id >= CSSValueActiveborder && id <= CSSValueWindowtext) || id == CSS ValueMenu; |
5315 } | 5353 } |
5316 | 5354 |
5317 } // namespace blink | 5355 } // namespace blink |
OLD | NEW |