This fixes the failure of
layout/reftests/css-grid/grid-min-max-content-sizing-002.html with the
primary patch in bug 1308876 (which causes a child whose parent is dirty
to pick up the dirty bit from the parent only the first reflow of the
child if the parent reflows the child multiple times). A simplified
testcase for that failure is
https://bugzilla.mozilla.org/attachment.cgi?id=8849771 .
The failure was caused by an error in height calculation of the first
<x> in the test. The div that is the parent of that x has a definite
height (presumably due to rules in grid), and the x has a specified
height. The div gets three reflows: two measuring reflows (from
MinContentContribution and then from MaxContentContribution) and then a
final reflow from nsGridContainerFrame::ReflowInFlowChild. Prior to the
primary patch in this bug, the div was marked dirty on all three
reflows, but with it it is marked dirty only on the first. This means
that, without the block-resize flag, the div optimizes away the reflow
of its children, since ShouldReflowAllKids returns false because
IsBResize() is false, even though NS_FRAME_CONTAINS_RELATIVE_BSIZE is
correctly set.
In order to fix this, we need to make sure the BResize flag on the
reflow state in at least some cases (see the comments in the patch for
when, and for how the cases could be optimized in the future).
Note that:
* when the dirty bit is set on the grid container, the new behavior
(with the combination of the patches) is strictly more efficient than
the old, since we will sometimes do non-dirty reflows on the grid
items (with the b-resize flag)
* when the dirty bit is *not* set on the grid container, the new
behavior is less efficient than the old, since we will set the
b-resize flag when we did not do so before. However, this slowdown
fixes existing bugs such as the one in the reftest.
Given that I was able to construct a reftest that triggers the failure
without the changes from bug 1308876, I've moved this to a separate bug.
Without the patch, grid-measuring-reflow-resize-dynamic-001.html fails,
but grid-measuring-reflow-resize-static-001.html passes. With the patch
both tests pass. (And without the patch, doing a text zoom on the
dynamic test fixes the layout error.)
MozReview-Commit-ID: JQOdVTQIkU0
--HG--
extra : transplant_source : %8B%2ARO%3B%D0%7B%EC%C9_%B3%60Sp%F9T%14X%85%DC
When mArray is used it contains all grid container children, including
placeholders. aGridItemCount always excludes placeholders.
MozReview-Commit-ID: 2RVFOdVvTq
The calculated 'fr' value might change in the second round (after
applying min/max-size) even if it's zero in the first round.
MozReview-Commit-ID: 60moiyoWwuo
The "origSizes.isSome()" condition on the outer if-block was
a logical mistake. We should check it before re-assigning
mSizes though (this was the optimization originally intended).
MozReview-Commit-ID: AooUHYKG3jB
This patch is written by the following script with some manual adjustment to
the comment in nsRubyTextContainerFrame.cpp and nsRubyFrame.cpp, and
nsColumnSetFrame's constructor.
function rename() {
find layout\
-type f\
\( -name "*.cpp" -or\
-name "*.h" \)\
-exec sed -i -r "s/$1/$2/g" "{}" \;
}
rename "nsReflowStatus *([a-zA-Z0-9]*) = NS_FRAME_COMPLETE" "nsReflowStatus \1"
rename "([a-zA-Z0-9.*]*) *= NS_FRAME_COMPLETE;" "\1.Reset();"
rename "([a-zA-Z0-9.*]*) == NS_FRAME_COMPLETE" "\1.IsEmpty()"
MozReview-Commit-ID: 9tqQAHvdQex
--HG--
extra : rebase_source : 3119776946dc2c8350098b7bf9f3ceff29bdffb5
NS_INLINE_MAKE_BREAK_TYPE is used only in BRFrame. Delete it, too.
MozReview-Commit-ID: GC4vF0GFsAD
--HG--
extra : rebase_source : d7727fe41410a8998142d9ded8dcd8ae9c2a780f
NS_INLINE_LINE_BREAK_BEFORE() was replaced by the help of the following script.
function rename() {
find layout\
-type f\
\( -name "*.cpp" -or\
-name "*.h" \)\
-exec sed -i -r "s/$1/$2/g" "{}" \;
}
rename " = NS_INLINE_LINE_BREAK_BEFORE\(\);" ".SetInlineLineBreakBeforeAndReset();"
MozReview-Commit-ID: mz6L8zay7q
--HG--
extra : rebase_source : fddffa1288c7a52c7245aec0839a65f8d1d3f008
Also, remove NS_FRAME_TRUNCATED and NS_FRAME_REFLOW_NEXTINFLOW because both
are used only by NS_MergeReflowStatusInto().
MozReview-Commit-ID: LsPOji9j2e
--HG--
extra : rebase_source : 7cf1421c066f0f8df3e8402b84ae0f584cad2d11
This patch is written by the help of the following script.
function rename() {
find layout\
-type f\
\( -name "*.cpp" -or\
-name "*.h" \)\
-exec sed -i -r "s/$1/$2/g" "{}" \;
}
rename "NS_FRAME_SET_OVERFLOW_INCOMPLETE\(\*([a-zA-Z0-9.*]*)\)" "\1->SetOverflowIncomplete()"
rename "NS_FRAME_SET_OVERFLOW_INCOMPLETE\(([a-zA-Z0-9.*]*)\)" "\1.SetOverflowIncomplete()"
MozReview-Commit-ID: EJOIs84vwev
--HG--
extra : rebase_source : 59a5ac827f57e7a0e50910f5a813c44560baeb00
This patch is written by the help of the following script.
function rename() {
find layout\
-type f\
\( -name "*.cpp" -or\
-name "*.h" \)\
-exec sed -i -r "s/$1/$2/g" "{}" \;
}
rename "NS_FRAME_SET_INCOMPLETE\(\*([a-zA-Z0-9.*]*)\)" "\1->SetIncomplete()"
rename "NS_FRAME_SET_INCOMPLETE\(([a-zA-Z0-9.*]*)\)" "\1.SetIncomplete()"
MozReview-Commit-ID: GOd4y2N6dcz
--HG--
extra : rebase_source : 185f5d6f5a3c8306761860c579eff10d931f3b35
This patch is written by the help of the following script.
function rename() {
find layout\
-type f\
\( -name "*.cpp" -or\
-name "*.h" \)\
-exec sed -i -r "s/$1/$2/g" "{}" \;
}
rename "NS_FRAME_IS_COMPLETE\(([a-zA-Z0-9.*]*)\)" "\1.IsComplete()"
MozReview-Commit-ID: GOd4y2N6dcz
--HG--
extra : rebase_source : aa8b11d3a756c9e7c521e6ffd70713af0174bd98
This patch is written by the help of the following script.
function rename() {
find layout\
-type f\
\( -name "*.cpp" -or\
-name "*.h" \)\
-exec sed -i -r "s/$1/$2/g" "{}" \;
}
rename "NS_FRAME_IS_FULLY_COMPLETE\(([a-zA-Z0-9.*]*)\)" "\1.IsFullyComplete()"
MozReview-Commit-ID: GOd4y2N6dcz
--HG--
extra : rebase_source : 200639e836cebe26fd77cde21f478fd027e1725f
This patch is written by the help of the following script.
function rename() {
find layout\
-type f\
\( -name "*.cpp" -or\
-name "*.h" \)\
-exec sed -i -r "s/$1/$2/g" "{}" \;
}
rename "NS_FRAME_IS_NOT_COMPLETE\(([a-zA-Z0-9.*]*)\)" "\1.IsIncomplete()"
MozReview-Commit-ID: GOd4y2N6dcz
--HG--
extra : rebase_source : 412b60e7954118d8443ebf2a786046d7cd38c516
This grid implementation is similar to the one on nsFlexContainerFrame, with a few simplifications:
- We can simply use the LogicalAxis to decide between align-* vs justify-* prpoerties (whereas flexbox has extra abstraction from the flex axes).
- We don't have to bother with "align-content" or "justify-content", since those apply to grid areas rather than to children. (And any grid area that's involved will be sized/positioned separately.)
- Grid can unconditionally treat "flex-start" & "flex-end" as "start" & "end".
MozReview-Commit-ID: 9l1Wq9Cq5T0