Index: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h |
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h |
index 101b00f62ce96782edb5ad177a3b354008c23c98..67552621e1bc9ddda3e3ad9f9320f248400f0727 100644 |
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h |
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h |
@@ -110,6 +110,7 @@ public: |
static PassRefPtr<StylePath> convertPath(StyleResolverState&, const CSSValue&); |
static PassRefPtr<StylePath> convertPathOrNone(StyleResolverState&, const CSSValue&); |
static StyleMotionRotation convertMotionRotation(const CSSValue&); |
+ template <CSSValueID cssValueFor0, CSSValueID cssValueFor100> static Length convertOriginLength(StyleResolverState&, const CSSPrimitiveValue&); |
}; |
template <typename T> |
@@ -164,6 +165,25 @@ AtomicString StyleBuilderConverter::convertString(StyleResolverState&, const CSS |
return nullAtom; |
} |
+template <CSSValueID cssValueFor0, CSSValueID cssValueFor100> |
+Length StyleBuilderConverter::convertOriginLength(StyleResolverState& state, const CSSPrimitiveValue& primitiveValue) |
+{ |
+ if (primitiveValue.isValueID()) { |
+ switch (primitiveValue.getValueID()) { |
+ case cssValueFor0: |
+ return Length(0, Percent); |
+ case cssValueFor100: |
+ return Length(100, Percent); |
+ case CSSValueCenter: |
+ return Length(50, Percent); |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ } |
+ |
+ return StyleBuilderConverter::convertLength(state, primitiveValue); |
+} |
+ |
} // namespace blink |
#endif |