inconsistent layout of negative-margin content after float |
|||
Issue descriptionWhat steps will reproduce the problem? 1. Open https://output.jsbin.com/hebedit/quiet (also copied in attachment) 2. Observe rendering. 3. Resize the window. What is the expected result? Green square in step 2. Rendering does not change on resize in step 3. What happens instead of that? Square is half red in step 2. Resizing the window makes the whole square green. Additional information: The interaction of floats and negative margins is subtle, but Firefox and IE agree the square should be fully-green. Certainly the rendering should not change on resize. In Blink and WebKit, the first layout pass (once the content is in the DOM) assigns offsetLeft == 0 to the .content div, leading to the half-red state. The second layout pass (if and when it occurs) assigns offsetLeft == 50 to the .content div, leading to the fully-green state. The offsetLeft value is computed in LayoutBlockFlow::DetermineLogicalLeftPositionForChild (where "this" == .container div). This method sees ContainsFloats() == false during the first layout pass, and ContainsFloats() == true during the second layout pass, for reasons not understood. This test case is based on the layout test fast/block/float/avoid-floats-when-negative-margin-top-5.html, with a modification to disable scrollbars. The layout test passes because the removal of the frame's initial vertical scrollbar triggers a second layout pass. This bug was discovered while investigating test failures on patchset 1 of http://crrev.com/c/838249/1. That patchset caused the initial vertical scrollbar to be removed before the content was in the DOM. (This isn't desirable, but it shouldn't have broken layout.) There were many other layout tests that failed with this patchset, that I didn't investigate. So, it's possible there is a whole class of bugs where we rely on a second layout pass to correct the mistakes of the first.
,
Dec 22 2017
,
Dec 23 2017
,
Jan 2 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5050aa20edf169134ee08a90c635e1b087509817 commit 5050aa20edf169134ee08a90c635e1b087509817 Author: Robert Hogan <robhogan@gmail.com> Date: Tue Jan 02 14:47:15 2018 Look past formatting context objects for overhanging floats Bug: 797185 Change-Id: I2521e1cf552be56abba6513eada51cad571d2cca Reviewed-on: https://chromium-review.googlesource.com/844074 Reviewed-by: Morten Stenshorne <mstensho@chromium.org> Commit-Queue: Robert Hogan <robhogan@gmail.com> Cr-Commit-Position: refs/heads/master@{#526477} [add] https://crrev.com/5050aa20edf169134ee08a90c635e1b087509817/third_party/WebKit/LayoutTests/fast/block/float/avoid-floats-when-negative-margin-top-7.html [add] https://crrev.com/5050aa20edf169134ee08a90c635e1b087509817/third_party/WebKit/LayoutTests/fast/block/float/avoid-floats-when-negative-margin-top-8.html [modify] https://crrev.com/5050aa20edf169134ee08a90c635e1b087509817/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
|||
►
Sign in to add a comment |
|||
Comment 1 by skobes@chromium.org
, Dec 22 2017