Changeset 225472 in webkit
- Timestamp:
- Dec 4, 2017 12:49:26 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r225467 r225472 1 2017-12-04 Jer Noble <jer.noble@apple.com> 2 3 Include 'video/*' in image request Accept header if browser supports video media in image contexts. 4 https://bugs.webkit.org/show_bug.cgi?id=179178 5 6 Reviewed by Alex Christensen. 7 8 * http/tests/images/image-supports-video-expected.txt: Added. 9 * http/tests/images/image-supports-video.html: Added. 10 * http/tests/misc/resources/image-checks-for-accept.php: 11 * http/tests/resources/redirect-to-video-if-accepted.php: Added. 12 * platform/ios/TestExpectations: 13 * platform/mac/imported/w3c/web-platform-tests/html/semantics/the-img-element/update-the-source-set-expected.txt: Added. 14 1 15 2017-12-03 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/LayoutTests/http/tests/misc/resources/image-checks-for-accept.php
r206206 r225472 1 1 <?php 2 if($_SERVER["HTTP_ACCEPT"] == "image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5") 2 if($_SERVER["HTTP_ACCEPT"] == "image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5" 3 || $_SERVER["HTTP_ACCEPT"] == "image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5") 3 4 { 4 5 header("Content-Type: image/jpg"); -
trunk/LayoutTests/platform/ios/TestExpectations
r225426 r225472 3303 3303 # Skip WebGL while the ANGLE update has caused many failures 3304 3304 webgl [ Skip ] 3305 3306 # Requries AVFoundation support <rdar://problem/34502208> 3307 http/tests/images/image-supports-video.html -
trunk/Source/WebCore/ChangeLog
r225470 r225472 1 2017-12-04 Jer Noble <jer.noble@apple.com> 2 3 Include 'video/*' in image request Accept header if browser supports video media in image contexts. 4 https://bugs.webkit.org/show_bug.cgi?id=179178 5 6 Reviewed by Alex Christensen. 7 8 Test: http/tests/images/image-supports-video.html 9 10 Ensure that 'video/*' is included in the Accept header by asking the ImageDecoder whether "Video" 11 media is supported. The ImageDecoder will ask all it's constituent decoders, which aside from 12 ImageDecoderAVFObjC will say only support the "Image" media type. 13 14 Drive-by fix: Make sure the MIMETypeRegistry includes all the types supported by AVFoundation when 15 ImageDecoderAVFObjC is enabled. Also, now that Image reports it can support video mime types, check 16 whether MediaDocument can support a given mime type before asking ImageDocument. 17 18 * html/HTMLImageElement.cpp: 19 (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): 20 * loader/LinkLoader.cpp: 21 (WebCore::LinkLoader::isSupportedType): 22 * loader/cache/CachedResourceRequest.cpp: 23 (WebCore::acceptHeaderValueFromType): 24 * platform/MIMETypeRegistry.cpp: 25 (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType): 26 (WebCore::MIMETypeRegistry::isSupportedImageOrSVGMIMEType): Deleted. 27 * platform/MIMETypeRegistry.h: 28 * platform/graphics/ImageDecoder.cpp: 29 (WebCore::ImageDecoder::supportsMediaType): 30 * platform/graphics/ImageDecoder.h: 31 * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h: 32 (WebCore::ImageDecoderAVFObjC::supportsMediaType): 33 * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: 34 (WebCore::ImageDecoderAVFObjC::supportsContentType): 35 * platform/graphics/cg/ImageDecoderCG.h: 36 * platform/graphics/win/ImageDecoderDirect2D.h: 37 * platform/image-decoders/ScalableImageDecoder.h: 38 (WebCore::ScalableImageDecoder::supportsMediaType): 39 * html/parser/HTMLPreloadScanner.cpp: 40 (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): 41 1 42 2017-12-03 Yusuke Suzuki <utatane.tea@gmail.com> 2 43 -
trunk/Source/WebCore/html/HTMLImageElement.cpp
r224390 r225472 164 164 type.truncate(type.find(';')); 165 165 type = stripLeadingAndTrailingHTMLSpaces(type); 166 if (!type.isEmpty() && !MIMETypeRegistry::isSupportedImage OrSVGMIMEType(type))166 if (!type.isEmpty() && !MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType(type)) 167 167 continue; 168 168 } -
trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp
r224928 r225472 224 224 // when multiple type attributes present: first value wins, ignore subsequent (to match ImageElement parser and Blink behaviours) 225 225 m_typeAttribute = attributeValue; 226 m_typeMatched &= MIMETypeRegistry::isSupportedImage OrSVGMIMEType(m_typeAttribute);226 m_typeMatched &= MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType(m_typeAttribute); 227 227 } 228 228 break; -
trunk/Source/WebCore/loader/LinkLoader.cpp
r222673 r225472 182 182 switch (resourceType) { 183 183 case CachedResource::ImageResource: 184 return MIMETypeRegistry::isSupportedImage OrSVGMIMEType(mimeType);184 return MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType(mimeType); 185 185 case CachedResource::Script: 186 186 return MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType); -
trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp
r225294 r225472 34 34 #include "FrameLoader.h" 35 35 #include "HTTPHeaderValues.h" 36 #include "ImageDecoder.h" 36 37 #include "MemoryCache.h" 37 38 #include "SecurityPolicy.h" … … 146 147 return ASCIILiteral("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); 147 148 case CachedResource::Type::ImageResource: 149 if (ImageDecoder::supportsMediaType(ImageDecoder::MediaType::Video)) 150 return ASCIILiteral("image/png,image/svg+xml,image/*;q=0.8,video/*;q=0.8,*/*;q=0.5"); 148 151 return ASCIILiteral("image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"); 149 152 case CachedResource::Type::CSSStyleSheet: -
trunk/Source/WebCore/platform/MIMETypeRegistry.cpp
r225241 r225472 54 54 #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML) 55 55 #include "ArchiveFactory.h" 56 #endif 57 58 #if HAVE(AVSAMPLEBUFFERGENERATOR) 59 #include "ContentType.h" 60 #include "ImageDecoderAVFObjC.h" 56 61 #endif 57 62 … … 451 456 } 452 457 453 bool MIMETypeRegistry::isSupportedImageOrSVGMIMEType(const String& mimeType) 454 { 455 return isSupportedImageMIMEType(mimeType) || equalLettersIgnoringASCIICase(mimeType, "image/svg+xml"); 458 bool MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType(const String& mimeType) 459 { 460 if (isSupportedImageMIMEType(mimeType) || equalLettersIgnoringASCIICase(mimeType, "image/svg+xml")) 461 return true; 462 463 #if HAVE(AVSAMPLEBUFFERGENERATOR) 464 if (ImageDecoderAVFObjC::supportsContentType(ContentType(mimeType))) 465 return true; 466 #endif 467 468 return false; 456 469 } 457 470 -
trunk/Source/WebCore/platform/MIMETypeRegistry.h
r225241 r225472 48 48 WEBCORE_EXPORT static bool isSupportedImageMIMEType(const String& mimeType); 49 49 50 // Check to see if a MIME type is suitable for being loaded as an image, including SVG .51 WEBCORE_EXPORT static bool isSupportedImage OrSVGMIMEType(const String& mimeType);50 // Check to see if a MIME type is suitable for being loaded as an image, including SVG and Video (where supported). 51 WEBCORE_EXPORT static bool isSupportedImageVideoOrSVGMIMEType(const String& mimeType); 52 52 53 53 // Check to see if a MIME type is suitable for being loaded as an image -
trunk/Source/WebCore/platform/graphics/ImageDecoder.cpp
r222225 r225472 59 59 } 60 60 61 bool ImageDecoder::supportsMediaType(MediaType type) 62 { 63 bool supports = false; 64 #if HAVE(AVSAMPLEBUFFERGENERATOR) 65 if (ImageDecoderAVFObjC::supportsMediaType(type)) 66 supports = true; 67 #endif 68 69 #if USE(CG) 70 if (ImageDecoderCG::supportsMediaType(type)) 71 supports = true; 72 #elif USE(DIRECT2D) 73 if (ImageDecoderDirect2D::supportsMediaType(type)) 74 supports = true; 75 #else 76 if (ScalableImageDecoder::supportsMediaType(type)) 77 supports = true; 78 #endif 79 80 return supports; 61 81 } 82 83 } -
trunk/Source/WebCore/platform/graphics/ImageDecoder.h
r222225 r225472 47 47 virtual ~ImageDecoder() = default; 48 48 49 enum class MediaType { 50 Image, 51 Video, 52 }; 53 static bool supportsMediaType(MediaType); 54 49 55 virtual size_t bytesDecodedToDetermineProperties() const = 0; 50 56 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h
r223452 r225472 49 49 namespace WebCore { 50 50 51 class ContentType; 51 52 class PixelBufferConformerCV; 52 53 class WebCoreDecompressionSession; … … 56 57 static RefPtr<ImageDecoderAVFObjC> create(SharedBuffer&, const String& mimeType, AlphaOption, GammaAndColorProfileOption); 57 58 virtual ~ImageDecoderAVFObjC(); 59 60 static bool supportsMediaType(MediaType); 61 static bool supportsContentType(const ContentType&); 58 62 59 63 size_t bytesDecodedToDetermineProperties() const override { return 0; } -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm
r224620 r225472 29 29 #if HAVE(AVSAMPLEBUFFERGENERATOR) 30 30 31 #import "AVFoundationMIMETypeCache.h" 31 32 #import "AffineTransform.h" 33 #import "ContentType.h" 32 34 #import "FloatQuad.h" 33 35 #import "FloatRect.h" … … 310 312 ImageDecoderAVFObjC::~ImageDecoderAVFObjC() = default; 311 313 314 bool ImageDecoderAVFObjC::supportsMediaType(MediaType type) 315 { 316 if (type == MediaType::Video) 317 return getAVURLAssetClass() && canLoad_VideoToolbox_VTCreateCGImageFromCVPixelBuffer(); 318 return false; 319 } 320 321 bool ImageDecoderAVFObjC::supportsContentType(const ContentType& type) 322 { 323 if (getAVURLAssetClass() && canLoad_VideoToolbox_VTCreateCGImageFromCVPixelBuffer()) 324 return AVFoundationMIMETypeCache::singleton().types().contains(type.containerType()); 325 return false; 326 } 327 312 328 bool ImageDecoderAVFObjC::canDecodeType(const String& mimeType) 313 329 { 330 if (!supportsMediaType(MediaType::Video)) 331 return nullptr; 332 314 333 return [getAVURLAssetClass() isPlayableExtendedMIMEType:mimeType]; 315 334 } -
trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h
r222196 r225472 39 39 return adoptRef(*new ImageDecoderCG(data, alphaOption, gammaAndColorProfileOption)); 40 40 } 41 42 static bool supportsMediaType(MediaType type) { return type == MediaType::Image; } 41 43 42 44 size_t bytesDecodedToDetermineProperties() const final; -
trunk/Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h
r222151 r225472 48 48 } 49 49 50 static bool supportsMediaType(MediaType type) { return type == MediaType::Image; } 51 50 52 static size_t bytesDecodedToDetermineProperties(); 51 53 -
trunk/Source/WebCore/platform/image-decoders/ScalableImageDecoder.h
r225091 r225472 57 57 } 58 58 59 static bool supportsMediaType(MediaType type) { return type == MediaType::Image; } 60 59 61 // Returns nullptr if we can't sniff a supported type from the provided data (possibly 60 62 // because there isn't enough data yet).
Note: See TracChangeset
for help on using the changeset viewer.