OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 }; | 155 }; |
156 | 156 |
157 class ReferenceFilterOperation : public FilterOperation { | 157 class ReferenceFilterOperation : public FilterOperation { |
158 public: | 158 public: |
159 static PassRefPtr<ReferenceFilterOperation> create(const String& url, const
String& fragment, OperationType type) | 159 static PassRefPtr<ReferenceFilterOperation> create(const String& url, const
String& fragment, OperationType type) |
160 { | 160 { |
161 return adoptRef(new ReferenceFilterOperation(url, fragment, type)); | 161 return adoptRef(new ReferenceFilterOperation(url, fragment, type)); |
162 } | 162 } |
163 | 163 |
| 164 class Data { |
| 165 public: |
| 166 virtual ~Data() { } |
| 167 }; |
| 168 |
164 virtual bool affectsOpacity() const { return true; } | 169 virtual bool affectsOpacity() const { return true; } |
165 virtual bool movesPixels() const { return true; } | 170 virtual bool movesPixels() const { return true; } |
166 | 171 |
167 const String& url() const { return m_url; } | 172 const String& url() const { return m_url; } |
168 const String& fragment() const { return m_fragment; } | 173 const String& fragment() const { return m_fragment; } |
169 | 174 |
170 void* data() const { return m_data; } | 175 Data* data() const { return m_data.get(); } |
171 void setData(void* data) { m_data = data; } | 176 void setData(PassOwnPtr<Data> data) { m_data = data; } |
172 | 177 |
173 private: | 178 private: |
174 | 179 |
175 virtual bool operator==(const FilterOperation& o) const | 180 virtual bool operator==(const FilterOperation& o) const |
176 { | 181 { |
177 if (!isSameType(o)) | 182 if (!isSameType(o)) |
178 return false; | 183 return false; |
179 const ReferenceFilterOperation* other = static_cast<const ReferenceFilte
rOperation*>(&o); | 184 const ReferenceFilterOperation* other = static_cast<const ReferenceFilte
rOperation*>(&o); |
180 return m_url == other->m_url; | 185 return m_url == other->m_url; |
181 } | 186 } |
182 | 187 |
183 ReferenceFilterOperation(const String& url, const String& fragment, Operatio
nType type) | 188 ReferenceFilterOperation(const String& url, const String& fragment, Operatio
nType type) |
184 : FilterOperation(type) | 189 : FilterOperation(type) |
185 , m_url(url) | 190 , m_url(url) |
186 , m_fragment(fragment) | 191 , m_fragment(fragment) |
187 , m_data(0) | |
188 { | 192 { |
189 } | 193 } |
190 | 194 |
191 String m_url; | 195 String m_url; |
192 String m_fragment; | 196 String m_fragment; |
193 void* m_data; | 197 OwnPtr<Data> m_data; |
194 }; | 198 }; |
195 | 199 |
196 // GRAYSCALE, SEPIA, SATURATE and HUE_ROTATE are variations on a basic color mat
rix effect. | 200 // GRAYSCALE, SEPIA, SATURATE and HUE_ROTATE are variations on a basic color mat
rix effect. |
197 // For HUE_ROTATE, the angle of rotation is stored in m_amount. | 201 // For HUE_ROTATE, the angle of rotation is stored in m_amount. |
198 class BasicColorMatrixFilterOperation : public FilterOperation { | 202 class BasicColorMatrixFilterOperation : public FilterOperation { |
199 public: | 203 public: |
200 static PassRefPtr<BasicColorMatrixFilterOperation> create(double amount, Ope
rationType type) | 204 static PassRefPtr<BasicColorMatrixFilterOperation> create(double amount, Ope
rationType type) |
201 { | 205 { |
202 return adoptRef(new BasicColorMatrixFilterOperation(amount, type)); | 206 return adoptRef(new BasicColorMatrixFilterOperation(amount, type)); |
203 } | 207 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 IntPoint m_location; // FIXME: should location be in Lengths? | 370 IntPoint m_location; // FIXME: should location be in Lengths? |
367 int m_stdDeviation; | 371 int m_stdDeviation; |
368 Color m_color; | 372 Color m_color; |
369 }; | 373 }; |
370 | 374 |
371 } // namespace WebCore | 375 } // namespace WebCore |
372 | 376 |
373 #endif // ENABLE(CSS_FILTERS) | 377 #endif // ENABLE(CSS_FILTERS) |
374 | 378 |
375 #endif // FilterOperation_h | 379 #endif // FilterOperation_h |
OLD | NEW |