OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/parser/CSSPropertyParser.h" | 5 #include "core/css/parser/CSSPropertyParser.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
9 #include "core/css/CSSBasicShapeValues.h" | 9 #include "core/css/CSSBasicShapeValues.h" |
10 #include "core/css/CSSBorderImage.h" | 10 #include "core/css/CSSBorderImage.h" |
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 | 2440 |
2441 AddExpandedPropertyForValue(CSSPropertyBorderWidth, *width, important); | 2441 AddExpandedPropertyForValue(CSSPropertyBorderWidth, *width, important); |
2442 AddExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important); | 2442 AddExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important); |
2443 AddExpandedPropertyForValue(CSSPropertyBorderColor, *color, important); | 2443 AddExpandedPropertyForValue(CSSPropertyBorderColor, *color, important); |
2444 AddExpandedPropertyForValue(CSSPropertyBorderImage, | 2444 AddExpandedPropertyForValue(CSSPropertyBorderImage, |
2445 *CSSInitialValue::Create(), important); | 2445 *CSSInitialValue::Create(), important); |
2446 | 2446 |
2447 return range_.AtEnd(); | 2447 return range_.AtEnd(); |
2448 } | 2448 } |
2449 | 2449 |
| 2450 bool CSSPropertyParser::Consume2Values(const StylePropertyShorthand& shorthand, |
| 2451 bool important) { |
| 2452 DCHECK_EQ(shorthand.length(), 2u); |
| 2453 const CSSPropertyID* longhands = shorthand.properties(); |
| 2454 const CSSValue* start = ParseSingleValue(longhands[0], shorthand.id()); |
| 2455 if (!start) |
| 2456 return false; |
| 2457 |
| 2458 const CSSValue* end = ParseSingleValue(longhands[1], shorthand.id()); |
| 2459 if (!end) |
| 2460 end = start; |
| 2461 AddProperty(longhands[0], shorthand.id(), *start, important); |
| 2462 AddProperty(longhands[1], shorthand.id(), *end, important); |
| 2463 |
| 2464 return range_.AtEnd(); |
| 2465 } |
| 2466 |
2450 bool CSSPropertyParser::Consume4Values(const StylePropertyShorthand& shorthand, | 2467 bool CSSPropertyParser::Consume4Values(const StylePropertyShorthand& shorthand, |
2451 bool important) { | 2468 bool important) { |
2452 DCHECK_EQ(shorthand.length(), 4u); | 2469 DCHECK_EQ(shorthand.length(), 4u); |
2453 const CSSPropertyID* longhands = shorthand.properties(); | 2470 const CSSPropertyID* longhands = shorthand.properties(); |
2454 const CSSValue* top = ParseSingleValue(longhands[0], shorthand.id()); | 2471 const CSSValue* top = ParseSingleValue(longhands[0], shorthand.id()); |
2455 if (!top) | 2472 if (!top) |
2456 return false; | 2473 return false; |
2457 | 2474 |
2458 const CSSValue* right = ParseSingleValue(longhands[1], shorthand.id()); | 2475 const CSSValue* right = ParseSingleValue(longhands[1], shorthand.id()); |
2459 const CSSValue* bottom = nullptr; | 2476 const CSSValue* bottom = nullptr; |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3404 case CSSPropertyGridTemplate: | 3421 case CSSPropertyGridTemplate: |
3405 return ConsumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 3422 return ConsumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
3406 case CSSPropertyGrid: | 3423 case CSSPropertyGrid: |
3407 return ConsumeGridShorthand(important); | 3424 return ConsumeGridShorthand(important); |
3408 case CSSPropertyPlaceContent: | 3425 case CSSPropertyPlaceContent: |
3409 return ConsumePlaceContentShorthand(important); | 3426 return ConsumePlaceContentShorthand(important); |
3410 case CSSPropertyPlaceItems: | 3427 case CSSPropertyPlaceItems: |
3411 return ConsumePlaceItemsShorthand(important); | 3428 return ConsumePlaceItemsShorthand(important); |
3412 case CSSPropertyPlaceSelf: | 3429 case CSSPropertyPlaceSelf: |
3413 return ConsumePlaceSelfShorthand(important); | 3430 return ConsumePlaceSelfShorthand(important); |
| 3431 case CSSPropertyScrollBoundaryBehavior: |
| 3432 return Consume2Values(scrollBoundaryBehaviorShorthand(), important); |
3414 default: | 3433 default: |
3415 return false; | 3434 return false; |
3416 } | 3435 } |
3417 } | 3436 } |
3418 | 3437 |
3419 } // namespace blink | 3438 } // namespace blink |
OLD | NEW |