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 d95f1f656d63f77101dd2168c2af526c5b1cb519..b567f5aee7aabc12bc591b954182986c88939fb2 100644 |
--- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp |
+++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp |
@@ -448,6 +448,22 @@ static CSSValueList* valueForItemPositionWithOverflowAlignment(const StyleSelfAl |
return result; |
} |
+static CSSValue* valueForOffsetPath(const StylePath* styleMotionPath) |
+{ |
+ if (styleMotionPath) |
+ return styleMotionPath->computedCSSValue(); |
+ return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
+} |
+ |
+static CSSValue* valueForOffsetRotation(const StyleOffsetRotation& offsetRotation) |
+{ |
+ CSSValueList* list = CSSValueList::createSpaceSeparated(); |
+ if (offsetRotation.type == OffsetRotationAuto) |
+ list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto)); |
+ list->append(*CSSPrimitiveValue::create(offsetRotation.angle, CSSPrimitiveValue::UnitType::Degrees)); |
+ return list; |
+} |
+ |
static CSSValueList* valuesForGridShorthand(const StylePropertyShorthand& shorthand, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle) |
{ |
CSSValueList* list = CSSValueList::createSlashSeparated(); |
@@ -1574,6 +1590,28 @@ CSSValue* ComputedStyleCSSValueMapping::valueForFont(const ComputedStyle& style) |
return list; |
} |
+CSSValue* ComputedStyleCSSValueMapping::valueForOffset(const ComputedStyle& style) |
+{ |
+ CSSValueList* list = CSSValueList::createSpaceSeparated(); |
+ if (style.offsetPosition() != ComputedStyle::initialOffsetPosition()) { |
+ DCHECK(RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()); |
+ list->append(*valueForPosition(style.offsetPosition(), style)); |
+ } |
+ |
+ list->append(*valueForOffsetPath(style.offsetPath())); |
+ list->append(*zoomAdjustedPixelValueForLength(style.offsetDistance(), style)); |
+ list->append(*valueForOffsetRotation(style.offsetRotation())); |
+ |
+ if (style.offsetAnchor() == ComputedStyle::initialOffsetAnchor()) |
+ return list; |
+ |
+ DCHECK(RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()); |
+ CSSValueList* outerList = CSSValueList::createSlashSeparated(); |
+ outerList->append(*list); |
+ outerList->append(*valueForPosition(style.offsetAnchor(), style)); |
+ return outerList; |
+} |
+ |
static CSSValue* valueForScrollSnapDestination(const LengthPoint& destination, const ComputedStyle& style) |
{ |
CSSValueList* list = CSSValueList::createSpaceSeparated(); |
@@ -2743,7 +2781,7 @@ const CSSValue* ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, cons |
return valuesForShorthandProperty(motionShorthand(), style, layoutObject, styledNode, allowVisitedStyle); |
case CSSPropertyOffset: |
- return valuesForShorthandProperty(offsetShorthand(), style, layoutObject, styledNode, allowVisitedStyle); |
+ return valueForOffset(style); |
case CSSPropertyOffsetAnchor: |
return valueForPosition(style.offsetAnchor(), style); |
@@ -2752,20 +2790,13 @@ const CSSValue* ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, cons |
return valueForPosition(style.offsetPosition(), style); |
case CSSPropertyOffsetPath: |
- if (const StylePath* styleMotionPath = style.offsetPath()) |
- return styleMotionPath->computedCSSValue(); |
- return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
+ return valueForOffsetPath(style.offsetPath()); |
case CSSPropertyOffsetDistance: |
return zoomAdjustedPixelValueForLength(style.offsetDistance(), style); |
- case CSSPropertyOffsetRotation: { |
- CSSValueList* list = CSSValueList::createSpaceSeparated(); |
- if (style.offsetRotation().type == OffsetRotationAuto) |
- list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto)); |
- list->append(*CSSPrimitiveValue::create(style.offsetRotation().angle, CSSPrimitiveValue::UnitType::Degrees)); |
- return list; |
- } |
+ case CSSPropertyOffsetRotation: |
+ return valueForOffsetRotation(style.offsetRotation()); |
// Unimplemented CSS 3 properties (including CSS3 shorthand properties). |
case CSSPropertyWebkitTextEmphasis: |