| 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 17 matching lines...) Expand all Loading... |
| 28 kResolution, | 28 kResolution, |
| 29 kTransformFunction, | 29 kTransformFunction, |
| 30 kCustomIdent, | 30 kCustomIdent, |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 struct CSSSyntaxComponent { | 33 struct CSSSyntaxComponent { |
| 34 CSSSyntaxComponent(CSSSyntaxType type, const String& string, bool repeatable) | 34 CSSSyntaxComponent(CSSSyntaxType type, const String& string, bool repeatable) |
| 35 : type_(type), string_(string), repeatable_(repeatable) {} | 35 : type_(type), string_(string), repeatable_(repeatable) {} |
| 36 | 36 |
| 37 CSSSyntaxType type_; | 37 CSSSyntaxType type_; |
| 38 String string_; // Only used when m_type is CSSSyntaxType::Ident | 38 String string_; // Only used when type_ is CSSSyntaxType::kIdent |
| 39 bool repeatable_; | 39 bool repeatable_; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 class CORE_EXPORT CSSSyntaxDescriptor { | 42 class CORE_EXPORT CSSSyntaxDescriptor { |
| 43 public: | 43 public: |
| 44 CSSSyntaxDescriptor(String syntax); | 44 CSSSyntaxDescriptor(String syntax); |
| 45 | 45 |
| 46 const CSSValue* Parse(CSSParserTokenRange, | 46 const CSSValue* Parse(CSSParserTokenRange, |
| 47 const CSSParserContext*, | 47 const CSSParserContext*, |
| 48 bool is_animation_tainted) const; | 48 bool is_animation_tainted) const; |
| 49 bool IsValid() const { return !syntax_components_.IsEmpty(); } | 49 bool IsValid() const { return !syntax_components_.IsEmpty(); } |
| 50 bool IsTokenStream() const { | 50 bool IsTokenStream() const { |
| 51 return syntax_components_.size() == 1 && | 51 return syntax_components_.size() == 1 && |
| 52 syntax_components_[0].type_ == CSSSyntaxType::kTokenStream; | 52 syntax_components_[0].type_ == CSSSyntaxType::kTokenStream; |
| 53 } | 53 } |
| 54 const Vector<CSSSyntaxComponent>& Components() const { | 54 const Vector<CSSSyntaxComponent>& Components() const { |
| 55 return syntax_components_; | 55 return syntax_components_; |
| 56 } | 56 } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 Vector<CSSSyntaxComponent> syntax_components_; | 59 Vector<CSSSyntaxComponent> syntax_components_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace blink | 62 } // namespace blink |
| 63 | 63 |
| 64 #endif // CSSSyntaxDescriptor_h | 64 #endif // CSSSyntaxDescriptor_h |
| OLD | NEW |