summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsSubDocumentFrame.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/nsSubDocumentFrame.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/nsSubDocumentFrame.cpp')
-rw-r--r--layout/generic/nsSubDocumentFrame.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp
index 47026b73c..1c5ade583 100644
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -327,7 +327,6 @@ WrapBackgroundColorInOwnLayer(nsDisplayListBuilder* aBuilder,
void
nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
- const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
if (!IsVisibleForPainting(aBuilder))
@@ -343,7 +342,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
bool pointerEventsNone =
StyleUserInterface()->mPointerEvents == NS_STYLE_POINTER_EVENTS_NONE;
if (!aBuilder->IsForEventDelivery() || !pointerEventsNone) {
- nsDisplayListCollection decorations;
+ nsDisplayListCollection decorations(aBuilder);
DisplayBorderBackgroundOutline(aBuilder, decorations);
if (rfp) {
// Wrap background colors of <iframe>s with remote subdocuments in their
@@ -368,7 +367,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
if (rfp) {
- rfp->BuildDisplayList(aBuilder, this, aDirtyRect, aLists);
+ rfp->BuildDisplayList(aBuilder, this, aLists);
return;
}
@@ -387,23 +386,28 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
int32_t parentAPD = PresContext()->AppUnitsPerDevPixel();
int32_t subdocAPD = presContext->AppUnitsPerDevPixel();
+ nsRect visible;
nsRect dirty;
bool haveDisplayPort = false;
bool ignoreViewportScrolling = false;
nsIFrame* savedIgnoreScrollFrame = nullptr;
if (subdocRootFrame) {
// get the dirty rect relative to the root frame of the subdoc
- dirty = aDirtyRect + GetOffsetToCrossDoc(subdocRootFrame);
+ visible = aBuilder->GetVisibleRect() + GetOffsetToCrossDoc(subdocRootFrame);
+ dirty = aBuilder->GetDirtyRect() + GetOffsetToCrossDoc(subdocRootFrame);
// and convert into the appunits of the subdoc
+ visible = visible.ScaleToOtherAppUnitsRoundOut(parentAPD, subdocAPD);
dirty = dirty.ScaleToOtherAppUnitsRoundOut(parentAPD, subdocAPD);
if (nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame()) {
nsIScrollableFrame* rootScrollableFrame = presShell->GetRootScrollFrameAsScrollable();
MOZ_ASSERT(rootScrollableFrame);
- // Use a copy, so the dirty rect doesn't get modified to the display port.
- nsRect copy = dirty;
+ // Use a copy, so the rects don't get modified.
+ nsRect copyOfDirty = dirty;
+ nsRect copyOfVisible = visible;
haveDisplayPort = rootScrollableFrame->DecideScrollableLayer(aBuilder,
- &copy, /* aAllowCreateDisplayPort = */ true);
+ &copyOfVisible, &copyOfDirty,
+ /* aAllowCreateDisplayPort = */ true);
if (!gfxPrefs::LayoutUseContainersForRootFrames()) {
haveDisplayPort = false;
}
@@ -417,7 +421,8 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
aBuilder->EnterPresShell(subdocRootFrame, pointerEventsNone);
} else {
- dirty = aDirtyRect;
+ visible = aBuilder->GetVisibleRect();
+ dirty = aBuilder->GetDirtyRect();
}
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
@@ -456,6 +461,13 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nestedClipState.EnterStackingContextContents(true);
}
+ // Invoke AutoBuildingDisplayList to ensure that the correct dirty rect
+ // is used to compute the visible rect if AddCanvasBackgroundColorItem
+ // creates a display item.
+ nsIFrame* frame = subdocRootFrame ? subdocRootFrame : this;
+ nsDisplayListBuilder::AutoBuildingDisplayList
+ building(aBuilder, frame, visible, dirty, true);
+
if (subdocRootFrame) {
nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
nsDisplayListBuilder::AutoCurrentScrollParentIdSetter idSetter(
@@ -466,7 +478,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
aBuilder->SetAncestorHasApzAwareEventHandler(false);
subdocRootFrame->
- BuildDisplayListForStackingContext(aBuilder, dirty, &childItems);
+ BuildDisplayListForStackingContext(aBuilder, &childItems);
}
if (!aBuilder->IsForEventDelivery()) {
@@ -485,15 +497,8 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// painted on the page itself.
if (nsLayoutUtils::NeedsPrintPreviewBackground(presContext)) {
presShell->AddPrintPreviewBackgroundItem(
- *aBuilder, childItems, subdocRootFrame ? subdocRootFrame : this,
- bounds);
+ *aBuilder, childItems, frame, bounds);
} else {
- // Invoke AutoBuildingDisplayList to ensure that the correct dirty rect
- // is used to compute the visible rect if AddCanvasBackgroundColorItem
- // creates a display item.
- nsIFrame* frame = subdocRootFrame ? subdocRootFrame : this;
- nsDisplayListBuilder::AutoBuildingDisplayList
- building(aBuilder, frame, dirty, true);
// Add the canvas background color to the bottom of the list. This
// happens after we've built the list so that AddCanvasBackgroundColorItem
// can monkey with the contents if necessary.