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

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

Issue 1408383010: Parse -webkit-border shorthands in CSSPropertyParser with CSSParserTokens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reuse consumeLineWidth 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 | « no previous file | third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/parser/CSSPropertyParser.h" 6 #include "core/css/parser/CSSPropertyParser.h"
7 7
8 #include "core/StylePropertyShorthand.h" 8 #include "core/StylePropertyShorthand.h"
9 #include "core/css/CSSCalculationValue.h" 9 #include "core/css/CSSCalculationValue.h"
10 #include "core/css/CSSCustomIdentValue.h" 10 #include "core/css/CSSCustomIdentValue.h"
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 } 1589 }
1590 1590
1591 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLineWidth(CSSParserToken Range& range, CSSParserMode cssParserMode) 1591 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLineWidth(CSSParserToken Range& range, CSSParserMode cssParserMode)
1592 { 1592 {
1593 CSSValueID id = range.peek().id(); 1593 CSSValueID id = range.peek().id();
1594 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) 1594 if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick)
1595 return consumeIdent(range); 1595 return consumeIdent(range);
1596 return consumeLength(range, cssParserMode, ValueRangeNonNegative); 1596 return consumeLength(range, cssParserMode, ValueRangeNonNegative);
1597 } 1597 }
1598 1598
1599 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeBorderWidth(CSSParserTok enRange& range, CSSParserMode cssParserMode)
1600 {
1601 return consumeLineWidth(range, cssParserMode);
1602 }
1603
1599 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) 1604 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty)
1600 { 1605 {
1601 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); 1606 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
1602 m_range.consumeWhitespace(); 1607 m_range.consumeWhitespace();
1603 switch (property) { 1608 switch (property) {
1604 case CSSPropertyWillChange: 1609 case CSSPropertyWillChange:
1605 return consumeWillChange(m_range); 1610 return consumeWillChange(m_range);
1606 case CSSPropertyPage: 1611 case CSSPropertyPage:
1607 return consumePage(m_range); 1612 return consumePage(m_range);
1608 case CSSPropertyQuotes: 1613 case CSSPropertyQuotes:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 return consumeAnimationPropertyList(property, m_range, m_context, unreso lvedProperty == CSSPropertyAliasWebkitAnimationName); 1697 return consumeAnimationPropertyList(property, m_range, m_context, unreso lvedProperty == CSSPropertyAliasWebkitAnimationName);
1693 case CSSPropertyOrphans: 1698 case CSSPropertyOrphans:
1694 case CSSPropertyWidows: 1699 case CSSPropertyWidows:
1695 return consumeWidowsOrOrphans(m_range); 1700 return consumeWidowsOrOrphans(m_range);
1696 case CSSPropertyTextDecorationColor: 1701 case CSSPropertyTextDecorationColor:
1697 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); 1702 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled());
1698 return consumeColor(m_range, m_context); 1703 return consumeColor(m_range, m_context);
1699 case CSSPropertyWebkitTextFillColor: 1704 case CSSPropertyWebkitTextFillColor:
1700 case CSSPropertyWebkitTapHighlightColor: 1705 case CSSPropertyWebkitTapHighlightColor:
1701 case CSSPropertyWebkitTextEmphasisColor: 1706 case CSSPropertyWebkitTextEmphasisColor:
1707 case CSSPropertyWebkitBorderStartColor:
1708 case CSSPropertyWebkitBorderEndColor:
1709 case CSSPropertyWebkitBorderBeforeColor:
1710 case CSSPropertyWebkitBorderAfterColor:
1702 return consumeColor(m_range, m_context); 1711 return consumeColor(m_range, m_context);
1703 case CSSPropertyColor: 1712 case CSSPropertyColor:
1704 return consumeColor(m_range, m_context, inQuirksMode()); 1713 return consumeColor(m_range, m_context, inQuirksMode());
1714 case CSSPropertyWebkitBorderStartWidth:
1715 case CSSPropertyWebkitBorderEndWidth:
1716 case CSSPropertyWebkitBorderBeforeWidth:
1717 case CSSPropertyWebkitBorderAfterWidth:
1718 return consumeBorderWidth(m_range, m_context.mode());
1705 case CSSPropertyZIndex: 1719 case CSSPropertyZIndex:
1706 return consumeZIndex(m_range); 1720 return consumeZIndex(m_range);
1707 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS 3, so treat as CSS3 1721 case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS 3, so treat as CSS3
1708 case CSSPropertyBoxShadow: 1722 case CSSPropertyBoxShadow:
1709 return consumeShadow(m_range, m_context, property == CSSPropertyBoxShado w); 1723 return consumeShadow(m_range, m_context, property == CSSPropertyBoxShado w);
1710 case CSSPropertyWebkitFilter: 1724 case CSSPropertyWebkitFilter:
1711 case CSSPropertyBackdropFilter: 1725 case CSSPropertyBackdropFilter:
1712 return consumeFilter(m_range, m_context); 1726 return consumeFilter(m_range, m_context);
1713 case CSSPropertyWebkitTextDecorationsInEffect: 1727 case CSSPropertyWebkitTextDecorationsInEffect:
1714 case CSSPropertyTextDecorationLine: 1728 case CSSPropertyTextDecorationLine:
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 addProperty(CSSPropertyTextDecoration, textDecoration.release(), importa nt); 2217 addProperty(CSSPropertyTextDecoration, textDecoration.release(), importa nt);
2204 return true; 2218 return true;
2205 } 2219 }
2206 case CSSPropertyMotion: 2220 case CSSPropertyMotion:
2207 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); 2221 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled());
2208 return consumeShorthandGreedily(motionShorthand(), important); 2222 return consumeShorthandGreedily(motionShorthand(), important);
2209 case CSSPropertyWebkitTextEmphasis: 2223 case CSSPropertyWebkitTextEmphasis:
2210 return consumeShorthandGreedily(webkitTextEmphasisShorthand(), important ); 2224 return consumeShorthandGreedily(webkitTextEmphasisShorthand(), important );
2211 case CSSPropertyOutline: 2225 case CSSPropertyOutline:
2212 return consumeShorthandGreedily(outlineShorthand(), important); 2226 return consumeShorthandGreedily(outlineShorthand(), important);
2227 case CSSPropertyWebkitBorderStart:
2228 return consumeShorthandGreedily(webkitBorderStartShorthand(), important) ;
2229 case CSSPropertyWebkitBorderEnd:
2230 return consumeShorthandGreedily(webkitBorderEndShorthand(), important);
2231 case CSSPropertyWebkitBorderBefore:
2232 return consumeShorthandGreedily(webkitBorderBeforeShorthand(), important );
2233 case CSSPropertyWebkitBorderAfter:
2234 return consumeShorthandGreedily(webkitBorderAfterShorthand(), important) ;
2213 default: 2235 default:
2214 m_currentShorthand = oldShorthand; 2236 m_currentShorthand = oldShorthand;
2215 return false; 2237 return false;
2216 } 2238 }
2217 } 2239 }
2218 2240
2219 } // namespace blink 2241 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698