| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CSSGridAutoRepeatValue_h | 5 #ifndef CSSGridAutoRepeatValue_h |
| 6 #define CSSGridAutoRepeatValue_h | 6 #define CSSGridAutoRepeatValue_h |
| 7 | 7 |
| 8 #include "core/CSSValueKeywords.h" | 8 #include "core/CSSValueKeywords.h" |
| 9 #include "core/css/CSSValueList.h" | 9 #include "core/css/CSSValueList.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 // CSSGridAutoRepeatValue stores the track sizes and line numbers when the auto-
repeat | 13 // CSSGridAutoRepeatValue stores the track sizes and line numbers when the auto-
repeat |
| 14 // syntax is used | 14 // syntax is used |
| 15 // | 15 // |
| 16 // Right now the auto-repeat syntax is as follows: | 16 // Right now the auto-repeat syntax is as follows: |
| 17 // <auto-repeat> = repeat( [ auto-fill | auto-fit ], <line-names>? <fixed-size>
<line-names>? ) | 17 // <auto-repeat> = repeat( [ auto-fill | auto-fit ], <line-names>? <fixed-size>
<line-names>? ) |
| 18 // | 18 // |
| 19 // meaning that only one fixed size track is allowed. It could be argued that a
different | 19 // meaning that only one fixed size track is allowed. It could be argued that a
different |
| 20 // class storing two CSSGridLineNamesValue and one CSSValue (for the track size)
fits | 20 // class storing two CSSGridLineNamesValue and one CSSValue (for the track size)
fits |
| 21 // better but the CSSWG has left the door open to allow more than one track in t
he | 21 // better but the CSSWG has left the door open to allow more than one track in t
he |
| 22 // future. That's why we're using a list, it's prepared for future changes and i
t also | 22 // future. That's why we're using a list, it's prepared for future changes and i
t also |
| 23 // allows us to keep the parsing algorithm almost intact. | 23 // allows us to keep the parsing algorithm almost intact. |
| 24 class CSSGridAutoRepeatValue : public CSSValueList { | 24 class CSSGridAutoRepeatValue : public CSSValueList { |
| 25 public: | 25 public: |
| 26 static RawPtr<CSSGridAutoRepeatValue> create(CSSValueID id) | 26 static CSSGridAutoRepeatValue* create(CSSValueID id) |
| 27 { | 27 { |
| 28 return new CSSGridAutoRepeatValue(id); | 28 return new CSSGridAutoRepeatValue(id); |
| 29 } | 29 } |
| 30 | 30 |
| 31 String customCSSText() const; | 31 String customCSSText() const; |
| 32 CSSValueID autoRepeatID() const { return m_autoRepeatID; } | 32 CSSValueID autoRepeatID() const { return m_autoRepeatID; } |
| 33 | 33 |
| 34 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValueList::traceAfterDispatch(visi
tor); } | 34 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValueList::traceAfterDispatch(visi
tor); } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 CSSGridAutoRepeatValue(CSSValueID id) | 37 CSSGridAutoRepeatValue(CSSValueID id) |
| 38 : CSSValueList(GridAutoRepeatClass, SpaceSeparator) | 38 : CSSValueList(GridAutoRepeatClass, SpaceSeparator) |
| 39 , m_autoRepeatID(id) | 39 , m_autoRepeatID(id) |
| 40 { | 40 { |
| 41 ASSERT(id == CSSValueAutoFill || id == CSSValueAutoFit); | 41 ASSERT(id == CSSValueAutoFill || id == CSSValueAutoFit); |
| 42 } | 42 } |
| 43 | 43 |
| 44 const CSSValueID m_autoRepeatID; | 44 const CSSValueID m_autoRepeatID; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 DEFINE_CSS_VALUE_TYPE_CASTS(CSSGridAutoRepeatValue, isGridAutoRepeatValue()); | 47 DEFINE_CSS_VALUE_TYPE_CASTS(CSSGridAutoRepeatValue, isGridAutoRepeatValue()); |
| 48 | 48 |
| 49 } // namespace blink | 49 } // namespace blink |
| 50 | 50 |
| 51 #endif // CSSGridAutoRepeatValue_h | 51 #endif // CSSGridAutoRepeatValue_h |
| OLD | NEW |