| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/css/properties/CSSPropertyAPIWebkitBoxReflect.h" |
| 6 |
| 7 #include "core/css/CSSPrimitiveValue.h" |
| 8 #include "core/css/CSSReflectValue.h" |
| 9 #include "core/css/parser/CSSParserContext.h" |
| 10 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 11 #include "core/css/properties/CSSPropertyBorderImageUtils.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 namespace { |
| 16 |
| 17 static CSSValue* ConsumeReflect(CSSParserTokenRange& range, |
| 18 const CSSParserContext* context) { |
| 19 CSSIdentifierValue* direction = CSSPropertyParserHelpers::ConsumeIdent< |
| 20 CSSValueAbove, CSSValueBelow, CSSValueLeft, CSSValueRight>(range); |
| 21 if (!direction) |
| 22 return nullptr; |
| 23 |
| 24 CSSPrimitiveValue* offset = nullptr; |
| 25 if (range.AtEnd()) { |
| 26 offset = CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kPixels); |
| 27 } else { |
| 28 offset = ConsumeLengthOrPercent( |
| 29 range, context->Mode(), kValueRangeAll, |
| 30 CSSPropertyParserHelpers::UnitlessQuirk::kForbid); |
| 31 if (!offset) |
| 32 return nullptr; |
| 33 } |
| 34 |
| 35 CSSValue* mask = nullptr; |
| 36 if (!range.AtEnd()) { |
| 37 mask = |
| 38 CSSPropertyBorderImageUtils::ConsumeWebkitBorderImage(range, context); |
| 39 if (!mask) |
| 40 return nullptr; |
| 41 } |
| 42 return CSSReflectValue::Create(direction, offset, mask); |
| 43 } |
| 44 |
| 45 } // namespace |
| 46 |
| 47 const CSSValue* CSSPropertyAPIWebkitBoxReflect::parseSingleValue( |
| 48 CSSParserTokenRange& range, |
| 49 const CSSParserContext& context, |
| 50 const CSSParserLocalContext&) { |
| 51 return ConsumeReflect(range, &context); |
| 52 } |
| 53 |
| 54 } // namespace blink |
| OLD | NEW |