Bug 74131 - [CSS Regions] Incorrect margin-top result in regions with mixed widths
Summary: [CSS Regions] Incorrect margin-top result in regions with mixed widths
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Mihnea Ovidenie
URL:
Keywords: AdobeTracked
Depends on: 119393
Blocks: 57312
  Show dependency treegraph
 
Reported: 2011-12-08 14:44 PST by Alan Stearns
Modified: 2013-08-07 10:03 PDT (History)
4 users (show)

See Also:


Attachments
reftest (1.01 KB, application/zip)
2011-12-08 14:44 PST, Alan Stearns
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Stearns 2011-12-08 14:44:39 PST
Created attachment 118475 [details]
reftest

If you have an element in a region with a percentage margin, and the region is followed by another region with a larger width, this affects the top margin display. If the element is displayed entirely within a single region its margins should only be affected by that single region. If an element spans regions the margins should be calculated for each segment using the local region dimensions.

In the test file it appears as if the size and margin calculations are using the widest region in the flow, then moving and clipping for display in the first region. The computed dimensions are reported as 240px by 50px with a 30px margin, but the displayed dimensions are 160px by 50px with left and right margins of 20px and a top margin of 30px. For this testfile I'd expect the displayed dimensions but with an overall margin of 20px.
Comment 1 Michelangelo De Simone 2013-06-13 20:57:08 PDT
Still repros on today's nightly (r151543)
Comment 2 Simon Pena 2013-07-15 08:00:11 PDT
Taking a look at this.
Comment 3 Simon Pena 2013-07-30 02:31:14 PDT
I have been debugging this, and found that during the layout stage, the computed values of the margins end up being 30px (left, right and top). If you use the web inspector, those are the reported values. However, as Alan says in comment 0, the displayed margins are 20px.

It is in the paint stage where the left and right margins get the 20px values they display, in the WebCore::RenderBox::borderBoxRectInRegion method. However, in that place the top margin is not updated.

I talked to Mihnea and he warned me that since at this point margins are/can be collapsed (http://www.w3.org/TR/CSS2/box.html#collapsing-margins), it can be complicated / impossible to simply update the top-margin there.

I am still trying to see if there's something we can do about the top margin (which doesn't break existing behaviour), but feel free to comment if you have some ideas or suggestions.

My feeling is that trying to fix this behaviour so that we actually compute the correct margins in the layout stage would be quite complicated and would require many changes, but I might be missing something.