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

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

Issue 1737453002: WIP: snap-width Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 c6bc94a57fcb2167244e9dada8154dd6dbf51d19..040ca6f7a22aac602f71ebffd7c2b9b890273815 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -408,6 +408,26 @@ void StyleBuilderFunctions::applyValueCSSPropertySnapHeight(StyleResolverState&
state.style()->setSnapHeightPosition(position);
}
+void StyleBuilderFunctions::applyInitialCSSPropertySnapWidth(StyleResolverState& state)
+{
+ state.style()->setSnapWidth(LayoutUnit());
+}
+
+void StyleBuilderFunctions::applyInheritCSSPropertySnapWidth(StyleResolverState& state)
+{
+ state.style()->setSnapWidth(state.parentStyle()->snapWidth());
+}
+
+void StyleBuilderFunctions::applyValueCSSPropertySnapWidth(StyleResolverState& state, CSSValue* value)
+{
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
+ ASSERT(primitiveValue->isLength());
+ LayoutUnit unit = LayoutUnit::fromFloatCeil(primitiveValue->computeLength<float>(state.cssToLengthConversionData()));
+ ASSERT(unit >= 0);
+ const int kMaxSnapWidth = (1 << StyleRareNonInheritedData::kSnapWidthBits) - 1;
+ state.style()->setSnapWidth(std::min(unit, LayoutUnit(kMaxSnapWidth)));
+}
+
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