Closed
Bug 1174450
Opened 9 years ago
Closed 9 years ago
margin-left affects layout in both dimensions with vertical text
Categories
(Core :: Layout: Block and Inline, defect)
Core
Layout: Block and Inline
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)
References
(Blocks 1 open bug)
Details
(Keywords: testcase)
Attachments
(17 files, 1 obsolete file)
582 bytes,
text/html
|
Details | |
13.33 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
3.66 KB,
patch
|
Details | Diff | Splinter Review | |
6.69 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
6.90 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
3.03 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
4.38 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
6.77 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
11.79 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
6.86 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
13.63 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
3.27 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
4.34 KB,
patch
|
Details | Diff | Splinter Review | |
3.01 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
4.54 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
15.37 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
43.01 KB,
patch
|
Details | Diff | Splinter Review |
STR: load the attached testcase
ACTUAL RESULTS
There's a 100px gap to the left of, and below, the red block.
EXPECTED RESULTS
A 100px gap to the left, no gap below, the red box.
(that's what Chrome Canary renders, fwiw)
Assignee | ||
Comment 1•9 years ago
|
||
Jonathan, can you confirm this is a bug? and my expected results is correct?
Flags: needinfo?(jfkthame)
Comment 2•9 years ago
|
||
Yes, looks like a bug to me. Mixed-up writing modes when initializing the reflow-state, I'd guess. Maybe Simon can provide a quick fix?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(jfkthame) → needinfo?(smontagu)
Assignee | ||
Comment 3•9 years ago
|
||
I discovered it by accidentally fixing it while working on Grid item intrinsic sizing.
The bug is in nsLayoutUtils::IntrinsicForContainer / IntrinsicISizeOffsets. I'm
refactoring those to support Grid layout so I can provide a fix if you want.
Comment 4•9 years ago
|
||
Yes please, sounds good. (I'm a bit surprised we haven't been noticing this already; anyway, let's fix asap.)
I presume this will mean passing the appropriate (container's) writing mode in to nsFrame::IntrinsicISizeOffsets. While you're there, it looks like we could also clean up the AddCoord calls to use logical accessors, along the lines of
AddCoord(styleMargin->mMargin.GetIStart(aWM), aRenderingContext, this,
&result.hMargin, &result.hPctMargin, false);
instead of the ugly IsVertical()?... conditional expressions.
Thanks!
Updated•9 years ago
|
Blocks: writing-mode
Assignee | ||
Comment 5•9 years ago
|
||
OK, I'll submit my patches for those bits here.
Assignee | ||
Comment 6•9 years ago
|
||
I'll submit a series of patches that takes minimal steps to avoid mistakes in
refactoring this code and to make it easier to review...
Assignee | ||
Comment 7•9 years ago
|
||
I intentionally didn't rename the variables (which are now params)
in this patch to make it easier to review. I'll rename these in
part 2/3. Also, I duplicated the GetAbsoluteCoord calculations
of minISize/maxISize for now - this will come off in part 5.
Attachment #8622110 -
Flags: review?(jfkthame)
Assignee | ||
Comment 8•9 years ago
|
||
This might make it easier to see the changes in the moved code.
Assignee | ||
Comment 9•9 years ago
|
||
(intentionally leaving 'min' and 'result' for now)
Attachment #8622112 -
Flags: review?(jfkthame)
Assignee | ||
Comment 10•9 years ago
|
||
Attachment #8622113 -
Flags: review?(jfkthame)
Assignee | ||
Comment 11•9 years ago
|
||
I made 'min' and 'result' local vars again since we'll increment these
from being content-box values at the start towards margin-box at the end.
Attachment #8622114 -
Flags: review?(jfkthame)
Assignee | ||
Comment 12•9 years ago
|
||
Attachment #8622115 -
Flags: review?(jfkthame)
Assignee | ||
Comment 13•9 years ago
|
||
Attachment #8622116 -
Flags: review?(jfkthame)
Assignee | ||
Comment 14•9 years ago
|
||
IntrinsicForContainer(...) is implemented as
IntrinsicForWM(aFrame->GetParent()->GetWritingMode(), ...).
(This is needed for Grid which will pass a different WM depending
on whether we're calculating the intrinsic size in the column or
row dimension (bug 1174553))
Attachment #8622117 -
Flags: review?(jfkthame)
Assignee | ||
Comment 15•9 years ago
|
||
(In reply to Jonathan Kew (:jfkthame) from comment #4)
> it looks like we could also clean up the AddCoord calls to use
> logical accessors, along the lines of
> AddCoord(styleMargin->mMargin.GetIStart(aWM), ...
We could, but we will also need a BSize variant so I kept the code
mostly intact.
Attachment #8622118 -
Flags: review?(jfkthame)
Assignee | ||
Comment 16•9 years ago
|
||
Attachment #8622119 -
Flags: review?(jfkthame)
Assignee | ||
Comment 17•9 years ago
|
||
Attachment #8622120 -
Flags: review?(jfkthame)
Assignee | ||
Comment 18•9 years ago
|
||
Assignee | ||
Comment 19•9 years ago
|
||
Comment 20•9 years ago
|
||
Comment on attachment 8622117 [details] [diff] [review]
part 7 - Move most of IntrinsicForContainer into a new method, IntrinsicForWM, that takes the writing-mode to use as a parameter
Review of attachment 8622117 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/base/nsLayoutUtils.cpp
@@ +4678,5 @@
> +{
> + // We want the size this frame will contribute to the parent's inline-size,
> + // so we work in the parent's writing mode; but if aFrame is orthogonal to
> + // its parent, we'll need to look at its BSize instead of min/pref-ISize.
> + WritingMode wm = aFrame->GetParent()->GetWritingMode();
Clearly, it wouldn't make sense to ever call this for a frame that doesn't have a parent; maybe worth adding a MOZ_ASSERT(aFrame->GetParent()) to make that explicit?
Attachment #8622117 -
Flags: review?(jfkthame) → review+
Comment 21•9 years ago
|
||
Comment on attachment 8622118 [details] [diff] [review]
part 8 - Add a new method nsIFrame::IntrinsicBSizeOffsets
Review of attachment 8622118 [details] [diff] [review]:
-----------------------------------------------------------------
Looks fine, except that I'd prefer to see the |orthogonal| variable renamed; see below.
::: layout/generic/nsFrame.cpp
@@ +4098,5 @@
> +{
> + nsIFrame::IntrinsicISizeOffsetData result;
> + WritingMode wm = aFrame->GetWritingMode();
> + const nsStyleMargin* styleMargin = aFrame->StyleMargin();
> + bool orthogonal = aForISize == wm.IsVertical();
The variable name |orthogonal| seems wrong here (at least, I found it confusing when reading the code). It doesn't seem at all clear what it's saying is orthogonal to what.
This flag actually represents whether we're computing offsets in the vertical axis or the horizontal, so please rename it to |verticalAxis| or something like that.
@@ +4131,5 @@
> + result.hBorder += styleBorder->GetComputedBorderWidth(
> + WritingMode::PhysicalSideForBlockAxis(wm, eLogicalEdgeStart));
> + result.hBorder += styleBorder->GetComputedBorderWidth(
> + WritingMode::PhysicalSideForBlockAxis(wm, eLogicalEdgeEnd));
> + }
Wouldn't it be simpler to use the |verticalAxis| flag (formerly |orthogonal|) here, too? No need to go through the PhysicalSideFor... methods at all:
const nsStyleBorder* styleBorder = aFrame->StyleBorder();
if (verticalAxis) {
result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_TOP);
result.hBorder += ...(NS_SIDE_BOTTOM);
} else {
result .... (NS_SIDE_LEFT);
result .... (NS_SIDE_RIGHT);
}
Attachment #8622118 -
Flags: review?(jfkthame) → review+
Updated•9 years ago
|
Attachment #8622110 -
Flags: review?(jfkthame) → review+
Updated•9 years ago
|
Attachment #8622112 -
Flags: review?(jfkthame) → review+
Updated•9 years ago
|
Attachment #8622113 -
Flags: review?(jfkthame) → review+
Updated•9 years ago
|
Attachment #8622114 -
Flags: review?(jfkthame) → review+
Updated•9 years ago
|
Attachment #8622115 -
Flags: review?(jfkthame) → review+
Updated•9 years ago
|
Attachment #8622116 -
Flags: review?(jfkthame) → review+
Updated•9 years ago
|
Attachment #8622119 -
Flags: review?(jfkthame) → review+
Updated•9 years ago
|
Attachment #8622120 -
Flags: review?(jfkthame) → review+
Comment 22•9 years ago
|
||
Comment on attachment 8622110 [details] [diff] [review]
part 1 - Split IntrinsicForContainer in two parts; move the latter part to a new function, AddIntrinsicSizeOffset, which applies the padding/border/margin from the given IntrinsicISizeOffsetData
Review of attachment 8622110 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/base/nsLayoutUtils.cpp
@@ +4330,5 @@
> + const nsStyleCoord& styleISize,
> + const nsStyleCoord& styleMinISize,
> + const nsStyleCoord& styleMaxISize,
> + uint32_t aFlags,
> + WritingMode aContainerWM)
Hmm. Looking at how you end up using this later in bug 1174546, I wonder if it'd be better to pass just an 'aVerticalAxis' flag (or maybe a PhysicalAxis value -- see enum in WritingModes.h -- rather than a bool) instead of the WritingMode here.
I think this would let you do nsLayoutUtils::MinISizeContributionForAxis instead of ...ForWM in bug 1174546, and avoid the need to construct a "synthetic writing mode" just to pass down the vertical/horizontal choice.
Assignee | ||
Comment 23•9 years ago
|
||
I figured it's easier to review this as an increment on top of the
previous patches.
Attachment #8622663 -
Flags: review?(jfkthame)
Assignee | ||
Comment 24•9 years ago
|
||
Addressing the nits in comment 21.
Attachment #8622666 -
Flags: review?(jfkthame)
Assignee | ||
Comment 25•9 years ago
|
||
Attachment #8622668 -
Flags: review?(jfkthame)
Assignee | ||
Comment 26•9 years ago
|
||
Attachment #8622122 -
Attachment is obsolete: true
Updated•9 years ago
|
Attachment #8622666 -
Flags: review?(jfkthame) → review+
Updated•9 years ago
|
Attachment #8622663 -
Flags: review?(jfkthame) → review+
Comment 27•9 years ago
|
||
Comment on attachment 8622668 [details] [diff] [review]
part 10b - Rename IntrinsicForWM to IntrinsicForAxis and make it take a PhysicalAxis instead of a WritingMode
Review of attachment 8622668 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/base/nsLayoutUtils.cpp
@@ +4635,5 @@
> nscoord h;
> if (GetAbsoluteCoord(styleBSize, h) ||
> GetPercentBSize(styleBSize, aFrame, h)) {
> h = std::max(0, h - bSizeTakenByBoxSizing);
> +
oops - a line with just spaces managed to sneak in here.
::: layout/base/nsLayoutUtils.h
@@ +1308,5 @@
> enum {
> IGNORE_PADDING = 0x01
> };
> + static nscoord IntrinsicForAxis(mozilla::PhysicalAxis aAxis,
> + nsRenderingContext* aRenderingContext,
nit: it'd be nice to fix up the alignment of the params here.
Attachment #8622668 -
Flags: review?(jfkthame) → review+
Comment 29•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/06f474c578d6
https://hg.mozilla.org/integration/mozilla-inbound/rev/049abdaa341d
https://hg.mozilla.org/integration/mozilla-inbound/rev/0ab7b15d0f9e
https://hg.mozilla.org/integration/mozilla-inbound/rev/4caa417b34ee
https://hg.mozilla.org/integration/mozilla-inbound/rev/f06082b96326
https://hg.mozilla.org/integration/mozilla-inbound/rev/57b4bcc245bd
https://hg.mozilla.org/integration/mozilla-inbound/rev/cf69f521dacd
https://hg.mozilla.org/integration/mozilla-inbound/rev/98e5282a4050
https://hg.mozilla.org/integration/mozilla-inbound/rev/c671c18ebf38
https://hg.mozilla.org/integration/mozilla-inbound/rev/aef6541d904b
https://hg.mozilla.org/integration/mozilla-inbound/rev/f2ea8a36fc20
https://hg.mozilla.org/integration/mozilla-inbound/rev/0ddd689107a4
https://hg.mozilla.org/integration/mozilla-inbound/rev/16e74ccdc8bf
https://hg.mozilla.org/integration/mozilla-inbound/rev/966830250aa4
Comment 30•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/06f474c578d6
https://hg.mozilla.org/mozilla-central/rev/049abdaa341d
https://hg.mozilla.org/mozilla-central/rev/0ab7b15d0f9e
https://hg.mozilla.org/mozilla-central/rev/4caa417b34ee
https://hg.mozilla.org/mozilla-central/rev/f06082b96326
https://hg.mozilla.org/mozilla-central/rev/57b4bcc245bd
https://hg.mozilla.org/mozilla-central/rev/cf69f521dacd
https://hg.mozilla.org/mozilla-central/rev/98e5282a4050
https://hg.mozilla.org/mozilla-central/rev/c671c18ebf38
https://hg.mozilla.org/mozilla-central/rev/aef6541d904b
https://hg.mozilla.org/mozilla-central/rev/f2ea8a36fc20
https://hg.mozilla.org/mozilla-central/rev/0ddd689107a4
https://hg.mozilla.org/mozilla-central/rev/16e74ccdc8bf
https://hg.mozilla.org/mozilla-central/rev/966830250aa4
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•