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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 1696373003: Add CSS parser support for the snap-height property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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/resolver/StyleBuilderCustom.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
index ffbdf4189a0a9d57bc6ca37530e831ee2b708482..620d6d567f88cf8a40d5db4a36e2feee9726ab99 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -374,6 +374,40 @@ void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state,
state.style()->setPageSize(size);
}
+void StyleBuilderFunctions::applyInitialCSSPropertySnapHeight(StyleResolverState& state)
+{
+ state.style()->setSnapHeightUnit(0);
+ state.style()->setSnapHeightPosition(0);
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertySnapHeight(StyleResolverState& state)
+{
+ state.style()->setSnapHeightUnit(state.parentStyle()->snapHeightUnit());
+ state.style()->setSnapHeightPosition(state.parentStyle()->snapHeightPosition());
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertySnapHeight(StyleResolverState& state, CSSValue* value)
+{
+ CSSValueList* list = toCSSValueList(value);
+ CSSPrimitiveValue* first = toCSSPrimitiveValue(list->item(0));
+ ASSERT(first->isLength());
+ int unit = first->computeLength<int>(state.cssToLengthConversionData());
+ ASSERT(unit >= 0);
+ state.style()->setSnapHeightUnit(clampTo<uint8_t>(unit));
+
+ if (list->length() == 1) {
+ state.style()->setSnapHeightPosition(0);
+ return;
+ }
+
+ ASSERT(list->length() == 2);
+ CSSPrimitiveValue* second = toCSSPrimitiveValue(list->item(1));
+ ASSERT(second->isNumber());
+ int position = second->getIntValue();
+ ASSERT(position > 0 && position <= 100);
+ state.style()->setSnapHeightPosition(position);
+}
+
void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& state, CSSValue* value)
{
CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | third_party/WebKit/Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698