| 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 c067f76c1c233ecc83699205fe30ab7b41faca5f..f31bc6e63e4088702356dea8df9bacfcfab8a5a1 100644
|
| --- a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
|
| +++ b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp
|
| @@ -27,6 +27,7 @@
|
| #include "core/css/CSSCustomPropertyDeclaration.h"
|
| #include "core/css/CSSPendingSubstitutionValue.h"
|
| #include "core/css/CSSPropertyMetadata.h"
|
| +#include "core/css/CSSValuePair.h"
|
| #include "core/css/CSSValuePool.h"
|
| #include "wtf/StdLibExtras.h"
|
| #include "wtf/text/StringBuilder.h"
|
| @@ -457,7 +458,7 @@ String StylePropertySerializer::getPropertyValue(CSSPropertyID propertyID) const
|
| case CSSPropertyMotion:
|
| return getShorthandValue(motionShorthand());
|
| case CSSPropertyOffset:
|
| - return getShorthandValue(offsetShorthand());
|
| + return offsetValue();
|
| case CSSPropertyWebkitMarginCollapse:
|
| return getShorthandValue(webkitMarginCollapseShorthand());
|
| case CSSPropertyOverflow:
|
| @@ -546,6 +547,44 @@ void StylePropertySerializer::appendFontLonghandValueIfNotNormal(CSSPropertyID p
|
| result.append(value);
|
| }
|
|
|
| +String StylePropertySerializer::offsetValue() const
|
| +{
|
| + const CSSValue* offsetPathValue = m_propertySet.getPropertyCSSValue(CSSPropertyOffsetPath);
|
| + const CSSValue* offsetDistanceValue = m_propertySet.getPropertyCSSValue(CSSPropertyOffsetDistance);
|
| + const CSSValue* offsetRotationValue = m_propertySet.getPropertyCSSValue(CSSPropertyOffsetRotation);
|
| +
|
| + const CSSValue* offsetPositionValue = nullptr;
|
| + const CSSValue* offsetAnchorValue = nullptr;
|
| + if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) {
|
| + offsetPositionValue = m_propertySet.getPropertyCSSValue(CSSPropertyOffsetPosition);
|
| + offsetAnchorValue = m_propertySet.getPropertyCSSValue(CSSPropertyOffsetAnchor);
|
| + }
|
| +
|
| + StringBuilder result;
|
| + if (offsetPositionValue && offsetPositionValue->isValuePair()) {
|
| + result.append(offsetPositionValue->cssText());
|
| + result.append(' ');
|
| + }
|
| + result.append(offsetPathValue->cssText());
|
| + result.append(' ');
|
| + result.append(offsetDistanceValue->cssText());
|
| + result.append(' ');
|
| + result.append(offsetRotationValue->cssText());
|
| +
|
| + bool anchorIsCentre = !offsetAnchorValue;
|
| + if (offsetAnchorValue && offsetAnchorValue->isValuePair()) {
|
| + const CSSValuePair* pair = toCSSValuePair(offsetAnchorValue);
|
| + const CSSPrimitiveValue& first = toCSSPrimitiveValue(pair->first());
|
| + const CSSPrimitiveValue& second = toCSSPrimitiveValue(pair->second());
|
| + anchorIsCentre = first.isPercentage() && first.getDoubleValue() == 50 && second.isPercentage() && second.getDoubleValue() == 50;
|
| + }
|
| + if (!anchorIsCentre) {
|
| + result.append('/');
|
| + result.append(offsetAnchorValue->cssText());
|
| + }
|
| + return result.toString();
|
| +}
|
| +
|
| String StylePropertySerializer::fontValue() const
|
| {
|
| int fontSizePropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFontSize);
|
|
|