1 // Copyright 2020 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 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_SCOPED_CSS_VALUE_H_
6 #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_SCOPED_CSS_VALUE_H_
7 
8 namespace blink {
9 
10 class CSSValue;
11 class TreeScope;
12 
13 // Store a CSSValue along with a TreeScope to support tree-scoped names and
14 // references for e.g. @font-face/font-family and @keyframes/animation-name.
15 // If the TreeScope pointer is null, we do not support such references, for
16 // instance for UA stylesheets.
17 class ScopedCSSValue {
18   STACK_ALLOCATED();
19 
20  public:
ScopedCSSValue(const CSSValue & value,const TreeScope * tree_scope)21   ScopedCSSValue(const CSSValue& value, const TreeScope* tree_scope)
22       : value_(value), tree_scope_(tree_scope) {}
GetCSSValue()23   const CSSValue& GetCSSValue() const { return value_; }
GetTreeScope()24   const TreeScope* GetTreeScope() const { return tree_scope_; }
25 
26  private:
27   const CSSValue& value_;
28   const TreeScope* tree_scope_;
29 };
30 
31 }  // namespace blink
32 
33 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_SCOPED_CSS_VALUE_H_
34