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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 validPrimitive = validUnit(value, unitless); | 554 validPrimitive = validUnit(value, unitless); |
555 break; | 555 break; |
556 case CSSPropertyOutlineColor: // <color> | invert | inherit | 556 case CSSPropertyOutlineColor: // <color> | invert | inherit |
557 // Outline color has "invert" as additional keyword. | 557 // Outline color has "invert" as additional keyword. |
558 // Also, we want to allow the special focus color even in HTML Standard
parsing mode. | 558 // Also, we want to allow the special focus color even in HTML Standard
parsing mode. |
559 if (id == CSSValueInvert || id == CSSValueWebkitFocusRingColor) { | 559 if (id == CSSValueInvert || id == CSSValueWebkitFocusRingColor) { |
560 validPrimitive = true; | 560 validPrimitive = true; |
561 break; | 561 break; |
562 } | 562 } |
563 /* nobreak */ | 563 /* nobreak */ |
| 564 case CSSPropertyColumnRuleColor: |
| 565 if (propId == CSSPropertyColumnRuleColor && unresolvedProperty != CSSPro
pertyAliasWebkitColumnRuleColor && !inShorthand() && !RuntimeEnabledFeatures::un
prefixMulticolEnabled()) |
| 566 return false; |
| 567 /* nobreak */ |
564 case CSSPropertyBackgroundColor: // <color> | inherit | 568 case CSSPropertyBackgroundColor: // <color> | inherit |
565 case CSSPropertyBorderTopColor: // <color> | inherit | 569 case CSSPropertyBorderTopColor: // <color> | inherit |
566 case CSSPropertyBorderRightColor: | 570 case CSSPropertyBorderRightColor: |
567 case CSSPropertyBorderBottomColor: | 571 case CSSPropertyBorderBottomColor: |
568 case CSSPropertyBorderLeftColor: | 572 case CSSPropertyBorderLeftColor: |
569 case CSSPropertyWebkitBorderStartColor: | 573 case CSSPropertyWebkitBorderStartColor: |
570 case CSSPropertyWebkitBorderEndColor: | 574 case CSSPropertyWebkitBorderEndColor: |
571 case CSSPropertyWebkitBorderBeforeColor: | 575 case CSSPropertyWebkitBorderBeforeColor: |
572 case CSSPropertyWebkitBorderAfterColor: | 576 case CSSPropertyWebkitBorderAfterColor: |
573 case CSSPropertyColor: // <color> | inherit | 577 case CSSPropertyColor: // <color> | inherit |
574 case CSSPropertyTextDecorationColor: // CSS3 text decoration colors | 578 case CSSPropertyTextDecorationColor: // CSS3 text decoration colors |
575 case CSSPropertyWebkitColumnRuleColor: | |
576 case CSSPropertyWebkitTextEmphasisColor: | 579 case CSSPropertyWebkitTextEmphasisColor: |
577 case CSSPropertyWebkitTextFillColor: | 580 case CSSPropertyWebkitTextFillColor: |
578 case CSSPropertyWebkitTextStrokeColor: | 581 case CSSPropertyWebkitTextStrokeColor: |
579 ASSERT(propId != CSSPropertyTextDecorationColor || RuntimeEnabledFeature
s::css3TextDecorationsEnabled()); | 582 ASSERT(propId != CSSPropertyTextDecorationColor || RuntimeEnabledFeature
s::css3TextDecorationsEnabled()); |
580 | 583 |
581 if ((id >= CSSValueAqua && id <= CSSValueWebkitText) || id == CSSValueMe
nu) { | 584 if ((id >= CSSValueAqua && id <= CSSValueWebkitText) || id == CSSValueMe
nu) { |
582 validPrimitive = isValueAllowedInMode(id, m_context.mode()); | 585 validPrimitive = isValueAllowedInMode(id, m_context.mode()); |
583 } else { | 586 } else { |
584 if (!inQuirksMode()) { | 587 if (!inQuirksMode()) { |
585 parsedValue = parseColor(); | 588 parsedValue = parseColor(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 } | 765 } |
763 break; | 766 break; |
764 | 767 |
765 case CSSPropertyBorderTopWidth: //// <border-width> | inherit | 768 case CSSPropertyBorderTopWidth: //// <border-width> | inherit |
766 case CSSPropertyBorderRightWidth: // Which is defined as | 769 case CSSPropertyBorderRightWidth: // Which is defined as |
767 case CSSPropertyBorderBottomWidth: // thin | medium | thick | <length> | 770 case CSSPropertyBorderBottomWidth: // thin | medium | thick | <length> |
768 case CSSPropertyBorderLeftWidth: | 771 case CSSPropertyBorderLeftWidth: |
769 if (!inShorthand() || m_currentShorthand == CSSPropertyBorderWidth) | 772 if (!inShorthand() || m_currentShorthand == CSSPropertyBorderWidth) |
770 unitless = FUnitlessQuirk; | 773 unitless = FUnitlessQuirk; |
771 // fall through | 774 // fall through |
| 775 case CSSPropertyColumnRuleWidth: |
| 776 if (propId == CSSPropertyColumnRuleWidth && unresolvedProperty != CSSPro
pertyAliasWebkitColumnRuleWidth && !inShorthand() && !RuntimeEnabledFeatures::un
prefixMulticolEnabled()) |
| 777 return false; |
| 778 // fall through |
772 case CSSPropertyWebkitTextStrokeWidth: | 779 case CSSPropertyWebkitTextStrokeWidth: |
773 case CSSPropertyOutlineWidth: // <border-width> | inherit | 780 case CSSPropertyOutlineWidth: // <border-width> | inherit |
774 case CSSPropertyWebkitBorderStartWidth: | 781 case CSSPropertyWebkitBorderStartWidth: |
775 case CSSPropertyWebkitBorderEndWidth: | 782 case CSSPropertyWebkitBorderEndWidth: |
776 case CSSPropertyWebkitBorderBeforeWidth: | 783 case CSSPropertyWebkitBorderBeforeWidth: |
777 case CSSPropertyWebkitBorderAfterWidth: | 784 case CSSPropertyWebkitBorderAfterWidth: |
778 case CSSPropertyWebkitColumnRuleWidth: | |
779 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) | 785 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) |
780 validPrimitive = true; | 786 validPrimitive = true; |
781 else | 787 else |
782 validPrimitive = validUnit(value, FLength | FNonNeg | unitless); | 788 validPrimitive = validUnit(value, FLength | FNonNeg | unitless); |
783 break; | 789 break; |
784 | 790 |
785 case CSSPropertyLetterSpacing: // normal | <length> | inherit | 791 case CSSPropertyLetterSpacing: // normal | <length> | inherit |
786 case CSSPropertyWordSpacing: // normal | <length> | inherit | 792 case CSSPropertyWordSpacing: // normal | <length> | inherit |
787 if (id == CSSValueNormal) | 793 if (id == CSSValueNormal) |
788 validPrimitive = true; | 794 validPrimitive = true; |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 return true; | 1255 return true; |
1250 } | 1256 } |
1251 else if (num == 2) { | 1257 else if (num == 2) { |
1252 ShorthandScope scope(this, CSSPropertyWebkitMarginCollapse); | 1258 ShorthandScope scope(this, CSSPropertyWebkitMarginCollapse); |
1253 if (!parseValue(webkitMarginCollapseShorthand().properties()[0], imp
ortant) || !parseValue(webkitMarginCollapseShorthand().properties()[1], importan
t)) | 1259 if (!parseValue(webkitMarginCollapseShorthand().properties()[0], imp
ortant) || !parseValue(webkitMarginCollapseShorthand().properties()[1], importan
t)) |
1254 return false; | 1260 return false; |
1255 return true; | 1261 return true; |
1256 } | 1262 } |
1257 return false; | 1263 return false; |
1258 } | 1264 } |
1259 case CSSPropertyWebkitColumnCount: | 1265 case CSSPropertyColumnCount: |
| 1266 if (unresolvedProperty != CSSPropertyAliasWebkitColumnCount && !inShorth
and() && !RuntimeEnabledFeatures::unprefixMulticolEnabled()) |
| 1267 return false; |
1260 parsedValue = parseColumnCount(); | 1268 parsedValue = parseColumnCount(); |
1261 break; | 1269 break; |
1262 case CSSPropertyWebkitColumnGap: // normal | <length> | 1270 case CSSPropertyColumnGap: // normal | <length> |
| 1271 if (unresolvedProperty != CSSPropertyAliasWebkitColumnGap && !RuntimeEna
bledFeatures::unprefixMulticolEnabled()) |
| 1272 return false; |
1263 if (id == CSSValueNormal) | 1273 if (id == CSSValueNormal) |
1264 validPrimitive = true; | 1274 validPrimitive = true; |
1265 else | 1275 else |
1266 validPrimitive = validUnit(value, FLength | FNonNeg); | 1276 validPrimitive = validUnit(value, FLength | FNonNeg); |
1267 break; | 1277 break; |
1268 case CSSPropertyWebkitColumnSpan: // none | all | 1 (will be dropped in the
unprefixed property) | 1278 case CSSPropertyColumnSpan: // none | all | 1 (will be dropped in the unpref
ixed property) |
| 1279 if (unresolvedProperty != CSSPropertyAliasWebkitColumnSpan && !RuntimeEn
abledFeatures::unprefixMulticolEnabled()) |
| 1280 return false; |
1269 validPrimitive = id == CSSValueAll || id == CSSValueNone || (value->unit
== CSSPrimitiveValue::CSS_NUMBER && value->fValue == 1); | 1281 validPrimitive = id == CSSValueAll || id == CSSValueNone || (value->unit
== CSSPrimitiveValue::CSS_NUMBER && value->fValue == 1); |
1270 break; | 1282 break; |
1271 case CSSPropertyWebkitColumnWidth: // auto | <length> | 1283 case CSSPropertyColumnRuleStyle: |
| 1284 // TODO(mstensho): move this back into CSSParserFastPaths once we have s
hipped unprefixed multicol. |
| 1285 if (unresolvedProperty != CSSPropertyAliasWebkitColumnRuleStyle && !inSh
orthand() && !RuntimeEnabledFeatures::unprefixMulticolEnabled()) |
| 1286 return false; |
| 1287 validPrimitive = id >= CSSValueNone && id <= CSSValueDouble; |
| 1288 break; |
| 1289 case CSSPropertyColumnWidth: // auto | <length> |
| 1290 if (unresolvedProperty != CSSPropertyAliasWebkitColumnWidth && !inShorth
and() && !RuntimeEnabledFeatures::unprefixMulticolEnabled()) |
| 1291 return false; |
1272 parsedValue = parseColumnWidth(); | 1292 parsedValue = parseColumnWidth(); |
1273 break; | 1293 break; |
1274 case CSSPropertyWillChange: | 1294 case CSSPropertyWillChange: |
1275 parsedValue = parseWillChange(); | 1295 parsedValue = parseWillChange(); |
1276 break; | 1296 break; |
1277 // End of CSS3 properties | 1297 // End of CSS3 properties |
1278 | 1298 |
1279 // Apple specific properties. These will never be standardized and are pure
ly to | 1299 // Apple specific properties. These will never be standardized and are pure
ly to |
1280 // support custom WebKit-based Apple applications. | 1300 // support custom WebKit-based Apple applications. |
1281 case CSSPropertyWebkitLineClamp: | 1301 case CSSPropertyWebkitLineClamp: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 case CSSPropertyFont: | 1413 case CSSPropertyFont: |
1394 // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [
/ 'line-height' ]? | 1414 // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [
/ 'line-height' ]? |
1395 // 'font-family' ] | caption | icon | menu | message-box | small-caption
| status-bar | inherit | 1415 // 'font-family' ] | caption | icon | menu | message-box | small-caption
| status-bar | inherit |
1396 if (num == 1 && id >= CSSValueCaption && id <= CSSValueStatusBar) { | 1416 if (num == 1 && id >= CSSValueCaption && id <= CSSValueStatusBar) { |
1397 parseSystemFont(important); | 1417 parseSystemFont(important); |
1398 return true; | 1418 return true; |
1399 } | 1419 } |
1400 return parseFont(important); | 1420 return parseFont(important); |
1401 case CSSPropertyListStyle: | 1421 case CSSPropertyListStyle: |
1402 return parseShorthand(propId, listStyleShorthand(), important); | 1422 return parseShorthand(propId, listStyleShorthand(), important); |
1403 case CSSPropertyWebkitColumns: | 1423 case CSSPropertyColumns: |
| 1424 if (unresolvedProperty != CSSPropertyAliasWebkitColumns && !RuntimeEnabl
edFeatures::unprefixMulticolEnabled()) |
| 1425 return false; |
1404 return parseColumnsShorthand(important); | 1426 return parseColumnsShorthand(important); |
1405 case CSSPropertyWebkitColumnRule: | 1427 case CSSPropertyColumnRule: |
1406 return parseShorthand(propId, webkitColumnRuleShorthand(), important); | 1428 if (unresolvedProperty != CSSPropertyAliasWebkitColumnRule && !RuntimeEn
abledFeatures::unprefixMulticolEnabled()) |
| 1429 return false; |
| 1430 return parseShorthand(propId, columnRuleShorthand(), important); |
1407 case CSSPropertyWebkitTextStroke: | 1431 case CSSPropertyWebkitTextStroke: |
1408 return parseShorthand(propId, webkitTextStrokeShorthand(), important); | 1432 return parseShorthand(propId, webkitTextStrokeShorthand(), important); |
1409 case CSSPropertyAnimation: | 1433 case CSSPropertyAnimation: |
1410 return parseAnimationShorthand(unresolvedProperty == CSSPropertyAliasWeb
kitAnimation, important); | 1434 return parseAnimationShorthand(unresolvedProperty == CSSPropertyAliasWeb
kitAnimation, important); |
1411 case CSSPropertyTransition: | 1435 case CSSPropertyTransition: |
1412 return parseTransitionShorthand(important); | 1436 return parseTransitionShorthand(important); |
1413 case CSSPropertyInvalid: | 1437 case CSSPropertyInvalid: |
1414 return false; | 1438 return false; |
1415 case CSSPropertyPage: | 1439 case CSSPropertyPage: |
1416 return parsePage(propId, important); | 1440 return parsePage(propId, important); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 columnWidth = cssValuePool().createIdentifierValue(CSSValueAuto); | 1919 columnWidth = cssValuePool().createIdentifierValue(CSSValueAuto); |
1896 } else { | 1920 } else { |
1897 ASSERT(!columnCount); | 1921 ASSERT(!columnCount); |
1898 columnCount = cssValuePool().createIdentifierValue(CSSValueAuto); | 1922 columnCount = cssValuePool().createIdentifierValue(CSSValueAuto); |
1899 } | 1923 } |
1900 } | 1924 } |
1901 ASSERT(columnCount || columnWidth); | 1925 ASSERT(columnCount || columnWidth); |
1902 | 1926 |
1903 // Any unassigned property at this point will become implicit 'auto'. | 1927 // Any unassigned property at this point will become implicit 'auto'. |
1904 if (columnWidth) | 1928 if (columnWidth) |
1905 addProperty(CSSPropertyWebkitColumnWidth, columnWidth, important); | 1929 addProperty(CSSPropertyColumnWidth, columnWidth, important); |
1906 else | 1930 else |
1907 addProperty(CSSPropertyWebkitColumnWidth, cssValuePool().createIdentifie
rValue(CSSValueAuto), important, true /* implicit */); | 1931 addProperty(CSSPropertyColumnWidth, cssValuePool().createIdentifierValue
(CSSValueAuto), important, true /* implicit */); |
1908 if (columnCount) | 1932 if (columnCount) |
1909 addProperty(CSSPropertyWebkitColumnCount, columnCount, important); | 1933 addProperty(CSSPropertyColumnCount, columnCount, important); |
1910 else | 1934 else |
1911 addProperty(CSSPropertyWebkitColumnCount, cssValuePool().createIdentifie
rValue(CSSValueAuto), important, true /* implicit */); | 1935 addProperty(CSSPropertyColumnCount, cssValuePool().createIdentifierValue
(CSSValueAuto), important, true /* implicit */); |
1912 return true; | 1936 return true; |
1913 } | 1937 } |
1914 | 1938 |
1915 bool CSSPropertyParser::parseShorthand(CSSPropertyID propId, const StyleProperty
Shorthand& shorthand, bool important) | 1939 bool CSSPropertyParser::parseShorthand(CSSPropertyID propId, const StyleProperty
Shorthand& shorthand, bool important) |
1916 { | 1940 { |
1917 // We try to match as many properties as possible | 1941 // We try to match as many properties as possible |
1918 // We set up an array of booleans to mark which property has been found, | 1942 // We set up an array of booleans to mark which property has been found, |
1919 // and we try to search for properties until it makes no longer any sense. | 1943 // and we try to search for properties until it makes no longer any sense. |
1920 ShorthandScope scope(this, propId); | 1944 ShorthandScope scope(this, propId); |
1921 | 1945 |
(...skipping 6544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8466 } | 8490 } |
8467 } | 8491 } |
8468 | 8492 |
8469 if (!list->length()) | 8493 if (!list->length()) |
8470 return nullptr; | 8494 return nullptr; |
8471 | 8495 |
8472 return list.release(); | 8496 return list.release(); |
8473 } | 8497 } |
8474 | 8498 |
8475 } // namespace blink | 8499 } // namespace blink |
OLD | NEW |