OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 #ifndef SVGImage_h | 27 #ifndef SVGImage_h |
28 #define SVGImage_h | 28 #define SVGImage_h |
29 | 29 |
30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
31 #include "platform/graphics/Image.h" | 31 #include "platform/graphics/Image.h" |
32 #include "platform/graphics/paint/PaintRecord.h" | 32 #include "platform/graphics/paint/PaintRecord.h" |
33 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
34 #include "platform/weborigin/KURL.h" | 34 #include "platform/weborigin/KURL.h" |
35 #include "platform/wtf/Allocator.h" | 35 #include "platform/wtf/Allocator.h" |
| 36 #include "platform/wtf/WeakPtr.h" |
36 #include "third_party/skia/include/core/SkRefCnt.h" | 37 #include "third_party/skia/include/core/SkRefCnt.h" |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 class Document; | 41 class Document; |
41 class Page; | 42 class Page; |
42 class PaintController; | 43 class PaintController; |
43 class LayoutReplaced; | 44 class LayoutReplaced; |
44 class SVGImageChromeClient; | 45 class SVGImageChromeClient; |
45 class SVGImageForContainer; | 46 class SVGImageForContainer; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 PaintFlags&, | 177 PaintFlags&, |
177 const SkMatrix& local_matrix); | 178 const SkMatrix& local_matrix); |
178 bool ApplyShaderInternal(PaintFlags&, | 179 bool ApplyShaderInternal(PaintFlags&, |
179 const SkMatrix& local_matrix, | 180 const SkMatrix& local_matrix, |
180 const KURL&); | 181 const KURL&); |
181 | 182 |
182 void StopAnimation(); | 183 void StopAnimation(); |
183 void ScheduleTimelineRewind(); | 184 void ScheduleTimelineRewind(); |
184 void FlushPendingTimelineRewind(); | 185 void FlushPendingTimelineRewind(); |
185 | 186 |
| 187 void LoadCompleted(); |
| 188 |
| 189 WTF::WeakPtr<SVGImage> AsWeakPtr() { |
| 190 return weak_ptr_factory_.CreateWeakPtr(); |
| 191 } |
| 192 |
| 193 class SVGImageLocalFrameClient; |
| 194 |
186 Persistent<SVGImageChromeClient> chrome_client_; | 195 Persistent<SVGImageChromeClient> chrome_client_; |
187 Persistent<Page> page_; | 196 Persistent<Page> page_; |
188 std::unique_ptr<PaintController> paint_controller_; | 197 std::unique_ptr<PaintController> paint_controller_; |
189 | 198 |
190 // When an SVG image has no intrinsic size, the size depends on the default | 199 // When an SVG image has no intrinsic size, the size depends on the default |
191 // object size, which in turn depends on the container. One SVGImage may | 200 // object size, which in turn depends on the container. One SVGImage may |
192 // belong to multiple containers so the final image size can't be known in | 201 // belong to multiple containers so the final image size can't be known in |
193 // SVGImage. SVGImageForContainer carries the final image size, also called | 202 // SVGImage. SVGImageForContainer carries the final image size, also called |
194 // the "concrete object size". For more, see: SVGImageForContainer.h | 203 // the "concrete object size". For more, see: SVGImageForContainer.h |
195 IntSize intrinsic_size_; | 204 IntSize intrinsic_size_; |
196 bool has_pending_timeline_rewind_; | 205 bool has_pending_timeline_rewind_; |
| 206 |
| 207 enum LoadState { |
| 208 kDataChangedNotStarted, |
| 209 kInDataChanged, |
| 210 kWaitingForAsyncLoadCompletion, |
| 211 kLoadCompleted, |
| 212 }; |
| 213 |
| 214 LoadState load_state_ = kDataChangedNotStarted; |
| 215 |
| 216 WTF::WeakPtrFactory<SVGImage> weak_ptr_factory_; |
197 }; | 217 }; |
198 | 218 |
199 DEFINE_IMAGE_TYPE_CASTS(SVGImage); | 219 DEFINE_IMAGE_TYPE_CASTS(SVGImage); |
200 | 220 |
201 class ImageObserverDisabler { | 221 class ImageObserverDisabler { |
202 STACK_ALLOCATED(); | 222 STACK_ALLOCATED(); |
203 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); | 223 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); |
204 | 224 |
205 public: | 225 public: |
206 ImageObserverDisabler(Image* image) : image_(image) { | 226 ImageObserverDisabler(Image* image) : image_(image) { |
207 image_->SetImageObserverDisabled(true); | 227 image_->SetImageObserverDisabled(true); |
208 } | 228 } |
209 | 229 |
210 ~ImageObserverDisabler() { image_->SetImageObserverDisabled(false); } | 230 ~ImageObserverDisabler() { image_->SetImageObserverDisabled(false); } |
211 | 231 |
212 private: | 232 private: |
213 Image* image_; | 233 Image* image_; |
214 }; | 234 }; |
215 | 235 |
216 } // namespace blink | 236 } // namespace blink |
217 | 237 |
218 #endif // SVGImage_h | 238 #endif // SVGImage_h |
OLD | NEW |