summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsBlockFrame.cpp
diff options
context:
space:
mode:
authorwin7-7 <win7-7@users.noreply.github.com>2020-02-25 00:17:54 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:58:11 +0200
commitcbb61ab832508e9c231a256fb161d38d35faeabf (patch)
treefe4ffc233045d9b461460e19d31fcfbe64cae59f /layout/generic/nsBlockFrame.cpp
parentcf288a1847afc0f101ff64afc29d8a2c3f7ffb03 (diff)
downloadUXP-cbb61ab832508e9c231a256fb161d38d35faeabf.tar
UXP-cbb61ab832508e9c231a256fb161d38d35faeabf.tar.gz
UXP-cbb61ab832508e9c231a256fb161d38d35faeabf.tar.lz
UXP-cbb61ab832508e9c231a256fb161d38d35faeabf.tar.xz
UXP-cbb61ab832508e9c231a256fb161d38d35faeabf.zip
Issue #1355 - Better way to create display items for column backgrounds
Part 1: Remove current table item, as it's never set. Part 2: Get rid of generic table painting code, and handle each class separately. Part 4: Hoist outline skipping into col(group) frame code. Part 5: Skip box-shadow for table column and column groups. Part 6: Store column and column group backgrounds separately, and then append them before the rest of the table contents. Part 7: Pass rects in display list coordinates to AppendBackgroundItemsToTop. Part 8: Create column and column group background display items as part of the cell's BuildDisplayList. Part 9: Used cached values instead of calling nsDisplayListBuilder::ToReferenceFrame when possible, since it can be expensive when the requested frame isn't the builder's current frame. Part 10: Make sure we build display items for table parts where only the normal position is visible, since we may need to create background items for ancestors at that position. Part 11: Create an AutoBuildingDisplayList when we create background items for table columns and column groups, so that we initialize the invalidation state correctly.
Diffstat (limited to 'layout/generic/nsBlockFrame.cpp')
-rw-r--r--layout/generic/nsBlockFrame.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp
index a37bfc06b..93de79cef 100644
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -6527,13 +6527,14 @@ static void DebugOutputDrawLine(int32_t aDepth, nsLineBox* aLine, bool aDrawn) {
static void
DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea,
- const nsRect& aDirtyRect, nsBlockFrame::LineIterator& aLine,
+ nsBlockFrame::LineIterator& aLine,
int32_t aDepth, int32_t& aDrawnLines, const nsDisplayListSet& aLists,
nsBlockFrame* aFrame, TextOverflow* aTextOverflow) {
// If the line's combined area (which includes child frames that
// stick outside of the line's bounding box or our bounding box)
// intersects the dirty rect then paint the line.
- bool intersect = aLineArea.Intersects(aDirtyRect);
+ bool intersect = aLineArea.Intersects(aBuilder->GetDirtyRect());
+ bool visible = aLineArea.Intersects(aBuilder->GetVisibleRect());
#ifdef DEBUG
if (nsBlockFrame::gLamePaintMetrics) {
aDrawnLines++;
@@ -6549,14 +6550,14 @@ DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea,
// frame in the line, it's also true for aFrame.
bool lineInline = aLine->IsInline();
bool lineMayHaveTextOverflow = aTextOverflow && lineInline;
- if (!intersect && !aBuilder->ShouldDescendIntoFrame(aFrame) &&
+ if (!intersect && !aBuilder->ShouldDescendIntoFrame(aFrame, visible) &&
!lineMayHaveTextOverflow)
return;
// Collect our line's display items in a temporary nsDisplayListCollection,
// so that we can apply any "text-overflow" clipping to the entire collection
// without affecting previous lines.
- nsDisplayListCollection collection;
+ nsDisplayListCollection collection(aBuilder);
// Block-level child backgrounds go on the blockBorderBackgrounds list ...
// Inline-level child backgrounds go on the regular child content list.
@@ -6568,8 +6569,7 @@ DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea,
nsIFrame* kid = aLine->mFirstChild;
int32_t n = aLine->GetChildCount();
while (--n >= 0) {
- aFrame->BuildDisplayListForChild(aBuilder, kid, aDirtyRect,
- childLists, flags);
+ aFrame->BuildDisplayListForChild(aBuilder, kid, childLists, flags);
kid = kid->GetNextSibling();
}
@@ -6582,13 +6582,13 @@ DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea,
void
nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
- const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
int32_t drawnLines; // Will only be used if set (gLamePaintMetrics).
int32_t depth = 0;
#ifdef DEBUG
if (gNoisyDamageRepair) {
+ nsRect dirty = aBuilder->GetDirtyRect();
depth = GetDepth();
nsRect ca;
::ComputeVisualOverflowArea(mLines, mRect.width, mRect.height, ca);
@@ -6596,7 +6596,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
ListTag(stdout);
printf(": bounds=%d,%d,%d,%d dirty(absolute)=%d,%d,%d,%d ca=%d,%d,%d,%d\n",
mRect.x, mRect.y, mRect.width, mRect.height,
- aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height,
+ dirty.x, dirty.y, dirty.width, dirty.height,
ca.x, ca.y, ca.width, ca.height);
}
PRTime start = 0; // Initialize these variables to silence the compiler.
@@ -6609,21 +6609,21 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
DisplayBorderBackgroundOutline(aBuilder, aLists);
if (GetPrevInFlow()) {
- DisplayOverflowContainers(aBuilder, aDirtyRect, aLists);
+ DisplayOverflowContainers(aBuilder, aLists);
for (nsIFrame* f : mFloats) {
if (f->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT)
- BuildDisplayListForChild(aBuilder, f, aDirtyRect, aLists);
+ BuildDisplayListForChild(aBuilder, f, aLists);
}
}
- aBuilder->MarkFramesForDisplayList(this, mFloats, aDirtyRect);
+ aBuilder->MarkFramesForDisplayList(this, mFloats);
// Prepare for text-overflow processing.
UniquePtr<TextOverflow> textOverflow(
TextOverflow::WillProcessLines(aBuilder, this));
// We'll collect our lines' display items here, & then append this to aLists.
- nsDisplayListCollection linesDisplayListCollection;
+ nsDisplayListCollection linesDisplayListCollection(aBuilder);
// Don't use the line cursor if we might have a descendant placeholder ...
// it might skip lines that contain placeholders but don't themselves
@@ -6632,8 +6632,8 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// on all our child frames, but that might be expensive. So we
// approximate it by checking it on |this|; if it's true for any
// frame in our child list, it's also true for |this|.
- nsLineBox* cursor = aBuilder->ShouldDescendIntoFrame(this) ?
- nullptr : GetFirstLineContaining(aDirtyRect.y);
+ nsLineBox* cursor = (aBuilder->ShouldDescendIntoFrame(this, true)) ?
+ nullptr : GetFirstLineContaining(aBuilder->GetDirtyRect().y);
LineIterator line_end = LinesEnd();
if (cursor) {
@@ -6644,10 +6644,10 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (!lineArea.IsEmpty()) {
// Because we have a cursor, the combinedArea.ys are non-decreasing.
// Once we've passed aDirtyRect.YMost(), we can never see it again.
- if (lineArea.y >= aDirtyRect.YMost()) {
+ if (lineArea.y >= aBuilder->GetDirtyRect().YMost()) {
break;
}
- DisplayLine(aBuilder, lineArea, aDirtyRect, line, depth, drawnLines,
+ DisplayLine(aBuilder, lineArea, line, depth, drawnLines,
linesDisplayListCollection, this, textOverflow.get());
}
}
@@ -6660,7 +6660,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
line != line_end;
++line) {
nsRect lineArea = line->GetVisualOverflowArea();
- DisplayLine(aBuilder, lineArea, aDirtyRect, line, depth, drawnLines,
+ DisplayLine(aBuilder, lineArea, line, depth, drawnLines,
linesDisplayListCollection, this, textOverflow.get());
if (!lineArea.IsEmpty()) {
if (lineArea.y < lastY
@@ -6690,7 +6690,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (HasOutsideBullet()) {
// Display outside bullets manually
nsIFrame* bullet = GetOutsideBullet();
- BuildDisplayListForChild(aBuilder, bullet, aDirtyRect, aLists);
+ BuildDisplayListForChild(aBuilder, bullet, aLists);
}
#ifdef DEBUG