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

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

Issue 2932593004: Update the snap points css properties (Closed)
Patch Set: Fix nits 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/StylePropertySerializer.cpp
diff --git a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
index 21c373448600917a394ec741e9148bd74801339a..3e42083d8a84347e5becf8672e79bd3fda3d6f90 100644
--- a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
+++ b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
@@ -506,6 +506,18 @@ String StylePropertySerializer::GetPropertyValue(
}
case CSSPropertyBorderRadius:
return Get4Values(borderRadiusShorthand());
+ case CSSPropertyScrollPadding:
+ return Get4Values(scrollPaddingShorthand());
+ case CSSPropertyScrollPaddingBlock:
+ return Get2Values(scrollPaddingBlockShorthand());
+ case CSSPropertyScrollPaddingInline:
+ return Get2Values(scrollPaddingInlineShorthand());
+ case CSSPropertyScrollSnapMargin:
+ return Get4Values(scrollSnapMarginShorthand());
+ case CSSPropertyScrollSnapMarginBlock:
+ return Get2Values(scrollSnapMarginBlockShorthand());
+ case CSSPropertyScrollSnapMarginInline:
+ return Get2Values(scrollSnapMarginInlineShorthand());
default:
return String();
}
@@ -695,6 +707,32 @@ String StylePropertySerializer::OffsetValue() const {
return result.ToString();
}
+String StylePropertySerializer::Get2Values(
+ const StylePropertyShorthand& shorthand) const {
+ // Assume the properties are in the usual order start, end.
+ int start_value_index =
+ property_set_.FindPropertyIndex(shorthand.properties()[0]);
+ int end_value_index =
+ property_set_.FindPropertyIndex(shorthand.properties()[1]);
+
+ if (start_value_index == -1 || end_value_index == -1)
+ return String();
+
+ PropertyValueForSerializer start =
+ property_set_.PropertyAt(start_value_index);
+ PropertyValueForSerializer end = property_set_.PropertyAt(end_value_index);
+
+ bool show_end = !DataEquivalent(start.Value(), end.Value());
+
+ StringBuilder result;
+ result.Append(start.Value()->CssText());
+ if (show_end) {
+ result.Append(' ');
+ result.Append(end.Value()->CssText());
+ }
+ return result.ToString();
+}
+
String StylePropertySerializer::Get4Values(
const StylePropertyShorthand& shorthand) const {
// Assume the properties are in the usual order top, right, bottom, left.

Powered by Google App Engine
This is Rietveld 408576698