Closed Bug 1145218 Opened 10 years ago Closed 10 years ago

block frames with orthogonal writing mode need their own float manager

Categories

(Core :: Layout: Floats, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(2 files, 2 obsolete files)

As proposed in bug 1142318 comment 23 (based on :dbaron's patch mentioned in bug 1114329), I tried adding the attached patch to assert if we're using a float manager whose block direction does not match what the caller expects. Turns out these assertions fire frequently as soon as we start using vertical writing modes; e.g. a simple testcase such as data:text/html,<div style="writing-mode:vertical-lr;inline-size:150px"> <p><img style="float:left" src="foo">The quick brown fox jumps over the lazy dog.
Attachment #8580128 - Flags: review?(smontagu)
Is this what we want to do? I'm assuming we should not use the same float manager for vertical-lr and vertical-rl, as the block dir will be opposite.
Attachment #8580131 - Flags: review?(smontagu)
Comment on attachment 8580131 [details] [diff] [review] Require a new float manager if a block frame has a different writing-mode to its parent's I think it would be better to set the NS_BLOCK_FLOAT_MGR bit; we check that bit in other places too.
(And it probably also requires NS_BLOCK_MARGIN_ROOT, which is separate, since I think we shouldn't be attempting to collapse margins per http://dev.w3.org/csswg/css2/box.html#collapsing-margins since blocks that establish orthogonal flows establish new block formatting contexts. At least, the writing-modes spec better say that they do...)
This sets the suggested bits in nsBlockFrame::Init(). Is there any situation where the frame might be reparented such that we'd need to reset/clear these bits subsequently, or can we assume that if things change that much, we'll be reconstructing frames anyway?
Attachment #8580753 - Flags: review?(dbaron)
Attachment #8580131 - Attachment is obsolete: true
Attachment #8580131 - Flags: review?(smontagu)
Comment on attachment 8580753 [details] [diff] [review] Require a new float manager if a block frame has a different writing-mode to its parent's r=dbaron, though maybe it's worth a comment citing the spec http://dev.w3.org/csswg/css-writing-modes/#block-flow which says that: If a box has a different block flow direction than its containing block: ... If the box is a block container, then it establishes a new block formatting context.
Attachment #8580753 - Flags: review?(dbaron) → review+
Oh, and one nit: drop the "StyleContext()->" in both places; there's a StyleVisibility() on nsIFrame that forwards to the style context, and is preferred.
Updated patch 1 following the recent float manager rework.
Attachment #8581545 - Flags: review?(smontagu)
Attachment #8580128 - Attachment is obsolete: true
Attachment #8580128 - Flags: review?(smontagu)
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Blocks: 1130907
Comment on attachment 8581545 [details] [diff] [review] Make the float manager's writing-mode field debug-only, and assert that it matches what callers are passing in Review of attachment 8581545 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsFloatManager.cpp @@ -404,5 @@ > // reflow mentioned above) and then from B to C during the subsequent > // reflow. In the typical case A and C will be the same, but not always. > // Allowing mFloatDamage to accumulate the damage incurred during both > // reflows ensures that nothing gets missed. > - aState->mWritingMode = mWritingMode; Don't we want to make this #ifdef DEBUG instead of removing it completely? @@ -419,5 @@ > nsFloatManager::PopState(SavedState* aState) > { > NS_PRECONDITION(aState, "No state to restore?"); > > - mWritingMode = aState->mWritingMode; Ditto ::: layout/generic/nsFloatManager.h @@ -88,5 @@ > struct SavedState { > explicit SavedState() {} > private: > uint32_t mFloatInfoCount; > - mozilla::WritingMode mWritingMode; Ditto @@ -288,5 @@ > > void AssertStateMatches(SavedState *aState) const > { > - NS_ASSERTION(aState->mWritingMode == mWritingMode && > - aState->mLineLeft == mLineLeft && Ditto
(In reply to Simon Montagu :smontagu from comment #8) > ::: layout/generic/nsFloatManager.cpp > @@ -404,5 @@ > > // reflow mentioned above) and then from B to C during the subsequent > > // reflow. In the typical case A and C will be the same, but not always. > > // Allowing mFloatDamage to accumulate the damage incurred during both > > // reflows ensures that nothing gets missed. > > - aState->mWritingMode = mWritingMode; > > Don't we want to make this #ifdef DEBUG instead of removing it completely? As far as I could see, including the writing mode in the SavedState seemed to be completely redundant; we don't modify the float manager's mode after initialization, so it never needs to be saved and restored either. Or did I miss something there?
Comment on attachment 8581545 [details] [diff] [review] Make the float manager's writing-mode field debug-only, and assert that it matches what callers are passing in Review of attachment 8581545 [details] [diff] [review]: ----------------------------------------------------------------- Oh well, if you put it that way...
Attachment #8581545 - Flags: review?(smontagu) → review+
It looks like the reftest failures here are spurious, inasmuch as they're not an "error" in our layout but rather an artifact where Windows positions glyphs erratically on the pixel grid: we're getting a one-pixel offset of the baseline between adjacent glyphs within the same element and textrun, which should be rendered with the exact same x-coordinate. The patch here has affected this, presumably, because the new float manager we're creating for the vertical writing-mode elements means that available-space computations are working within a new coordinate space, and we end up It's possible that we can mitigate this somehow via device-pixel rounding or snapping at some level, but it's not a new problem and it shouldn't block this bug. We already have some fuzz-annotations that are due to this same issue, so I propose to mark these tests fuzzy as well and re-land these patches.
Flags: needinfo?(jfkthame)
FTR, I just filed bug 1150250 on the tests that I marked fuzzy here.
Blocks: 1141867
Blocks: 1150614
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: