Bug 1699317 Part 2 - Make ConsiderBlockEndEdgeOfChildren() a nsBlockFrame method. r=emilio

In Bug 1527949, we are going to add block-end padding of the block
container to aBEndEdgeOfChildren, so we need this patch in order to
query GetLogicalUsedPadding().

Differential Revision: https://phabricator.services.mozilla.com/D108889
This commit is contained in:
Ting-Yu Lin 2021-03-18 04:41:14 +00:00
parent a5dfdac62f
commit 8f13019656
2 changed files with 19 additions and 10 deletions

View File

@ -2042,10 +2042,11 @@ void nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowInput,
#endif
}
static void ConsiderBlockEndEdgeOfChildren(const WritingMode aWritingMode,
nscoord aBEndEdgeOfChildren,
OverflowAreas& aOverflowAreas,
const nsStyleDisplay* aDisplay) {
void nsBlockFrame::ConsiderBlockEndEdgeOfChildren(
OverflowAreas& aOverflowAreas, nscoord aBEndEdgeOfChildren,
const nsStyleDisplay* aDisplay) const {
const auto wm = GetWritingMode();
// Factor in the block-end edge of the children. Child frames will be added
// to the overflow area as we iterate through the lines, but their margins
// won't, so we need to account for block-end margins here.
@ -2055,8 +2056,8 @@ static void ConsiderBlockEndEdgeOfChildren(const WritingMode aWritingMode,
// XXX Currently, overflow areas are stored as physical rects, so we have
// to handle writing modes explicitly here. If we change overflow rects
// to be stored logically, this can be simplified again.
if (aWritingMode.IsVertical()) {
if (aWritingMode.IsVerticalLR()) {
if (wm.IsVertical()) {
if (wm.IsVerticalLR()) {
for (const auto otype : AllOverflowTypes()) {
if (!(aDisplay->IsContainLayout() &&
otype == OverflowType::Scrollable)) {
@ -2121,8 +2122,8 @@ void nsBlockFrame::ComputeOverflowAreas(OverflowAreas& aOverflowAreas,
aOverflowAreas.UnionAllWith(outsideMarker->GetRect());
}
ConsiderBlockEndEdgeOfChildren(GetWritingMode(), aBEndEdgeOfChildren,
aOverflowAreas, aDisplay);
ConsiderBlockEndEdgeOfChildren(aOverflowAreas, aBEndEdgeOfChildren,
aDisplay);
}
#ifdef NOISY_OVERFLOW_AREAS
@ -2169,8 +2170,8 @@ bool nsBlockFrame::ComputeCustomOverflow(OverflowAreas& aOverflowAreas) {
nscoord blockEndEdgeOfChildren =
GetProperty(BlockEndEdgeOfChildrenProperty(), &found);
if (found) {
ConsiderBlockEndEdgeOfChildren(GetWritingMode(), blockEndEdgeOfChildren,
aOverflowAreas, StyleDisplay());
ConsiderBlockEndEdgeOfChildren(aOverflowAreas, blockEndEdgeOfChildren,
StyleDisplay());
}
// Line cursor invariants depend on the overflow areas of the lines, so

View File

@ -480,6 +480,14 @@ class nsBlockFrame : public nsContainerFrame {
nscoord aBEndEdgeOfChildren,
const nsStyleDisplay* aDisplay) const;
/**
* Helper method for ComputeOverflowAreas(). Incorporates aBEndEdgeOfChildren
* into the aOverflowAreas.
*/
void ConsiderBlockEndEdgeOfChildren(mozilla::OverflowAreas& aOverflowAreas,
nscoord aBEndEdgeOfChildren,
const nsStyleDisplay* aDisplay) const;
/**
* Add the frames in aFrameList to this block after aPrevSibling.
* This block thinks in terms of lines, but the frame construction code