OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 protected: | 57 protected: |
58 ClipPathOperation(OperationType type) | 58 ClipPathOperation(OperationType type) |
59 : m_type(type) | 59 : m_type(type) |
60 { | 60 { |
61 } | 61 } |
62 | 62 |
63 OperationType m_type; | 63 OperationType m_type; |
64 }; | 64 }; |
65 | 65 |
66 class ReferenceClipPathOperation FINAL : public ClipPathOperation { | 66 class ReferenceClipPathOperation final : public ClipPathOperation { |
67 public: | 67 public: |
68 static PassRefPtr<ReferenceClipPathOperation> create(const String& url, cons
t AtomicString& fragment) | 68 static PassRefPtr<ReferenceClipPathOperation> create(const String& url, cons
t AtomicString& fragment) |
69 { | 69 { |
70 return adoptRef(new ReferenceClipPathOperation(url, fragment)); | 70 return adoptRef(new ReferenceClipPathOperation(url, fragment)); |
71 } | 71 } |
72 | 72 |
73 const String& url() const { return m_url; } | 73 const String& url() const { return m_url; } |
74 const AtomicString& fragment() const { return m_fragment; } | 74 const AtomicString& fragment() const { return m_fragment; } |
75 | 75 |
76 private: | 76 private: |
77 virtual bool operator==(const ClipPathOperation& o) const OVERRIDE | 77 virtual bool operator==(const ClipPathOperation& o) const override |
78 { | 78 { |
79 return isSameType(o) && m_url == static_cast<const ReferenceClipPathOper
ation&>(o).m_url; | 79 return isSameType(o) && m_url == static_cast<const ReferenceClipPathOper
ation&>(o).m_url; |
80 } | 80 } |
81 | 81 |
82 ReferenceClipPathOperation(const String& url, const AtomicString& fragment) | 82 ReferenceClipPathOperation(const String& url, const AtomicString& fragment) |
83 : ClipPathOperation(REFERENCE) | 83 : ClipPathOperation(REFERENCE) |
84 , m_url(url) | 84 , m_url(url) |
85 , m_fragment(fragment) | 85 , m_fragment(fragment) |
86 { | 86 { |
87 } | 87 } |
88 | 88 |
89 String m_url; | 89 String m_url; |
90 AtomicString m_fragment; | 90 AtomicString m_fragment; |
91 }; | 91 }; |
92 | 92 |
93 DEFINE_TYPE_CASTS(ReferenceClipPathOperation, ClipPathOperation, op, op->type()
== ClipPathOperation::REFERENCE, op.type() == ClipPathOperation::REFERENCE); | 93 DEFINE_TYPE_CASTS(ReferenceClipPathOperation, ClipPathOperation, op, op->type()
== ClipPathOperation::REFERENCE, op.type() == ClipPathOperation::REFERENCE); |
94 | 94 |
95 class ShapeClipPathOperation FINAL : public ClipPathOperation { | 95 class ShapeClipPathOperation final : public ClipPathOperation { |
96 public: | 96 public: |
97 static PassRefPtr<ShapeClipPathOperation> create(PassRefPtr<BasicShape> shap
e) | 97 static PassRefPtr<ShapeClipPathOperation> create(PassRefPtr<BasicShape> shap
e) |
98 { | 98 { |
99 return adoptRef(new ShapeClipPathOperation(shape)); | 99 return adoptRef(new ShapeClipPathOperation(shape)); |
100 } | 100 } |
101 | 101 |
102 const BasicShape* basicShape() const { return m_shape.get(); } | 102 const BasicShape* basicShape() const { return m_shape.get(); } |
103 bool isValid() const { return m_shape.get(); } | 103 bool isValid() const { return m_shape.get(); } |
104 WindRule windRule() const { return m_shape->windRule(); } | 104 WindRule windRule() const { return m_shape->windRule(); } |
105 const Path& path(const FloatRect& boundingRect) | 105 const Path& path(const FloatRect& boundingRect) |
106 { | 106 { |
107 ASSERT(m_shape); | 107 ASSERT(m_shape); |
108 m_path.clear(); | 108 m_path.clear(); |
109 m_path = adoptPtr(new Path); | 109 m_path = adoptPtr(new Path); |
110 m_shape->path(*m_path, boundingRect); | 110 m_shape->path(*m_path, boundingRect); |
111 return *m_path; | 111 return *m_path; |
112 } | 112 } |
113 | 113 |
114 private: | 114 private: |
115 virtual bool operator==(const ClipPathOperation&) const OVERRIDE; | 115 virtual bool operator==(const ClipPathOperation&) const override; |
116 | 116 |
117 ShapeClipPathOperation(PassRefPtr<BasicShape> shape) | 117 ShapeClipPathOperation(PassRefPtr<BasicShape> shape) |
118 : ClipPathOperation(SHAPE) | 118 : ClipPathOperation(SHAPE) |
119 , m_shape(shape) | 119 , m_shape(shape) |
120 { | 120 { |
121 } | 121 } |
122 | 122 |
123 RefPtr<BasicShape> m_shape; | 123 RefPtr<BasicShape> m_shape; |
124 OwnPtr<Path> m_path; | 124 OwnPtr<Path> m_path; |
125 }; | 125 }; |
126 | 126 |
127 DEFINE_TYPE_CASTS(ShapeClipPathOperation, ClipPathOperation, op, op->type() == C
lipPathOperation::SHAPE, op.type() == ClipPathOperation::SHAPE); | 127 DEFINE_TYPE_CASTS(ShapeClipPathOperation, ClipPathOperation, op, op->type() == C
lipPathOperation::SHAPE, op.type() == ClipPathOperation::SHAPE); |
128 | 128 |
129 inline bool ShapeClipPathOperation::operator==(const ClipPathOperation& o) const | 129 inline bool ShapeClipPathOperation::operator==(const ClipPathOperation& o) const |
130 { | 130 { |
131 if (!isSameType(o)) | 131 if (!isSameType(o)) |
132 return false; | 132 return false; |
133 BasicShape* otherShape = toShapeClipPathOperation(o).m_shape.get(); | 133 BasicShape* otherShape = toShapeClipPathOperation(o).m_shape.get(); |
134 if (!m_shape.get() || !otherShape) | 134 if (!m_shape.get() || !otherShape) |
135 return static_cast<bool>(m_shape.get()) == static_cast<bool>(otherShape)
; | 135 return static_cast<bool>(m_shape.get()) == static_cast<bool>(otherShape)
; |
136 return *m_shape == *otherShape; | 136 return *m_shape == *otherShape; |
137 } | 137 } |
138 | 138 |
139 } | 139 } |
140 | 140 |
141 #endif // ClipPathOperation_h | 141 #endif // ClipPathOperation_h |
OLD | NEW |