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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h

Issue 1715513002: Move background related shorthands into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase tests Created 4 years, 10 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/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

Powered by Google App Engine
This is Rietveld 408576698