| 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 |
| 14 // syntax is used | 14 // auto-repeat 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> |
| 18 // <line-names>? ) |
| 18 // | 19 // |
| 19 // meaning that only one fixed size track is allowed. It could be argued that a
different | 20 // meaning that only one fixed size track is allowed. It could be argued that a |
| 20 // class storing two CSSGridLineNamesValue and one CSSValue (for the track size)
fits | 21 // different class storing two CSSGridLineNamesValue and one CSSValue (for the |
| 21 // better but the CSSWG has left the door open to allow more than one track in t
he | 22 // track size) fits better but the CSSWG has left the door open to allow more |
| 22 // future. That's why we're using a list, it's prepared for future changes and i
t also | 23 // than one track in the future. That's why we're using a list, it's prepared |
| 23 // allows us to keep the parsing algorithm almost intact. | 24 // for future changes and it also allows us to keep the parsing algorithm almost |
| 25 // intact. |
| 24 class CSSGridAutoRepeatValue : public CSSValueList { | 26 class CSSGridAutoRepeatValue : public CSSValueList { |
| 25 public: | 27 public: |
| 26 static CSSGridAutoRepeatValue* create(CSSValueID id) { | 28 static CSSGridAutoRepeatValue* create(CSSValueID id) { |
| 27 return new CSSGridAutoRepeatValue(id); | 29 return new CSSGridAutoRepeatValue(id); |
| 28 } | 30 } |
| 29 | 31 |
| 30 String customCSSText() const; | 32 String customCSSText() const; |
| 31 CSSValueID autoRepeatID() const { return m_autoRepeatID; } | 33 CSSValueID autoRepeatID() const { return m_autoRepeatID; } |
| 32 | 34 |
| 33 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { | 35 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { |
| 34 CSSValueList::traceAfterDispatch(visitor); | 36 CSSValueList::traceAfterDispatch(visitor); |
| 35 } | 37 } |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 CSSGridAutoRepeatValue(CSSValueID id) | 40 CSSGridAutoRepeatValue(CSSValueID id) |
| 39 : CSSValueList(GridAutoRepeatClass, SpaceSeparator), m_autoRepeatID(id) { | 41 : CSSValueList(GridAutoRepeatClass, SpaceSeparator), m_autoRepeatID(id) { |
| 40 ASSERT(id == CSSValueAutoFill || id == CSSValueAutoFit); | 42 ASSERT(id == CSSValueAutoFill || id == CSSValueAutoFit); |
| 41 } | 43 } |
| 42 | 44 |
| 43 const CSSValueID m_autoRepeatID; | 45 const CSSValueID m_autoRepeatID; |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 DEFINE_CSS_VALUE_TYPE_CASTS(CSSGridAutoRepeatValue, isGridAutoRepeatValue()); | 48 DEFINE_CSS_VALUE_TYPE_CASTS(CSSGridAutoRepeatValue, isGridAutoRepeatValue()); |
| 47 | 49 |
| 48 } // namespace blink | 50 } // namespace blink |
| 49 | 51 |
| 50 #endif // CSSGridAutoRepeatValue_h | 52 #endif // CSSGridAutoRepeatValue_h |
| OLD | NEW |