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

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: 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
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 376f7c4e8f25bd71a537be28fa788a08f5492cb9..662ac381b38770bda4a3c48056a6bd1cdb3734af
--- 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 | (panX || panY)
Rick Byers 2013/12/06 21:44:04 indent comment
gnana 2013/12/10 18:24:37 Done.
+ return parseTouchAction(propId, 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,56 @@ bool CSSParser::parsePerspectiveOrigin(CSSPropertyID propId, CSSPropertyID& prop
return value;
}
+void CSSParser::addTouchActionProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important)
Rick Byers 2013/12/06 21:44:04 this looks like it's copied from a function dealin
gnana 2013/12/10 18:24:37 Done. Removed this function and called addProperty
+{
+ if (propId == CSSPropertyTouchAction && !important && !inShorthand()) {
+ for (unsigned i = 0; i < m_parsedProperties.size(); ++i) {
+ if (m_parsedProperties[i].id() == CSSPropertyTouchAction)
+ return;
+ }
+ }
+ addProperty(propId, value, important);
+}
+
+bool CSSParser::parseTouchAction(CSSPropertyID propId, bool important)
+{
+ if (propId == CSSPropertyTouchAction
+ && !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));
+ addTouchActionProperty(propId, list.release(), important);
+ m_valueList->next();
+ return true;
+ }
+
+ bool isValid = true;
+ while (isValid && value) {
+ switch (value->id) {
+ case CSSValuePanX:
+ case CSSValuePanY:
+ list->append(cssValuePool().createIdentifierValue(value->id));
Rick Byers 2013/12/06 21:44:04 You should check that a given value never occurs m
gnana 2013/12/10 18:24:37 Done.
+ break;
+ default:
+ isValid = false;
+ break;
+ }
+ if (isValid)
+ value = m_valueList->next();
+ }
+
+ // Values are either valid or in shorthand scope.
+ if (list->length() && isValid) {
+ addTouchActionProperty(propId, 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.

Powered by Google App Engine
This is Rietveld 408576698