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

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

Issue 1405793002: Move legacy webkit properties into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up a bit Created 5 years, 2 months 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 return nullptr; 828 return nullptr;
829 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = consumeClipComponent(args, cs sParserMode); 829 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = consumeClipComponent(args, cs sParserMode);
830 if (!bottom || (needsComma && !consumeCommaIncludingWhitespace(args))) 830 if (!bottom || (needsComma && !consumeCommaIncludingWhitespace(args)))
831 return nullptr; 831 return nullptr;
832 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = consumeClipComponent(args, cssP arserMode); 832 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = consumeClipComponent(args, cssP arserMode);
833 if (!left || !args.atEnd()) 833 if (!left || !args.atEnd())
834 return nullptr; 834 return nullptr;
835 return CSSQuadValue::create(top.release(), right.release(), bottom.release() , left.release(), CSSQuadValue::SerializeAsRect); 835 return CSSQuadValue::create(top.release(), right.release(), bottom.release() , left.release(), CSSQuadValue::SerializeAsRect);
836 } 836 }
837 837
838 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLineClamp(CSSParserToken Range& range, CSSParserMode cssParserMode)
839 {
840 if (range.peek().type() != PercentageToken && range.peek().type() != NumberT oken)
Timothy Loh 2015/10/15 23:44:36 I wouldn't bother disallowing calcs, but I'll leav
841 return nullptr;
842 RefPtrWillBeRawPtr<CSSPrimitiveValue> clampValue = consumePercent(range, Val ueRangeNonNegative);
843 if (clampValue)
844 return clampValue;
845 // When specifying number of lines, don't allow 0 as a valid value.
846 return consumeInteger(range, cssParserMode, 1);
847 }
848
849 static PassRefPtrWillBeRawPtr<CSSValue> consumeLocale(CSSParserTokenRange& range )
850 {
851 if (range.peek().id() == CSSValueAuto)
852 return consumeIdent(range);
853 return consumeString(range);
854 }
855
838 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID propId) 856 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID propId)
839 { 857 {
840 m_range.consumeWhitespace(); 858 m_range.consumeWhitespace();
841 switch (propId) { 859 switch (propId) {
842 case CSSPropertyWillChange: 860 case CSSPropertyWillChange:
843 return consumeWillChange(m_range); 861 return consumeWillChange(m_range);
844 case CSSPropertyPage: 862 case CSSPropertyPage:
845 return consumePage(m_range); 863 return consumePage(m_range);
846 case CSSPropertyQuotes: 864 case CSSPropertyQuotes:
847 return consumeQuotes(m_range); 865 return consumeQuotes(m_range);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 case CSSPropertyWidth: 907 case CSSPropertyWidth:
890 case CSSPropertyHeight: 908 case CSSPropertyHeight:
891 return consumeWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow); 909 return consumeWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow);
892 case CSSPropertyWebkitMinLogicalWidth: 910 case CSSPropertyWebkitMinLogicalWidth:
893 case CSSPropertyWebkitMinLogicalHeight: 911 case CSSPropertyWebkitMinLogicalHeight:
894 case CSSPropertyWebkitLogicalWidth: 912 case CSSPropertyWebkitLogicalWidth:
895 case CSSPropertyWebkitLogicalHeight: 913 case CSSPropertyWebkitLogicalHeight:
896 return consumeWidthOrHeight(m_range, m_context); 914 return consumeWidthOrHeight(m_range, m_context);
897 case CSSPropertyClip: 915 case CSSPropertyClip:
898 return consumeClip(m_range, m_context.mode()); 916 return consumeClip(m_range, m_context.mode());
917 // Apple specific properties. These will never be standardized and are pure ly to
Timothy Loh 2015/10/15 23:44:36 Not sure we need this comment. -webkit-line-clamp
918 // support custom WebKit-based Apple applications.
919 case CSSPropertyWebkitLineClamp:
920 return consumeLineClamp(m_range, m_context.mode());
921 case CSSPropertyWebkitFontSizeDelta:
922 return consumeLength(m_range, m_context.mode(), ValueRangeAll, UnitlessQ uirk::Allow);
923 case CSSPropertyWebkitHyphenateCharacter:
924 case CSSPropertyWebkitLocale:
925 return consumeLocale(m_range);
926 // End Apple-specific properties.
899 default: 927 default:
900 return nullptr; 928 return nullptr;
901 } 929 }
902 } 930 }
903 931
904 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) 932 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range)
905 { 933 {
906 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); 934 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated ();
907 935
908 do { 936 do {
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 } 1311 }
1284 case CSSPropertyBorderSpacing: 1312 case CSSPropertyBorderSpacing:
1285 return consumeBorderSpacing(important); 1313 return consumeBorderSpacing(important);
1286 default: 1314 default:
1287 m_currentShorthand = oldShorthand; 1315 m_currentShorthand = oldShorthand;
1288 return false; 1316 return false;
1289 } 1317 }
1290 } 1318 }
1291 1319
1292 } // namespace blink 1320 } // 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