Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Not computing image aspect ratios from width and height attributes fo…
…r lazy loaded images https://bugs.webkit.org/show_bug.cgi?id=224197 Reviewed by Darin Adler. LayoutTests/imported/w3c: The test cases for error images and images without src in img-aspect-ratio.html are passed. This patch doesn't change the behavior of the original aspect ratio case, so it's failed like before. * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt: Source/WebCore: This patch supports error images and lazy loaded images (without src attribute) to compute implicit aspect ratios from width and height attributes. Refactor the code a bit. Added intrinsicAspectRatioFromWidthHeight() to compute aspect ratio from width and height attributes when the object is allowed to which is decided by canMapWidthHeightToAspectRatio(). Remove `!downcast<RenderImage>(*this).cachedImage()` constraint, so that images without src attributes is allowed. As to error images, compute the aspect ratio when the image shouldDisplayBrokenImageIcon(). * rendering/RenderImage.cpp: (WebCore::RenderImage::canMapWidthHeightToAspectRatio const): To indicate that the object is allowed to compute aspect ratio from width and height attributes. (WebCore::RenderImage::computeIntrinsicRatioInformation const): When shouldDisplayBrokenImageIcon(), try to compute the aspect ratio from attributes width and height. * rendering/RenderImage.h: * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::intrinsicAspectRatioFromWidthHeight const): Compute the aspect ratio from attributes width and height. (WebCore::RenderReplaced::computeIntrinsicRatioInformation const): * rendering/RenderReplaced.h: (WebCore::RenderReplaced::canMapWidthHeightToAspectRatio const): Ditto. Canonical link: https://commits.webkit.org/236975@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
7 changed files
with
74 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters