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

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

Issue 1451053002: Move paint-order property into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 5 years, 1 month 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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 case CSSPropertyWebkitBorderAfter: 1165 case CSSPropertyWebkitBorderAfter:
1166 case CSSPropertyWebkitTextStroke: 1166 case CSSPropertyWebkitTextStroke:
1167 case CSSPropertyWebkitTextStrokeColor: 1167 case CSSPropertyWebkitTextStrokeColor:
1168 case CSSPropertyWebkitTextStrokeWidth: 1168 case CSSPropertyWebkitTextStrokeWidth:
1169 case CSSPropertyTransform: 1169 case CSSPropertyTransform:
1170 case CSSPropertyFill: 1170 case CSSPropertyFill:
1171 case CSSPropertyStroke: 1171 case CSSPropertyStroke:
1172 case CSSPropertyStopColor: 1172 case CSSPropertyStopColor:
1173 case CSSPropertyFloodColor: 1173 case CSSPropertyFloodColor:
1174 case CSSPropertyLightingColor: 1174 case CSSPropertyLightingColor:
1175 case CSSPropertyPaintOrder:
1175 validPrimitive = false; 1176 validPrimitive = false;
1176 break; 1177 break;
1177 1178
1178 case CSSPropertyScrollSnapPointsX: 1179 case CSSPropertyScrollSnapPointsX:
1179 case CSSPropertyScrollSnapPointsY: 1180 case CSSPropertyScrollSnapPointsY:
1180 parsedValue = parseScrollSnapPoints(); 1181 parsedValue = parseScrollSnapPoints();
1181 break; 1182 break;
1182 case CSSPropertyScrollSnapCoordinate: 1183 case CSSPropertyScrollSnapCoordinate:
1183 parsedValue = parseScrollSnapCoordinate(); 1184 parsedValue = parseScrollSnapCoordinate();
1184 break; 1185 break;
(...skipping 4309 matching lines...) Expand 10 before | Expand all | Expand 10 after
5494 case CSSPropertyFillOpacity: 5495 case CSSPropertyFillOpacity:
5495 case CSSPropertyStopOpacity: 5496 case CSSPropertyStopOpacity:
5496 case CSSPropertyFloodOpacity: 5497 case CSSPropertyFloodOpacity:
5497 validPrimitive = validUnit(value, FNumber | FPercent, SVGAttributeMode); 5498 validPrimitive = validUnit(value, FNumber | FPercent, SVGAttributeMode);
5498 break; 5499 break;
5499 5500
5500 /* Start of supported CSS properties with validation. This is needed for par seShortHand to work 5501 /* Start of supported CSS properties with validation. This is needed for par seShortHand to work
5501 * correctly and allows optimization in applyRule(..) 5502 * correctly and allows optimization in applyRule(..)
5502 */ 5503 */
5503 5504
5504 case CSSPropertyPaintOrder:
5505 if (m_valueList->size() == 1 && id == CSSValueNormal)
5506 validPrimitive = true;
5507 else if ((parsedValue = parsePaintOrder()))
5508 m_valueList->next();
5509 break;
5510
5511 case CSSPropertyStrokeWidth: // <length> | inherit 5505 case CSSPropertyStrokeWidth: // <length> | inherit
5512 case CSSPropertyStrokeDashoffset: 5506 case CSSPropertyStrokeDashoffset:
5513 case CSSPropertyCx: 5507 case CSSPropertyCx:
5514 case CSSPropertyCy: 5508 case CSSPropertyCy:
5515 case CSSPropertyX: 5509 case CSSPropertyX:
5516 case CSSPropertyY: 5510 case CSSPropertyY:
5517 case CSSPropertyR: 5511 case CSSPropertyR:
5518 case CSSPropertyRx: 5512 case CSSPropertyRx:
5519 case CSSPropertyRy: 5513 case CSSPropertyRy:
5520 validPrimitive = validUnit(value, FLength | FPercent, SVGAttributeMode); 5514 validPrimitive = validUnit(value, FLength | FPercent, SVGAttributeMode);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
5593 bool commaConsumed = consumeComma(m_valueList); 5587 bool commaConsumed = consumeComma(m_valueList);
5594 value = m_valueList->current(); 5588 value = m_valueList->current();
5595 if (commaConsumed && !value) 5589 if (commaConsumed && !value)
5596 return nullptr; 5590 return nullptr;
5597 } 5591 }
5598 if (!validPrimitive) 5592 if (!validPrimitive)
5599 return nullptr; 5593 return nullptr;
5600 return ret.release(); 5594 return ret.release();
5601 } 5595 }
5602 5596
5603 // normal | [ fill || stroke || markers ]
5604 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePaintOrder() const
5605 {
5606 if (m_valueList->size() > 3)
5607 return nullptr;
5608
5609 CSSParserValue* value = m_valueList->current();
5610 ASSERT(value);
5611
5612 Vector<CSSValueID, 3> paintTypeList;
5613 RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr;
5614 RefPtrWillBeRawPtr<CSSPrimitiveValue> stroke = nullptr;
5615 RefPtrWillBeRawPtr<CSSPrimitiveValue> markers = nullptr;
5616 while (value) {
5617 if (value->id == CSSValueFill && !fill)
5618 fill = CSSPrimitiveValue::createIdentifier(value->id);
5619 else if (value->id == CSSValueStroke && !stroke)
5620 stroke = CSSPrimitiveValue::createIdentifier(value->id);
5621 else if (value->id == CSSValueMarkers && !markers)
5622 markers = CSSPrimitiveValue::createIdentifier(value->id);
5623 else
5624 return nullptr;
5625 paintTypeList.append(value->id);
5626 value = m_valueList->next();
5627 }
5628
5629 // After parsing we serialize the paint-order list. Since it is not possible to
5630 // pop a last list items from CSSValueList without bigger cost, we create th e
5631 // list after parsing.
5632 CSSValueID firstPaintOrderType = paintTypeList.at(0);
5633 RefPtrWillBeRawPtr<CSSValueList> paintOrderList = CSSValueList::createSpaceS eparated();
5634 switch (firstPaintOrderType) {
5635 case CSSValueFill:
5636 case CSSValueStroke:
5637 paintOrderList->append(firstPaintOrderType == CSSValueFill ? fill.releas e() : stroke.release());
5638 if (paintTypeList.size() > 1) {
5639 if (paintTypeList.at(1) == CSSValueMarkers)
5640 paintOrderList->append(markers.release());
5641 }
5642 break;
5643 case CSSValueMarkers:
5644 paintOrderList->append(markers.release());
5645 if (paintTypeList.size() > 1) {
5646 if (paintTypeList.at(1) == CSSValueStroke)
5647 paintOrderList->append(stroke.release());
5648 }
5649 break;
5650 default:
5651 ASSERT_NOT_REACHED();
5652 }
5653
5654 return paintOrderList.release();
5655 }
5656
5657 } // namespace blink 5597 } // 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