| 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 StylePath_h | 5 #ifndef StylePath_h |
| 6 #define StylePath_h | 6 #define StylePath_h |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include "core/style/BasicShapes.h" |
| 9 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 10 #include "platform/wtf/PassRefPtr.h" | 11 #include "platform/wtf/PassRefPtr.h" |
| 11 #include "platform/wtf/RefCounted.h" | 12 #include "platform/wtf/RefCounted.h" |
| 12 #include "platform/wtf/RefPtr.h" | 13 #include "platform/wtf/RefPtr.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class CSSValue; | 17 class CSSValue; |
| 17 class Path; | 18 class Path; |
| 18 class SVGPathByteStream; | 19 class SVGPathByteStream; |
| 19 | 20 |
| 20 class StylePath : public RefCounted<StylePath> { | 21 class StylePath final : public BasicShape { |
| 21 public: | 22 public: |
| 22 static PassRefPtr<StylePath> Create(std::unique_ptr<SVGPathByteStream>); | 23 static PassRefPtr<StylePath> Create(std::unique_ptr<SVGPathByteStream>); |
| 23 ~StylePath(); | 24 ~StylePath(); |
| 24 | 25 |
| 25 static StylePath* EmptyPath(); | 26 static StylePath* EmptyPath(); |
| 26 | 27 |
| 27 const Path& GetPath() const; | 28 const Path& GetPath() const; |
| 28 float length() const; | 29 float length() const; |
| 29 bool IsClosed() const; | 30 bool IsClosed() const; |
| 30 | 31 |
| 31 const SVGPathByteStream& ByteStream() const { return *byte_stream_; } | 32 const SVGPathByteStream& ByteStream() const { return *byte_stream_; } |
| 32 | 33 |
| 33 CSSValue* ComputedCSSValue() const; | 34 CSSValue* ComputedCSSValue() const; |
| 34 | 35 |
| 35 bool operator==(const StylePath&) const; | 36 void GetPath(Path&, const FloatRect&) override; |
| 37 PassRefPtr<BasicShape> Blend(const BasicShape*, double) const override; |
| 38 bool operator==(const BasicShape&) const override; |
| 39 |
| 40 ShapeType GetType() const override { return kStylePathType; } |
| 36 | 41 |
| 37 private: | 42 private: |
| 38 explicit StylePath(std::unique_ptr<SVGPathByteStream>); | 43 explicit StylePath(std::unique_ptr<SVGPathByteStream>); |
| 39 | 44 |
| 40 std::unique_ptr<SVGPathByteStream> byte_stream_; | 45 std::unique_ptr<SVGPathByteStream> byte_stream_; |
| 41 mutable std::unique_ptr<Path> path_; | 46 mutable std::unique_ptr<Path> path_; |
| 42 mutable float path_length_; | 47 mutable float path_length_; |
| 43 }; | 48 }; |
| 44 | 49 |
| 50 DEFINE_BASICSHAPE_TYPE_CASTS(StylePath); |
| 51 |
| 45 } // namespace blink | 52 } // namespace blink |
| 46 | 53 |
| 47 #endif // StylePath_h | 54 #endif // StylePath_h |
| OLD | NEW |