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

Unified Diff: Source/core/css/CSSParser-in.cpp

Issue 22839023: Add support for the object-position CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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: Source/core/css/CSSParser-in.cpp
diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp
index 7011c66b3dfa1db637a686e783cd6ffea9513e73..7be594f5ab7db1efd66b5da370801b1eff6544e3 100644
--- a/Source/core/css/CSSParser-in.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -145,9 +145,9 @@ static bool hasPrefix(const char* string, unsigned length, const char* prefix)
return false;
}
-static PassRefPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
+static PassRefPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second, Pair::IdenticalValuesPolicy identicalValuesPolicy = Pair::DropIdenticalValues)
{
- return cssValuePool().createValue(Pair::create(first, second));
+ return cssValuePool().createValue(Pair::create(first, second, identicalValuesPolicy));
}
class AnimationParseContext {
@@ -1973,6 +1973,8 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
m_implicitShorthand = false;
return result;
}
+ case CSSPropertyObjectPosition:
+ return RuntimeEnabledFeatures::objectFitPositionEnabled() && parseObjectPosition(important);
case CSSPropertyListStyleImage: // <uri> | none | inherit
case CSSPropertyBorderImageSource:
case CSSPropertyWebkitMaskBoxImageSource:
@@ -6588,6 +6590,20 @@ bool CSSParser::parseFlex(CSSParserValueList* args, bool important)
return true;
}
+bool CSSParser::parseObjectPosition(bool important)
+{
+ RefPtr<CSSValue> xValue;
+ RefPtr<CSSValue> yValue;
+ parseFillPosition(m_valueList.get(), xValue, yValue);
+ if (!xValue || !yValue)
+ return false;
+ addProperty(
+ CSSPropertyObjectPosition,
+ createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimitiveValue(yValue.get()), Pair::KeepIdenticalValues),
+ important);
+ return true;
+}
+
struct BorderImageParseContext {
BorderImageParseContext()
: m_canAdvance(false)

Powered by Google App Engine
This is Rietveld 408576698