Bug 1565037 Part 3 - Cache our children's reflow status, and use it to guide the morphing into our reflow status. r=dholbert

Because aStatus is also used as an output argument, caching aStatus as
our children's reflow status can and make the logic that morphs aStatus
to our reflow status easier to follow. And this helps the patch I'm
going to add for computing the block-size for column-span split.

Depends on D37624

Differential Revision: https://phabricator.services.mozilla.com/D37625

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ting-Yu Lin 2019-07-11 18:50:14 +00:00
Родитель b0c5d5ce8d
Коммит 271347c543
2 изменённых файлов: 12 добавлений и 8 удалений

Просмотреть файл

@ -7357,20 +7357,21 @@ nscoord nsBlockFrame::ComputeFinalBSize(const ReflowInput& aReflowInput,
NS_ASSERTION(!(IS_TRUE_OVERFLOW_CONTAINER(this) && computedBSizeLeftOver),
"overflow container must not have computedBSizeLeftOver");
const nsReflowStatus statusFromChildren = aStatus;
const nscoord availBSize = aReflowInput.AvailableBSize();
nscoord finalBSize = NSCoordSaturatingAdd(
NSCoordSaturatingAdd(aBorderPadding.BStart(wm), computedBSizeLeftOver),
aBorderPadding.BEnd(wm));
if (aStatus.IsIncomplete() && finalBSize <= availBSize) {
if (statusFromChildren.IsIncomplete() && finalBSize <= availBSize) {
// We used up all of our element's remaining computed block-size on this
// page/column, but we're incomplete. Set status to complete except for
// overflow.
// page/column, but our children are incomplete. Set aStatus to
// overflow-incomplete.
aStatus.SetOverflowIncomplete();
return finalBSize;
}
if (aStatus.IsComplete()) {
if (statusFromChildren.IsComplete()) {
if (computedBSizeLeftOver > 0 && NS_UNCONSTRAINEDSIZE != availBSize &&
finalBSize > availBSize) {
if (ShouldAvoidBreakInside(aReflowInput)) {
@ -7390,7 +7391,7 @@ nscoord nsBlockFrame::ComputeFinalBSize(const ReflowInput& aReflowInput,
if (aStatus.IsIncomplete()) {
MOZ_ASSERT(finalBSize > availBSize,
"We should be overflow incomplete and should've returned "
"We should be overflow-incomplete and should've returned "
"in early if-branch!");
// Use the current block-size; continuations will take up the rest.

Просмотреть файл

@ -297,9 +297,12 @@ class nsBlockFrame : public nsContainerFrame {
* Compute the final block size of this frame.
*
* @param aReflowInput Data structure passed from parent during reflow.
* @param aReflowStatus A pointer to the reflow status for when we're finished
* doing reflow. this will get set appropriately if the block-size
* causes us to exceed the current available (page) block-size.
* @param aStatus [in/out] The reflow status for this reflow operation. When
* this function is called, aStatus should represent what our status
* would be as if we were shrinkwrapping our children's block-size.
* This function will then adjust aStatus before returning, if our
* status is different in light of our actual final block-size and
* current page/column's available block-size.
* @param aContentBSize The block-size of content, precomputed outside of this
* function. The final block-size that is used in aMetrics will be set
* to either this or the available block-size, whichever is larger, in