Changeset 186180 in webkit
- Timestamp:
- Jul 1, 2015, 10:22:27 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/LayoutTests/ChangeLog ¶
r186177 r186180 1 2015-07-01 Antti Koivisto <antti@apple.com> 2 3 PNG mask images are loaded with Accept:image/svg+xml 4 https://bugs.webkit.org/show_bug.cgi?id=146509 5 6 Reviewed by Simon Fraser. 7 8 * http/tests/misc/mask-image-accept-expected.html: Added. 9 * http/tests/misc/mask-image-accept.html: Added. 10 1 11 2015-07-01 Jer Noble <jer.noble@apple.com> 2 12 -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r186177 r186180 1 2015-07-01 Antti Koivisto <antti@apple.com> 2 3 PNG mask images are loaded with Accept:image/svg+xml 4 https://bugs.webkit.org/show_bug.cgi?id=146509 5 rdar://problem/21584740 6 7 Reviewed by Simon Fraser. 8 9 For some strange reason MaskImageOperation code loads all mask images, including non-SVG ones 10 using CachedSVGDocument. Resulting bad accept header may cause server to reject the request. 11 12 This is far from ideal but as a quick fix we can override the accept header for mask images to 13 allow any image type. 14 15 Test: http/tests/misc/mask-image-accept.html 16 17 * loader/cache/CachedResourceLoader.cpp: 18 (WebCore::CachedResourceLoader::requestResource): 19 * loader/cache/CachedResourceRequest.h: 20 (WebCore::CachedResourceRequest::acceptOverride): 21 (WebCore::CachedResourceRequest::setAcceptOverride): 22 * loader/cache/CachedSVGDocumentReference.cpp: 23 (WebCore::CachedSVGDocumentReference::load): 24 * loader/cache/CachedSVGDocumentReference.h: 25 (WebCore::CachedSVGDocumentReference::loadRequested): 26 (WebCore::CachedSVGDocumentReference::setAcceptsAnyImageType): 27 (WebCore::CachedSVGDocumentReference::document): 28 * platform/graphics/MaskImageOperation.cpp: 29 (WebCore::MaskImageOperation::ensureCachedSVGDocumentReference): 30 1 31 2015-07-01 Jer Noble <jer.noble@apple.com> 2 32 -
TabularUnified trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp ¶
r186005 r186180 566 566 567 567 if ((policy != Use || resource->stillNeedsLoad()) && CachedResourceRequest::NoDefer == request.defer()) { 568 if (request.acceptOverride()) 569 resource->setAccept(request.acceptOverride().value()); 570 568 571 resource->load(*this, request.options()); 569 572 -
TabularUnified trunk/Source/WebCore/loader/cache/CachedResourceRequest.h ¶
r181876 r186180 54 54 void setOptions(const ResourceLoaderOptions& options) { m_options = options; } 55 55 const Optional<ResourceLoadPriority>& priority() const { return m_priority; } 56 const Optional<String>& acceptOverride() const { return m_acceptOverride; } 56 57 bool forPreload() const { return m_forPreload; } 57 58 void setForPreload(bool forPreload) { m_forPreload = forPreload; } … … 60 61 void setInitiator(PassRefPtr<Element>); 61 62 void setInitiator(const AtomicString& name); 63 void setAcceptOverride(const String& accept) { m_acceptOverride = accept; } 62 64 const AtomicString& initiatorName() const; 63 65 … … 70 72 ResourceLoaderOptions m_options; 71 73 Optional<ResourceLoadPriority> m_priority; 74 Optional<String> m_acceptOverride; 72 75 bool m_forPreload; 73 76 DeferOption m_defer; -
TabularUnified trunk/Source/WebCore/loader/cache/CachedSVGDocumentReference.cpp ¶
r179242 r186180 61 61 CachedResourceRequest request(ResourceRequest(loader.document()->completeURL(m_url))); 62 62 request.setInitiator(cachedResourceRequestInitiators().css); 63 if (m_acceptsAnyImageType) 64 request.setAcceptOverride("image/*"); 63 65 m_document = loader.requestSVGDocument(request); 64 66 if (m_document) { -
TabularUnified trunk/Source/WebCore/loader/cache/CachedSVGDocumentReference.h ¶
r179242 r186180 44 44 void load(CachedResourceLoader&); 45 45 bool loadRequested() const { return m_loadRequested; } 46 void setAcceptsAnyImageType() { m_acceptsAnyImageType = true; } 46 47 47 48 CachedSVGDocument* document() { return m_document.get(); } … … 53 54 CachedSVGDocumentClient* m_additionalDocumentClient; 54 55 bool m_canReuseResource; 56 bool m_acceptsAnyImageType { false }; 55 57 }; 56 58 -
TabularUnified trunk/Source/WebCore/platform/graphics/MaskImageOperation.cpp ¶
r184749 r186180 194 194 return nullptr; 195 195 196 if (!m_cachedSVGDocumentReference.get()) 196 if (!m_cachedSVGDocumentReference.get()) { 197 197 m_cachedSVGDocumentReference = std::make_unique<CachedSVGDocumentReference>(m_url, this, false); 198 // FIXME: For some strange reason we load all mask resources using CachedSVGDocument. 199 // This requires overriding SVG mime type in Accept header or server may reject the request. 200 m_cachedSVGDocumentReference->setAcceptsAnyImageType(); 201 } 198 202 return m_cachedSVGDocumentReference.get(); 199 203 } … … 220 224 } 221 225 } 222 226 223 227 // If no valid mask was found, this is not a valid SVG document or it specified an invalid fragment identifier. 224 228 // Fallback to the normal way of loading the document in an Image object. 229 // FIXME: This is silly. 225 230 if (!validMaskFound) { 226 231 // Get the resource loader, acquire the resource buffer and load it into an image.
Note:
See TracChangeset
for help on using the changeset viewer.