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

Unified 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: Patch for landing 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index b05888320d1cd3c8d6466e194e666bb5468e660a..1632103e4cafc7b748d2e315ce72d290646585bc 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -835,6 +835,46 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeClip(CSSParserTokenRange& range,
return CSSQuadValue::create(top.release(), right.release(), bottom.release(), left.release(), CSSQuadValue::SerializeAsRect);
}
+static bool consumePan(CSSParserTokenRange& range, RefPtrWillBeRawPtr<CSSValue>& panX, RefPtrWillBeRawPtr<CSSValue>& panY)
+{
+ CSSValueID id = range.peek().id();
+ if ((id == CSSValuePanX || id == CSSValuePanRight || id == CSSValuePanLeft) && !panX) {
+ if (id != CSSValuePanX && !RuntimeEnabledFeatures::cssTouchActionPanDirectionsEnabled())
+ return false;
+ panX = consumeIdent(range);
+ } else if ((id == CSSValuePanY || id == CSSValuePanDown || id == CSSValuePanUp) && !panY) {
+ if (id != CSSValuePanY && !RuntimeEnabledFeatures::cssTouchActionPanDirectionsEnabled())
+ return false;
+ panY = consumeIdent(range);
+ } else {
+ return false;
+ }
+ return true;
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> consumeTouchAction(CSSParserTokenRange& range)
+{
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ CSSValueID id = range.peek().id();
+ if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueManipulation) {
+ list->append(consumeIdent(range));
+ return list.release();
+ }
+
+ RefPtrWillBeRawPtr<CSSValue> panX = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> panY = nullptr;
+ if (!consumePan(range, panX, panY))
+ return nullptr;
+ if (!range.atEnd() && !consumePan(range, panX, panY))
+ return nullptr;
+
+ if (panX)
+ list->append(panX.release());
+ if (panY)
+ list->append(panY.release());
+ return list.release();
+}
+
PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID propId)
{
m_range.consumeWhitespace();
@@ -896,6 +936,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
return consumeWidthOrHeight(m_range, m_context);
case CSSPropertyClip:
return consumeClip(m_range, m_context.mode());
+ case CSSPropertyTouchAction:
+ return consumeTouchAction(m_range);
default:
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698