From 528abd534ef3e785d4a926a235e58f5c5179aef5 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 29 Apr 2020 12:36:53 +0000 Subject: Issue #80 - De-unify layout/base --- layout/base/MaskLayerImageCache.h | 1 + layout/base/MobileViewportManager.h | 3 +++ layout/base/RestyleManager.cpp | 7 +------ layout/base/RestyleManager.h | 6 ++++++ layout/base/RestyleManagerBase.cpp | 18 ++++++++++++++++++ layout/base/ServoRestyleManager.cpp | 1 + layout/base/TouchManager.cpp | 2 ++ layout/base/moz.build | 11 +++-------- layout/base/nsFrameTraversal.cpp | 1 + layout/base/nsLayoutUtils.cpp | 1 + layout/base/nsPresShell.cpp | 6 +++++- 11 files changed, 42 insertions(+), 15 deletions(-) (limited to 'layout/base') diff --git a/layout/base/MaskLayerImageCache.h b/layout/base/MaskLayerImageCache.h index b18fe5aa1..61881de83 100644 --- a/layout/base/MaskLayerImageCache.h +++ b/layout/base/MaskLayerImageCache.h @@ -10,6 +10,7 @@ #include "nsAutoPtr.h" #include "nsPresContext.h" #include "mozilla/gfx/Matrix.h" +#include "mozilla/layers/ShadowLayers.h" namespace mozilla { diff --git a/layout/base/MobileViewportManager.h b/layout/base/MobileViewportManager.h index 63128b281..6324a8645 100644 --- a/layout/base/MobileViewportManager.h +++ b/layout/base/MobileViewportManager.h @@ -7,8 +7,11 @@ #define MobileViewportManager_h_ #include "mozilla/Maybe.h" +#include "nsIDocument.h" #include "nsIDOMEventListener.h" +#include "nsIDOMEventTarget.h" #include "nsIObserver.h" +#include "nsViewportInfo.h" #include "Units.h" class nsIDOMEventTarget; diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 124b5535e..a5a4e1237 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -239,11 +239,6 @@ RestyleManager::AnimationsWithDestroyedFrame::StopAnimationsWithoutFrame( } } -static inline dom::Element* -ElementForStyleContext(nsIContent* aParentContent, - nsIFrame* aFrame, - CSSPseudoElementType aPseudoType); - // Forwarded nsIDocumentObserver method, to handle restyling (and // passing the notification to the frame). nsresult @@ -1008,7 +1003,7 @@ RestyleManager::TryInitiatingTransition(nsPresContext* aPresContext, return *aNewStyleContext != sc; } -static dom::Element* +dom::Element* ElementForStyleContext(nsIContent* aParentContent, nsIFrame* aFrame, CSSPseudoElementType aPseudoType) diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index e22fe9058..4886d77bc 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -191,6 +191,7 @@ public: MOZ_ASSERT(false, "unexpected aPseudoType"); return nullptr; } + private: RestyleManager* mRestyleManager; AutoRestore mRestorePointer; @@ -880,6 +881,11 @@ private: AutoTArray mAncestors; }; +dom::Element* +ElementForStyleContext(nsIContent* aParentContent, + nsIFrame* aFrame, + CSSPseudoElementType aPseudoType); + } // namespace mozilla #endif /* mozilla_RestyleManager_h */ diff --git a/layout/base/RestyleManagerBase.cpp b/layout/base/RestyleManagerBase.cpp index 6ef048a19..e2145934b 100644 --- a/layout/base/RestyleManagerBase.cpp +++ b/layout/base/RestyleManagerBase.cpp @@ -5,8 +5,26 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/RestyleManagerBase.h" +#include "mozilla/RestyleManager.h" #include "mozilla/StyleSetHandle.h" +#include "mozilla/StyleSetHandleInlines.h" // for Ptr::HasStateDependentStyle +#include "ActiveLayerTracker.h" +#include "nsCSSFrameConstructor.h" +#include "nsCSSRendering.h" #include "nsIFrame.h" +#include "nsIFrameInlines.h" // for IsAbsPosContainingBlock +#include "nsPlaceholderFrame.h" +#include "nsStyleChangeList.h" +#include "nsStyleStructInlines.h" // for HasTransform +#include "nsSVGEffects.h" +#include "nsSVGIntegrationUtils.h" +#include "nsSVGUtils.h" +#include "nsViewportFrame.h" +#include "StickyScrollContainer.h" +#include "SVGTextFrame.h" + +using namespace mozilla; +using namespace mozilla::layers; namespace mozilla { diff --git a/layout/base/ServoRestyleManager.cpp b/layout/base/ServoRestyleManager.cpp index 42ca23bb1..82c81ea46 100644 --- a/layout/base/ServoRestyleManager.cpp +++ b/layout/base/ServoRestyleManager.cpp @@ -9,6 +9,7 @@ #include "mozilla/ServoStyleSet.h" #include "mozilla/dom/ChildIterator.h" #include "nsContentUtils.h" +#include "nsCSSFrameConstructor.h" #include "nsPrintfCString.h" #include "nsStyleChangeList.h" diff --git a/layout/base/TouchManager.cpp b/layout/base/TouchManager.cpp index 5167ca588..e7972d5af 100644 --- a/layout/base/TouchManager.cpp +++ b/layout/base/TouchManager.cpp @@ -12,6 +12,8 @@ #include "nsPresShell.h" #include "nsView.h" +using namespace mozilla::dom; + namespace mozilla { nsDataHashtable* TouchManager::sCaptureTouchList; diff --git a/layout/base/moz.build b/layout/base/moz.build index afc683665..f115280ce 100644 --- a/layout/base/moz.build +++ b/layout/base/moz.build @@ -119,7 +119,7 @@ EXPORTS.mozilla += [ 'StaticPresData.h', ] -UNIFIED_SOURCES += [ +SOURCES += [ 'AccessibleCaret.cpp', 'AccessibleCaretEventHub.cpp', 'AccessibleCaretManager.cpp', @@ -151,9 +151,11 @@ UNIFIED_SOURCES += [ 'nsLayoutDebugger.cpp', 'nsLayoutHistoryState.cpp', 'nsLayoutUtils.cpp', + 'nsPresArena.cpp', 'nsPresContext.cpp', 'nsPresShell.cpp', 'nsQuoteList.cpp', + 'nsRefreshDriver.cpp', 'nsStyleChangeList.cpp', 'nsStyleSheetService.cpp', 'PaintTracker.cpp', @@ -169,13 +171,6 @@ UNIFIED_SOURCES += [ 'ZoomConstraintsClient.cpp', ] -# nsPresArena.cpp needs to be built separately because it uses plarena.h. -# nsRefreshDriver.cpp needs to be built separately because of name clashes in the OS X headers -SOURCES += [ - 'nsPresArena.cpp', - 'nsRefreshDriver.cpp', -] - if CONFIG['ENABLE_TESTS']: DIRS += ['gtest'] diff --git a/layout/base/nsFrameTraversal.cpp b/layout/base/nsFrameTraversal.cpp index 40fb5ff30..ab07d07df 100644 --- a/layout/base/nsFrameTraversal.cpp +++ b/layout/base/nsFrameTraversal.cpp @@ -10,6 +10,7 @@ #include "nsPlaceholderFrame.h" #include "nsContainerFrame.h" +using namespace mozilla; class nsFrameIterator : public nsIFrameEnumerator { diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 21d20c69f..04ac9ef52 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -118,6 +118,7 @@ #include "mozilla/StyleSetHandleInlines.h" #include "RegionBuilder.h" #include "SVGSVGElement.h" +#include "nsDocument.h" #ifdef MOZ_XUL #include "nsXULPopupManager.h" diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 264b52b18..2615bbc49 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -58,6 +58,7 @@ #include "nsNameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816) #include "nsFrame.h" #include "FrameLayerBuilder.h" +#include "FrameMetrics.h" // for ViewID #include "nsViewManager.h" #include "nsView.h" #include "nsCRTGlue.h" @@ -162,11 +163,12 @@ #endif -#include "mozilla/layers/CompositorBridgeChild.h" #include "GeckoProfiler.h" #include "gfxPlatform.h" #include "Layers.h" #include "LayerTreeInvalidation.h" +#include "ClientLayerManager.h" +#include "mozilla/layers/CompositorBridgeChild.h" #include "mozilla/css/ImageLoader.h" #include "mozilla/dom/DocumentTimeline.h" #include "mozilla/Preferences.h" @@ -221,6 +223,8 @@ using namespace mozilla::gfx; using namespace mozilla::layout; using PaintFrameFlags = nsLayoutUtils::PaintFrameFlags; +typedef FrameMetrics::ViewID ViewID; + CapturingContentInfo nsIPresShell::gCaptureInfo = { false /* mAllowed */, false /* mPointerLock */, false /* mRetargetToElement */, false /* mPreventDrag */ }; -- cgit v1.2.3 From e175224b88a94c5c1eb98e6f2636c97365caad8a Mon Sep 17 00:00:00 2001 From: adeshkp Date: Fri, 1 May 2020 23:43:15 +0530 Subject: Issue #80 - Include nsIContentInlines.h in layout/base/PositionedEventTargeting.cpp --- layout/base/PositionedEventTargeting.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'layout/base') diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index 8374ab9d2..668ff2938 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -8,6 +8,7 @@ #include "mozilla/EventStates.h" #include "mozilla/MouseEvents.h" #include "mozilla/Preferences.h" +#include "nsIContentInlines.h" #include "nsLayoutUtils.h" #include "nsGkAtoms.h" #include "nsFontMetrics.h" -- cgit v1.2.3 From 71137783ac6927bd0dc02fce1d6e61e6ec027753 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Fri, 8 May 2020 15:20:01 +0300 Subject: Issue #1355 - Store the dirty rect on the display list builder rather than passing it as a parameter to BuildDisplayList Also fix build bustage for De-unified layout/xul in nsRootBoxFrame.cpp --- layout/base/nsDisplayList.cpp | 16 +++++++--------- layout/base/nsDisplayList.h | 25 +++++++++++++------------ layout/base/nsLayoutUtils.cpp | 6 ++++-- layout/base/nsPresShell.cpp | 4 ++-- 4 files changed, 26 insertions(+), 25 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 8a34d108f..b08fe4219 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -864,10 +864,9 @@ nsDisplayListBuilder::FindAnimatedGeometryRootFor(nsDisplayItem* aItem) void nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, - nsIFrame* aFrame, - const nsRect& aDirtyRect) + nsIFrame* aFrame) { - nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect; + nsRect dirtyRectRelativeToDirtyFrame = GetDirtyRect(); if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) && IsPaintingToWindow()) { NS_ASSERTION(aDirtyFrame == aFrame->GetParent(), "Dirty frame should be viewport frame"); @@ -882,7 +881,9 @@ void nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, dirtyRectRelativeToDirtyFrame.SizeTo(aDirtyFrame->GetSize()); } } - nsRect dirty = dirtyRectRelativeToDirtyFrame - aFrame->GetOffsetTo(aDirtyFrame); + + nsPoint offset = aFrame->GetOffsetTo(aDirtyFrame); + nsRect dirty = dirtyRectRelativeToDirtyFrame - offset; nsRect overflowRect = aFrame->GetVisualOverflowRect(); if (aFrame->IsTransformed() && @@ -1094,8 +1095,7 @@ nsDisplayListBuilder::ResetMarkedFramesForDisplayList() void nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame, - const nsFrameList& aFrames, - const nsRect& aDirtyRect) { + const nsFrameList& aFrames) { for (nsIFrame* e : aFrames) { // Skip the AccessibleCaret frame when building no caret. if (!IsBuildingCaret()) { @@ -1107,9 +1107,8 @@ nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame, } } } - mFramesMarkedForDisplay.AppendElement(e); - MarkOutOfFlowFrameForDisplay(aDirtyFrame, e, aDirtyRect); + MarkOutOfFlowFrameForDisplay(aDirtyFrame, e); } } @@ -2626,7 +2625,6 @@ SpecialCutoutRegionCase(nsDisplayListBuilder* aBuilder, return true; } - /*static*/ bool nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 9cee7b517..e4fb57e8a 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -444,6 +444,10 @@ public: * BuildDisplayList on right now). */ const nsRect& GetDirtyRect() { return mDirtyRect; } + + void SetDirtyRect(const nsRect& aDirtyRect) { mDirtyRect = aDirtyRect; } + void IntersectDirtyRect(const nsRect& aDirtyRect) { mDirtyRect.IntersectRect(mDirtyRect, aDirtyRect); } + const nsIFrame* GetCurrentFrame() { return mCurrentFrame; } const nsIFrame* GetCurrentReferenceFrame() { return mCurrentReferenceFrame; } const nsPoint& GetCurrentFrameOffsetToReferenceFrame() { return mCurrentOffsetToReferenceFrame; } @@ -493,11 +497,10 @@ public: /** * Display the caret if needed. */ - void DisplayCaret(nsIFrame* aFrame, const nsRect& aDirtyRect, - nsDisplayList* aList) { + void DisplayCaret(nsIFrame* aFrame, nsDisplayList* aList) { nsIFrame* frame = GetCaretFrame(); if (aFrame == frame) { - frame->DisplayCaret(this, aDirtyRect, aList); + frame->DisplayCaret(this, aList); } } /** @@ -602,8 +605,7 @@ public: * destroyed. */ void MarkFramesForDisplayList(nsIFrame* aDirtyFrame, - const nsFrameList& aFrames, - const nsRect& aDirtyRect); + const nsFrameList& aFrames); /** * Mark all child frames that Preserve3D() as needing display. * Because these frames include transforms set on their parent, dirty rects @@ -700,8 +702,8 @@ public: friend class AutoBuildingDisplayList; class AutoBuildingDisplayList { public: - AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, - nsIFrame* aForChild, + + AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild, const nsRect& aDirtyRect, bool aIsRoot) : mBuilder(aBuilder), mPrevFrame(aBuilder->mCurrentFrame), @@ -1120,11 +1122,11 @@ public: Preserves3DContext mSavedCtx; }; - const nsRect GetPreserves3DDirtyRect(const nsIFrame *aFrame) const { + const nsRect GetPreserves3DRects() const { return mPreserves3DCtx.mDirtyRect; } - void SetPreserves3DDirtyRect(const nsRect &aDirtyRect) { - mPreserves3DCtx.mDirtyRect = aDirtyRect; + void SavePreserves3DRects() { + mPreserves3DCtx.mDirtyRect = mDirtyRect; } bool IsBuildingInvisibleItems() const { return mBuildingInvisibleItems; } @@ -1133,8 +1135,7 @@ public: } private: - void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame, - const nsRect& aDirtyRect); + void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame); /** * Returns whether a frame acts as an animated geometry root, optionally diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 04ac9ef52..fb0b42a6c 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3190,7 +3190,8 @@ nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect, } builder.EnterPresShell(aFrame); - aFrame->BuildDisplayListForStackingContext(&builder, aRect, &list); + builder.SetDirtyRect(aRect); + aFrame->BuildDisplayListForStackingContext(&builder, &list); builder.LeavePresShell(aFrame, nullptr); #ifdef MOZ_DUMP_PAINTING @@ -3539,7 +3540,8 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram PROFILER_LABEL("nsLayoutUtils", "PaintFrame::BuildDisplayList", js::ProfileEntry::Category::GRAPHICS); - aFrame->BuildDisplayListForStackingContext(&builder, dirtyRect, &list); + builder.SetDirtyRect(dirtyRect); + aFrame->BuildDisplayListForStackingContext(&builder, &list); } nsIAtom* frameType = aFrame->GetType(); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 2615bbc49..63f512af4 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -4898,8 +4898,8 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange, nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame(); // XXX deal with frame being null due to display:contents for (; frame; frame = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(frame)) { - frame->BuildDisplayListForStackingContext(&info->mBuilder, - frame->GetVisualOverflowRect(), &info->mList); + info->mBuilder.SetDirtyRect(frame->GetVisualOverflowRect()); + frame->BuildDisplayListForStackingContext(&info->mBuilder, &info->mList); } }; if (startParent->NodeType() == nsIDOMNode::TEXT_NODE) { -- cgit v1.2.3 From 3c1e71f0b105835cba634088682c922d6640d1c5 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Fri, 8 May 2020 00:46:35 +0300 Subject: Issue #1355 - Preemptively fix build bustage for 1409114 --- layout/base/nsDisplayList.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index e4fb57e8a..1b2010d33 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -2288,12 +2288,13 @@ protected: * to the object, and all distinct. */ struct nsDisplayListCollection : public nsDisplayListSet { - nsDisplayListCollection() : - nsDisplayListSet(&mLists[0], &mLists[1], &mLists[2], &mLists[3], &mLists[4], - &mLists[5]) {} - explicit nsDisplayListCollection(nsDisplayList* aBorderBackground) : - nsDisplayListSet(aBorderBackground, &mLists[1], &mLists[2], &mLists[3], &mLists[4], + explicit nsDisplayListCollection(nsDisplayListBuilder* aBuilder) + : nsDisplayListSet(&mLists[0], &mLists[1], &mLists[2], &mLists[3], &mLists[4], &mLists[5]) {} + explicit nsDisplayListCollection(nsDisplayListBuilder* aBuilder, + nsDisplayList* aBorderBackground) + : nsDisplayListSet(aBorderBackground, &mLists[1], &mLists[2], &mLists[3], &mLists[4], + &mLists[5]) {} /** * Sort all lists by content order. -- cgit v1.2.3 From 36369e0fef4642068bbe842b6dfea3e3789d1582 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Fri, 8 May 2020 00:52:23 +0300 Subject: Issue #1355 - Avoid unnecessary work in nsIFrame::BuildDisplayListForStackingContext() and nsIFrame::BuildDisplayListForChild() and Cleanup DescendIntoChild Bug 1441796 - Part 1: Optimize the (pseudo)-stacking context conditions Bug 1441796 - Part 3: Reuse the results in nsIFrame::BuildDisplayListForStackingContext() for ChildrenHavePerspective(), IsTransformed(), and Combines3DTransformWithAncestors() Bug 1512244 - Part 1: Cleanup DescendIntoChild --- layout/base/nsDisplayList.cpp | 23 +++++++++++++++-------- layout/base/nsDisplayList.h | 14 ++++++++++++-- 2 files changed, 27 insertions(+), 10 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index b08fe4219..a869564a4 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1009,8 +1009,22 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame, } state->mInsidePointerEventsNoneDoc = pointerEventsNone; - if (!buildCaret) + state->mPresShellIgnoreScrollFrame = + state->mPresShell->IgnoringViewportScrolling() + ? state->mPresShell->GetRootScrollFrame() + : nullptr; + + nsPresContext* pc = aReferenceFrame->PresContext(); + nsCOMPtr docShell = pc->GetDocShell(); + if (docShell) { + docShell->GetWindowDraggingAllowed(&mWindowDraggingAllowed); + } + + mIsInChromePresContext = pc->IsChrome(); + + if (!buildCaret) { return; + } RefPtr caret = state->mPresShell->GetCaret(); state->mCaretFrame = caret->GetPaintGeometry(&state->mCaretRect); @@ -1018,13 +1032,6 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame, mFramesMarkedForDisplay.AppendElement(state->mCaretFrame); MarkFrameForDisplay(state->mCaretFrame, nullptr); } - - nsPresContext* pc = aReferenceFrame->PresContext(); - nsCOMPtr docShell = pc->GetDocShell(); - if (docShell) { - docShell->GetWindowDraggingAllowed(&mWindowDraggingAllowed); - } - mIsInChromePresContext = pc->IsChrome(); } // A non-blank paint is a paint that does not just contain the canvas background. diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 1b2010d33..3aeb20d19 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -520,6 +520,14 @@ public: * Get the caret associated with the current presshell. */ nsCaret* GetCaret(); + + /** + * Returns the root scroll frame for the current PresShell, if the PresShell + * is ignoring viewport scrolling. + */ + nsIFrame* GetPresShellIgnoreScrollFrame() { + return CurrentPresShellState()->mPresShellIgnoreScrollFrame; + } /** * Notify the display list builder that we're entering a presshell. * aReferenceFrame should be a frame in the new presshell. @@ -805,10 +813,11 @@ public: friend class AutoSaveRestorePerspectiveIndex; class AutoSaveRestorePerspectiveIndex { public: - AutoSaveRestorePerspectiveIndex(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) + AutoSaveRestorePerspectiveIndex(nsDisplayListBuilder* aBuilder, + const bool aChildrenHavePerspective) : mBuilder(nullptr) { - if (aFrame->ChildrenHavePerspective()) { + if (aChildrenHavePerspective) { mBuilder = aBuilder; mCachedItemIndex = aBuilder->mPerspectiveItemIndex; aBuilder->mPerspectiveItemIndex = 0; @@ -1175,6 +1184,7 @@ private: nsRect mCaretRect; uint32_t mFirstFrameMarkedForDisplay; bool mIsBackgroundOnly; + nsIFrame* mPresShellIgnoreScrollFrame; // This is a per-document flag turning off event handling for all content // in the document, and is set when we enter a subdocument for a pointer- // events:none frame. -- cgit v1.2.3 From d3d3aad6e52397334844ed80f8db650174937854 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Fri, 8 May 2020 01:21:41 +0300 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/base/nsDisplayList.cpp | 29 +++++++++++++++++------------ layout/base/nsDisplayList.h | 25 +++++++++++++++++++------ 2 files changed, 36 insertions(+), 18 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index a869564a4..55461f7c0 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -721,7 +721,6 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame, : mReferenceFrame(aReferenceFrame), mIgnoreScrollFrame(nullptr), mLayerEventRegions(nullptr), - mCurrentTableItem(nullptr), mCurrentFrame(aReferenceFrame), mCurrentReferenceFrame(aReferenceFrame), mCurrentAGR(&mRootAGR), @@ -731,6 +730,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame, mGlassDisplayItem(nullptr), mScrollInfoItemsForHoisting(nullptr), mMode(aMode), + mTableBackgroundSet(nullptr), mCurrentScrollParentId(FrameMetrics::NULL_SCROLL_ID), mCurrentScrollbarTarget(FrameMetrics::NULL_SCROLL_ID), mCurrentScrollbarFlags(0), @@ -926,7 +926,6 @@ nsDisplayListBuilder::~nsDisplayListBuilder() { "All frames should have been unmarked"); NS_ASSERTION(mPresShellStates.Length() == 0, "All presshells should have been exited"); - NS_ASSERTION(!mCurrentTableItem, "No table item should be active"); nsCSSRendering::EndFrameTreesLocked(); @@ -2579,8 +2578,7 @@ static nsStyleContext* GetBackgroundStyleContext(nsIFrame* aFrame) /* static */ void SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState, - nsIFrame* aFrame, const nsPoint& aToReferenceFrame, - const nsStyleImageLayers::Layer& aLayer, + nsIFrame* aFrame, const nsStyleImageLayers::Layer& aLayer, const nsRect& aBackgroundRect, bool aWillPaintBorder) { @@ -2640,14 +2638,16 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil bool aAllowWillPaintBorderOptimization, nsStyleContext* aStyleContext, const nsRect& aBackgroundOriginRect, - nsIFrame* aSecondaryReferenceFrame) + nsIFrame* aSecondaryReferenceFrame, + Maybe* + aAutoBuildingDisplayList) { nsStyleContext* bgSC = aStyleContext; const nsStyleBackground* bg = nullptr; - nsRect bgRect = aBackgroundRect + aBuilder->ToReferenceFrame(aFrame); + nsRect bgRect = aBackgroundRect; nsRect bgOriginRect = bgRect; if (!aBackgroundOriginRect.IsEmpty()) { - bgOriginRect = aBackgroundOriginRect + aBuilder->ToReferenceFrame(aFrame); + bgOriginRect = aBackgroundOriginRect; } nsPresContext* presContext = aFrame->PresContext(); bool isThemed = aFrame->IsThemed(); @@ -2683,8 +2683,6 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil !isThemed && !hasInsetShadow && borderStyle->HasBorder(); - nsPoint toRef = aBuilder->ToReferenceFrame(aFrame); - // An auxiliary list is necessary in case we have background blending; if that // is the case, background items need to be wrapped by a blend container to // isolate blending to the background @@ -2693,6 +2691,9 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil // to create an item for hit testing. if ((drawBackgroundColor && color != NS_RGBA(0,0,0,0)) || aBuilder->IsForEventDelivery()) { + if (aAutoBuildingDisplayList && !*aAutoBuildingDisplayList) { + aAutoBuildingDisplayList->emplace(aBuilder, aFrame); + } DisplayListClipState::AutoSaveRestore clipState(aBuilder); if (bg && !aBuilder->IsForEventDelivery()) { // Disable the will-paint-border optimization for background @@ -2704,7 +2705,7 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil // artifacts along the rounded corners. bool useWillPaintBorderOptimization = willPaintBorder && nsLayoutUtils::HasNonZeroCorner(borderStyle->mBorderRadius); - SetBackgroundClipRegion(clipState, aFrame, toRef, + SetBackgroundClipRegion(clipState, aFrame, bg->BottomLayer(), bgRect, useWillPaintBorderOptimization); } @@ -2757,6 +2758,10 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil continue; } + if (aAutoBuildingDisplayList && !*aAutoBuildingDisplayList) { + aAutoBuildingDisplayList->emplace(aBuilder, aFrame); + } + if (bg->mImage.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) { needBlendContainer = true; } @@ -2764,8 +2769,8 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil DisplayListClipState::AutoSaveRestore clipState(aBuilder); if (!aBuilder->IsForEventDelivery()) { const nsStyleImageLayers::Layer& layer = bg->mImage.mLayers[i]; - SetBackgroundClipRegion(clipState, aFrame, toRef, - layer, bgRect, willPaintBorder); + SetBackgroundClipRegion(clipState, aFrame, layer, bgRect, + willPaintBorder); } nsDisplayList thisItemList; diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 3aeb20d19..ff2a14dd7 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -48,6 +48,7 @@ class nsISelection; class nsIScrollableFrame; class nsDisplayLayerEventRegions; class nsDisplayScrollInfoLayer; +class nsDisplayTableBackgroundSet; class nsCaret; namespace mozilla { @@ -588,6 +589,16 @@ public: mSyncDecodeImages = aSyncDecodeImages; } + nsDisplayTableBackgroundSet* SetTableBackgroundSet( + nsDisplayTableBackgroundSet* aTableSet) { + nsDisplayTableBackgroundSet* old = mTableBackgroundSet; + mTableBackgroundSet = aTableSet; + return old; + } + nsDisplayTableBackgroundSet* GetTableBackgroundSet() const { + return mTableBackgroundSet; + } + /** * Helper method to generate background painting flags based on the * information available in the display list builder. Currently only @@ -711,6 +722,10 @@ public: class AutoBuildingDisplayList { public: + AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild) + : AutoBuildingDisplayList( + aBuilder, aForChild, aBuilder->GetDirtyRect(), aForChild->IsTransformed()){} + AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild, const nsRect& aDirtyRect, bool aIsRoot) : mBuilder(aBuilder), @@ -992,10 +1007,6 @@ public: return mPreserves3DCtx.mAccumulatedRectLevels; } - // Helpers for tables - nsDisplayTableItem* GetCurrentTableItem() { return mCurrentTableItem; } - void SetCurrentTableItem(nsDisplayTableItem* aTableItem) { mCurrentTableItem = aTableItem; } - struct OutOfFlowDisplayData { OutOfFlowDisplayData(const DisplayItemClip* aContainingBlockClip, const DisplayItemScrollClip* aContainingBlockScrollClip, @@ -1213,7 +1224,6 @@ private: AutoTArray mPresShellStates; AutoTArray mFramesMarkedForDisplay; AutoTArray mThemeGeometries; - nsDisplayTableItem* mCurrentTableItem; DisplayListClipState mClipState; // mCurrentFrame is the frame that we're currently calling (or about to call) // BuildDisplayList on. @@ -1256,6 +1266,7 @@ private: nsTArray mScrollClipsToDestroy; nsTArray mDisplayItemClipsToDestroy; nsDisplayListBuilderMode mMode; + nsDisplayTableBackgroundSet* mTableBackgroundSet; ViewID mCurrentScrollParentId; ViewID mCurrentScrollbarTarget; uint32_t mCurrentScrollbarFlags; @@ -2751,7 +2762,9 @@ public: bool aAllowWillPaintBorderOptimization = true, nsStyleContext* aStyleContext = nullptr, const nsRect& aBackgroundOriginRect = nsRect(), - nsIFrame* aSecondaryReferenceFrame = nullptr); + nsIFrame* aSecondaryReferenceFrame = nullptr, + mozilla::Maybe* + aAutoBuildingDisplayList = nullptr); virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager, -- cgit v1.2.3 From 3a1bebfb87d994b810574fdfeba09683e80cd2c9 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Sun, 10 May 2020 15:00:08 +0300 Subject: Issue #1355 - Fix the nit, remove nsPoint offset in nsFrame.cpp and change PresShellState member order --- layout/base/nsDisplayList.cpp | 3 +-- layout/base/nsDisplayList.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 55461f7c0..73e991246 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -882,8 +882,7 @@ void nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, } } - nsPoint offset = aFrame->GetOffsetTo(aDirtyFrame); - nsRect dirty = dirtyRectRelativeToDirtyFrame - offset; + nsRect dirty = dirtyRectRelativeToDirtyFrame - aFrame->GetOffsetTo(aDirtyFrame); nsRect overflowRect = aFrame->GetVisualOverflowRect(); if (aFrame->IsTransformed() && diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index ff2a14dd7..9eac132fa 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -1195,11 +1195,11 @@ private: nsRect mCaretRect; uint32_t mFirstFrameMarkedForDisplay; bool mIsBackgroundOnly; - nsIFrame* mPresShellIgnoreScrollFrame; // This is a per-document flag turning off event handling for all content // in the document, and is set when we enter a subdocument for a pointer- // events:none frame. bool mInsidePointerEventsNoneDoc; + nsIFrame* mPresShellIgnoreScrollFrame; }; PresShellState* CurrentPresShellState() { -- cgit v1.2.3 From ad69c023a96f516ae9a0089b1bc6e4c0712dccd3 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Tue, 12 May 2020 19:23:47 +0300 Subject: Issue #1545 - Fix border-radius on table row groups, rows, column groups, or columns Before issue #146, border-radius on row groups, rows, column groups, or columns don't apply to the background of each cell, yet the border-radius on the cell itself does. After issue #146, the behaviors changed. In this patch, I tried to revert the behaviors of border-radius on table row groups, rows, column groups, or columns back to what happened before issue #146. Also: Don't override GetBorderRadii in nsBCTableCellFrame. --- layout/base/nsCSSRendering.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 119c6c8a2..9a827546f 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -1903,8 +1903,15 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer, nsRect clipBorderArea = ::BoxDecorationRectForBorder(aForFrame, aBorderArea, skipSides, &aBorder); - bool haveRoundedCorners = GetRadii(aForFrame, aBorder, aBorderArea, - clipBorderArea, aClipState->mRadii); + bool haveRoundedCorners = false; + nsIAtom* fType = aForFrame->GetType(); + if (fType != nsGkAtoms::tableColGroupFrame && + fType != nsGkAtoms::tableColFrame && + fType != nsGkAtoms::tableRowFrame && + fType != nsGkAtoms::tableRowGroupFrame) { + haveRoundedCorners = GetRadii(aForFrame, aBorder, aBorderArea, + clipBorderArea, aClipState->mRadii); + } bool isSolidBorder = aWillPaintBorder && IsOpaqueBorder(aBorder); -- cgit v1.2.3 From c4ed56660230a124fa3457cd5f789e78a3188515 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 20 May 2020 23:25:37 -0500 Subject: Revert "Merge pull request #1357 from athenian200/form-disabled-issue" This reverts commit ed88b99849156004c04e4a0c87ea9b2360ef19b6, reversing changes made to c4b0715baaffc541670fd1158557aa7e61e521d3. --- layout/base/nsCaret.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index 8396726c6..eca22f3ba 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -511,7 +511,7 @@ nsCaret::GetPaintGeometry(nsRect* aRect) CheckSelectionLanguageChange(); int32_t frameOffset; - nsIFrame* frame = GetFrameAndOffset(GetSelectionInternal(), + nsIFrame *frame = GetFrameAndOffset(GetSelectionInternal(), mOverrideContent, mOverrideOffset, &frameOffset); if (!frame) { return nullptr; @@ -521,7 +521,8 @@ nsCaret::GetPaintGeometry(nsRect* aRect) const nsStyleUserInterface* userinterface = frame->StyleUserInterface(); if ((!mIgnoreUserModify && userinterface->mUserModify == StyleUserModify::ReadOnly) || - frame->IsContentDisabled()){ + userinterface->mUserInput == StyleUserInput::None || + userinterface->mUserInput == StyleUserInput::Disabled) { return nullptr; } -- cgit v1.2.3 From 44de3c3023f40686d1cc46c8074e7b04d6832966 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 21 May 2020 16:22:51 +0000 Subject: [printing] Fix build bustage with --disable-printing --- layout/base/nsDocumentViewer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'layout/base') diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 8baf1a464..df0f1266d 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -544,10 +544,12 @@ nsDocumentViewer::~nsDocumentViewer() mDocument->Destroy(); } +#ifdef NS_PRINTING if (mPrintEngine) { mPrintEngine->Destroy(); mPrintEngine = nullptr; } +#endif MOZ_RELEASE_ASSERT(mDestroyRefCount == 0); NS_ASSERTION(!mPresShell && !mPresContext, -- cgit v1.2.3