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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 virtual bool UsesContainerSize() const { return false; } | 95 virtual bool UsesContainerSize() const { return false; } |
96 virtual bool HasRelativeSize() const { return false; } | 96 virtual bool HasRelativeSize() const { return false; } |
97 | 97 |
98 virtual IntSize Size() const = 0; | 98 virtual IntSize Size() const = 0; |
99 IntRect Rect() const { return IntRect(IntPoint(), Size()); } | 99 IntRect Rect() const { return IntRect(IntPoint(), Size()); } |
100 int width() const { return Size().Width(); } | 100 int width() const { return Size().Width(); } |
101 int height() const { return Size().Height(); } | 101 int height() const { return Size().Height(); } |
102 virtual bool GetHotSpot(IntPoint&) const { return false; } | 102 virtual bool GetHotSpot(IntPoint&) const { return false; } |
103 | 103 |
104 enum SizeAvailability { kSizeAvailable, kSizeUnavailable }; | 104 enum SizeAvailability { |
| 105 kSizeAvailable, |
| 106 kSizeUnavailable, |
| 107 kSizeAvailableAndLoadingAsynchronously |
| 108 }; |
| 109 |
| 110 // If SetData() returns |kSizeAvailableAndLoadingAsynchronously|: |
| 111 // Image loading is continuing asynchronously |
| 112 // (only when |this| is SVGImage and |all_data_received| is true), and |
| 113 // ImageResourceObserver::AsyncLoadCompleted() is called when finished. |
| 114 // Otherwise: |
| 115 // Image loading is completed synchronously. |
| 116 // ImageResourceObserver::AsyncLoadCompleted() is not called. |
105 virtual SizeAvailability SetData(PassRefPtr<SharedBuffer> data, | 117 virtual SizeAvailability SetData(PassRefPtr<SharedBuffer> data, |
106 bool all_data_received); | 118 bool all_data_received); |
107 virtual SizeAvailability DataChanged(bool /*allDataReceived*/) { | 119 virtual SizeAvailability DataChanged(bool /*all_data_received*/) { |
108 return kSizeUnavailable; | 120 return kSizeUnavailable; |
109 } | 121 } |
110 | 122 |
111 virtual String FilenameExtension() const { | 123 virtual String FilenameExtension() const { |
112 return String(); | 124 return String(); |
113 } // null string if unknown | 125 } // null string if unknown |
114 | 126 |
115 virtual void DestroyDecodedData() = 0; | 127 virtual void DestroyDecodedData() = 0; |
116 | 128 |
117 virtual PassRefPtr<SharedBuffer> Data() { return encoded_image_data_; } | 129 virtual PassRefPtr<SharedBuffer> Data() { return encoded_image_data_; } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 bool image_observer_disabled_; | 231 bool image_observer_disabled_; |
220 }; | 232 }; |
221 | 233 |
222 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 234 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
223 DEFINE_TYPE_CASTS(typeName, Image, image, image->Is##typeName(), \ | 235 DEFINE_TYPE_CASTS(typeName, Image, image, image->Is##typeName(), \ |
224 image.Is##typeName()) | 236 image.Is##typeName()) |
225 | 237 |
226 } // namespace blink | 238 } // namespace blink |
227 | 239 |
228 #endif | 240 #endif |
OLD | NEW |