Collapsed margins do not uncollapse properly in this dynamic case

NEW
Unassigned

Status

()

Core
Layout
8 years ago
4 years ago

People

(Reporter: Jesse Ruderman, Unassigned)

Tracking

(Depends on: 1 bug, Blocks: 2 bugs, {testcase})

Trunk
x86
Mac OS X
testcase
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

8 years ago
Created attachment 405908 [details]
testcase (dynamic)
(Reporter)

Comment 1

8 years ago
Created attachment 405909 [details]
reference (static)
(Reporter)

Comment 2

8 years ago
Based on layout/reftests/margin-collapsing/block-sibling-1a.html.
(Reporter)

Comment 3

8 years ago
This bug gets in refdyn's way fairly often.
Hmm.  So that first change is just there to force textframe creation.  Then the second marks the line with that textframe as dirty... but not the block line after it.

And then in ReflowDirtyLines, this code:

1934          if (line.next() != end_lines()) {
1935            PRBool maybeWasEmpty = oldY == line.next()->mBounds.y;
1936            PRBool isEmpty = line->CachedIsEmpty();
1937            if (maybeReflowingForFirstTime /*1*/ ||
1938                (isEmpty || maybeWasEmpty) /*2/3/4*/) {
1939              line.next()->MarkPreviousMarginDirty();

doesn't reach line 1939 because maybeWasEmpty is false.  And its false because oldY is 1800 but line.next()->mBounds.y is 2400.

And that happens because oldY includes the margin of the block above.... but not that of the block below.  But the old position of the second line includes both margins.  So we end up maybeWasEmpty false when in fact the line used to be empty.  Since isEmpty is false, and we're not reflowing for the first time, we skip the MarkPreviousMarginDirty call we actually need to make in this case.
Perhaps we should do:

  PRBool maybeWasEmpty = oldY == oldYMost ||
                         oldY == line.next()->mBounds.y;

?  Or would that miss some cases in which oldYMost is bigger than oldY but the line was still empty for margin-collapsing purposes?
Yeah, it seems like we'd have a combination of bug 393655 and this bug that could still happen.

The right approach is probably to have a state bit for line boxes that records whether the line was empty last time we reflowed it.
Assignee: nobody → roc
That seems relatively low-pain....
Assignee: roc → nobody
Blocks: 549926

Updated

4 years ago
Depends on: 50959
You need to log in before you can comment on or make changes to this bug.