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

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

Issue 1406763002: Move touch-action property into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 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
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 bool consumePan(CSSParserTokenRange& range, RefPtrWillBeRawPtr<CSSValue>& panX, RefPtrWillBeRawPtr<CSSValue>& panY)
839 {
840 CSSValueID id = range.peek().id();
841 if (id == CSSValuePanX || id == CSSValuePanRight || id == CSSValuePanLeft) {
Timothy Loh 2015/10/14 23:45:45 Should we check if panX is null here (similar for
rwlbuis 2015/10/14 23:54:54 Yes, I think that is invalid. Below panX check sho
rwlbuis 2015/10/14 23:58:06 Ah, you mean add the check to the outer if(s) inst
Timothy Loh 2015/10/14 23:59:00 I actually didn't see it in the below if statement
842 if ((id != CSSValuePanX && !RuntimeEnabledFeatures::cssTouchActionPanDir ectionsEnabled()) || panX)
843 return false;
844 panX = consumeIdent(range);
845 } else if (id == CSSValuePanY || id == CSSValuePanDown || id == CSSValuePanU p) {
846 if ((id != CSSValuePanY && !RuntimeEnabledFeatures::cssTouchActionPanDir ectionsEnabled()) || panY)
847 return false;
848 panY = consumeIdent(range);
849 } else {
850 return false;
851 }
852 return true;
853 }
854
855 static PassRefPtrWillBeRawPtr<CSSValue> consumeTouchAction(CSSParserTokenRange& range)
856 {
857 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
858 CSSValueID id = range.peek().id();
859 if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueManipulation) {
860 list->append(consumeIdent(range));
861 return list.release();
862 }
863
864 RefPtrWillBeRawPtr<CSSValue> panX = nullptr;
865 RefPtrWillBeRawPtr<CSSValue> panY = nullptr;
866 if (!consumePan(range, panX, panY))
867 return nullptr;
868 if (!range.atEnd() && !consumePan(range, panX, panY))
869 return nullptr;
870
871 if (panX)
872 list->append(panX.release());
873 if (panY)
874 list->append(panY.release());
875 return list.release();
876 }
877
838 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID propId) 878 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID propId)
839 { 879 {
840 m_range.consumeWhitespace(); 880 m_range.consumeWhitespace();
841 switch (propId) { 881 switch (propId) {
842 case CSSPropertyWillChange: 882 case CSSPropertyWillChange:
843 return consumeWillChange(m_range); 883 return consumeWillChange(m_range);
844 case CSSPropertyPage: 884 case CSSPropertyPage:
845 return consumePage(m_range); 885 return consumePage(m_range);
846 case CSSPropertyQuotes: 886 case CSSPropertyQuotes:
847 return consumeQuotes(m_range); 887 return consumeQuotes(m_range);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 case CSSPropertyWidth: 929 case CSSPropertyWidth:
890 case CSSPropertyHeight: 930 case CSSPropertyHeight:
891 return consumeWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow); 931 return consumeWidthOrHeight(m_range, m_context, UnitlessQuirk::Allow);
892 case CSSPropertyWebkitMinLogicalWidth: 932 case CSSPropertyWebkitMinLogicalWidth:
893 case CSSPropertyWebkitMinLogicalHeight: 933 case CSSPropertyWebkitMinLogicalHeight:
894 case CSSPropertyWebkitLogicalWidth: 934 case CSSPropertyWebkitLogicalWidth:
895 case CSSPropertyWebkitLogicalHeight: 935 case CSSPropertyWebkitLogicalHeight:
896 return consumeWidthOrHeight(m_range, m_context); 936 return consumeWidthOrHeight(m_range, m_context);
897 case CSSPropertyClip: 937 case CSSPropertyClip:
898 return consumeClip(m_range, m_context.mode()); 938 return consumeClip(m_range, m_context.mode());
939 case CSSPropertyTouchAction:
940 return consumeTouchAction(m_range);
899 default: 941 default:
900 return nullptr; 942 return nullptr;
901 } 943 }
902 } 944 }
903 945
904 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range) 946 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse rTokenRange& range)
905 { 947 {
906 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated (); 948 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated ();
907 949
908 do { 950 do {
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 } 1325 }
1284 case CSSPropertyBorderSpacing: 1326 case CSSPropertyBorderSpacing:
1285 return consumeBorderSpacing(important); 1327 return consumeBorderSpacing(important);
1286 default: 1328 default:
1287 m_currentShorthand = oldShorthand; 1329 m_currentShorthand = oldShorthand;
1288 return false; 1330 return false;
1289 } 1331 }
1290 } 1332 }
1291 1333
1292 } // namespace blink 1334 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698