OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 LineLayoutSVGTextPath_h | 5 #ifndef LineLayoutSVGTextPath_h |
6 #define LineLayoutSVGTextPath_h | 6 #define LineLayoutSVGTextPath_h |
7 | 7 |
8 #include "core/layout/api/LineLayoutSVGInline.h" | 8 #include "core/layout/api/LineLayoutSVGInline.h" |
9 #include "core/layout/svg/LayoutSVGTextPath.h" | 9 #include "core/layout/svg/LayoutSVGTextPath.h" |
10 #include <memory> | |
11 | 10 |
12 namespace blink { | 11 namespace blink { |
13 | 12 |
14 class LineLayoutSVGTextPath : public LineLayoutSVGInline { | 13 class LineLayoutSVGTextPath : public LineLayoutSVGInline { |
15 public: | 14 public: |
16 explicit LineLayoutSVGTextPath(LayoutSVGTextPath* layoutSVGTextPath) | 15 explicit LineLayoutSVGTextPath(LayoutSVGTextPath* layoutSVGTextPath) |
17 : LineLayoutSVGInline(layoutSVGTextPath) | 16 : LineLayoutSVGInline(layoutSVGTextPath) |
18 { | 17 { |
19 } | 18 } |
20 | 19 |
21 explicit LineLayoutSVGTextPath(const LineLayoutItem& item) | 20 explicit LineLayoutSVGTextPath(const LineLayoutItem& item) |
22 : LineLayoutSVGInline(item) | 21 : LineLayoutSVGInline(item) |
23 { | 22 { |
24 ASSERT_WITH_SECURITY_IMPLICATION(!item || item.isSVGTextPath()); | 23 ASSERT_WITH_SECURITY_IMPLICATION(!item || item.isSVGTextPath()); |
25 } | 24 } |
26 | 25 |
27 explicit LineLayoutSVGTextPath(std::nullptr_t) : LineLayoutSVGInline(nullptr
) { } | 26 explicit LineLayoutSVGTextPath(std::nullptr_t) : LineLayoutSVGInline(nullptr
) { } |
28 | 27 |
29 LineLayoutSVGTextPath() { } | 28 LineLayoutSVGTextPath() { } |
30 | 29 |
31 std::unique_ptr<PathPositionMapper> layoutPath() const | 30 PassOwnPtr<PathPositionMapper> layoutPath() const |
32 { | 31 { |
33 return toSVGTextPath()->layoutPath(); | 32 return toSVGTextPath()->layoutPath(); |
34 } | 33 } |
35 | 34 |
36 float calculateStartOffset(float pathLength) const | 35 float calculateStartOffset(float pathLength) const |
37 { | 36 { |
38 return toSVGTextPath()->calculateStartOffset(pathLength); | 37 return toSVGTextPath()->calculateStartOffset(pathLength); |
39 } | 38 } |
40 | 39 |
41 private: | 40 private: |
42 LayoutSVGTextPath* toSVGTextPath() | 41 LayoutSVGTextPath* toSVGTextPath() |
43 { | 42 { |
44 return toLayoutSVGTextPath(layoutObject()); | 43 return toLayoutSVGTextPath(layoutObject()); |
45 } | 44 } |
46 | 45 |
47 const LayoutSVGTextPath* toSVGTextPath() const | 46 const LayoutSVGTextPath* toSVGTextPath() const |
48 { | 47 { |
49 return toLayoutSVGTextPath(layoutObject()); | 48 return toLayoutSVGTextPath(layoutObject()); |
50 } | 49 } |
51 }; | 50 }; |
52 | 51 |
53 } // namespace blink | 52 } // namespace blink |
54 | 53 |
55 #endif // LineLayoutSVGTextPath_h | 54 #endif // LineLayoutSVGTextPath_h |
OLD | NEW |