Chromium Code Reviews| 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 kLoadCompletedSynchronously, | |
|
fs
2017/05/05 10:52:42
We don't really need both kLoadCompletedSynchronou
hiroshige
2017/05/08 17:22:06
Mostly. The state assertion at the bottom of SVGIm
| |
| 212 kLoadCompletedAsynchronously, | |
| 213 }; | |
| 214 | |
| 215 LoadState load_state_ = kDataChangedNotStarted; | |
| 216 | |
| 217 WTF::WeakPtrFactory<SVGImage> weak_ptr_factory_; | |
| 197 }; | 218 }; |
| 198 | 219 |
| 199 DEFINE_IMAGE_TYPE_CASTS(SVGImage); | 220 DEFINE_IMAGE_TYPE_CASTS(SVGImage); |
| 200 | 221 |
| 201 class ImageObserverDisabler { | 222 class ImageObserverDisabler { |
| 202 STACK_ALLOCATED(); | 223 STACK_ALLOCATED(); |
| 203 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); | 224 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); |
| 204 | 225 |
| 205 public: | 226 public: |
| 206 ImageObserverDisabler(Image* image) : image_(image) { | 227 ImageObserverDisabler(Image* image) : image_(image) { |
| 207 image_->SetImageObserverDisabled(true); | 228 image_->SetImageObserverDisabled(true); |
| 208 } | 229 } |
| 209 | 230 |
| 210 ~ImageObserverDisabler() { image_->SetImageObserverDisabled(false); } | 231 ~ImageObserverDisabler() { image_->SetImageObserverDisabled(false); } |
| 211 | 232 |
| 212 private: | 233 private: |
| 213 Image* image_; | 234 Image* image_; |
| 214 }; | 235 }; |
| 215 | 236 |
| 216 } // namespace blink | 237 } // namespace blink |
| 217 | 238 |
| 218 #endif // SVGImage_h | 239 #endif // SVGImage_h |
| OLD | NEW |