| 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 CSSSyntaxDescriptor_h | 5 #ifndef CSSSyntaxDescriptor_h |
| 6 #define CSSSyntaxDescriptor_h | 6 #define CSSSyntaxDescriptor_h |
| 7 | 7 |
| 8 #include "core/css/parser/CSSParserTokenRange.h" | 8 #include "core/css/parser/CSSParserTokenRange.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 struct CSSSyntaxComponent { | 32 struct CSSSyntaxComponent { |
| 33 CSSSyntaxComponent(CSSSyntaxType type, const String& string, bool repeatable) | 33 CSSSyntaxComponent(CSSSyntaxType type, const String& string, bool repeatable) |
| 34 : m_type(type), m_string(string), m_repeatable(repeatable) {} | 34 : m_type(type), m_string(string), m_repeatable(repeatable) {} |
| 35 | 35 |
| 36 CSSSyntaxType m_type; | 36 CSSSyntaxType m_type; |
| 37 String m_string; // Only used when m_type is CSSSyntaxType::Ident | 37 String m_string; // Only used when m_type is CSSSyntaxType::Ident |
| 38 bool m_repeatable; | 38 bool m_repeatable; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 class CSSSyntaxDescriptor { | 41 class CORE_EXPORT CSSSyntaxDescriptor { |
| 42 public: | 42 public: |
| 43 CSSSyntaxDescriptor(String syntax); | 43 CSSSyntaxDescriptor(String syntax); |
| 44 | 44 |
| 45 const CSSValue* parse(CSSParserTokenRange, bool isAnimationTainted) const; | 45 const CSSValue* parse(CSSParserTokenRange, bool isAnimationTainted) const; |
| 46 bool isValid() const { return !m_syntaxComponents.isEmpty(); } | 46 bool isValid() const { return !m_syntaxComponents.isEmpty(); } |
| 47 bool isTokenStream() const { | 47 bool isTokenStream() const { |
| 48 return m_syntaxComponents.size() == 1 && | 48 return m_syntaxComponents.size() == 1 && |
| 49 m_syntaxComponents[0].m_type == CSSSyntaxType::TokenStream; | 49 m_syntaxComponents[0].m_type == CSSSyntaxType::TokenStream; |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 Vector<CSSSyntaxComponent> m_syntaxComponents; | 53 Vector<CSSSyntaxComponent> m_syntaxComponents; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace blink | 56 } // namespace blink |
| 57 | 57 |
| 58 #endif // CSSSyntaxDescriptor_h | 58 #endif // CSSSyntaxDescriptor_h |
| OLD | NEW |