Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store replaced element's aspect ratio into its own struct.
https://bugs.webkit.org/show_bug.cgi?id=248096 rdar://102525236 Reviewed by Alan Baradlay. When replaced element's compute their aspect ratio, the value is stored inside of a double This value is computed fairly deep in the computeIntrinsicRatioInformation call stack and then is propagated back up to where it will be used. This has been causing some slight issues with precision when making other changes to replaced element sizing code that uses the aspect ratio. To help with this, this patch changes how the aspect ratio is stored by instead storing each dimension that corresponds with the aspect ratio into a FloatSize. This variable is then propagated back up the same call stack the same way and then the caller can determine how they want to use the aspect ratio (compute into a double or use the individual dimensions). For this patch there is no functional change because we will store the value in a double regardless. However, we do seem to progress on a test (fast/replaced/width100percent-image). The new sizes match how other browsers are sizing the image. This is likely due to the change in RenderReplaced::computeIntrinsicRatioInformation. The old version was computing the intrinsicRatio by dividing two floats. The new version is storing the dimensions in FloatSize, but the aspect ratio is being computed by casting one of the values in the operation to a double. aspectRatioDouble was added into FloatSize to help with this. This patch also introduces aspectRatioLogicalWidth and aspectRatioLogicalHeight inside RenderStyle. These methods will return the correct width/height depending on the writing mode. * LayoutTests/platform/gtk/fast/replaced/width100percent-image-expected.txt: * LayoutTests/platform/ios/fast/replaced/width100percent-image-expected.txt: * LayoutTests/platform/mac/fast/replaced/width100percent-image-expected.txt: * Source/WebCore/platform/graphics/FloatSize.h: (WebCore::FloatSize::aspectRatioDouble const): * Source/WebCore/rendering/RenderBox.h: (WebCore::RenderBox::computeIntrinsicRatioInformation const): * Source/WebCore/rendering/RenderImage.cpp: (WebCore::RenderImage::computeIntrinsicRatioInformation const): * Source/WebCore/rendering/RenderImage.h: * Source/WebCore/rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox const): (WebCore::RenderReplaced::computeIntrinsicAspectRatio const): (WebCore::RenderReplaced::computeIntrinsicRatioInformation const): (WebCore::RenderReplaced::computeReplacedLogicalWidth const): (WebCore::resolveHeightForRatio): (WebCore::RenderReplaced::computeReplacedLogicalHeight const): * Source/WebCore/rendering/RenderReplaced.h: * Source/WebCore/rendering/style/RenderStyle.h: (WebCore::RenderStyle::aspectRatioLogicalWidth const): (WebCore::RenderStyle::aspectRatioLogicalHeight const): * Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp: (WebCore::LegacyRenderSVGRoot::computeIntrinsicRatioInformation const): * Source/WebCore/rendering/svg/LegacyRenderSVGRoot.h: * Source/WebCore/rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation const): * Source/WebCore/rendering/svg/RenderSVGRoot.h: Canonical link: https://commits.webkit.org/257430@main
- Loading branch information
Showing
14 changed files
with
69 additions
and
56 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
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
Oops, something went wrong.