Closed Bug 1232194 Opened 9 years ago Closed 7 years ago

[writing-mode] GetConsumedBSize() should return block-size, not physical height

Categories

(Core :: Layout: Block and Inline, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

This doesn't look right to me:
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsSplittableFrame.cpp#210
GetContentRectRelativeToSelf().height; is the physical height, right?
Assignee: nobody → mats
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All
I think we should drop the "Get" since it always returns a valid result,
to follow the naming convention.  This patch also adds a WritingMode
param but does not change the behavior yet.  That's the next patch...
Attachment #8823022 - Flags: review?(dholbert)
I will add reftests in an upcoming bug, since we have more bugs
in this area...
Attachment #8823023 - Flags: review?(dholbert)
Blocks: 1328095
(In reply to Mats Palmgren (:mats) from comment #0)
> This doesn't look right to me:
> http://mxr.mozilla.org/mozilla-central/source/layout/generic/
> nsSplittableFrame.cpp#210
> GetContentRectRelativeToSelf().height; is the physical height, right?

Indeed it is, so this must be wrong, and our tests are inadequate. Thanks for picking this up!
Group: layout-core-security
Group: layout-core-security
(FYI, I'm adding a reftest in bug 1328095 that will fail without these patches.)
Comment on attachment 8823022 [details] [diff] [review]
part 1 - [writing-mode] Drop "Get" from GetConsumedBSize() and add a WritingMode param.

Review of attachment 8823022 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/generic/BlockReflowInput.cpp
@@ +153,3 @@
>    }
>  
>    return mConsumedBSize;

This caching of |mConsumedBSize| means that you're implicitly expecting |aWM| to always be the same thing, in every call to this function. (If aWM varied from one call to the next, then the cached value would be bogus!!)

This expectation is worth explicitly asserting & documenting, since it's different from how nsSplittableFrame::ConsumedBSize behaves. (That one is more forgiving/flexible, I think.)  Or, we should just avoid introducing this variability.

So -- please do one of the following -- EITHER:
 (1) Please add an assertion that aWM == mReflowInput.GetWritingMode()  (I suspect that should be valid).  And please mention this aWM expectation in the documentation in BlockReflowInput.h.

...OR, perhaps better:
 (2) Don't add the aWM arg to this particular function-signature, and instead just document that this function uses mReflowInput's WM. And adjust the mBlock->ConsumedBSize() function-call to pass in mReflowState->GetWritingMode().


Personally I lean towards option #2, particularly since this only has one caller:
https://dxr.mozilla.org/mozilla-central/rev/c91249f41e3766274131a84f9157a4d9d9949520/layout/generic/nsBlockFrame.cpp#1630-1631
...and it's indeed correct to use the BlockReflowInput's mReflowState.GetWritingMode() as its writing mode, for that caller.  Your patch currently adjusts that caller to pass "wm", which is declared here as aState.mReflowInput.GetWritingMode():
https://dxr.mozilla.org/mozilla-central/rev/c91249f41e3766274131a84f9157a4d9d9949520/layout/generic/nsBlockFrame.cpp#1549

::: layout/generic/nsBlockFrame.cpp
@@ +1622,5 @@
>        finalSize.BSize(wm) = std::max(aReflowInput.AvailableBSize(),
>                                       aState.mBCoord + nonCarriedOutBDirMargin);
>        // ... but don't take up more block size than is available
>        nscoord effectiveComputedBSize =
> +        GetEffectiveComputedBSize(aReflowInput, aState.ConsumedBSize(wm));

(If you choose option #2 for my note BlockReflowInput notes above, then your patch won't need to modify this line.)
To be clear (since Splinter doesn't show enough context), the previous comment is entirely about BlockReflowInput::ConsumedBSize(), which is completely separate from the nsSplittableFrame function of the same name.
I agree option #2 seems better; no need for flexibility here, the purpose
of this method is just to coalesce calls that should yield the same value.
Attachment #8823022 - Attachment is obsolete: true
Attachment #8823022 - Flags: review?(dholbert)
Attachment #8823404 - Flags: review?(dholbert)
Comment on attachment 8823404 [details] [diff] [review]
part 1 - [writing-mode] Drop "Get" from GetConsumedBSize() and add a WritingMode param.

Review of attachment 8823404 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks! r=me
Attachment #8823404 - Flags: review?(dholbert) → review+
Comment on attachment 8823023 [details] [diff] [review]
part 2 - [writing-mode] Make ConsumedBSize() return the block-axis size, not the physical height.

Review of attachment 8823023 [details] [diff] [review]:
-----------------------------------------------------------------

r=me
Attachment #8823023 - Flags: review?(dholbert) → review+
Pushed by mpalmgren@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/bcbf5734ae38
part 1 - [writing-mode] Drop "Get" from GetConsumedBSize() and add a WritingMode param.  r=dholbert
https://hg.mozilla.org/integration/mozilla-inbound/rev/efad45adb8c4
part 2 - [writing-mode] Make ConsumedBSize() return the block-axis size, not the physical height.  r=dholbert
(the reftest in bug 1328095 covers this bug too)
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/bcbf5734ae38
https://hg.mozilla.org/mozilla-central/rev/efad45adb8c4
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Blocks: 1328764
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: