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

Unified Diff: Source/core/css/CSSPrimitiveValueMappings.h

Issue 140253004: Implement 'scroll-behavior' parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review comments Created 6 years, 11 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
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/CSSProperties.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSPrimitiveValueMappings.h
diff --git a/Source/core/css/CSSPrimitiveValueMappings.h b/Source/core/css/CSSPrimitiveValueMappings.h
index eb64b56daa7ab30649d8e7aefd80b26d1a8bfff0..1302d79c0a9fb4919f73a302a0f9756cb5bdc314 100644
--- a/Source/core/css/CSSPrimitiveValueMappings.h
+++ b/Source/core/css/CSSPrimitiveValueMappings.h
@@ -45,6 +45,7 @@
#include "platform/fonts/TextRenderingMode.h"
#include "platform/graphics/GraphicsTypes.h"
#include "platform/graphics/Path.h"
+#include "platform/scroll/ScrollableArea.h"
#include "platform/text/TextDirection.h"
#include "platform/text/UnicodeBidi.h"
#include "platform/text/WritingMode.h"
@@ -5044,6 +5045,38 @@ template<> inline CSSPrimitiveValue::operator OverflowAlignment() const
return OverflowAlignmentTrue;
}
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollBehavior behavior)
+ : CSSValue(PrimitiveClass)
+{
+ m_primitiveUnitType = CSS_VALUE_ID;
+ switch (behavior) {
+ case ScrollBehaviorInstant:
+ m_value.valueID = CSSValueInstant;
+ break;
+ case ScrollBehaviorSmooth:
+ m_value.valueID = CSSValueSmooth;
+ break;
+ case ScrollBehaviorAuto:
+ // Behavior 'auto' is only allowed in ScrollOptions arguments passed to
+ // CSSOM scroll APIs.
+ ASSERT_NOT_REACHED();
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ScrollBehavior() const
+{
+ switch (getValueID()) {
+ case CSSValueInstant:
+ return ScrollBehaviorInstant;
+ case CSSValueSmooth:
+ return ScrollBehaviorSmooth;
+ default:
+ break;
+ }
+ ASSERT_NOT_REACHED();
+ return ScrollBehaviorInstant;
+}
+
}
#endif
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/CSSProperties.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698