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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 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 } |
(...skipping 18 matching lines...) Expand all Loading... |
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 m_path->setWindRule(windRule()); | 111 m_path->setWindRule(windRule()); |
112 return *m_path; | 112 return *m_path; |
113 } | 113 } |
114 | 114 |
115 private: | 115 private: |
116 virtual bool operator==(const ClipPathOperation&) const override; | 116 bool operator==(const ClipPathOperation&) const override; |
117 | 117 |
118 ShapeClipPathOperation(PassRefPtr<BasicShape> shape) | 118 ShapeClipPathOperation(PassRefPtr<BasicShape> shape) |
119 : ClipPathOperation(SHAPE) | 119 : ClipPathOperation(SHAPE) |
120 , m_shape(shape) | 120 , m_shape(shape) |
121 { | 121 { |
122 } | 122 } |
123 | 123 |
124 RefPtr<BasicShape> m_shape; | 124 RefPtr<BasicShape> m_shape; |
125 OwnPtr<Path> m_path; | 125 OwnPtr<Path> m_path; |
126 }; | 126 }; |
127 | 127 |
128 DEFINE_TYPE_CASTS(ShapeClipPathOperation, ClipPathOperation, op, op->type() == C
lipPathOperation::SHAPE, op.type() == ClipPathOperation::SHAPE); | 128 DEFINE_TYPE_CASTS(ShapeClipPathOperation, ClipPathOperation, op, op->type() == C
lipPathOperation::SHAPE, op.type() == ClipPathOperation::SHAPE); |
129 | 129 |
130 inline bool ShapeClipPathOperation::operator==(const ClipPathOperation& o) const | 130 inline bool ShapeClipPathOperation::operator==(const ClipPathOperation& o) const |
131 { | 131 { |
132 if (!isSameType(o)) | 132 if (!isSameType(o)) |
133 return false; | 133 return false; |
134 BasicShape* otherShape = toShapeClipPathOperation(o).m_shape.get(); | 134 BasicShape* otherShape = toShapeClipPathOperation(o).m_shape.get(); |
135 if (!m_shape.get() || !otherShape) | 135 if (!m_shape.get() || !otherShape) |
136 return static_cast<bool>(m_shape.get()) == static_cast<bool>(otherShape)
; | 136 return static_cast<bool>(m_shape.get()) == static_cast<bool>(otherShape)
; |
137 return *m_shape == *otherShape; | 137 return *m_shape == *otherShape; |
138 } | 138 } |
139 | 139 |
140 } | 140 } |
141 | 141 |
142 #endif // ClipPathOperation_h | 142 #endif // ClipPathOperation_h |
OLD | NEW |