Changeset 140722 in webkit
- Timestamp:
- Jan 24, 2013 2:27:44 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r140721 r140722 1 2013-01-24 Philip Rogers <pdr@google.com> 2 3 Preserve container size requests across image loads 4 https://bugs.webkit.org/show_bug.cgi?id=106733 5 6 Reviewed by Tim Horton. 7 8 * http/tests/svg/cached-image-sizing-expected.html: Added. 9 * http/tests/svg/cached-image-sizing.html: Added. 10 * http/tests/svg/resources/delayCachedLoad.php: Added. 11 * http/tests/svg/resources/greenSquare.svg: Added. 12 1 13 2013-01-24 Sheriff Bot <webkit.review.bot@gmail.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r140721 r140722 1 2013-01-24 Philip Rogers <pdr@google.com> 2 3 Preserve container size requests across image loads 4 https://bugs.webkit.org/show_bug.cgi?id=106733 5 6 Reviewed by Tim Horton. 7 8 Some images, such as SVG with relative dimensions, depend on the renderer's container size. 9 r137981 introduced the ability to store pending container size requests that are made 10 after the image element lays out but before the image loads. Before this patch, cached 11 images could discard these pending container size requests during cache revalidation. 12 13 During a cached image load, two CachedImages exist: the image in cache and a new CachedImage 14 that will be used if the cache is stale. Pending container size requests are stored 15 on the second cached image which is discarded if a 304 not modified response is received. 16 17 This patch modifies the switchClientsToRevalidatedResource logic to maintain pending 18 container size requests. This fixes a bug where cached SVG images would be sized 19 incorrectly. 20 21 Test: http/tests/svg/cached-image-sizing.html 22 23 * loader/cache/CachedImage.cpp: 24 (WebCore::CachedImage::switchClientsToRevalidatedResource): 25 26 In this virtual call we special-case images with pending size requests and 27 transfer these requests to the revalidating resource. Note that all container size 28 requests received before revalidation will be pending because the image has not loaded. 29 Therefore, there is no risk of discarding non-pending container size requests. 30 31 (WebCore): 32 * loader/cache/CachedImage.h: 33 (CachedImage): 34 * loader/cache/CachedResource.h: 35 (CachedResource): 36 1 37 2013-01-24 Sheriff Bot <webkit.review.bot@gmail.com> 2 38 -
trunk/Source/WebCore/loader/cache/CachedImage.cpp
r139589 r140722 115 115 } 116 116 117 void CachedImage::switchClientsToRevalidatedResource() 118 { 119 ASSERT(resourceToRevalidate()); 120 ASSERT(resourceToRevalidate()->isImage()); 121 // Pending container size requests need to be transferred to the revalidated resource. 122 if (!m_pendingContainerSizeRequests.isEmpty()) { 123 // A copy of pending size requests is needed as they are deleted during CachedResource::switchClientsToRevalidateResouce(). 124 ContainerSizeRequests switchContainerSizeRequests; 125 for (ContainerSizeRequests::iterator it = m_pendingContainerSizeRequests.begin(); it != m_pendingContainerSizeRequests.end(); ++it) 126 switchContainerSizeRequests.set(it->key, it->value); 127 CachedResource::switchClientsToRevalidatedResource(); 128 CachedImage* revalidatedCachedImage = static_cast<CachedImage*>(resourceToRevalidate()); 129 for (ContainerSizeRequests::iterator it = switchContainerSizeRequests.begin(); it != switchContainerSizeRequests.end(); ++it) 130 revalidatedCachedImage->setContainerSizeForRenderer(it->key, it->value.first, it->value.second); 131 return; 132 } 133 134 CachedResource::switchClientsToRevalidatedResource(); 135 } 136 117 137 void CachedImage::allClientsRemoved() 118 138 { -
trunk/Source/WebCore/loader/cache/CachedImage.h
r138202 r140722 110 110 void checkShouldPaintBrokenImage(); 111 111 112 virtual void switchClientsToRevalidatedResource() OVERRIDE; 113 112 114 typedef pair<IntSize, float> SizeAndZoom; 113 115 typedef HashMap<const CachedImageClient*, SizeAndZoom> ContainerSizeRequests; -
trunk/Source/WebCore/loader/cache/CachedResource.h
r140105 r140722 245 245 // HTTP revalidation support methods for CachedResourceLoader. 246 246 void setResourceToRevalidate(CachedResource*); 247 v oid switchClientsToRevalidatedResource();247 virtual void switchClientsToRevalidatedResource(); 248 248 void clearResourceToRevalidate(); 249 249 void updateResponseAfterRevalidation(const ResourceResponse& validatingResponse);
Note: See TracChangeset
for help on using the changeset viewer.