From cbb61ab832508e9c231a256fb161d38d35faeabf Mon Sep 17 00:00:00 2001 From: win7-7 Date: Tue, 25 Feb 2020 00:17:54 +0200 Subject: 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. --- layout/mathml/nsMathMLChar.cpp | 3 ++- layout/mathml/nsMathMLContainerFrame.cpp | 4 +--- layout/mathml/nsMathMLContainerFrame.h | 1 - layout/mathml/nsMathMLSelectedFrame.cpp | 5 ++--- layout/mathml/nsMathMLSelectedFrame.h | 1 - layout/mathml/nsMathMLmencloseFrame.cpp | 3 +-- layout/mathml/nsMathMLmencloseFrame.h | 1 - layout/mathml/nsMathMLmfencedFrame.cpp | 3 +-- layout/mathml/nsMathMLmfencedFrame.h | 1 - layout/mathml/nsMathMLmfracFrame.cpp | 3 +-- layout/mathml/nsMathMLmfracFrame.h | 1 - layout/mathml/nsMathMLmoFrame.cpp | 3 +-- layout/mathml/nsMathMLmoFrame.h | 1 - layout/mathml/nsMathMLmrootFrame.cpp | 3 +-- layout/mathml/nsMathMLmrootFrame.h | 1 - 15 files changed, 10 insertions(+), 24 deletions(-) (limited to 'layout/mathml') diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp index 507e32b22..4b02a52d8 100644 --- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -1992,7 +1992,8 @@ nsMathMLChar::Display(nsDisplayListBuilder* aBuilder, if (styleContext != parentContext && NS_GET_A(backg->mBackgroundColor) > 0) { nsDisplayBackgroundImage::AppendBackgroundItemsToTop( - aBuilder, aForFrame, mRect, aLists.BorderBackground(), + aBuilder, aForFrame, mRect + aBuilder->ToReferenceFrame(aForFrame), + aLists.BorderBackground(), /* aAllowWillPaintBorderOptimization */ true, styleContext); } //else diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index 93b631c9d..8e22ba204 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -618,7 +618,6 @@ nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(nsIFrame* aPa void nsMathMLContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { // report an error if something wrong was found in this frame @@ -633,8 +632,7 @@ nsMathMLContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, DisplayBorderBackgroundOutline(aBuilder, aLists); - BuildDisplayListForNonBlockChildren(aBuilder, aDirtyRect, aLists, - DISPLAY_CHILD_INLINE); + BuildDisplayListForNonBlockChildren(aBuilder, aLists, DISPLAY_CHILD_INLINE); #if defined(DEBUG) && defined(SHOW_BOUNDING_BOX) // for visual debug diff --git a/layout/mathml/nsMathMLContainerFrame.h b/layout/mathml/nsMathMLContainerFrame.h index 94ccf70d2..61c59a4fe 100644 --- a/layout/mathml/nsMathMLContainerFrame.h +++ b/layout/mathml/nsMathMLContainerFrame.h @@ -126,7 +126,6 @@ public: } virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override; diff --git a/layout/mathml/nsMathMLSelectedFrame.cpp b/layout/mathml/nsMathMLSelectedFrame.cpp index 2378d0763..11eb14d83 100644 --- a/layout/mathml/nsMathMLSelectedFrame.cpp +++ b/layout/mathml/nsMathMLSelectedFrame.cpp @@ -71,14 +71,13 @@ nsMathMLSelectedFrame::SetInitialChildList(ChildListID aListID, // Only paint the selected child... void nsMathMLSelectedFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { // Report an error if something wrong was found in this frame. // We can't call nsDisplayMathMLError from here, // so ask nsMathMLContainerFrame to do the work for us. if (NS_MATHML_HAS_ERROR(mPresentationData.flags)) { - nsMathMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsMathMLContainerFrame::BuildDisplayList(aBuilder, aLists); return; } @@ -89,7 +88,7 @@ nsMathMLSelectedFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // Put the child's background directly onto the content list nsDisplayListSet set(aLists, aLists.Content()); // The children should be in content order - BuildDisplayListForChild(aBuilder, childFrame, aDirtyRect, set); + BuildDisplayListForChild(aBuilder, childFrame, set); } #if defined(DEBUG) && defined(SHOW_BOUNDING_BOX) diff --git a/layout/mathml/nsMathMLSelectedFrame.h b/layout/mathml/nsMathMLSelectedFrame.h index ad523a594..872351829 100644 --- a/layout/mathml/nsMathMLSelectedFrame.h +++ b/layout/mathml/nsMathMLSelectedFrame.h @@ -26,7 +26,6 @@ public: ChildListChanged(int32_t aModType) override; virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; virtual nsresult diff --git a/layout/mathml/nsMathMLmencloseFrame.cpp b/layout/mathml/nsMathMLmencloseFrame.cpp index 64277a92e..236a5ab07 100644 --- a/layout/mathml/nsMathMLmencloseFrame.cpp +++ b/layout/mathml/nsMathMLmencloseFrame.cpp @@ -201,12 +201,11 @@ nsMathMLmencloseFrame::TransmitAutomaticData() void nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { ///////////// // paint the menclosed content - nsMathMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsMathMLContainerFrame::BuildDisplayList(aBuilder, aLists); if (NS_MATHML_HAS_ERROR(mPresentationData.flags)) return; diff --git a/layout/mathml/nsMathMLmencloseFrame.h b/layout/mathml/nsMathMLmencloseFrame.h index 82d73b2cf..e9e7a2b0a 100644 --- a/layout/mathml/nsMathMLmencloseFrame.h +++ b/layout/mathml/nsMathMLmencloseFrame.h @@ -70,7 +70,6 @@ public: GetAdditionalStyleContext(int32_t aIndex) const override; virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; NS_IMETHOD diff --git a/layout/mathml/nsMathMLmfencedFrame.cpp b/layout/mathml/nsMathMLmfencedFrame.cpp index ca780e649..5d66e541b 100644 --- a/layout/mathml/nsMathMLmfencedFrame.cpp +++ b/layout/mathml/nsMathMLmfencedFrame.cpp @@ -161,12 +161,11 @@ nsMathMLmfencedFrame::CreateFencesAndSeparators(nsPresContext* aPresContext) void nsMathMLmfencedFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { ///////////// // display the content - nsMathMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsMathMLContainerFrame::BuildDisplayList(aBuilder, aLists); //////////// // display fences and separators diff --git a/layout/mathml/nsMathMLmfencedFrame.h b/layout/mathml/nsMathMLmfencedFrame.h index 2d7535d0c..472e5aed9 100644 --- a/layout/mathml/nsMathMLmfencedFrame.h +++ b/layout/mathml/nsMathMLmfencedFrame.h @@ -41,7 +41,6 @@ public: nsReflowStatus& aStatus) override; virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; virtual void diff --git a/layout/mathml/nsMathMLmfracFrame.cpp b/layout/mathml/nsMathMLmfracFrame.cpp index 4e74faea2..731cca7d0 100644 --- a/layout/mathml/nsMathMLmfracFrame.cpp +++ b/layout/mathml/nsMathMLmfracFrame.cpp @@ -149,12 +149,11 @@ nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext, void nsMathMLmfracFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { ///////////// // paint the numerator and denominator - nsMathMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsMathMLContainerFrame::BuildDisplayList(aBuilder, aLists); ///////////// // paint the fraction line diff --git a/layout/mathml/nsMathMLmfracFrame.h b/layout/mathml/nsMathMLmfracFrame.h index 330a31180..8ced03694 100644 --- a/layout/mathml/nsMathMLmfracFrame.h +++ b/layout/mathml/nsMathMLmfracFrame.h @@ -67,7 +67,6 @@ public: ReflowOutput& aDesiredSize) override; virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; virtual nsresult diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp index 591b46309..3ef7b88d0 100644 --- a/layout/mathml/nsMathMLmoFrame.cpp +++ b/layout/mathml/nsMathMLmoFrame.cpp @@ -78,14 +78,13 @@ nsMathMLmoFrame::UseMathMLChar() void nsMathMLmoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { bool useMathMLChar = UseMathMLChar(); if (!useMathMLChar) { // let the base class do everything - nsMathMLTokenFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsMathMLTokenFrame::BuildDisplayList(aBuilder, aLists); } else { DisplayBorderBackgroundOutline(aBuilder, aLists); diff --git a/layout/mathml/nsMathMLmoFrame.h b/layout/mathml/nsMathMLmoFrame.h index f25107a20..15df62ac2 100644 --- a/layout/mathml/nsMathMLmoFrame.h +++ b/layout/mathml/nsMathMLmoFrame.h @@ -29,7 +29,6 @@ public: GetAdditionalStyleContext(int32_t aIndex) const override; virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; NS_IMETHOD diff --git a/layout/mathml/nsMathMLmrootFrame.cpp b/layout/mathml/nsMathMLmrootFrame.cpp index 4c81bde3d..300adcb91 100644 --- a/layout/mathml/nsMathMLmrootFrame.cpp +++ b/layout/mathml/nsMathMLmrootFrame.cpp @@ -77,12 +77,11 @@ nsMathMLmrootFrame::TransmitAutomaticData() void nsMathMLmrootFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { ///////////// // paint the content we are square-rooting - nsMathMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsMathMLContainerFrame::BuildDisplayList(aBuilder, aLists); ///////////// // paint the sqrt symbol diff --git a/layout/mathml/nsMathMLmrootFrame.h b/layout/mathml/nsMathMLmrootFrame.h index 0996af26b..ddf6f89a6 100644 --- a/layout/mathml/nsMathMLmrootFrame.h +++ b/layout/mathml/nsMathMLmrootFrame.h @@ -51,7 +51,6 @@ public: ReflowOutput& aDesiredSize) override; virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; uint8_t -- cgit v1.2.3