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

Unified Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 2767213003: First Implementation of Snapped Points
Patch Set: Rebase and format Created 3 years, 6 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/ComputedStyleCSSValueMapping.cpp
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
index c43788100193cd6f8a8d155f0f1558a7f0a4cc75..fa2822bb2c92a931fb35c3d4b11b3b604e5a6986 100644
--- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -1926,6 +1926,23 @@ CSSValue* ComputedStyleCSSValueMapping::ValueForFont(
return list;
}
+static CSSValue* ValueForScrollSnapType(const ScrollSnapType& type,
+ const ComputedStyle& style) {
+ if (type.axis != kSnapAxisNone) {
+ return CSSValuePair::Create(CSSIdentifierValue::Create(type.axis),
+ CSSIdentifierValue::Create(type.strictness),
+ CSSValuePair::kDropIdenticalValues);
+ }
+ return CSSIdentifierValue::Create(CSSValueNone);
+}
+
+static CSSValue* ValueForScrollSnapAlign(const ScrollSnapAlign& align,
+ const ComputedStyle& style) {
+ return CSSValuePair::Create(CSSIdentifierValue::Create(align.alignmentX),
+ CSSIdentifierValue::Create(align.alignmentY),
+ CSSValuePair::kDropIdenticalValues);
+}
+
static CSSValue* ValueForScrollSnapDestination(const LengthPoint& destination,
const ComputedStyle& style) {
CSSValueList* list = CSSValueList::CreateSpaceSeparated();
@@ -3418,6 +3435,30 @@ const CSSValue* ComputedStyleCSSValueMapping::Get(
case CSSPropertyPadding:
return ValuesForSidesShorthand(paddingShorthand(), style, layout_object,
styled_node, allow_visited_style);
+ case CSSPropertyScrollPadding:
+ return ValuesForSidesShorthand(scrollPaddingShorthand(), style,
+ layout_object, styled_node,
+ allow_visited_style);
+ case CSSPropertyScrollPaddingBlock:
+ return ValuesForShorthandProperty(scrollPaddingBlockShorthand(), style,
+ layout_object, styled_node,
+ allow_visited_style);
+ case CSSPropertyScrollPaddingInline:
+ return ValuesForShorthandProperty(scrollPaddingInlineShorthand(), style,
+ layout_object, styled_node,
+ allow_visited_style);
+ case CSSPropertyScrollSnapMargin:
+ return ValuesForSidesShorthand(scrollSnapMarginShorthand(), style,
+ layout_object, styled_node,
+ allow_visited_style);
+ case CSSPropertyScrollSnapMarginBlock:
+ return ValuesForShorthandProperty(scrollSnapMarginBlockShorthand(), style,
+ layout_object, styled_node,
+ allow_visited_style);
+ case CSSPropertyScrollSnapMarginInline:
+ return ValuesForShorthandProperty(scrollSnapMarginInlineShorthand(),
+ style, layout_object, styled_node,
+ allow_visited_style);
// Individual properties not part of the spec.
case CSSPropertyBackgroundRepeatX:
case CSSPropertyBackgroundRepeatY:
@@ -3648,7 +3689,7 @@ const CSSValue* ComputedStyleCSSValueMapping::Get(
case CSSPropertyRy:
return ZoomAdjustedPixelValueForLength(svg_style.Ry(), style);
case CSSPropertyScrollSnapType:
- return CSSIdentifierValue::Create(style.GetScrollSnapType());
+ return ValueForScrollSnapType(style.GetScrollSnapType(), style);
case CSSPropertyScrollSnapPointsX:
return ValueForScrollSnapPoints(style.ScrollSnapPointsX(), style);
case CSSPropertyScrollSnapPointsY:
@@ -3658,6 +3699,55 @@ const CSSValue* ComputedStyleCSSValueMapping::Get(
case CSSPropertyScrollSnapDestination:
return ValueForScrollSnapDestination(style.ScrollSnapDestination(),
style);
+ case CSSPropertyScrollSnapAlign:
+ return ValueForScrollSnapAlign(style.GetScrollSnapAlign(), style);
+ case CSSPropertyScrollSnapStop:
+ return CSSIdentifierValue::Create(style.ScrollSnapStop());
+ case CSSPropertyScrollPaddingTop:
+ return ZoomAdjustedPixelValueForLength(style.ScrollPaddingTop(), style);
+ case CSSPropertyScrollPaddingRight:
+ return ZoomAdjustedPixelValueForLength(style.ScrollPaddingRight(), style);
+ case CSSPropertyScrollPaddingBottom:
+ return ZoomAdjustedPixelValueForLength(style.ScrollPaddingBottom(),
+ style);
+ case CSSPropertyScrollPaddingLeft:
+ return ZoomAdjustedPixelValueForLength(style.ScrollPaddingLeft(), style);
+ case CSSPropertyScrollPaddingBlockStart:
+ return ZoomAdjustedPixelValueForLength(style.ScrollPaddingBlockStart(),
+ style);
+ case CSSPropertyScrollPaddingBlockEnd:
+ return ZoomAdjustedPixelValueForLength(style.ScrollPaddingBlockEnd(),
+ style);
+ case CSSPropertyScrollPaddingInlineStart:
+ return ZoomAdjustedPixelValueForLength(style.ScrollPaddingInlineStart(),
+ style);
+ case CSSPropertyScrollPaddingInlineEnd:
+ return ZoomAdjustedPixelValueForLength(style.ScrollPaddingInlineEnd(),
+ style);
+ case CSSPropertyScrollSnapMarginTop:
+ return ZoomAdjustedPixelValueForLength(style.ScrollSnapMarginTop(),
+ style);
+ case CSSPropertyScrollSnapMarginRight:
+ return ZoomAdjustedPixelValueForLength(style.ScrollSnapMarginRight(),
+ style);
+ case CSSPropertyScrollSnapMarginBottom:
+ return ZoomAdjustedPixelValueForLength(style.ScrollSnapMarginBottom(),
+ style);
+ case CSSPropertyScrollSnapMarginLeft:
+ return ZoomAdjustedPixelValueForLength(style.ScrollSnapMarginLeft(),
+ style);
+ case CSSPropertyScrollSnapMarginBlockStart:
+ return ZoomAdjustedPixelValueForLength(style.ScrollSnapMarginBlockStart(),
+ style);
+ case CSSPropertyScrollSnapMarginBlockEnd:
+ return ZoomAdjustedPixelValueForLength(style.ScrollSnapMarginBlockEnd(),
+ style);
+ case CSSPropertyScrollSnapMarginInlineStart:
+ return ZoomAdjustedPixelValueForLength(
+ style.ScrollSnapMarginInlineStart(), style);
+ case CSSPropertyScrollSnapMarginInlineEnd:
+ return ZoomAdjustedPixelValueForLength(style.ScrollSnapMarginInlineEnd(),
+ style);
case CSSPropertyTranslate: {
if (!style.Translate())
return CSSIdentifierValue::Create(CSSValueNone);

Powered by Google App Engine
This is Rietveld 408576698