OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 virtual bool UsesContainerSize() const { return false; } | 96 virtual bool UsesContainerSize() const { return false; } |
97 virtual bool HasRelativeSize() const { return false; } | 97 virtual bool HasRelativeSize() const { return false; } |
98 | 98 |
99 virtual IntSize Size() const = 0; | 99 virtual IntSize Size() const = 0; |
100 IntRect Rect() const { return IntRect(IntPoint(), Size()); } | 100 IntRect Rect() const { return IntRect(IntPoint(), Size()); } |
101 int width() const { return Size().Width(); } | 101 int width() const { return Size().Width(); } |
102 int height() const { return Size().Height(); } | 102 int height() const { return Size().Height(); } |
103 virtual bool GetHotSpot(IntPoint&) const { return false; } | 103 virtual bool GetHotSpot(IntPoint&) const { return false; } |
104 | 104 |
105 enum SizeAvailability { kSizeAvailable, kSizeUnavailable }; | 105 enum SizeAvailability { |
| 106 kSizeUnavailable, |
| 107 kSizeAvailableAndLoadingAsynchronously, |
| 108 kSizeAvailable, |
| 109 }; |
| 110 |
| 111 // If SetData() returns |kSizeAvailableAndLoadingAsynchronously|: |
| 112 // Image loading is continuing asynchronously |
| 113 // (only when |this| is SVGImage and |all_data_received| is true), and |
| 114 // ImageResourceObserver::AsyncLoadCompleted() is called when finished. |
| 115 // Otherwise: |
| 116 // Image loading is completed synchronously. |
| 117 // ImageResourceObserver::AsyncLoadCompleted() is not called. |
106 virtual SizeAvailability SetData(PassRefPtr<SharedBuffer> data, | 118 virtual SizeAvailability SetData(PassRefPtr<SharedBuffer> data, |
107 bool all_data_received); | 119 bool all_data_received); |
108 virtual SizeAvailability DataChanged(bool /*allDataReceived*/) { | 120 virtual SizeAvailability DataChanged(bool /*all_data_received*/) { |
109 return kSizeUnavailable; | 121 return kSizeUnavailable; |
110 } | 122 } |
111 | 123 |
112 virtual String FilenameExtension() const { | 124 virtual String FilenameExtension() const { |
113 return String(); | 125 return String(); |
114 } // null string if unknown | 126 } // null string if unknown |
115 | 127 |
116 virtual void DestroyDecodedData() = 0; | 128 virtual void DestroyDecodedData() = 0; |
117 | 129 |
118 virtual PassRefPtr<SharedBuffer> Data() { return encoded_image_data_; } | 130 virtual PassRefPtr<SharedBuffer> Data() { return encoded_image_data_; } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 UntracedMember<ImageObserver> image_observer_; | 234 UntracedMember<ImageObserver> image_observer_; |
223 }; | 235 }; |
224 | 236 |
225 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 237 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
226 DEFINE_TYPE_CASTS(typeName, Image, image, image->Is##typeName(), \ | 238 DEFINE_TYPE_CASTS(typeName, Image, image, image->Is##typeName(), \ |
227 image.Is##typeName()) | 239 image.Is##typeName()) |
228 | 240 |
229 } // namespace blink | 241 } // namespace blink |
230 | 242 |
231 #endif | 243 #endif |
OLD | NEW |