Bug 126898

Summary: Subpixel layout: -webkit-flex pushes content off of-by-one pixel.
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: ASSIGNED ---    
Severity: Normal CC: changseok, esprehn+autocc, ews-watchlist, glenn, jbedard, jonlee, kondapallykalyan, pdr, rbuis, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=236680
Bug Depends on:    
Bug Blocks: 126283    
Attachments:
Description Flags
Patch ews-feeder: commit-queue-

Description zalan 2014-01-13 07:36:01 PST
LayoutTests/css3/flexbox/image-percent-max-height.html
Comment 1 zalan 2014-01-15 20:05:23 PST
The flexbox layout ends up with different value for the available space (compared to the default layout flow) -> centering the content results in different x pos.
Comment 2 zalan 2014-01-15 20:21:46 PST
this double rounding is probably unnecessary. The reason why it works when subpixel is off is in that case both layout paths round, one is explicitly while the other is implicitly (due to using only integral px positions).

diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp
index d81b6cb..c0dc7a4 100644
--- a/Source/WebCore/rendering/RenderReplaced.cpp
+++ b/Source/WebCore/rendering/RenderReplaced.cpp
@@ -388,7 +388,7 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh
             // of 'width' is: (used height) * (intrinsic ratio)
             if (intrinsicRatio && ((heightIsAuto && !hasIntrinsicWidth && hasIntrinsicHeight) || !heightIsAuto)) {
                 LayoutUnit logicalHeight = computeReplacedLogicalHeight();
-                return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred);
+                return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalHeight * intrinsicRatio, shouldComputePreferred);
             }
Comment 3 zalan 2014-01-19 17:59:00 PST
<rdar://problem/15855716>
Comment 4 Jonathan Bedard 2017-06-03 08:27:10 PDT
This is only an issue in simulators, this test passes on device.  Moved the expectation in <https://trac.webkit.org/changeset/217757/webkit>.
Comment 5 Rob Buis 2021-04-02 05:18:03 PDT
Created attachment 425009 [details]
Patch