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

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: Rebase master Created 7 years, 3 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
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSProperties.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSParser-in.cpp
diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp
index 1ff2cfe8f1ab2355d990715a8dacce611992d08e..980d111cbe4a48e9c83bfcdf7f413d3ed52aeaa7 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 {
@@ -1990,6 +1990,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:
@@ -6616,6 +6618,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)
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSProperties.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698