OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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/properties/CSSShorthandPropertyAPIWebkitMarginCollapse.h" | 5 #include "core/css/properties/CSSShorthandPropertyAPIWebkitMarginCollapse.h" |
6 | 6 |
7 #include "core/css/CSSIdentifierValue.h" | 7 #include "core/css/CSSIdentifierValue.h" |
8 #include "core/css/parser/CSSParserContext.h" | 8 #include "core/css/parser/CSSParserContext.h" |
9 #include "core/css/parser/CSSParserFastPaths.h" | 9 #include "core/css/parser/CSSParserFastPaths.h" |
10 #include "core/css/parser/CSSPropertyParserHelpers.h" | 10 #include "core/css/parser/CSSPropertyParserHelpers.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 bool CSSShorthandPropertyAPIWebkitMarginCollapse::parseShorthand( | 14 bool CSSShorthandPropertyAPIWebkitMarginCollapse::parseShorthand( |
15 bool important, | 15 bool important, |
16 CSSParserTokenRange& range, | 16 CSSParserTokenRange& range, |
17 const CSSParserContext& context, | 17 const CSSParserContext& context, |
18 const CSSParserLocalContext&, | 18 const CSSParserLocalContext&, |
19 HeapVector<CSSProperty, 256>& properties) { | 19 HeapVector<CSSProperty, 256>& properties) { |
20 CSSValueID id = range.ConsumeIncludingWhitespace().Id(); | 20 CSSValueID id = range.ConsumeIncludingWhitespace().Id(); |
21 if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue( | 21 if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue( |
22 CSSPropertyWebkitMarginBeforeCollapse, id, context.Mode())) | 22 CSSPropertyWebkitMarginBeforeCollapse, id, context.Mode())) |
23 return false; | 23 return false; |
24 | 24 |
25 CSSValue* before_collapse = CSSIdentifierValue::Create(id); | 25 CSSValue* before_collapse = CSSIdentifierValue::Create(id); |
26 CSSPropertyParserHelpers::AddProperty( | 26 CSSPropertyParserHelpers::AddProperty( |
27 CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginCollapse, | 27 CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginCollapse, |
28 *before_collapse, important, false /* implicit */, properties); | 28 *before_collapse, important, |
| 29 CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); |
29 | 30 |
30 if (range.AtEnd()) { | 31 if (range.AtEnd()) { |
31 CSSPropertyParserHelpers::AddProperty( | 32 CSSPropertyParserHelpers::AddProperty( |
32 CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMarginCollapse, | 33 CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMarginCollapse, |
33 *before_collapse, important, false /* implicit */, properties); | 34 *before_collapse, important, |
| 35 CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); |
34 return true; | 36 return true; |
35 } | 37 } |
36 | 38 |
37 id = range.ConsumeIncludingWhitespace().Id(); | 39 id = range.ConsumeIncludingWhitespace().Id(); |
38 if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue( | 40 if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue( |
39 CSSPropertyWebkitMarginAfterCollapse, id, context.Mode())) | 41 CSSPropertyWebkitMarginAfterCollapse, id, context.Mode())) |
40 return false; | 42 return false; |
41 CSSPropertyParserHelpers::AddProperty( | 43 CSSPropertyParserHelpers::AddProperty( |
42 CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMarginCollapse, | 44 CSSPropertyWebkitMarginAfterCollapse, CSSPropertyWebkitMarginCollapse, |
43 *CSSIdentifierValue::Create(id), important, false /* implicit */, | 45 *CSSIdentifierValue::Create(id), important, |
44 properties); | 46 CSSPropertyParserHelpers::IsImplicitProperty::kNotImplicit, properties); |
45 return true; | 47 return true; |
46 } | 48 } |
47 | 49 |
48 } // namespace blink | 50 } // namespace blink |
OLD | NEW |