Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp

Issue 1450123006: Parse -webkit-column-rule shorthand in CSSPropertyParser with CSSParserTokens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 376
377 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work 377 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work
378 * correctly and allows optimization in blink::applyRule(..) 378 * correctly and allows optimization in blink::applyRule(..)
379 */ 379 */
380 380
381 case CSSPropertyBackgroundColor: // <color> | inherit 381 case CSSPropertyBackgroundColor: // <color> | inherit
382 case CSSPropertyBorderTopColor: // <color> | inherit 382 case CSSPropertyBorderTopColor: // <color> | inherit
383 case CSSPropertyBorderRightColor: 383 case CSSPropertyBorderRightColor:
384 case CSSPropertyBorderBottomColor: 384 case CSSPropertyBorderBottomColor:
385 case CSSPropertyBorderLeftColor: 385 case CSSPropertyBorderLeftColor:
386 case CSSPropertyWebkitColumnRuleColor: 386 parsedValue = parseColor(m_valueList->current(), inQuirksMode() && (!inS horthand() || m_currentShorthand == CSSPropertyBorderColor));
387 parsedValue = parseColor(m_valueList->current(), acceptQuirkyColors(prop Id));
388 if (parsedValue) 387 if (parsedValue)
389 m_valueList->next(); 388 m_valueList->next();
390 break; 389 break;
391 390
392 case CSSPropertyCursor: { 391 case CSSPropertyCursor: {
393 // Grammar defined by CSS3 UI and modified by CSS4 images: 392 // Grammar defined by CSS3 UI and modified by CSS4 images:
394 // [ [<image> [<x> <y>]?,]* 393 // [ [<image> [<x> <y>]?,]*
395 // [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize | 394 // [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize |
396 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize | 395 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize |
397 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex t | wait | help | 396 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex t | wait | help |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 m_valueList->next(); 543 m_valueList->next();
545 } 544 }
546 break; 545 break;
547 546
548 case CSSPropertyBorderTopWidth: //// <border-width> | inherit 547 case CSSPropertyBorderTopWidth: //// <border-width> | inherit
549 case CSSPropertyBorderRightWidth: // Which is defined as 548 case CSSPropertyBorderRightWidth: // Which is defined as
550 case CSSPropertyBorderBottomWidth: // thin | medium | thick | <length> 549 case CSSPropertyBorderBottomWidth: // thin | medium | thick | <length>
551 case CSSPropertyBorderLeftWidth: 550 case CSSPropertyBorderLeftWidth:
552 if (!inShorthand() || m_currentShorthand == CSSPropertyBorderWidth) 551 if (!inShorthand() || m_currentShorthand == CSSPropertyBorderWidth)
553 unitless = FUnitlessQuirk; 552 unitless = FUnitlessQuirk;
554 // fall through
555 case CSSPropertyWebkitColumnRuleWidth:
556 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) 553 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick)
557 validPrimitive = true; 554 validPrimitive = true;
558 else 555 else
559 validPrimitive = validUnit(value, FLength | FNonNeg | unitless); 556 validPrimitive = validUnit(value, FLength | FNonNeg | unitless);
560 break; 557 break;
561 558
562 case CSSPropertyVerticalAlign: 559 case CSSPropertyVerticalAlign:
563 // baseline | sub | super | top | text-top | middle | bottom | text-bott om | 560 // baseline | sub | super | top | text-top | middle | bottom | text-bott om |
564 // <percentage> | <length> | inherit 561 // <percentage> | <length> | inherit
565 562
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 // <color>{1,4} | inherit 894 // <color>{1,4} | inherit
898 return parse4Values(propId, borderColorShorthand().properties(), importa nt); 895 return parse4Values(propId, borderColorShorthand().properties(), importa nt);
899 case CSSPropertyBorderWidth: 896 case CSSPropertyBorderWidth:
900 // <border-width>{1,4} | inherit 897 // <border-width>{1,4} | inherit
901 return parse4Values(propId, borderWidthShorthand().properties(), importa nt); 898 return parse4Values(propId, borderWidthShorthand().properties(), importa nt);
902 case CSSPropertyBorderStyle: 899 case CSSPropertyBorderStyle:
903 // <border-style>{1,4} | inherit 900 // <border-style>{1,4} | inherit
904 return parse4Values(propId, borderStyleShorthand().properties(), importa nt); 901 return parse4Values(propId, borderStyleShorthand().properties(), importa nt);
905 case CSSPropertyListStyle: 902 case CSSPropertyListStyle:
906 return parseShorthand(propId, listStyleShorthand(), important); 903 return parseShorthand(propId, listStyleShorthand(), important);
907 case CSSPropertyWebkitColumnRule:
908 return parseShorthand(propId, webkitColumnRuleShorthand(), important);
909 case CSSPropertyInvalid: 904 case CSSPropertyInvalid:
910 return false; 905 return false;
911 case CSSPropertyWebkitClipPath: 906 case CSSPropertyWebkitClipPath:
912 if (id == CSSValueNone) { 907 if (id == CSSValueNone) {
913 validPrimitive = true; 908 validPrimitive = true;
914 } else if (value->m_unit == CSSParserValue::Function) { 909 } else if (value->m_unit == CSSParserValue::Function) {
915 parsedValue = parseBasicShape(); 910 parsedValue = parseBasicShape();
916 } else if (value->m_unit == CSSParserValue::URI) { 911 } else if (value->m_unit == CSSParserValue::URI) {
917 parsedValue = CSSURIValue::create(value->string); 912 parsedValue = CSSURIValue::create(value->string);
918 addProperty(propId, parsedValue.release(), important); 913 addProperty(propId, parsedValue.release(), important);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 case CSSPropertyMarker: 1082 case CSSPropertyMarker:
1088 case CSSPropertyMarkerStart: 1083 case CSSPropertyMarkerStart:
1089 case CSSPropertyMarkerMid: 1084 case CSSPropertyMarkerMid:
1090 case CSSPropertyMarkerEnd: 1085 case CSSPropertyMarkerEnd:
1091 case CSSPropertyFlex: 1086 case CSSPropertyFlex:
1092 case CSSPropertyFlexBasis: 1087 case CSSPropertyFlexBasis:
1093 case CSSPropertyFlexGrow: 1088 case CSSPropertyFlexGrow:
1094 case CSSPropertyFlexShrink: 1089 case CSSPropertyFlexShrink:
1095 case CSSPropertyFlexFlow: 1090 case CSSPropertyFlexFlow:
1096 case CSSPropertyStrokeDasharray: 1091 case CSSPropertyStrokeDasharray:
1092 case CSSPropertyWebkitColumnRule:
1093 case CSSPropertyWebkitColumnRuleColor:
1094 case CSSPropertyWebkitColumnRuleWidth:
1097 validPrimitive = false; 1095 validPrimitive = false;
1098 break; 1096 break;
1099 1097
1100 case CSSPropertyScrollSnapPointsX: 1098 case CSSPropertyScrollSnapPointsX:
1101 case CSSPropertyScrollSnapPointsY: 1099 case CSSPropertyScrollSnapPointsY:
1102 parsedValue = parseScrollSnapPoints(); 1100 parsedValue = parseScrollSnapPoints();
1103 break; 1101 break;
1104 case CSSPropertyScrollSnapCoordinate: 1102 case CSSPropertyScrollSnapCoordinate:
1105 parsedValue = parseScrollSnapCoordinate(); 1103 parsedValue = parseScrollSnapCoordinate();
1106 break; 1104 break;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 return nullptr; 1519 return nullptr;
1522 1520
1523 if (m_context.isHTMLDocument()) 1521 if (m_context.isHTMLDocument())
1524 attrName = attrName.lower(); 1522 attrName = attrName.lower();
1525 1523
1526 RefPtrWillBeRawPtr<CSSFunctionValue> attrValue = CSSFunctionValue::create(CS SValueAttr); 1524 RefPtrWillBeRawPtr<CSSFunctionValue> attrValue = CSSFunctionValue::create(CS SValueAttr);
1527 attrValue->append(CSSCustomIdentValue::create(attrName)); 1525 attrValue->append(CSSCustomIdentValue::create(attrName));
1528 return attrValue.release(); 1526 return attrValue.release();
1529 } 1527 }
1530 1528
1531 bool CSSPropertyParser::acceptQuirkyColors(CSSPropertyID propertyId) const
1532 {
1533 if (!inQuirksMode())
1534 return false;
1535 switch (propertyId) {
1536 case CSSPropertyBackgroundColor:
1537 case CSSPropertyBorderBottomColor:
1538 case CSSPropertyBorderLeftColor:
1539 case CSSPropertyBorderRightColor:
1540 case CSSPropertyBorderTopColor:
1541 return !inShorthand() || m_currentShorthand == CSSPropertyBorderColor;
1542 case CSSPropertyColor:
1543 return true;
1544 default:
1545 break;
1546 }
1547 return false;
1548 }
1549
1550 bool CSSPropertyParser::isColorKeyword(CSSValueID id) 1529 bool CSSPropertyParser::isColorKeyword(CSSValueID id)
1551 { 1530 {
1552 // Named colors and color keywords: 1531 // Named colors and color keywords:
1553 // 1532 //
1554 // <named-color> 1533 // <named-color>
1555 // 'aqua', 'black', 'blue', ..., 'yellow' (CSS3: "basic color keywords") 1534 // 'aqua', 'black', 'blue', ..., 'yellow' (CSS3: "basic color keywords")
1556 // 'aliceblue', ..., 'yellowgreen' (CSS3: "extended color keywords" ) 1535 // 'aliceblue', ..., 'yellowgreen' (CSS3: "extended color keywords" )
1557 // 'transparent' 1536 // 'transparent'
1558 // 1537 //
1559 // 'currentcolor' 1538 // 'currentcolor'
(...skipping 3843 matching lines...) Expand 10 before | Expand all | Expand 10 after
5403 m_valueList->next(); 5382 m_valueList->next();
5404 } 5383 }
5405 if (!parsedValue || (m_valueList->current() && !inShorthand())) 5384 if (!parsedValue || (m_valueList->current() && !inShorthand()))
5406 return false; 5385 return false;
5407 5386
5408 addProperty(propId, parsedValue.release(), important); 5387 addProperty(propId, parsedValue.release(), important);
5409 return true; 5388 return true;
5410 } 5389 }
5411 5390
5412 } // namespace blink 5391 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698