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

Unified Diff: Source/core/css/CSSComputedStyleDeclaration.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: incorporating review comments 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/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
old mode 100644
new mode 100755
index 82d0c741688d8cd2ba4159284ff508c06120f53c..72d69c23f2284e0e7faaa1b29e53f1801a0db8ed
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -1542,6 +1542,31 @@ static PassRefPtr<CSSPrimitiveValue> valueForFontWeight(RenderStyle& style)
return cssValuePool().createIdentifierValue(CSSValueNormal);
}
+static PassRefPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction touchAction)
+{
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ if (touchAction & TouchActionNone) {
+ ASSERT(!(list->length()));
Rick Byers 2013/12/12 15:30:35 This is trivially true. I think you can simplify
gnana 2013/12/13 11:10:54 Done.
+ list->append(cssValuePool().createIdentifierValue(CSSValueNone));
+ }
+ if (touchAction & TouchActionAuto) {
Rick Byers 2013/12/12 15:30:35 The way you've defined it (which I think is reason
gnana 2013/12/13 11:10:54 Done.
+ ASSERT(!(list->length()));
+ list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
+ }
+ if (touchAction & TouchActionPanX) {
+ ASSERT(!(list->length() && !(list->hasValue(cssValuePool().createIdentifierValue(CSSValuePanY).get()))));
+ list->append(cssValuePool().createIdentifierValue(CSSValuePanX));
+ }
+ if (touchAction & TouchActionPanY) {
+ ASSERT(!(list->length() && !(list->hasValue(cssValuePool().createIdentifierValue(CSSValuePanX).get()))));
+ list->append(cssValuePool().createIdentifierValue(CSSValuePanY));
+ }
+
+ if (!list->length())
Rick Byers 2013/12/12 15:30:35 When the above is fixed, you should be able to ass
gnana 2013/12/13 11:10:54 Done.
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
+ return list.release();
+}
+
static bool isLayoutDependent(CSSPropertyID propertyID, PassRefPtr<RenderStyle> style, RenderObject* renderer)
{
// Some properties only depend on layout in certain conditions which
@@ -2316,7 +2341,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyTop:
return valueForPositionOffset(*style, CSSPropertyTop, renderer, m_node->document().renderView());
case CSSPropertyTouchAction:
- return cssValuePool().createValue(style->touchAction());
+ return touchActionFlagsToCSSValue(style->touchAction());
case CSSPropertyTouchActionDelay:
return cssValuePool().createValue(style->touchActionDelay());
case CSSPropertyUnicodeBidi:

Powered by Google App Engine
This is Rietveld 408576698