| 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 { |
| 11 | 11 |
| 12 class CSSParserContext; |
| 12 class CSSValue; | 13 class CSSValue; |
| 13 | 14 |
| 14 enum class CSSSyntaxType { | 15 enum class CSSSyntaxType { |
| 15 TokenStream, | 16 TokenStream, |
| 16 Ident, | 17 Ident, |
| 17 Length, | 18 Length, |
| 18 Number, | 19 Number, |
| 19 Percentage, | 20 Percentage, |
| 20 LengthPercentage, | 21 LengthPercentage, |
| 21 Color, | 22 Color, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 | 36 |
| 36 CSSSyntaxType m_type; | 37 CSSSyntaxType m_type; |
| 37 String m_string; // Only used when m_type is CSSSyntaxType::Ident | 38 String m_string; // Only used when m_type is CSSSyntaxType::Ident |
| 38 bool m_repeatable; | 39 bool m_repeatable; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 class CSSSyntaxDescriptor { | 42 class CSSSyntaxDescriptor { |
| 42 public: | 43 public: |
| 43 CSSSyntaxDescriptor(String syntax); | 44 CSSSyntaxDescriptor(String syntax); |
| 44 | 45 |
| 45 const CSSValue* parse(CSSParserTokenRange, bool isAnimationTainted) const; | 46 const CSSValue* parse(CSSParserTokenRange, |
| 47 const CSSParserContext*, |
| 48 bool isAnimationTainted) const; |
| 46 bool isValid() const { return !m_syntaxComponents.isEmpty(); } | 49 bool isValid() const { return !m_syntaxComponents.isEmpty(); } |
| 47 bool isTokenStream() const { | 50 bool isTokenStream() const { |
| 48 return m_syntaxComponents.size() == 1 && | 51 return m_syntaxComponents.size() == 1 && |
| 49 m_syntaxComponents[0].m_type == CSSSyntaxType::TokenStream; | 52 m_syntaxComponents[0].m_type == CSSSyntaxType::TokenStream; |
| 50 } | 53 } |
| 51 | 54 |
| 52 private: | 55 private: |
| 53 Vector<CSSSyntaxComponent> m_syntaxComponents; | 56 Vector<CSSSyntaxComponent> m_syntaxComponents; |
| 54 }; | 57 }; |
| 55 | 58 |
| 56 } // namespace blink | 59 } // namespace blink |
| 57 | 60 |
| 58 #endif // CSSSyntaxDescriptor_h | 61 #endif // CSSSyntaxDescriptor_h |
| OLD | NEW |