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

Unified Diff: Source/core/css/CSSParser-in.cpp

Issue 87973002: add pan-x and pan-y support to CSS touch-action parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated review comments and merge to trunk Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSParser-in.cpp
diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp
old mode 100644
new mode 100755
index 42ee2d6562b093c9411593a4a0da33e90e7a4ef6..7b540fd7b14933d06d2f785664449768abe7f452
--- a/Source/core/css/CSSParser-in.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -621,10 +621,6 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
if ((valueID >= CSSValueCapitalize && valueID <= CSSValueLowercase) || valueID == CSSValueNone)
return true;
break;
- case CSSPropertyTouchAction: // auto | none
- if (RuntimeEnabledFeatures::cssTouchActionEnabled() && (valueID == CSSValueAuto || valueID == CSSValueNone))
- return true;
- break;
case CSSPropertyTouchActionDelay: // none | script
if (RuntimeEnabledFeatures::cssTouchActionEnabled() && (valueID == CSSValueScript || valueID == CSSValueNone))
return true;
@@ -882,7 +878,6 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId)
case CSSPropertyTextTransform:
case CSSPropertyTextUnderlineMode:
case CSSPropertyTextUnderlineStyle:
- case CSSPropertyTouchAction:
case CSSPropertyTouchActionDelay:
case CSSPropertyVisibility:
case CSSPropertyWebkitAppearance:
@@ -2706,6 +2701,11 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyShapeImageThreshold:
validPrimitive = (RuntimeEnabledFeatures::cssShapesEnabled() && !id && validUnit(value, FNumber));
break;
+
+ case CSSPropertyTouchAction:
+ // auto | none | [pan-x || pan-y]
+ return parseTouchAction(important);
+
case CSSPropertyBorderBottomStyle:
case CSSPropertyBorderCollapse:
case CSSPropertyBorderLeftStyle:
@@ -2746,7 +2746,6 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyTextTransform:
case CSSPropertyTextUnderlineMode:
case CSSPropertyTextUnderlineStyle:
- case CSSPropertyTouchAction:
case CSSPropertyTouchActionDelay:
case CSSPropertyVariable:
case CSSPropertyVisibility:
@@ -9014,6 +9013,49 @@ bool CSSParser::parsePerspectiveOrigin(CSSPropertyID propId, CSSPropertyID& prop
return value;
}
+bool CSSParser::parseTouchAction(bool important)
+{
+ if (!RuntimeEnabledFeatures::cssTouchActionEnabled())
+ return false;
+
+ CSSParserValue* value = m_valueList->current();
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ if (m_valueList->size() == 1 && value && (value->id == CSSValueAuto || value->id == CSSValueNone)) {
+ list->append(cssValuePool().createIdentifierValue(value->id));
+ addProperty(CSSPropertyTouchAction, list.release(), important);
+ m_valueList->next();
+ return true;
+ }
+
+ bool isValid = true;
+ while (isValid && value) {
+ switch (value->id) {
+ case CSSValuePanX:
+ case CSSValuePanY: {
+ RefPtr<CSSValue> panValue = cssValuePool().createIdentifierValue(value->id);
+ if (list->hasValue(panValue.get())) {
+ isValid = false;
+ break;
+ }
+ list->append(panValue.release());
+ break;
+ }
+ default:
+ isValid = false;
+ break;
+ }
+ if (isValid)
+ value = m_valueList->next();
+ }
+
+ if (list->length() && isValid) {
+ addProperty(CSSPropertyTouchAction, list.release(), important);
+ return true;
+ }
+
+ return false;
+}
+
void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important)
{
// The text-decoration-line property takes priority over text-decoration, unless the latter has important priority set.
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698