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
getComputedStyle(img).height returns string of a rounded int not a float
https://bugs.webkit.org/show_bug.cgi?id=206161 <rdar://93860607> Patch by Sammy Gill <sgill26@apple.com> on 2022-06-21 Reviewed by Alan Bujtas. When computing the logical height/width for a replaced element, we may need to calculate it using (used width) / (intrinsic ratio) or (used height) / (intrinsic ratio). In either case, these are the used values according to the spec, which means they may be floats. Currently, WebKit performs these computations, but it also rounds them leading to an incorrect value. By removing these calls to round, the computed value should line up with what is specified in the spec. As a result of this change, several tests needed to be rebaselined since the generated content was slightly different. In the test cases, there were certain elements that computed a slightly different width/height value, which resulted in different dimensions that were used in the rendering as well as in the output of the tests. Depending on how the dimensions of an element changed, this could have in turn caused a nearby element to get rendered slightly differetly as well. For example, if an element had a slight increase in its height, this could have caused a neighboring element to have a slightly different position in the y dimension. The more of these interactions/differences there are would mean we would see a greater difference in the expected vs actual output (e.g. css1/text_properties/vertical_align.html). However, this change should be seen as a progression when comparing the tests with the results of other browsers. By loading up the tests in other browsers, you can see that the dimensions that are calculated are more in line with the new values generated with this patch. Referenced spec: https://www.w3.org/TR/CSS21/visudet.html#propdef-height * Source/WebCore/rendering/RenderReplaced.cpp: (WebCore::resolveWidthForRatio): (WebCore::RenderReplaced::computeReplacedLogicalWidth const): (WebCore::resolveHeightForRatio): (WebCore::RenderReplaced::computeReplacedLogicalHeight const): * LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt: * LayoutTests/fast/block/positioning/replaced-inside-fixed-top-bottom-expected.txt: * LayoutTests/fast/writing-mode/block-level-images-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-fractional-height-from-aspect-ratio-expected.txt: * LayoutTests/platform/mac/css1/box_properties/width-expected.txt: * LayoutTests/platform/mac/css1/formatting_model/replaced_elements-expected.txt: * LayoutTests/platform/mac/css1/text_properties/vertical_align-expected.txt: * LayoutTests/platform/mac/fast/repaint/block-layout-inline-children-replaced-expected.txt: * LayoutTests/platform/mac/fast/replaced/width100percent-image-expected.txt: * LayoutTests/platform/mac/svg/wicd/test-rightsizing-b-expected.txt: * LayoutTests/platform/mac/tables/mozilla/bugs/bug14929-expected.txt: * LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug85016-expected.txt: * LayoutTests/svg/css/max-width-2-expected.html: * LayoutTests/platform/glib/css2.1/t090501-c414-flt-03-b-g-expected.txt: * LayoutTests/platform/glib/fast/block/positioning/replaced-inside-fixed-top-bottom-expected.txt: * LayoutTests/platform/glib/tables/mozilla_expected_failures/bugs/bug85016-expected.txt: * LayoutTests/platform/gtk/css1/box_properties/width-expected.txt: * LayoutTests/platform/gtk/css1/formatting_model/replaced_elements-expected.txt: * LayoutTests/platform/gtk/css1/text_properties/vertical_align-expected.txt: * LayoutTests/platform/gtk/css2.1/t090501-c414-flt-03-b-g-expected.png: * LayoutTests/platform/gtk/fast/repaint/block-layout-inline-children-replaced-expected.png: * LayoutTests/platform/gtk/fast/repaint/block-layout-inline-children-replaced-expected.txt: * LayoutTests/platform/gtk/fast/replaced/width100percent-image-expected.txt: * LayoutTests/platform/gtk/tables/mozilla/bugs/bug14929-expected.txt: * LayoutTests/platform/ios/css1/text_properties/vertical_align-expected.txt: * LayoutTests/platform/ios/fast/replaced/width100percent-image-expected.txt: * LayoutTests/platform/ios/tables/mozilla/bugs/bug14929-expected.txt: * LayoutTests/platform/ios/tables/mozilla_expected_failures/bugs/bug85016-expected.txt: * LayoutTests/platform/glib/TestExpectations: * LayoutTests/platform/gtk/TestExpectations: Canonical link: https://commits.webkit.org/251706@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295701 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
0ea60ac
commit e7abdadb1b69209d90e51b46caab32d4cc6bb093
Showing
31 changed files
with
519 additions
and
513 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
CONSOLE MESSAGE: ReferenceError: Can't find variable: checkLayout | ||
layer at (0,0) size 800x600 | ||
RenderView at (0,0) size 800x600 | ||
layer at (0,0) size 800x130 | ||
RenderBlock {HTML} at (0,0) size 800x130 | ||
layer at (0,0) size 800x129 | ||
RenderBlock {HTML} at (0,0) size 800x129 | ||
RenderBody {BODY} at (8,8) size 784x0 | ||
layer at (8,8) size 203x0 | ||
RenderBlock (relative positioned) {DIV} at (0,0) size 204x0 | ||
RenderHTMLCanvas {CANVAS} at (0,0) size 61x61 [bgcolor=#008000] | ||
RenderHTMLCanvas {CANVAS} at (60,0) size 62x61 [bgcolor=#008000] | ||
RenderHTMLCanvas {CANVAS} at (0,61) size 122x61 [bgcolor=#008000] | ||
RenderHTMLCanvas {CANVAS} at (0,60) size 122x61 [bgcolor=#008000] |
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.