Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp |
| diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp |
| index e129977ff7f7f2f7e03a435338a9af2cc6b13968..369ece4eceace380b6c2b53f0725f0578a569a93 100644 |
| --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp |
| +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyOffsetPathUtils.cpp |
| @@ -4,7 +4,11 @@ |
| #include "core/css/properties/CSSPropertyOffsetPathUtils.h" |
| +#include "core/css/CSSIdentifierValue.h" |
| #include "core/css/CSSPathValue.h" |
| +#include "core/css/CSSPrimitiveValue.h" |
| +#include "core/css/CSSRayValue.h" |
| +#include "core/css/CSSValueList.h" |
| #include "core/css/parser/CSSParserContext.h" |
| #include "core/css/parser/CSSPropertyParserHelpers.h" |
| #include "core/svg/SVGPathByteStream.h" |
| @@ -41,12 +45,51 @@ CSSValue* ConsumePath(CSSParserTokenRange& range) { |
| return CSSPathValue::Create(std::move(byte_stream)); |
| } |
| +CSSValue* ConsumeRay(CSSParserTokenRange& range) { |
| + DCHECK(range.Peek().FunctionId() == CSSValueRay); |
| + CSSParserTokenRange function_range = range; |
| + CSSParserTokenRange function_args = |
| + CSSPropertyParserHelpers::ConsumeFunction(function_range); |
| + CSSValueList* arguments = CSSValueList::CreateSpaceSeparated(); |
|
fs
2017/05/15 09:18:14
Rather than constructing a temporary list, could t
Eric Willigers
2017/05/15 10:52:23
Done.
|
| + |
| + CSSPrimitiveValue* angle = nullptr; |
| + CSSIdentifierValue* size = nullptr; |
| + CSSIdentifierValue* contain = nullptr; |
| + while (!function_args.AtEnd()) { |
| + if (!angle && |
| + (angle = CSSPropertyParserHelpers::ConsumeAngle(function_args))) |
| + arguments->Append(*angle); |
| + else if (!size && (size = CSSPropertyParserHelpers::ConsumeIdent< |
| + CSSValueClosestSide, CSSValueClosestCorner, |
| + CSSValueFarthestSide, CSSValueFarthestCorner, |
| + CSSValueSides, CSSValueCover>(function_args))) |
|
fs
2017/05/15 09:18:14
I didn't see 'cover' in <size>? C'n'P?
Eric Willigers
2017/05/15 10:52:23
Oops. Fixed.
|
| + arguments->Append(*size); |
| + else if (RuntimeEnabledFeatures::cssOffsetPathRayContainEnabled() && |
| + !contain && |
| + (contain = CSSPropertyParserHelpers::ConsumeIdent<CSSValueContain>( |
| + function_args))) |
| + arguments->Append(*contain); |
| + else |
| + return nullptr; |
| + } |
| + if (!angle || !size) |
| + return nullptr; |
| + DCHECK_LE(arguments->length(), 3U); |
| + range = function_range; |
| + return CSSRayValue::Create(arguments); |
| +} |
| + |
| } // namespace |
| CSSValue* CSSPropertyOffsetPathUtils::ConsumeOffsetPath( |
| CSSParserTokenRange& range, |
| const CSSParserContext* context) { |
| - CSSValue* value = ConsumePathOrNone(range); |
| + CSSValue* value = nullptr; |
| + if (RuntimeEnabledFeatures::cssOffsetPathRayEnabled() && |
| + range.Peek().FunctionId() == CSSValueRay) |
| + value = ConsumeRay(range); |
| + else |
| + value = ConsumePathOrNone(range); |
| // Count when we receive a valid path other than 'none'. |
| if (value && !value->IsIdentifierValue()) |