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 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2424 | 2424 |
2425 AddExpandedPropertyForValue(CSSPropertyBorderWidth, *width, important); | 2425 AddExpandedPropertyForValue(CSSPropertyBorderWidth, *width, important); |
2426 AddExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important); | 2426 AddExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important); |
2427 AddExpandedPropertyForValue(CSSPropertyBorderColor, *color, important); | 2427 AddExpandedPropertyForValue(CSSPropertyBorderColor, *color, important); |
2428 AddExpandedPropertyForValue(CSSPropertyBorderImage, | 2428 AddExpandedPropertyForValue(CSSPropertyBorderImage, |
2429 *CSSInitialValue::Create(), important); | 2429 *CSSInitialValue::Create(), important); |
2430 | 2430 |
2431 return range_.AtEnd(); | 2431 return range_.AtEnd(); |
2432 } | 2432 } |
2433 | 2433 |
2434 bool CSSPropertyParser::Consume2Values(const StylePropertyShorthand& shorthand, | |
2435 bool important) { | |
2436 DCHECK_EQ(shorthand.length(), 2u); | |
2437 const CSSPropertyID* longhands = shorthand.properties(); | |
2438 const CSSValue* start = ParseSingleValue(longhands[0], shorthand.id()); | |
2439 if (!start) | |
2440 return false; | |
2441 | |
2442 const CSSValue* end = ParseSingleValue(longhands[1], shorthand.id()); | |
2443 if (!end) | |
2444 end = start; | |
2445 AddParsedProperty(longhands[0], shorthand.id(), *start, important); | |
2446 AddParsedProperty(longhands[1], shorthand.id(), *end, important); | |
2447 | |
2448 return range_.AtEnd(); | |
2449 } | |
majidvp
2017/07/12 21:04:21
Most of the CSS logic is present in the other patc
sunyunjia
2017/07/19 20:44:12
Yeah, they are no longer needed in this patch.
| |
2450 | |
2434 bool CSSPropertyParser::Consume4Values(const StylePropertyShorthand& shorthand, | 2451 bool CSSPropertyParser::Consume4Values(const StylePropertyShorthand& shorthand, |
2435 bool important) { | 2452 bool important) { |
2436 DCHECK_EQ(shorthand.length(), 4u); | 2453 DCHECK_EQ(shorthand.length(), 4u); |
2437 const CSSPropertyID* longhands = shorthand.properties(); | 2454 const CSSPropertyID* longhands = shorthand.properties(); |
2438 const CSSValue* top = ParseSingleValue(longhands[0], shorthand.id()); | 2455 const CSSValue* top = ParseSingleValue(longhands[0], shorthand.id()); |
2439 if (!top) | 2456 if (!top) |
2440 return false; | 2457 return false; |
2441 | 2458 |
2442 const CSSValue* right = ParseSingleValue(longhands[1], shorthand.id()); | 2459 const CSSValue* right = ParseSingleValue(longhands[1], shorthand.id()); |
2443 const CSSValue* bottom = nullptr; | 2460 const CSSValue* bottom = nullptr; |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3393 case CSSPropertyGridTemplate: | 3410 case CSSPropertyGridTemplate: |
3394 return ConsumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 3411 return ConsumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
3395 case CSSPropertyGrid: | 3412 case CSSPropertyGrid: |
3396 return ConsumeGridShorthand(important); | 3413 return ConsumeGridShorthand(important); |
3397 case CSSPropertyPlaceContent: | 3414 case CSSPropertyPlaceContent: |
3398 return ConsumePlaceContentShorthand(important); | 3415 return ConsumePlaceContentShorthand(important); |
3399 case CSSPropertyPlaceItems: | 3416 case CSSPropertyPlaceItems: |
3400 return ConsumePlaceItemsShorthand(important); | 3417 return ConsumePlaceItemsShorthand(important); |
3401 case CSSPropertyPlaceSelf: | 3418 case CSSPropertyPlaceSelf: |
3402 return ConsumePlaceSelfShorthand(important); | 3419 return ConsumePlaceSelfShorthand(important); |
3420 case CSSPropertyScrollBoundaryBehavior: | |
3421 return Consume2Values(scrollBoundaryBehaviorShorthand(), important); | |
3403 default: | 3422 default: |
3404 return false; | 3423 return false; |
3405 } | 3424 } |
3406 } | 3425 } |
3407 | 3426 |
3408 } // namespace blink | 3427 } // namespace blink |
OLD | NEW |