summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/css/css_path_value.h
blob: 6ff0f908a7a6ed144141a6d17c9033dfe4c6f225 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PATH_VALUE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PATH_VALUE_H_

#include <memory>
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/core/css/css_value.h"
#include "third_party/blink/renderer/core/style/style_path.h"
#include "third_party/blink/renderer/core/svg/svg_path_byte_stream.h"
#include "third_party/blink/renderer/core/svg/svg_path_utilities.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"

namespace blink {

class StylePath;

namespace cssvalue {

class CSSPathValue : public CSSValue {
 public:
  static CSSPathValue& EmptyPathValue();

  explicit CSSPathValue(scoped_refptr<StylePath>,
                        PathSerializationFormat = kNoTransformation);
  explicit CSSPathValue(std::unique_ptr<SVGPathByteStream>,
                        PathSerializationFormat = kNoTransformation);

  StylePath* GetStylePath() const { return style_path_.get(); }
  String CustomCSSText() const;

  bool Equals(const CSSPathValue&) const;

  void TraceAfterDispatch(blink::Visitor*);

  const SVGPathByteStream& ByteStream() const {
    return style_path_->ByteStream();
  }

 private:
  scoped_refptr<StylePath> style_path_;
  const PathSerializationFormat serialization_format_;
};

}  // namespace cssvalue

template <>
struct DowncastTraits<cssvalue::CSSPathValue> {
  static bool AllowFrom(const CSSValue& value) { return value.IsPathValue(); }
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PATH_VALUE_H_