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
3 // found in the LICENSE file.
4 
5 // This header is hand-written, whereas most CSSProperty subclass
6 // headers are generated by core/css/properties/templates/Subclass.h.tmpl.
7 // CSSPropertyID::kVariable is treated as a CSS properties in some places for
8 // convenience but is not really a CSS property.
9 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_LONGHANDS_VARIABLE_H_
10 #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_LONGHANDS_VARIABLE_H_
11 
12 #include "third_party/blink/renderer/core/css/properties/longhand.h"
13 
14 namespace blink {
15 
16 // TODO(https://crbug.com/980160): Remove this class when the static Variable
17 // instance (as returned by GetCSSPropertyVariable()) has been removed.
18 class CORE_EXPORT Variable : public Longhand {
19  public:
Variable()20   constexpr Variable() : Variable(true) {}
21 
IsAffectedByAll()22   bool IsAffectedByAll() const override { return false; }
GetCSSPropertyName()23   CSSPropertyName GetCSSPropertyName() const override {
24     NOTREACHED();
25     return CSSPropertyName("");
26   }
GetPropertyName()27   const char* GetPropertyName() const override { return "variable"; }
GetPropertyNameAtomicString()28   const WTF::AtomicString& GetPropertyNameAtomicString() const override {
29     DEFINE_STATIC_LOCAL(const AtomicString, name, ("variable"));
30     return name;
31   }
32 
33   static bool IsStaticInstance(const CSSProperty&);
34 
35  protected:
Variable(bool inherited)36   constexpr Variable(bool inherited)
37       : Longhand(CSSPropertyID::kVariable,
38                  kProperty | (inherited ? kInherited : 0) |
39                      kValidForFirstLetter | kValidForMarker,
40                  '\0') {}
41 };
42 
43 }  // namespace blink
44 
45 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTIES_LONGHANDS_VARIABLE_H_
46