Closed
Bug 249982
Opened 21 years ago
Closed 19 years ago
percentage margins relative to float width not CB width if width:auto
Categories
(Core :: Layout: Floats, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: ian, Assigned: bzbarsky)
References
()
Details
(Whiteboard: [reflow-refactor])
Attachments
(3 files, 1 obsolete file)
494 bytes,
text/html
|
Details | |
958 bytes,
patch
|
bzbarsky
:
review-
bzbarsky
:
superreview-
|
Details | Diff | Splinter Review |
1.36 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
If you have a width:auto float, then percentage margins are relative to the
actual width of the float, not its containing block width.
Reporter | ||
Updated•21 years ago
|
![]() |
Assignee | |
Comment 1•21 years ago
|
||
This happens for any shrink-wrapping block, actually. It looks to me like the
code at the end of nsBlockReflowContext::ReflowBlock that does:
// If the block is shrink wrapping its width, then see if we have percentage
// based margins. If so, we can calculate them now that we know the shrink
// wrap width
if (NS_SHRINKWRAPWIDTH == aFrameRS.mComputedWidth) {
ComputeShrinkwrapMargins(aFrameRS.mStyleMargin, mMetrics.width, mMargin, mX);
}
is completely bogus (and has been since troy checked it in sometime in 2000).
If the block being reflown is shrink-wrapping, its _kids_ need to use
ComputeShrinkWrapMargins; it itself does not need to.
![]() |
Assignee | |
Comment 2•21 years ago
|
||
In this testcase, the black square should be half the width of the red
rectangle.
![]() |
Assignee | |
Comment 3•21 years ago
|
||
With this patch, the "testcase to not regress" is not regressed, and this bug
is fixed. Now that we're not changing mX anymore (that part was pretty bogus
too, in my opinion), we no longer need the last arg of
ComputeShrinkwrapMargins.
![]() |
Assignee | |
Comment 4•21 years ago
|
||
Comment on attachment 153269 [details] [diff] [review]
Proposed patch
David, what do you think?
Attachment #153269 -
Flags: superreview?(dbaron)
Attachment #153269 -
Flags: review?(dbaron)
I'm suspicious of this change. mComputeMaximumWidth isn't the normal way of
computing maximum width, so I think there has to be a third caller somewhere
(until reflow refactoring), for maximum width computation using
NS_UNCONSTRAINEDSIZE, under some condition. Did you run the regression tests?
![]() |
Assignee | |
Comment 6•21 years ago
|
||
I haven't yet; I need to clear up a gig of disk space first.... But I'll try to
do that today.
![]() |
Assignee | |
Comment 7•21 years ago
|
||
OK, I finished running the regression tests. There weren't any failures (other
than the false positives).
If you'd prefer to hold off on this till after reflow refactoring, I guess I'm
OK with that.
Comment on attachment 153269 [details] [diff] [review]
Proposed patch
As long as you don't make http://dbaron.org/css/test/intrinsic/perc-marg-max
and http://dbaron.org/css/test/intrinsic/perc-marg-min any worse (the're not so
great already), r+sr=dbaron.
Attachment #153269 -
Flags: superreview?(dbaron)
Attachment #153269 -
Flags: superreview+
Attachment #153269 -
Flags: review?(dbaron)
Attachment #153269 -
Flags: review+
![]() |
Assignee | |
Comment 9•21 years ago
|
||
Comment on attachment 153269 [details] [diff] [review]
Proposed patch
Ah, there we go. That patch does make the testcase at
http://dbaron.org/css/test/intrinsic/perc-marg-max worse (the margins compute
to 0, looks like). The testcase at
http://dbaron.org/css/test/intrinsic/perc-marg-min is not affected (and is
really bad, yes).
So it looks like this is no good as things stand --
we can't easily tell whether the width is shrink-wrap because it really is or
because the parent is shrink-wrapping... :(
Attachment #153269 -
Attachment is obsolete: true
Attachment #153269 -
Flags: superreview-
Attachment #153269 -
Flags: superreview+
Attachment #153269 -
Flags: review-
Attachment #153269 -
Flags: review+
![]() |
Assignee | |
Comment 10•21 years ago
|
||
This computes the shrinkwrap margins only if our _parent_ is shrinkwrapping,
instead of if we're shrinkwrapping.
![]() |
Assignee | |
Comment 11•21 years ago
|
||
Comment on attachment 153739 [details] [diff] [review]
As discussed on IRC
Where by "parent" I mean "containing block", since that's what the percent
margins should be using to size.
Attachment #153739 -
Flags: superreview?(dbaron)
Attachment #153739 -
Flags: review?(dbaron)
Unfortunately you need to do the equivalent for the other two callers (and I'm
not really sure how one would do that right now) -- particularly the max-width
one, since this will cause {inc} bugs without such a change.
That said, maybe the best solution is to move this code where it belongs, and
add the margins at the parent, just like all other margins are added (right?).
![]() |
Assignee | |
Comment 13•21 years ago
|
||
Comment on attachment 153739 [details] [diff] [review]
As discussed on IRC
Hmm.. Yeah, margins are generally added at the parent (though most just add
whatever the reflow state computed margin is).
You're right that this has {inc} issues..
Attachment #153739 -
Flags: superreview?(dbaron)
Attachment #153739 -
Flags: superreview-
Attachment #153739 -
Flags: review?(dbaron)
Attachment #153739 -
Flags: review-
Comment 14•19 years ago
|
||
*** Bug 332551 has been marked as a duplicate of this bug. ***
![]() |
Assignee | |
Updated•19 years ago
|
Whiteboard: [reflow-refactor]
![]() |
||
Comment 15•19 years ago
|
||
Based on the test case:
fails with the 20061207 build
works with the 20061298 build
Bug 300030 fixed this, I think.
![]() |
Assignee | |
Comment 16•19 years ago
|
||
Yeah, it would have.
Comment 17•18 years ago
|
||
Attachment #257619 -
Flags: review?(dbaron)
Comment on attachment 257619 [details] [diff] [review]
Reftests
Checked in after testing in pre- and post-reflow-branch builds.
Attachment #257619 -
Flags: review?(dbaron) → review+
Updated•18 years ago
|
Status: RESOLVED → VERIFIED
Flags: in-testsuite+
Updated•14 years ago
|
Assignee: nobody → bzbarsky
You need to log in
before you can comment on or make changes to this bug.
Description
•