| 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 CSSPropertyAPI_h | 5 #ifndef CSSPropertyAPI_h |
| 6 #define CSSPropertyAPI_h | 6 #define CSSPropertyAPI_h |
| 7 | 7 |
| 8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
| 9 #include "core/css/CSSValue.h" | 9 #include "wtf/Allocator.h" |
| 10 #include "core/css/parser/CSSParserMode.h" | |
| 11 #include "core/css/parser/CSSParserTokenRange.h" | |
| 12 | 10 |
| 13 namespace blink { | 11 namespace blink { |
| 14 | 12 |
| 13 class CSSValue; |
| 14 class CSSParserContext; |
| 15 class CSSParserTokenRange; |
| 16 |
| 15 // We will use this API to represent all functions used for property-specific | 17 // We will use this API to represent all functions used for property-specific |
| 16 // logic inside the blink style engine. All specific properties are subclasses | 18 // logic inside the blink style engine. All specific properties are subclasses |
| 17 // of CSSPropertyAPI. | 19 // of CSSPropertyAPI. |
| 18 // | 20 // |
| 19 // To add a new property using this API: | 21 // To add a new property using this API: |
| 20 // - Make a class that implements CSSPropertyAPI, and implement the static | 22 // - Make a class that implements CSSPropertyAPI, and implement the static |
| 21 // methods. | 23 // methods. |
| 22 // - Update the cssPropertyDescriptors array in CSSPropertyDescriptor.cpp to | 24 // - Update the cssPropertyDescriptors array in CSSPropertyDescriptor.cpp to |
| 23 // call GET_DESCRIPTOR(classname). | 25 // call GET_DESCRIPTOR(classname). |
| 24 // | 26 // |
| 25 // To add new functions using this API: | 27 // To add new functions using this API: |
| 26 // - New functions and static variables can be added in this class. A default | 28 // - New functions and static variables can be added in this class. A default |
| 27 // implementation of functions can optionally be provided. | 29 // implementation of functions can optionally be provided. |
| 28 // - When adding new functions, also add them to GET_DESCRIPTOR, and the get() | 30 // - When adding new functions, also add them to GET_DESCRIPTOR, and the get() |
| 29 // method in CSSPropertyDescriptors.cpp, and the descriptor struct in | 31 // method in CSSPropertyDescriptors.cpp, and the descriptor struct in |
| 30 // CSSPropertyDescriptor.h. | 32 // CSSPropertyDescriptor.h. |
| 31 class CSSPropertyAPI { | 33 class CSSPropertyAPI { |
| 32 STATIC_ONLY(CSSPropertyAPI); | 34 STATIC_ONLY(CSSPropertyAPI); |
| 33 | 35 |
| 34 public: | 36 public: |
| 35 // Parses a single CSS property and returns the corresponding CSSValue. If the | 37 // Parses a single CSS property and returns the corresponding CSSValue. If the |
| 36 // input is invalid it returns nullptr. | 38 // input is invalid it returns nullptr. |
| 37 static const CSSValue* parseSingleValue(CSSParserTokenRange&, | 39 static const CSSValue* parseSingleValue(CSSParserTokenRange&, |
| 38 const CSSParserContext&); | 40 const CSSParserContext&); |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 } // namespace blink | 43 } // namespace blink |
| 42 | 44 |
| 43 #endif // CSSPropertyAPI_h | 45 #endif // CSSPropertyAPI_h |
| OLD | NEW |