diff options
author | Moonchild <moonchild@palemoon.org> | 2020-06-01 21:58:35 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-06-01 21:58:35 +0000 |
commit | c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810 (patch) | |
tree | c7672903a2030d37f861b12900165a015f49d10a /layout/base | |
parent | 451509e2c0188a4164d4b3d1d9f5839ed1e95246 (diff) | |
parent | 744b044935f7d1d67fbe0df42d898efcbdd00536 (diff) | |
download | UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.tar UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.tar.gz UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.tar.lz UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.tar.xz UXP-c6ca4380e9e5e95df9de02daf8bfb9a6ebc22810.zip |
Merge remote-tracking branch 'origin/redwood' into release
Diffstat (limited to 'layout/base')
-rw-r--r-- | layout/base/MaskLayerImageCache.h | 1 | ||||
-rw-r--r-- | layout/base/MobileViewportManager.h | 3 | ||||
-rw-r--r-- | layout/base/PositionedEventTargeting.cpp | 1 | ||||
-rw-r--r-- | layout/base/RestyleManager.cpp | 7 | ||||
-rw-r--r-- | layout/base/RestyleManager.h | 6 | ||||
-rw-r--r-- | layout/base/RestyleManagerBase.cpp | 18 | ||||
-rw-r--r-- | layout/base/ServoRestyleManager.cpp | 1 | ||||
-rw-r--r-- | layout/base/TouchManager.cpp | 2 | ||||
-rw-r--r-- | layout/base/moz.build | 11 | ||||
-rw-r--r-- | layout/base/nsCSSRendering.cpp | 11 | ||||
-rw-r--r-- | layout/base/nsDisplayList.cpp | 65 | ||||
-rw-r--r-- | layout/base/nsDisplayList.h | 75 | ||||
-rw-r--r-- | layout/base/nsDocumentViewer.cpp | 2 | ||||
-rw-r--r-- | layout/base/nsFrameTraversal.cpp | 1 | ||||
-rw-r--r-- | layout/base/nsLayoutUtils.cpp | 7 | ||||
-rw-r--r-- | layout/base/nsPresShell.cpp | 10 |
16 files changed, 147 insertions, 74 deletions
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/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" 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<ReframingStyleContexts*> mRestorePointer; @@ -880,6 +881,11 @@ private: AutoTArray<mozilla::dom::Element*, 4> 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<nsUint32HashKey, TouchManager::TouchInfo>* 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/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); diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 8a34d108f..73e991246 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), @@ -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,6 +881,7 @@ void nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, dirtyRectRelativeToDirtyFrame.SizeTo(aDirtyFrame->GetSize()); } } + nsRect dirty = dirtyRectRelativeToDirtyFrame - aFrame->GetOffsetTo(aDirtyFrame); nsRect overflowRect = aFrame->GetVisualOverflowRect(); @@ -925,7 +925,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(); @@ -1008,8 +1007,22 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame, } state->mInsidePointerEventsNoneDoc = pointerEventsNone; - if (!buildCaret) + state->mPresShellIgnoreScrollFrame = + state->mPresShell->IgnoringViewportScrolling() + ? state->mPresShell->GetRootScrollFrame() + : nullptr; + + nsPresContext* pc = aReferenceFrame->PresContext(); + nsCOMPtr<nsIDocShell> docShell = pc->GetDocShell(); + if (docShell) { + docShell->GetWindowDraggingAllowed(&mWindowDraggingAllowed); + } + + mIsInChromePresContext = pc->IsChrome(); + + if (!buildCaret) { return; + } RefPtr<nsCaret> caret = state->mPresShell->GetCaret(); state->mCaretFrame = caret->GetPaintGeometry(&state->mCaretRect); @@ -1017,13 +1030,6 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame, mFramesMarkedForDisplay.AppendElement(state->mCaretFrame); MarkFrameForDisplay(state->mCaretFrame, nullptr); } - - nsPresContext* pc = aReferenceFrame->PresContext(); - nsCOMPtr<nsIDocShell> 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. @@ -1094,8 +1100,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 +1112,8 @@ nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame, } } } - mFramesMarkedForDisplay.AppendElement(e); - MarkOutOfFlowFrameForDisplay(aDirtyFrame, e, aDirtyRect); + MarkOutOfFlowFrameForDisplay(aDirtyFrame, e); } } @@ -2573,8 +2577,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) { @@ -2626,7 +2629,6 @@ SpecialCutoutRegionCase(nsDisplayListBuilder* aBuilder, return true; } - /*static*/ bool nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, @@ -2635,14 +2637,16 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil bool aAllowWillPaintBorderOptimization, nsStyleContext* aStyleContext, const nsRect& aBackgroundOriginRect, - nsIFrame* aSecondaryReferenceFrame) + nsIFrame* aSecondaryReferenceFrame, + Maybe<nsDisplayListBuilder::AutoBuildingDisplayList>* + 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(); @@ -2678,8 +2682,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 @@ -2688,6 +2690,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 @@ -2699,7 +2704,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); } @@ -2752,6 +2757,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; } @@ -2759,8 +2768,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 9cee7b517..9eac132fa 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 { @@ -444,6 +445,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 +498,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); } } /** @@ -517,6 +521,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. @@ -577,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 @@ -602,8 +624,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 +721,12 @@ public: friend class AutoBuildingDisplayList; class AutoBuildingDisplayList { public: - AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, - nsIFrame* aForChild, + + AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild) + : AutoBuildingDisplayList( + aBuilder, aForChild, aBuilder->GetDirtyRect(), aForChild->IsTransformed()){} + + AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild, const nsRect& aDirtyRect, bool aIsRoot) : mBuilder(aBuilder), mPrevFrame(aBuilder->mCurrentFrame), @@ -803,10 +828,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; @@ -981,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, @@ -1120,11 +1142,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 +1155,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 @@ -1178,6 +1199,7 @@ private: // in the document, and is set when we enter a subdocument for a pointer- // events:none frame. bool mInsidePointerEventsNoneDoc; + nsIFrame* mPresShellIgnoreScrollFrame; }; PresShellState* CurrentPresShellState() { @@ -1202,7 +1224,6 @@ private: AutoTArray<PresShellState,8> mPresShellStates; AutoTArray<nsIFrame*,400> mFramesMarkedForDisplay; AutoTArray<ThemeGeometry,2> mThemeGeometries; - nsDisplayTableItem* mCurrentTableItem; DisplayListClipState mClipState; // mCurrentFrame is the frame that we're currently calling (or about to call) // BuildDisplayList on. @@ -1245,6 +1266,7 @@ private: nsTArray<DisplayItemScrollClip*> mScrollClipsToDestroy; nsTArray<DisplayItemClip*> mDisplayItemClipsToDestroy; nsDisplayListBuilderMode mMode; + nsDisplayTableBackgroundSet* mTableBackgroundSet; ViewID mCurrentScrollParentId; ViewID mCurrentScrollbarTarget; uint32_t mCurrentScrollbarFlags; @@ -2287,12 +2309,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. @@ -2739,7 +2762,9 @@ public: bool aAllowWillPaintBorderOptimization = true, nsStyleContext* aStyleContext = nullptr, const nsRect& aBackgroundOriginRect = nsRect(), - nsIFrame* aSecondaryReferenceFrame = nullptr); + nsIFrame* aSecondaryReferenceFrame = nullptr, + mozilla::Maybe<nsDisplayListBuilder::AutoBuildingDisplayList>* + aAutoBuildingDisplayList = nullptr); virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager, 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, 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..fb0b42a6c 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" @@ -3189,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 @@ -3538,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 264b52b18..63f512af4 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 */ }; @@ -4894,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) { |