From 0db87ebeb5887ef3db4cec9797394afd781e3f7a Mon Sep 17 00:00:00 2001 From: Miko Mynttinen Date: Mon, 19 Jul 2021 11:28:21 +0000 Subject: [PATCH] Bug 1720804 - Part 2: Cleanup clang tidy warnings and namespaces r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D120042 --- layout/painting/nsDisplayList.cpp | 411 ++++++++---------- layout/painting/nsDisplayList.h | 669 ++++++++++++------------------ 2 files changed, 438 insertions(+), 642 deletions(-) diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 2ea1b05db56d..9613f7ea4ede 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -114,16 +114,14 @@ #include "mozilla/layers/WebRenderMessages.h" #include "mozilla/layers/WebRenderScrollData.h" -using namespace mozilla::layers; -using namespace mozilla::dom; -using namespace mozilla::layout; -using namespace mozilla::gfx; - -typedef ScrollableLayerGuid::ViewID ViewID; -typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox; - namespace mozilla { +using namespace dom; +using namespace gfx; +using namespace layout; +using namespace layers; +using namespace image; + #ifdef DEBUG static bool SpammyLayoutWarningsEnabled() { static bool sValue = false; @@ -228,7 +226,7 @@ bool ActiveScrolledRoot::IsAncestor(const ActiveScrolledRoot* aAncestor, nsCString ActiveScrolledRoot::ToString( const ActiveScrolledRoot* aActiveScrolledRoot) { nsAutoCString str; - for (auto* asr = aActiveScrolledRoot; asr; asr = asr->mParent) { + for (const auto* asr = aActiveScrolledRoot; asr; asr = asr->mParent) { str.AppendPrintf("<0x%p>", asr->mScrollableFrame); if (asr->mParent) { str.AppendLiteral(", "); @@ -237,8 +235,7 @@ nsCString ActiveScrolledRoot::ToString( return std::move(str); } -mozilla::layers::ScrollableLayerGuid::ViewID ActiveScrolledRoot::ComputeViewId() - const { +ScrollableLayerGuid::ViewID ActiveScrolledRoot::ComputeViewId() const { nsIContent* content = mScrollableFrame->GetScrolledFrame()->GetContent(); return nsLayoutUtils::FindOrCreateIDFor(content); } @@ -251,7 +248,7 @@ ActiveScrolledRoot::~ActiveScrolledRoot() { } static uint64_t AddAnimationsForWebRender( - nsDisplayItem* aItem, mozilla::layers::RenderRootStateManager* aManager, + nsDisplayItem* aItem, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder, const Maybe& aPosition = Nothing()) { EffectSet* effects = @@ -361,8 +358,8 @@ void nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer( // Only send animations to a layer that is actually using // off-main-thread compositing. LayersBackend backend = aLayer->Manager()->GetBackendType(); - if (!(backend == layers::LayersBackend::LAYERS_CLIENT || - backend == layers::LayersBackend::LAYERS_WR)) { + if (!(backend == LayersBackend::LAYERS_CLIENT || + backend == LayersBackend::LAYERS_WR)) { return; } @@ -538,9 +535,8 @@ nsRect nsDisplayListBuilder::OutOfFlowDisplayData::ComputeVisibleRectForFrame( nsRect overflowRect = aFrame->InkOverflowRect(); - if (aFrame->IsTransformed() && - mozilla::EffectCompositor::HasAnimationsForCompositor( - aFrame, DisplayItemType::TYPE_TRANSFORM)) { + if (aFrame->IsTransformed() && EffectCompositor::HasAnimationsForCompositor( + aFrame, DisplayItemType::TYPE_TRANSFORM)) { /** * Add a fuzz factor to the overflow rectangle so that elements only * just out of view are pulled into the display list, so they can be @@ -1364,7 +1360,7 @@ void nsDisplayListBuilder::MarkFramesForDisplayList( nsIContent* content = e->GetContent(); if (content && content->IsInNativeAnonymousSubtree() && content->IsElement()) { - auto classList = content->AsElement()->ClassList(); + auto* classList = content->AsElement()->ClassList(); if (classList->Contains(u"moz-accessiblecaret"_ns)) { continue; } @@ -1821,7 +1817,7 @@ void nsDisplayListBuilder::AdjustWindowDraggingRegion(nsIFrame* aFrame) { return; } - mozilla::gfx::IntRect rect(transformedDevPixelBorderBoxInt.ToUnknownRect()); + gfx::IntRect rect(transformedDevPixelBorderBoxInt.ToUnknownRect()); if (styleUI->mWindowDragging == StyleWindowDragging::Drag) { mRetainedWindowDraggingRegion.Add(aFrame, rect); } else { @@ -1892,7 +1888,7 @@ size_t nsDisplayListBuilder::WeakFrameRegion::SizeOfExcludingThis( MallocSizeOf aMallocSizeOf) const { size_t n = 0; n += mFrames.ShallowSizeOfExcludingThis(aMallocSizeOf); - for (auto& frame : mFrames) { + for (const auto& frame : mFrames) { const UniquePtr& weakFrame = frame.mWeakFrame; n += aMallocSizeOf(weakFrame.get()); } @@ -2306,7 +2302,8 @@ LayerManager* nsDisplayListBuilder::GetWidgetLayerManager(nsView** aView) { // Find the layer which should house the root scroll metadata for a given // layer tree. This is the async zoom container layer if there is one, // otherwise it's the root layer. -Layer* GetLayerForRootMetadata(Layer* aRootLayer, ViewID aRootScrollId) { +Layer* GetLayerForRootMetadata(Layer* aRootLayer, + ScrollableLayerGuid::ViewID aRootScrollId) { Layer* asyncZoomContainer = DepthFirstSearch( aRootLayer, [aRootScrollId](Layer* aLayer) { if (auto id = aLayer->GetAsyncZoomContainerId()) { @@ -2461,7 +2458,7 @@ void nsDisplayList::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx, */ already_AddRefed nsDisplayList::PaintRoot( nsDisplayListBuilder* aBuilder, gfxContext* aCtx, uint32_t aFlags, - mozilla::Maybe aDisplayListBuildTime) { + Maybe aDisplayListBuildTime) { AUTO_PROFILER_LABEL("nsDisplayList::PaintRoot", GRAPHICS); RefPtr layerManager; @@ -2499,7 +2496,7 @@ already_AddRefed nsDisplayList::PaintRoot( return nullptr; } - if (layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) { + if (layerManager->GetBackendType() == LayersBackend::LAYERS_WR) { if (doBeginTransaction) { if (aCtx) { if (!layerManager->BeginTransactionWithTarget(aCtx)) { @@ -3141,10 +3138,8 @@ nsDisplayContainer::nsDisplayContainer( } bool nsDisplayContainer::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { aManager->CommandBuilder().CreateWebRenderCommandsFromDisplayList( GetChildren(), this, aDisplayListBuilder, aSc, aBuilder, aResources); @@ -3177,8 +3172,8 @@ static bool ComputeClippedVisibilityForSubList(nsDisplayListBuilder* aBuilder, bool nsDisplayContainer::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsRegion* aVisibleRegion) { - return ::ComputeClippedVisibilityForSubList(aBuilder, aVisibleRegion, - GetChildren(), GetPaintRect()); + return ComputeClippedVisibilityForSubList(aBuilder, aVisibleRegion, + GetChildren(), GetPaintRect()); } nsRect nsDisplayContainer::GetBounds(nsDisplayListBuilder* aBuilder, @@ -3212,7 +3207,8 @@ static nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder, nsRegion nsDisplayContainer::GetOpaqueRegion(nsDisplayListBuilder* aBuilder, bool* aSnap) const { - return ::GetOpaqueRegion(aBuilder, GetChildren(), GetBounds(aBuilder, aSnap)); + return ::mozilla::GetOpaqueRegion(aBuilder, GetChildren(), + GetBounds(aBuilder, aSnap)); } Maybe nsDisplayContainer::GetClipWithRespectToASR( @@ -3291,10 +3287,8 @@ void nsDisplaySolidColor::WriteDebugInfo(std::stringstream& aStream) { } bool nsDisplaySolidColor::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits( mBounds, mFrame->PresContext()->AppUnitsPerDevPixel()); @@ -3329,10 +3323,8 @@ void nsDisplaySolidColorRegion::WriteDebugInfo(std::stringstream& aStream) { } bool nsDisplaySolidColorRegion::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { for (auto iter = mRegion.RectIter(); !iter.Done(); iter.Next()) { nsRect rect = iter.Get(); @@ -3867,8 +3859,10 @@ AppendedBackgroundType nsDisplayBackgroundImage::AppendBackgroundItemsToTop( static bool RoundedBorderIntersectsRect(nsIFrame* aFrame, const nsPoint& aFrameToReferenceFrame, const nsRect& aTestRect) { - if (!nsRect(aFrameToReferenceFrame, aFrame->GetSize()).Intersects(aTestRect)) + if (!nsRect(aFrameToReferenceFrame, aFrame->GetSize()) + .Intersects(aTestRect)) { return false; + } nscoord radii[8]; return !aFrame->GetBorderRadii(radii) || @@ -4045,9 +4039,9 @@ already_AddRefed nsDisplayBackgroundImage::BuildLayer( } bool nsDisplayBackgroundImage::CanBuildWebRenderDisplayItems( - LayerManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { - if (aDisplayListBuilder) { - mImageFlags = aDisplayListBuilder->GetBackgroundPaintFlags(); + LayerManager* aManager, nsDisplayListBuilder* aBuilder) { + if (aBuilder) { + mImageFlags = aBuilder->GetBackgroundPaintFlags(); } return mBackgroundStyle->StyleBackground()->mImage.mLayers[mLayer].mClip != @@ -4058,8 +4052,7 @@ bool nsDisplayBackgroundImage::CanBuildWebRenderDisplayItems( } bool nsDisplayBackgroundImage::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { if (!CanBuildWebRenderDisplayItems(aManager->LayerManager(), @@ -4199,10 +4192,7 @@ bool nsDisplayBackgroundImage::RenderingMightDependOnPositioningAreaSizeChange() const nsStyleImageLayers::Layer& layer = mBackgroundStyle->StyleBackground()->mImage.mLayers[mLayer]; - if (layer.RenderingMightDependOnPositioningAreaSizeChange()) { - return true; - } - return false; + return layer.RenderingMightDependOnPositioningAreaSizeChange(); } void nsDisplayBackgroundImage::Paint(nsDisplayListBuilder* aBuilder, @@ -4246,7 +4236,8 @@ void nsDisplayBackgroundImage::ComputeInvalidationRegion( return; } - auto* geometry = static_cast(aGeometry); + const auto* geometry = + static_cast(aGeometry); bool snap; nsRect bounds = GetBounds(aBuilder, &snap); @@ -4420,10 +4411,8 @@ void nsDisplayThemedBackground::PaintInternal(nsDisplayListBuilder* aBuilder, } bool nsDisplayThemedBackground::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { nsITheme* theme = StyleFrame()->PresContext()->Theme(); return theme->CreateWebRenderCommandsForWidget(aBuilder, aResources, aSc, @@ -4439,7 +4428,7 @@ bool nsDisplayThemedBackground::IsWindowActive() const { void nsDisplayThemedBackground::ComputeInvalidationRegion( nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry, nsRegion* aInvalidRegion) const { - auto* geometry = + const auto* geometry = static_cast(aGeometry); bool snap; @@ -4665,10 +4654,8 @@ already_AddRefed nsDisplayBackgroundColor::BuildLayer( } bool nsDisplayBackgroundColor::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { if (mColor == sRGBColor() && !EffectCompositor::HasAnimationsForCompositor( @@ -4897,10 +4884,8 @@ bool nsDisplayOutline::IsThemedOutline() const { } bool nsDisplayOutline::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { nsPresContext* pc = mFrame->PresContext(); nsRect rect = GetInnerRect() + ToReferenceFrame(); @@ -4955,10 +4940,8 @@ void nsDisplayEventReceiver::HitTest(nsDisplayListBuilder* aBuilder, } bool nsDisplayCompositorHitTestInfo::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { return true; } @@ -5003,12 +4986,10 @@ void nsDisplayCaret::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) { } bool nsDisplayCaret::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { - using namespace mozilla::layers; + using namespace layers; int32_t contentOffset; nsIFrame* frame = mCaret->GetFrame(&contentOffset); if (!frame) { @@ -5074,7 +5055,7 @@ nsDisplayItemGeometry* nsDisplayBorder::AllocateGeometry( void nsDisplayBorder::ComputeInvalidationRegion( nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry, nsRegion* aInvalidRegion) const { - auto* geometry = static_cast(aGeometry); + const auto* geometry = static_cast(aGeometry); bool snap; if (!geometry->mBounds.IsEqualInterior(GetBounds(aBuilder, &snap))) { @@ -5097,10 +5078,8 @@ LayerState nsDisplayBorder::GetLayerState( } bool nsDisplayBorder::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { nsRect rect = nsRect(ToReferenceFrame(), mFrame->GetSize()); @@ -5240,18 +5219,12 @@ bool nsDisplayBoxShadowOuter::CanBuildWebRenderDisplayItems() { // TODO(emilio): The non-native theme could provide the right rect+radius // instead relatively painlessly, if we find this causes performance issues or // what not. - if (nsCSSRendering::HasBoxShadowNativeTheme(mFrame, hasBorderRadius)) { - return false; - } - - return true; + return !nsCSSRendering::HasBoxShadowNativeTheme(mFrame, hasBorderRadius); } bool nsDisplayBoxShadowOuter::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { if (!CanBuildWebRenderDisplayItems()) { return false; @@ -5288,7 +5261,7 @@ bool nsDisplayBoxShadowOuter::CreateWebRenderCommands( auto shadows = mFrame->StyleEffects()->mBoxShadow.AsSpan(); MOZ_ASSERT(!shadows.IsEmpty()); - for (auto& shadow : Reversed(shadows)) { + for (const auto& shadow : Reversed(shadows)) { if (shadow.inset) { continue; } @@ -5339,7 +5312,7 @@ bool nsDisplayBoxShadowOuter::CreateWebRenderCommands( void nsDisplayBoxShadowOuter::ComputeInvalidationRegion( nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry, nsRegion* aInvalidRegion) const { - auto* geometry = + const auto* geometry = static_cast(aGeometry); bool snap; if (!geometry->mBounds.IsEqualInterior(GetBounds(aBuilder, &snap)) || @@ -5398,16 +5371,12 @@ bool nsDisplayBoxShadowInner::CanCreateWebRenderCommands( // We don't support native themed things yet like box shadows around // input buttons. - if (nativeTheme) { - return false; - } - - return true; + return !nativeTheme; } /* static */ void nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, const StackingContextHelper& aSc, + wr::DisplayListBuilder& aBuilder, const StackingContextHelper& aSc, nsRegion& aVisibleRegion, nsIFrame* aFrame, const nsRect& aBorderRect) { if (!nsCSSRendering::ShouldPaintBoxShadowInner(aFrame)) { return; @@ -5424,7 +5393,7 @@ void nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands( LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits(rects[i], appUnitsPerDevPixel); - for (auto& shadow : Reversed(shadows)) { + for (const auto& shadow : Reversed(shadows)) { if (!shadow.inset) { continue; } @@ -5469,10 +5438,8 @@ void nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands( } bool nsDisplayBoxShadowInner::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { if (!CanCreateWebRenderCommands(aDisplayListBuilder, mFrame, ToReferenceFrame())) { @@ -5599,15 +5566,16 @@ nsRect nsDisplayWrapList::GetBounds(nsDisplayListBuilder* aBuilder, bool nsDisplayWrapList::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsRegion* aVisibleRegion) { - return ::ComputeClippedVisibilityForSubList(aBuilder, aVisibleRegion, - GetChildren(), GetPaintRect()); + return ComputeClippedVisibilityForSubList(aBuilder, aVisibleRegion, + GetChildren(), GetPaintRect()); } nsRegion nsDisplayWrapList::GetOpaqueRegion(nsDisplayListBuilder* aBuilder, bool* aSnap) const { *aSnap = false; bool snap; - return ::GetOpaqueRegion(aBuilder, GetChildren(), GetBounds(aBuilder, &snap)); + return ::mozilla::GetOpaqueRegion(aBuilder, GetChildren(), + GetBounds(aBuilder, &snap)); } Maybe nsDisplayWrapList::IsUniform( @@ -5682,10 +5650,8 @@ nsRect nsDisplayWrapList::GetComponentAlphaBounds( } bool nsDisplayWrapList::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { aManager->CommandBuilder().CreateWebRenderCommandsFromDisplayList( GetChildren(), this, aDisplayListBuilder, aSc, aBuilder, aResources); @@ -5832,8 +5798,7 @@ void nsDisplayOpacity::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) { // TODO: Compute a bounds rect to pass to PushLayer for a smaller // allocation. - aCtx->GetDrawTarget()->PushLayer(false, GetOpacity(), nullptr, - mozilla::gfx::Matrix()); + aCtx->GetDrawTarget()->PushLayer(false, GetOpacity(), nullptr, gfx::Matrix()); GetChildren()->Paint(aBuilder, aCtx, mFrame->PresContext()->AppUnitsPerDevPixel()); aCtx->GetDrawTarget()->PopLayer(); @@ -5857,14 +5822,11 @@ static bool IsItemTooSmallForActiveLayer(nsIFrame* aFrame) { bool nsDisplayOpacity::NeedsActiveLayer(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, bool aEnforceMinimumSize) { - if (EffectCompositor::HasAnimationsForCompositor( - aFrame, DisplayItemType::TYPE_OPACITY) || - (ActiveLayerTracker::IsStyleAnimated( - aBuilder, aFrame, nsCSSPropertyIDSet::OpacityProperties()) && - !(aEnforceMinimumSize && IsItemTooSmallForActiveLayer(aFrame)))) { - return true; - } - return false; + return EffectCompositor::HasAnimationsForCompositor( + aFrame, DisplayItemType::TYPE_OPACITY) || + (ActiveLayerTracker::IsStyleAnimated( + aBuilder, aFrame, nsCSSPropertyIDSet::OpacityProperties()) && + !(aEnforceMinimumSize && IsItemTooSmallForActiveLayer(aFrame))); } void nsDisplayOpacity::ApplyOpacity(nsDisplayListBuilder* aBuilder, @@ -5957,7 +5919,7 @@ bool nsDisplayOpacity::ApplyToChildren(nsDisplayListBuilder* aBuilder) { } struct { - nsPaintedDisplayItem* item; + nsPaintedDisplayItem* item{}; nsRect bounds; } children[kOpacityMaxChildCount]; @@ -6045,7 +6007,7 @@ bool nsDisplayOpacity::ShouldFlattenAway(nsDisplayListBuilder* aBuilder) { return ApplyToChildren(aBuilder); } -nsDisplayItem::LayerState nsDisplayOpacity::GetLayerState( +LayerState nsDisplayOpacity::GetLayerState( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) { // If we only created this item so that we'd get correct nsDisplayEventRegions @@ -6083,7 +6045,8 @@ bool nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder, void nsDisplayOpacity::ComputeInvalidationRegion( nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry, nsRegion* aInvalidRegion) const { - auto* geometry = static_cast(aGeometry); + const auto* geometry = + static_cast(aGeometry); bool snap; if (mOpacity != geometry->mOpacity) { @@ -6111,10 +6074,8 @@ void nsDisplayOpacity::WriteDebugInfo(std::stringstream& aStream) { } bool nsDisplayOpacity::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { MOZ_ASSERT(mChildOpacityState != ChildOpacityState::Applied); float* opacityForSC = &mOpacity; @@ -6141,8 +6102,8 @@ bool nsDisplayOpacity::CreateWebRenderCommands( nsDisplayBlendMode::nsDisplayBlendMode( nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, - mozilla::StyleBlend aBlendMode, - const ActiveScrolledRoot* aActiveScrolledRoot, const bool aIsForBackground) + StyleBlend aBlendMode, const ActiveScrolledRoot* aActiveScrolledRoot, + const bool aIsForBackground) : nsDisplayWrapList(aBuilder, aFrame, aList, aActiveScrolledRoot, true), mBlendMode(aBlendMode), mIsForBackground(aIsForBackground) { @@ -6163,10 +6124,8 @@ LayerState nsDisplayBlendMode::GetLayerState( } bool nsDisplayBlendMode::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { wr::StackingContextParams params; params.mix_blend_mode = @@ -6239,7 +6198,7 @@ void nsDisplayBlendMode::Paint(nsDisplayListBuilder* aBuilder, DrawOptions(1.0f, nsCSSRendering::GetGFXBlendMode(mBlendMode))); } -mozilla::gfx::CompositionOp nsDisplayBlendMode::BlendMode() { +gfx::CompositionOp nsDisplayBlendMode::BlendMode() { return nsCSSRendering::GetGFXBlendMode(mBlendMode); } @@ -6336,17 +6295,15 @@ LayerState nsDisplayBlendContainer::GetLayerState( void nsDisplayBlendContainer::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) { - aCtx->GetDrawTarget()->PushLayer(false, 1.0, nullptr, mozilla::gfx::Matrix()); + aCtx->GetDrawTarget()->PushLayer(false, 1.0, nullptr, gfx::Matrix()); GetChildren()->Paint(aBuilder, aCtx, mFrame->PresContext()->AppUnitsPerDevPixel()); aCtx->GetDrawTarget()->PopLayer(); } bool nsDisplayBlendContainer::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { wr::StackingContextParams params; params.flags |= wr::StackingContextFlags::IS_BLEND_CONTAINER; @@ -6385,7 +6342,7 @@ LayerState nsDisplayOwnLayer::GetLayerState( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) { if (mForceActive) { - return mozilla::LayerState::LAYER_ACTIVE_FORCE; + return LayerState::LAYER_ACTIVE_FORCE; } return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList, @@ -6394,13 +6351,11 @@ LayerState nsDisplayOwnLayer::GetLayerState( } bool nsDisplayOwnLayer::IsScrollThumbLayer() const { - return mScrollbarData.mScrollbarLayerType == - layers::ScrollbarLayerType::Thumb; + return mScrollbarData.mScrollbarLayerType == ScrollbarLayerType::Thumb; } bool nsDisplayOwnLayer::IsScrollbarContainer() const { - return mScrollbarData.mScrollbarLayerType == - layers::ScrollbarLayerType::Container; + return mScrollbarData.mScrollbarLayerType == ScrollbarLayerType::Container; } bool nsDisplayOwnLayer::IsRootScrollbarContainer() const { @@ -6455,8 +6410,7 @@ already_AddRefed nsDisplayOwnLayer::BuildLayer( } bool nsDisplayOwnLayer::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { Maybe prop; @@ -6507,8 +6461,7 @@ bool nsDisplayOwnLayer::CreateWebRenderCommands( } bool nsDisplayOwnLayer::UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) { + WebRenderScrollData* aData, WebRenderLayerScrollData* aLayerData) { bool isRelevantToApz = (IsScrollThumbLayer() || IsScrollbarContainer() || IsZoomingLayer() || (IsFixedPositionLayer() && HasDynamicToolbar()) || @@ -6782,7 +6735,7 @@ already_AddRefed nsDisplayFixedPosition::BuildLayer( return layer.forget(); } -ViewID nsDisplayFixedPosition::GetScrollTargetId() { +ScrollableLayerGuid::ViewID nsDisplayFixedPosition::GetScrollTargetId() { if (mContainerASR && !nsLayoutUtils::IsReallyFixedPos(mFrame)) { return mContainerASR->GetViewId(); } @@ -6790,10 +6743,8 @@ ViewID nsDisplayFixedPosition::GetScrollTargetId() { } bool nsDisplayFixedPosition::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { SideBits sides = SideBits::eNone; if (!mIsFixedBackground) { @@ -6804,15 +6755,15 @@ bool nsDisplayFixedPosition::CreateWebRenderCommands( // nsDisplayCompositorHitTestInfo items inside this fixed-pos item (and that // share the same ASR as this item) use the correct scroll target. That way // attempts to scroll on those items will scroll the root scroll frame. - mozilla::wr::DisplayListBuilder::FixedPosScrollTargetTracker tracker( + wr::DisplayListBuilder::FixedPosScrollTargetTracker tracker( aBuilder, GetActiveScrolledRoot(), GetScrollTargetId(), sides); return nsDisplayOwnLayer::CreateWebRenderCommands( aBuilder, aResources, aSc, aManager, aDisplayListBuilder); } bool nsDisplayFixedPosition::UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) { + WebRenderScrollData* aData, + WebRenderLayerScrollData* aLayerData) { if (aLayerData) { if (!mIsFixedBackground) { aLayerData->SetFixedPositionSides( @@ -6924,7 +6875,7 @@ already_AddRefed nsDisplayStickyPosition::BuildLayer( scrollFrameSize), mFrame, presContext, aContainerParameters); - ViewID scrollId = nsLayoutUtils::FindOrCreateIDFor( + ScrollableLayerGuid::ViewID scrollId = nsLayoutUtils::FindOrCreateIDFor( stickyScrollContainer->ScrollFrame()->GetScrolledFrame()->GetContent()); float factor = presContext->AppUnitsPerDevPixel(); @@ -7003,8 +6954,7 @@ StickyScrollContainer* nsDisplayStickyPosition::GetStickyScrollContainer() { } bool nsDisplayStickyPosition::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { StickyScrollContainer* stickyScrollContainer = GetStickyScrollContainer(); @@ -7194,8 +7144,8 @@ void nsDisplayStickyPosition::CalculateLayerScrollRanges( } bool nsDisplayStickyPosition::UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) { + WebRenderScrollData* aData, + WebRenderLayerScrollData* aLayerData) { bool hasDynamicToolbar = HasDynamicToolbar(); if (aLayerData && hasDynamicToolbar) { StickyScrollContainer* stickyScrollContainer = GetStickyScrollContainer(); @@ -7215,7 +7165,7 @@ bool nsDisplayStickyPosition::UpdateScrollData( nsLayoutUtils::GetSideBitsForFixedPositionContent(mFrame); aLayerData->SetFixedPositionSides(sides); - ViewID scrollId = + ScrollableLayerGuid::ViewID scrollId = nsLayoutUtils::FindOrCreateIDFor(stickyScrollContainer->ScrollFrame() ->GetScrolledFrame() ->GetContent()); @@ -7281,8 +7231,8 @@ UniquePtr nsDisplayScrollInfoLayer::ComputeScrollMetadata( } bool nsDisplayScrollInfoLayer::UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) { + WebRenderScrollData* aData, + WebRenderLayerScrollData* aLayerData) { if (aLayerData) { UniquePtr metadata = ComputeScrollMetadata( aData->GetBuilder(), aData->GetManager(), ContainerLayerParameters()); @@ -7294,10 +7244,8 @@ bool nsDisplayScrollInfoLayer::UpdateScrollData( } bool nsDisplayScrollInfoLayer::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { ScrollableLayerGuid::ViewID scrollId = nsLayoutUtils::FindOrCreateIDFor(mScrollFrame->GetContent()); @@ -7389,7 +7337,7 @@ bool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsDisplayAsyncZoom::nsDisplayAsyncZoom( nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, const ActiveScrolledRoot* aActiveScrolledRoot, - mozilla::layers::FrameMetrics::ViewID aViewID) + FrameMetrics::ViewID aViewID) : nsDisplayOwnLayer(aBuilder, aFrame, aList, aActiveScrolledRoot), mViewID(aViewID) { MOZ_COUNT_CTOR(nsDisplayAsyncZoom); @@ -7434,8 +7382,8 @@ already_AddRefed nsDisplayAsyncZoom::BuildLayer( } bool nsDisplayAsyncZoom::UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) { + WebRenderScrollData* aData, + WebRenderLayerScrollData* aLayerData) { bool ret = nsDisplayOwnLayer::UpdateScrollData(aData, aLayerData); MOZ_ASSERT(ret); if (aLayerData) { @@ -7600,7 +7548,7 @@ Point3D nsDisplayTransform::GetDeltaToTransformOrigin( origin.y += CSSPixel::FromAppUnits(aRefBox.Y()); } - float scale = mozilla::AppUnitsPerCSSPixel() / float(aAppUnitsPerPixel); + float scale = AppUnitsPerCSSPixel() / float(aAppUnitsPerPixel); float z = transformOrigin.depth._0; return Point3D(origin.x * scale, origin.y * scale, z * scale); } @@ -8116,8 +8064,7 @@ const Matrix4x4& nsDisplayTransform::GetAccumulatedPreserved3DTransform( } bool nsDisplayTransform::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { // We want to make sure we don't pollute the transform property in the WR @@ -8201,8 +8148,8 @@ bool nsDisplayTransform::CreateWebRenderCommands( } bool nsDisplayTransform::UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) { + WebRenderScrollData* aData, + WebRenderLayerScrollData* aLayerData) { if (!mFrame->ChildrenHavePerspective()) { // This case is handled in CreateWebRenderCommands by stashing the transform // on the stacking context. @@ -8453,16 +8400,13 @@ bool nsDisplayTransform::MayBeAnimated(nsDisplayListBuilder* aBuilder, // already involved so there is less to be gained. // Therefore we check that the *post-transform* bounds of this item are // big enough to justify an active layer. - if (EffectCompositor::HasAnimationsForCompositor( - mFrame, DisplayItemType::TYPE_TRANSFORM) || - (ActiveLayerTracker::IsTransformAnimated(aBuilder, mFrame) && - !(aEnforceMinimumSize && IsItemTooSmallForActiveLayer(mFrame)))) { - return true; - } - return false; + return EffectCompositor::HasAnimationsForCompositor( + mFrame, DisplayItemType::TYPE_TRANSFORM) || + (ActiveLayerTracker::IsTransformAnimated(aBuilder, mFrame) && + !(aEnforceMinimumSize && IsItemTooSmallForActiveLayer(mFrame))); } -nsDisplayItem::LayerState nsDisplayTransform::GetLayerState( +LayerState nsDisplayTransform::GetLayerState( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) { // If the transform is 3d, the layer takes part in preserve-3d @@ -8780,7 +8724,8 @@ nsRegion nsDisplayTransform::GetOpaqueRegion(nsDisplayListBuilder* aBuilder, bool tmpSnap; const nsRect bounds = GetUntransformedBounds(aBuilder, &tmpSnap); - const nsRegion opaque = ::GetOpaqueRegion(aBuilder, GetChildren(), bounds); + const nsRegion opaque = + ::mozilla::GetOpaqueRegion(aBuilder, GetChildren(), bounds); if (opaque.Contains(untransformedVisible)) { result = GetBuildingRect().Intersect(GetBounds(aBuilder, &tmpSnap)); @@ -9011,8 +8956,7 @@ nsRegion nsDisplayPerspective::GetOpaqueRegion(nsDisplayListBuilder* aBuilder, } bool nsDisplayPerspective::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { float appUnitsPerPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); @@ -9072,7 +9016,7 @@ bool nsDisplayPerspective::CreateWebRenderCommands( wr::WrStackingContextClip::ClipChain(aBuilder.CurrentClipChainId()); Maybe scrollingRelativeTo; - for (auto* asr = GetActiveScrolledRoot(); asr; asr = asr->mParent) { + for (const auto* asr = GetActiveScrolledRoot(); asr; asr = asr->mParent) { // In OOP documents, the root scrollable frame of the in-process root // document is always active, so using IsAncestorFrameCrossDocInProcess // should be fine here. @@ -9133,11 +9077,7 @@ bool nsDisplayText::CanApplyOpacity() const { nsTextFrame::TextDecorations decorations; f->GetTextDecorations(f->PresContext(), nsTextFrame::eResolvedColors, decorations); - if (decorations.HasDecorationLines()) { - return false; - } - - return true; + return !decorations.HasDecorationLines(); } void nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) { @@ -9149,8 +9089,7 @@ void nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) { } bool nsDisplayText::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { auto* f = static_cast(mFrame); @@ -9399,7 +9338,8 @@ gfxPoint nsDisplayEffectsBase::UserSpaceOffset() const { void nsDisplayEffectsBase::ComputeInvalidationRegion( nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry, nsRegion* aInvalidRegion) const { - auto* geometry = static_cast(aGeometry); + const auto* geometry = + static_cast(aGeometry); bool snap; nsRect bounds = GetBounds(aBuilder, &snap); if (geometry->mFrameOffsetToReferenceFrame != ToReferenceFrame() || @@ -9434,7 +9374,7 @@ bool nsDisplayEffectsBase::ValidateSVGFrame() { return true; } -typedef SVGIntegrationUtils::PaintFramesParams PaintFramesParams; +using PaintFramesParams = SVGIntegrationUtils::PaintFramesParams; static void ComputeMaskGeometry(PaintFramesParams& aParams) { // Properties are added lazily and may have been removed by a restyle, so @@ -9528,7 +9468,7 @@ static bool CanMergeDisplayMaskFrame(nsIFrame* aFrame) { // Do not merge items for box-decoration-break:clone elements, // since each box should have its own mask in that case. if (aFrame->StyleBorder()->mBoxDecorationBreak == - mozilla::StyleBoxDecorationBreak::Clone) { + StyleBoxDecorationBreak::Clone) { return false; } @@ -9565,14 +9505,10 @@ bool nsDisplayMasksAndClipPaths::IsValidMask() { nsIFrame* firstFrame = nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame); - if (SVGObserverUtils::GetAndObserveClipPath(firstFrame, nullptr) == - SVGObserverUtils::eHasRefsSomeInvalid || - SVGObserverUtils::GetAndObserveMasks(firstFrame, nullptr) == - SVGObserverUtils::eHasRefsSomeInvalid) { - return false; - } - - return true; + return !(SVGObserverUtils::GetAndObserveClipPath(firstFrame, nullptr) == + SVGObserverUtils::eHasRefsSomeInvalid || + SVGObserverUtils::GetAndObserveMasks(firstFrame, nullptr) == + SVGObserverUtils::eHasRefsSomeInvalid); } already_AddRefed nsDisplayMasksAndClipPaths::BuildLayer( @@ -9673,7 +9609,7 @@ void nsDisplayMasksAndClipPaths::ComputeInvalidationRegion( nsDisplayEffectsBase::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion); - auto* geometry = + const auto* geometry = static_cast(aGeometry); bool snap; nsRect bounds = GetBounds(aBuilder, &snap); @@ -9771,7 +9707,7 @@ static Maybe CreateSimpleClipRegion( const nsDisplayMasksAndClipPaths& aDisplayItem, wr::DisplayListBuilder& aBuilder) { nsIFrame* frame = aDisplayItem.Frame(); - auto* style = frame->StyleSVGReset(); + const auto* style = frame->StyleSVGReset(); MOZ_ASSERT(style->HasClipPath() || style->HasMask()); if (!SVGIntegrationUtils::UsingSimpleClipPathForFrame(frame)) { return Nothing(); @@ -9784,7 +9720,7 @@ static Maybe CreateSimpleClipRegion( const nsRect refBox = nsLayoutUtils::ComputeGeometryBox(frame, clipPath.AsShape()._1); - wr::WrClipId clipId; + wr::WrClipId clipId{}; switch (shape.tag) { case StyleBasicShape::Tag::Inset: { @@ -9822,7 +9758,7 @@ static Maybe CreateSimpleClipRegion( radii * 2); nscoord ellipseRadii[8]; - for (const auto corner : mozilla::AllPhysicalHalfCorners()) { + for (const auto corner : AllPhysicalHalfCorners()) { ellipseRadii[corner] = HalfCornerIsX(corner) ? radii.width : radii.height; } @@ -9886,7 +9822,7 @@ static void FillPolygonDataForDisplayItem( static Maybe CreateWRClipPathAndMasks( nsDisplayMasksAndClipPaths* aDisplayItem, const LayoutDeviceRect& aBounds, wr::IpcResourceUpdateQueue& aResources, wr::DisplayListBuilder& aBuilder, - const StackingContextHelper& aSc, layers::RenderRootStateManager* aManager, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { if (auto clip = CreateSimpleClipRegion(*aDisplayItem, aBuilder)) { return clip; @@ -9911,10 +9847,8 @@ static Maybe CreateWRClipPathAndMasks( } bool nsDisplayMasksAndClipPaths::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { bool snap; auto appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); @@ -10039,7 +9973,7 @@ already_AddRefed nsDisplayBackdropRootContainer::BuildLayer( void nsDisplayBackdropRootContainer::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) { - aCtx->GetDrawTarget()->PushLayer(false, 1.0, nullptr, mozilla::gfx::Matrix()); + aCtx->GetDrawTarget()->PushLayer(false, 1.0, nullptr, gfx::Matrix()); GetChildren()->Paint(aBuilder, aCtx, mFrame->PresContext()->AppUnitsPerDevPixel()); aCtx->GetDrawTarget()->PopLayer(); @@ -10054,10 +9988,8 @@ LayerState nsDisplayBackdropRootContainer::GetLayerState( } bool nsDisplayBackdropRootContainer::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { wr::StackingContextParams params; params.flags |= wr::StackingContextFlags::IS_BACKDROP_ROOT; @@ -10078,10 +10010,8 @@ bool nsDisplayBackdropFilters::CanCreateWebRenderCommands( } bool nsDisplayBackdropFilters::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { WrFiltersHolder wrFilters; Maybe filterClip; @@ -10203,7 +10133,8 @@ void nsDisplayFilters::ComputeInvalidationRegion( nsDisplayEffectsBase::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion); - auto* geometry = static_cast(aGeometry); + const auto* geometry = + static_cast(aGeometry); if (aBuilder->ShouldSyncDecodeImages() && geometry->ShouldInvalidateToSyncDecodeImages()) { @@ -10240,7 +10171,7 @@ void nsDisplayFilters::PaintWithContentsPaintCallback( SVGIntegrationUtils::PaintFilter( params, [&](gfxContext& aContext, nsIFrame* aTarget, const gfxMatrix& aTransform, - const nsIntRect* aDirtyRect, image::imgDrawingParams& aImgParams) { + const nsIntRect* aDirtyRect, imgDrawingParams& aImgParams) { gfxContextMatrixAutoSaveRestore autoSR(&aContext); aContext.SetMatrixDouble(aContext.CurrentMatrixDouble().PreTranslate( -userSpaceToFrameSpaceOffset)); @@ -10254,10 +10185,8 @@ bool nsDisplayFilters::CanCreateWebRenderCommands() { } bool nsDisplayFilters::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { float auPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); @@ -10271,7 +10200,7 @@ bool nsDisplayFilters::CreateWebRenderCommands( return false; } - wr::WrStackingContextClip clip; + wr::WrStackingContextClip clip{}; if (filterClip) { auto devPxRect = LayoutDeviceRect::FromAppUnits( filterClip.value() + ToReferenceFrame(), auPerDevPixel); @@ -10332,7 +10261,7 @@ LayerState nsDisplaySVGWrapper::GetLayerState( const ContainerLayerParameters& aParameters) { RefPtr layerManager = aBuilder->GetWidgetLayerManager(); if (layerManager && - layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) { + layerManager->GetBackendType() == LayersBackend::LAYERS_WR) { return LayerState::LAYER_ACTIVE_FORCE; } return LayerState::LAYER_NONE; @@ -10340,11 +10269,8 @@ LayerState nsDisplaySVGWrapper::GetLayerState( bool nsDisplaySVGWrapper::ShouldFlattenAway(nsDisplayListBuilder* aBuilder) { RefPtr layerManager = aBuilder->GetWidgetLayerManager(); - if (layerManager && - layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) { - return false; - } - return true; + return !(layerManager && + layerManager->GetBackendType() == LayersBackend::LAYERS_WR); } already_AddRefed nsDisplaySVGWrapper::BuildLayer( @@ -10362,10 +10288,8 @@ already_AddRefed nsDisplaySVGWrapper::BuildLayer( } bool nsDisplaySVGWrapper::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { return nsDisplayWrapList::CreateWebRenderCommands( aBuilder, aResources, aSc, aManager, aDisplayListBuilder); @@ -10389,7 +10313,7 @@ LayerState nsDisplayForeignObject::GetLayerState( const ContainerLayerParameters& aParameters) { RefPtr layerManager = aBuilder->GetWidgetLayerManager(); if (layerManager && - layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) { + layerManager->GetBackendType() == LayersBackend::LAYERS_WR) { return LayerState::LAYER_ACTIVE_FORCE; } return LayerState::LAYER_NONE; @@ -10397,11 +10321,8 @@ LayerState nsDisplayForeignObject::GetLayerState( bool nsDisplayForeignObject::ShouldFlattenAway(nsDisplayListBuilder* aBuilder) { RefPtr layerManager = aBuilder->GetWidgetLayerManager(); - if (layerManager && - layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) { - return false; - } - return true; + return !(layerManager && + layerManager->GetBackendType() == LayersBackend::LAYERS_WR); } already_AddRefed nsDisplayForeignObject::BuildLayer( @@ -10419,10 +10340,8 @@ already_AddRefed nsDisplayForeignObject::BuildLayer( } bool nsDisplayForeignObject::CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { AutoRestore restoreDoGrouping(aManager->CommandBuilder().mDoGrouping); aManager->CommandBuilder().mDoGrouping = false; diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index 83dfd3b1b4f7..e11580ed0714 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -13,53 +13,49 @@ #ifndef NSDISPLAYLIST_H_ #define NSDISPLAYLIST_H_ -#include "mozilla/Attributes.h" +#include "DisplayItemClipChain.h" +#include "DisplayListClipState.h" +#include "FrameMetrics.h" +#include "HitTestInfo.h" +#include "ImgDrawResult.h" +#include "LayerState.h" +#include "RetainedDisplayListHelpers.h" +#include "Units.h" #include "gfxContext.h" #include "mozilla/ArenaAllocator.h" #include "mozilla/Array.h" #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" #include "mozilla/DebugOnly.h" +#include "mozilla/EffectCompositor.h" #include "mozilla/EnumSet.h" +#include "mozilla/EnumeratedArray.h" #include "mozilla/Maybe.h" +#include "mozilla/MotionPathUtils.h" #include "mozilla/RefPtr.h" -#include "mozilla/TemplateLib.h" // mozilla::tl::Max -#include "nsCOMPtr.h" -#include "nsContainerFrame.h" -#include "nsPoint.h" -#include "nsRect.h" -#include "nsRegion.h" -#include "nsDisplayListInvalidation.h" -#include "DisplayItemClipChain.h" -#include "DisplayListClipState.h" -#include "LayerState.h" -#include "FrameMetrics.h" -#include "HitTestInfo.h" -#include "ImgDrawResult.h" +#include "mozilla/TemplateLib.h" +#include "mozilla/TimeStamp.h" +#include "mozilla/UniquePtr.h" #include "mozilla/dom/EffectsInfo.h" #include "mozilla/dom/RemoteBrowser.h" -#include "mozilla/EffectCompositor.h" -#include "mozilla/EnumeratedArray.h" -#include "mozilla/MotionPathUtils.h" -#include "mozilla/UniquePtr.h" -#include "mozilla/TimeStamp.h" #include "mozilla/gfx/UserData.h" +#include "mozilla/layers/BSPTree.h" #include "mozilla/layers/LayerAttributes.h" #include "mozilla/layers/ScrollableLayerGuid.h" -#include "mozilla/layers/BSPTree.h" -#include "nsCSSRenderingBorders.h" -#include "nsPresArena.h" #include "nsAutoLayoutPhase.h" +#include "nsCOMPtr.h" +#include "nsCSSRenderingBorders.h" +#include "nsContainerFrame.h" #include "nsDisplayItemTypes.h" -#include "RetainedDisplayListHelpers.h" -#include "Units.h" - -#include +#include "nsDisplayListInvalidation.h" +#include "nsPoint.h" +#include "nsPresArena.h" +#include "nsRect.h" +#include "nsRegion.h" #include "nsClassHashtable.h" #include "nsTHashSet.h" #include "nsTHashMap.h" -#include #include #include @@ -94,7 +90,6 @@ class Layer; class ImageLayer; class ImageContainer; class StackingContextHelper; -class WebRenderCommand; class WebRenderScrollData; class WebRenderLayerScrollData; } // namespace layers @@ -285,8 +280,7 @@ struct ActiveScrolledRoot { static bool IsAncestor(const ActiveScrolledRoot* aAncestor, const ActiveScrolledRoot* aDescendant); - static nsCString ToString( - const mozilla::ActiveScrolledRoot* aActiveScrolledRoot); + static nsCString ToString(const ActiveScrolledRoot* aActiveScrolledRoot); // Call this when inserting an ancestor. void IncrementDepth() { mDepth++; } @@ -295,7 +289,7 @@ struct ActiveScrolledRoot { * Find the view ID (or generate a new one) for the content element * corresponding to the ASR. */ - mozilla::layers::ScrollableLayerGuid::ViewID GetViewId() const { + layers::ScrollableLayerGuid::ViewID GetViewId() const { if (!mViewId.isSome()) { mViewId = Some(ComputeViewId()); } @@ -325,12 +319,12 @@ struct ActiveScrolledRoot { return aActiveScrolledRoot ? aActiveScrolledRoot->mDepth : 0; } - mozilla::layers::ScrollableLayerGuid::ViewID ComputeViewId() const; + layers::ScrollableLayerGuid::ViewID ComputeViewId() const; // This field is lazily populated in GetViewId(). We don't want to do the // work of populating if webrender is disabled, because it is often not // needed. - mutable Maybe mViewId; + mutable Maybe mViewId; uint32_t mDepth; bool mRetained; @@ -360,11 +354,6 @@ class nsDisplayTableItem; * for faster/more convenient access. */ class nsDisplayListBuilder { - typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect; - typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize; - typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion; - typedef mozilla::LayoutDeviceRect LayoutDeviceRect; - /** * This manages status of a 3d context to collect visible rects of * descendants and passing a dirty rect. @@ -383,8 +372,6 @@ class nsDisplayListBuilder { */ class Preserves3DContext { public: - typedef mozilla::gfx::Matrix4x4 Matrix4x4; - Preserves3DContext() : mAccumulatedRectLevels(0), mAllowAsyncAnimation(true) {} @@ -396,7 +383,7 @@ class nsDisplayListBuilder { mAllowAsyncAnimation(aOther.mAllowAsyncAnimation) {} // Accmulate transforms of ancestors on the preserves-3d chain. - Matrix4x4 mAccumulatedTransform; + gfx::Matrix4x4 mAccumulatedTransform; // Accmulate visible rect of descendants in the preserves-3d context. nsRect mAccumulatedRect; // How far this frame is from the root of the current 3d context. @@ -414,24 +401,7 @@ class nsDisplayListBuilder { enum AGRState { AGR_NO, AGR_YES }; public: - typedef mozilla::FrameLayerBuilder FrameLayerBuilder; - typedef mozilla::DisplayItemClip DisplayItemClip; - typedef mozilla::DisplayItemClipChain DisplayItemClipChain; - typedef mozilla::DisplayItemClipChainHasher DisplayItemClipChainHasher; - typedef mozilla::DisplayItemClipChainEqualer DisplayItemClipChainEqualer; - typedef mozilla::DisplayListClipState DisplayListClipState; - typedef mozilla::ActiveScrolledRoot ActiveScrolledRoot; - typedef nsIWidget::ThemeGeometry ThemeGeometry; - typedef mozilla::layers::Layer Layer; - typedef mozilla::layers::FrameMetrics FrameMetrics; - typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid; - typedef mozilla::layers::ScrollableLayerGuid::ViewID ViewID; - typedef mozilla::gfx::CompositorHitTestInfo CompositorHitTestInfo; - typedef mozilla::gfx::Matrix4x4 Matrix4x4; - typedef mozilla::Maybe MaybeScrollDirection; - typedef mozilla::dom::EffectsInfo EffectsInfo; - typedef mozilla::layers::LayersId LayersId; - typedef mozilla::dom::RemoteBrowser RemoteBrowser; + using ViewID = layers::ScrollableLayerGuid::ViewID; /** * @param aReferenceFrame the frame at the root of the subtree; its origin @@ -452,8 +422,7 @@ class nsDisplayListBuilder { mTemporaryItems.AppendElement(aItem); } - mozilla::layers::LayerManager* GetWidgetLayerManager( - nsView** aView = nullptr); + layers::LayerManager* GetWidgetLayerManager(nsView** aView = nullptr); /** * @return true if the display is being built in order to determine which @@ -517,9 +486,7 @@ class nsDisplayListBuilder { const nsIFrame* FindReferenceFrameFor(const nsIFrame* aFrame, nsPoint* aOffset = nullptr) const; - const mozilla::Maybe& AdditionalOffset() const { - return mAdditionalOffset; - } + const Maybe& AdditionalOffset() const { return mAdditionalOffset; } /** * @return the root of the display list's frame (sub)tree, whose origin @@ -576,7 +543,7 @@ class nsDisplayListBuilder { * which we are building display items at the moment. */ ViewID GetCurrentScrollbarTarget() const { return mCurrentScrollbarTarget; } - MaybeScrollDirection GetCurrentScrollbarDirection() const { + Maybe GetCurrentScrollbarDirection() const { return mCurrentScrollbarDirection; } /** @@ -700,11 +667,11 @@ class nsDisplayListBuilder { mAllowMergingAndFlattening = aAllow; } - void SetCompositorHitTestInfo(const CompositorHitTestInfo& aInfo) { + void SetCompositorHitTestInfo(const gfx::CompositorHitTestInfo& aInfo) { mCompositorHitTestInfo = aInfo; } - const CompositorHitTestInfo& GetCompositorHitTestInfo() const { + const gfx::CompositorHitTestInfo& GetCompositorHitTestInfo() const { return mCompositorHitTestInfo; } @@ -797,7 +764,7 @@ class nsDisplayListBuilder { void LeavePresShell(const nsIFrame* aReferenceFrame, nsDisplayList* aPaintedContents); - void IncrementPresShellPaintCount(mozilla::PresShell* aPresShell); + void IncrementPresShellPaintCount(PresShell* aPresShell); /** * Returns true if we're currently building a display list that's @@ -937,8 +904,8 @@ class nsDisplayListBuilder { /** * Returns the list of registered theme geometries. */ - nsTArray GetThemeGeometries() const { - nsTArray geometries; + nsTArray GetThemeGeometries() const { + nsTArray geometries; for (const auto& data : mThemeGeometries.Values()) { geometries.AppendElements(*data); @@ -962,14 +929,14 @@ class nsDisplayListBuilder { * for the themed widget */ void RegisterThemeGeometry(uint8_t aWidgetType, nsDisplayItem* aItem, - const mozilla::LayoutDeviceIntRect& aRect) { + const LayoutDeviceIntRect& aRect) { if (!mIsPaintingToWindow) { return; } - nsTArray* geometries = + nsTArray* geometries = mThemeGeometries.GetOrInsertNew(aItem); - geometries->AppendElement(ThemeGeometry(aWidgetType, aRect)); + geometries->AppendElement(nsIWidget::ThemeGeometry(aWidgetType, aRect)); } /** @@ -993,12 +960,12 @@ class nsDisplayListBuilder { void RemoveModifiedWindowRegions(); void ClearRetainedWindowRegions(); - const nsTHashMap, EffectsInfo>& GetEffectUpdates() - const { + const nsTHashMap, dom::EffectsInfo>& + GetEffectUpdates() const { return mEffectsUpdates; } - void AddEffectUpdate(RemoteBrowser* aBrowser, EffectsInfo aUpdate) { + void AddEffectUpdate(dom::RemoteBrowser* aBrowser, dom::EffectsInfo aUpdate) { mEffectsUpdates.InsertOrUpdate(aBrowser, aUpdate); } @@ -1009,27 +976,27 @@ class nsDisplayListBuilder { * * Destructors are called as soon as the item is no longer used. */ - void* Allocate(size_t aSize, mozilla::DisplayListArenaObjectId aId) { + void* Allocate(size_t aSize, DisplayListArenaObjectId aId) { return mPool.Allocate(aId, aSize); } void* Allocate(size_t aSize, DisplayItemType aType) { static_assert(size_t(DisplayItemType::TYPE_ZERO) == - size_t(mozilla::DisplayListArenaObjectId::CLIPCHAIN), + size_t(DisplayListArenaObjectId::CLIPCHAIN), ""); -#define DECLARE_DISPLAY_ITEM_TYPE(name_, ...) \ - static_assert(size_t(DisplayItemType::TYPE_##name_) == \ - size_t(mozilla::DisplayListArenaObjectId::name_), \ +#define DECLARE_DISPLAY_ITEM_TYPE(name_, ...) \ + static_assert(size_t(DisplayItemType::TYPE_##name_) == \ + size_t(DisplayListArenaObjectId::name_), \ ""); #include "nsDisplayItemTypesList.h" #undef DECLARE_DISPLAY_ITEM_TYPE - return Allocate(aSize, mozilla::DisplayListArenaObjectId(size_t(aType))); + return Allocate(aSize, DisplayListArenaObjectId(size_t(aType))); } - void Destroy(mozilla::DisplayListArenaObjectId aId, void* aPtr) { + void Destroy(DisplayListArenaObjectId aId, void* aPtr) { return mPool.Free(aId, aPtr); } void Destroy(DisplayItemType aType, void* aPtr) { - return Destroy(mozilla::DisplayListArenaObjectId(size_t(aType)), aPtr); + return Destroy(DisplayListArenaObjectId(size_t(aType)), aPtr); } /** @@ -1084,7 +1051,7 @@ class nsDisplayListBuilder { * the layer. When they are both null, the animations are added to * the layer as pending animations. */ - static void AddAnimationsAndTransitionsToLayer(Layer* aLayer, + static void AddAnimationsAndTransitionsToLayer(layers::Layer* aLayer, nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, nsIFrame* aFrame, @@ -1123,7 +1090,7 @@ class nsDisplayListBuilder { void SetAdditionalOffset(const nsPoint& aOffset) { MOZ_ASSERT(!mBuilder->mAdditionalOffset); - mBuilder->mAdditionalOffset = mozilla::Some(aOffset); + mBuilder->mAdditionalOffset = Some(aOffset); mBuilder->mCurrentOffsetToReferenceFrame += aOffset; } @@ -1155,11 +1122,11 @@ class nsDisplayListBuilder { const nsIFrame* mPrevFrame; const nsIFrame* mPrevReferenceFrame; nsPoint mPrevOffset; - mozilla::Maybe mPrevAdditionalOffset; + Maybe mPrevAdditionalOffset; nsRect mPrevVisibleRect; nsRect mPrevDirtyRect; RefPtr mPrevAGR; - CompositorHitTestInfo mPrevCompositorHitTestInfo; + gfx::CompositorHitTestInfo mPrevCompositorHitTestInfo; bool mPrevAncestorHasApzAwareEventHandler; bool mPrevBuildingInvisibleItems; bool mPrevInInvalidSubtree; @@ -1379,7 +1346,8 @@ class nsDisplayListBuilder { public: AutoCurrentScrollbarInfoSetter( nsDisplayListBuilder* aBuilder, ViewID aScrollTargetID, - const MaybeScrollDirection& aScrollbarDirection, bool aWillHaveLayer) + const Maybe& aScrollbarDirection, + bool aWillHaveLayer) : mBuilder(aBuilder) { aBuilder->mIsBuildingScrollbar = true; aBuilder->mCurrentScrollbarTarget = aScrollTargetID; @@ -1390,7 +1358,8 @@ class nsDisplayListBuilder { ~AutoCurrentScrollbarInfoSetter() { // No need to restore old values because scrollbars cannot be nested. mBuilder->mIsBuildingScrollbar = false; - mBuilder->mCurrentScrollbarTarget = ScrollableLayerGuid::NULL_SCROLL_ID; + mBuilder->mCurrentScrollbarTarget = + layers::ScrollableLayerGuid::NULL_SCROLL_ID; mBuilder->mCurrentScrollbarDirection.reset(); mBuilder->mCurrentScrollbarWillHaveLayer = false; } @@ -1429,8 +1398,6 @@ class nsDisplayListBuilder { */ class AutoAccumulateTransform { public: - typedef mozilla::gfx::Matrix4x4 Matrix4x4; - explicit AutoAccumulateTransform(nsDisplayListBuilder* aBuilder) : mBuilder(aBuilder), mSavedTransform(aBuilder->mPreserves3DCtx.mAccumulatedTransform) {} @@ -1439,22 +1406,22 @@ class nsDisplayListBuilder { mBuilder->mPreserves3DCtx.mAccumulatedTransform = mSavedTransform; } - void Accumulate(const Matrix4x4& aTransform) { + void Accumulate(const gfx::Matrix4x4& aTransform) { mBuilder->mPreserves3DCtx.mAccumulatedTransform = aTransform * mBuilder->mPreserves3DCtx.mAccumulatedTransform; } - const Matrix4x4& GetCurrentTransform() { + const gfx::Matrix4x4& GetCurrentTransform() { return mBuilder->mPreserves3DCtx.mAccumulatedTransform; } void StartRoot() { - mBuilder->mPreserves3DCtx.mAccumulatedTransform = Matrix4x4(); + mBuilder->mPreserves3DCtx.mAccumulatedTransform = gfx::Matrix4x4(); } private: nsDisplayListBuilder* mBuilder; - Matrix4x4 mSavedTransform; + gfx::Matrix4x4 mSavedTransform; }; /** @@ -1750,7 +1717,7 @@ class nsDisplayListBuilder { } void SetHitTestIsForVisibility(float aVisibleThreshold) { - mVisibleThreshold = mozilla::Some(aVisibleThreshold); + mVisibleThreshold = Some(aVisibleThreshold); } bool ShouldBuildAsyncZoomContainer() const { @@ -1777,7 +1744,7 @@ class nsDisplayListBuilder { explicit WeakFrameWrapper(nsIFrame* aFrame) : mWeakFrame(new WeakFrame(aFrame)), mFrame(aFrame) {} - mozilla::UniquePtr mWeakFrame; + UniquePtr mWeakFrame; void* mFrame; }; @@ -1804,9 +1771,9 @@ class nsDisplayListBuilder { void RemoveModifiedFramesAndRects(); - size_t SizeOfExcludingThis(mozilla::MallocSizeOf) const; + size_t SizeOfExcludingThis(MallocSizeOf) const; - typedef mozilla::gfx::ArrayView BoxArrayView; + typedef gfx::ArrayView BoxArrayView; nsRegion ToRegion() const { return nsRegion(BoxArrayView(mRects)); } @@ -1881,11 +1848,11 @@ class nsDisplayListBuilder { bool AddToAGRBudget(nsIFrame* aFrame); struct PresShellState { - mozilla::PresShell* mPresShell; + PresShell* mPresShell; #ifdef DEBUG - mozilla::Maybe mAutoLayoutPhase; + Maybe mAutoLayoutPhase; #endif - mozilla::Maybe mFixedBackgroundDisplayData; + Maybe mFixedBackgroundDisplayData; uint32_t mFirstFrameMarkedForDisplay; uint32_t mFirstFrameWithOOFData; bool mIsBackgroundOnly; @@ -1918,15 +1885,16 @@ class nsDisplayListBuilder { nsIFrame* const mReferenceFrame; nsIFrame* mIgnoreScrollFrame; - using Arena = nsPresArena<32768, mozilla::DisplayListArenaObjectId, - size_t(mozilla::DisplayListArenaObjectId::COUNT)>; + using Arena = nsPresArena<32768, DisplayListArenaObjectId, + size_t(DisplayListArenaObjectId::COUNT)>; Arena mPool; AutoTArray mPresShellStates; AutoTArray mFramesMarkedForDisplay; AutoTArray mFramesMarkedForDisplayIfVisible; AutoTArray mFramesWithOOFData; - nsClassHashtable, nsTArray> + nsClassHashtable, + nsTArray> mThemeGeometries; DisplayListClipState mClipState; const ActiveScrolledRoot* mCurrentActiveScrolledRoot; @@ -1939,7 +1907,7 @@ class nsDisplayListBuilder { // The offset from mCurrentFrame to mCurrentReferenceFrame. nsPoint mCurrentOffsetToReferenceFrame; - mozilla::Maybe mAdditionalOffset; + Maybe mAdditionalOffset; RefPtr mRootAGR; RefPtr mCurrentAGR; @@ -1961,7 +1929,8 @@ class nsDisplayListBuilder { // Set of frames already counted in budget nsTHashSet mAGRBudgetSet; - nsTHashMap, EffectsInfo> mEffectsUpdates; + nsTHashMap, dom::EffectsInfo> + mEffectsUpdates; // Relative to mCurrentFrame. nsRect mVisibleRect; @@ -2007,7 +1976,7 @@ class nsDisplayListBuilder { nsDisplayTableBackgroundSet* mTableBackgroundSet; ViewID mCurrentScrollParentId; ViewID mCurrentScrollbarTarget; - MaybeScrollDirection mCurrentScrollbarDirection; + Maybe mCurrentScrollbarDirection; Preserves3DContext mPreserves3DCtx; nsTArray mSVGEffectsFrames; // When we are inside a filter, the current ASR at the time we entered the @@ -2061,8 +2030,8 @@ class nsDisplayListBuilder { bool mUseOverlayScrollbars; bool mAlwaysLayerizeScrollbars; - mozilla::Maybe mVisibleThreshold; - mozilla::gfx::CompositorHitTestInfo mCompositorHitTestInfo; + Maybe mVisibleThreshold; + gfx::CompositorHitTestInfo mCompositorHitTestInfo; }; class nsDisplayItem; @@ -2167,7 +2136,7 @@ MOZ_ALWAYS_INLINE T* MakeDisplayItemWithIndex(nsDisplayListBuilder* aBuilder, AnyContentAncestorModified(item->FrameForInvalidation())); } - mozilla::DebugOnly isContainerType = + DebugOnly isContainerType = (GetDisplayItemFlagsForType(type) & TYPE_IS_CONTAINER); MOZ_ASSERT(item->HasChildren() == isContainerType, @@ -2216,23 +2185,10 @@ class nsDisplayItemLink { */ class nsDisplayItem : public nsDisplayItemLink { public: - typedef mozilla::ContainerLayerParameters ContainerLayerParameters; - typedef mozilla::DisplayItemClip DisplayItemClip; - typedef mozilla::DisplayItemClipChain DisplayItemClipChain; - typedef mozilla::ActiveScrolledRoot ActiveScrolledRoot; - typedef mozilla::layers::FrameMetrics FrameMetrics; - typedef mozilla::layers::ScrollMetadata ScrollMetadata; - typedef mozilla::layers::ScrollableLayerGuid::ViewID ViewID; - typedef mozilla::layers::Layer Layer; - typedef mozilla::layers::LayerManager LayerManager; - typedef mozilla::layers::StackingContextHelper StackingContextHelper; - typedef mozilla::layers::WebRenderCommand WebRenderCommand; - typedef mozilla::layers::WebRenderParentCommand WebRenderParentCommand; - typedef mozilla::LayerState LayerState; - typedef mozilla::image::imgDrawingParams imgDrawingParams; - typedef mozilla::image::ImgDrawResult ImgDrawResult; - typedef class mozilla::gfx::DrawTarget DrawTarget; - typedef mozilla::gfx::CompositorHitTestInfo CompositorHitTestInfo; + using Layer = layers::Layer; + using LayerManager = layers::LayerManager; + using StackingContextHelper = layers::StackingContextHelper; + using ViewID = layers::ScrollableLayerGuid::ViewID; /** * Downcasts this item to nsPaintedDisplayItem, if possible. @@ -2724,9 +2680,8 @@ class nsDisplayItem : public nsDisplayItemLink { * @return Some(nscolor) if the item is guaranteed to paint every pixel in its * bounds with the same (possibly translucent) color */ - virtual mozilla::Maybe IsUniform( - nsDisplayListBuilder* aBuilder) const { - return mozilla::Nothing(); + virtual Maybe IsUniform(nsDisplayListBuilder* aBuilder) const { + return Nothing(); } /** @@ -2769,7 +2724,7 @@ class nsDisplayItem : public nsDisplayItemLink { virtual LayerState GetLayerState( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) { - return mozilla::LayerState::LAYER_NONE; + return LayerState::LAYER_NONE; } #ifdef MOZ_DUMP_PAINTING @@ -2797,10 +2752,9 @@ class nsDisplayItem : public nsDisplayItemLink { * @return true if successfully creating webrender commands. */ virtual bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { return false; } @@ -2820,9 +2774,8 @@ class nsDisplayItem : public nsDisplayItemLink { * This function assumes that aData and aLayerData will either both be null, * or will both be non-null. The caller is responsible for enforcing this. */ - virtual bool UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) { + virtual bool UpdateScrollData(layers::WebRenderScrollData* aData, + layers::WebRenderLayerScrollData* aLayerData) { return false; } @@ -3054,7 +3007,7 @@ class nsDisplayItem : public nsDisplayItemLink { virtual void NotifyUsed(nsDisplayListBuilder* aBuilder) {} - virtual mozilla::Maybe GetClipWithRespectToASR( + virtual Maybe GetClipWithRespectToASR( nsDisplayListBuilder* aBuilder, const ActiveScrolledRoot* aASR) const; const nsRect& GetPaintRect() const { return mPaintRect; } @@ -3063,9 +3016,7 @@ class nsDisplayItem : public nsDisplayItemLink { return GetPaintRect(); } - virtual const mozilla::HitTestInfo& GetHitTestInfo() { - return mozilla::HitTestInfo::Empty(); - } + virtual const HitTestInfo& GetHitTestInfo() { return HitTestInfo::Empty(); } nsIFrame* mFrame; // 8 @@ -3093,7 +3044,7 @@ class nsDisplayItem : public nsDisplayItemLink { #endif }; - mozilla::EnumSet mItemFlags; // 2 + EnumSet mItemFlags; // 2 DisplayItemType mType = DisplayItemType::TYPE_ZERO; // 1 uint8_t mExtraPageForPageNum = 0; // 1 uint16_t mPerFrameIndex = 0; // 2 @@ -3224,16 +3175,16 @@ class nsPaintedDisplayItem : public nsDisplayItem { * If an item is reused and has the cache index set, it means that * |DisplayItemCache| has assigned a cache slot for the item. */ - mozilla::Maybe& CacheIndex() { return mCacheIndex; } + Maybe& CacheIndex() { return mCacheIndex; } void InvalidateItemCacheEntry() override { // |nsPaintedDisplayItem|s may have |DisplayItemCache| entries // that no longer match after a mutation. The cache will notice // on its own that the entry is no longer in use, and free it. - mCacheIndex = mozilla::Nothing(); + mCacheIndex = Nothing(); } - const mozilla::HitTestInfo& GetHitTestInfo() final { return mHitTestInfo; } + const HitTestInfo& GetHitTestInfo() final { return mHitTestInfo; } void InitializeHitTestInfo(nsDisplayListBuilder* aBuilder) { mHitTestInfo.Initialize(aBuilder, Frame()); SetHasHitTestInfo(); @@ -3253,8 +3204,8 @@ class nsPaintedDisplayItem : public nsDisplayItem { : nsDisplayItem(aBuilder, aOther), mHitTestInfo(aOther.mHitTestInfo) {} protected: - mozilla::HitTestInfo mHitTestInfo; - mozilla::Maybe mCacheIndex; + HitTestInfo mHitTestInfo; + Maybe mCacheIndex; }; /** @@ -3274,11 +3225,6 @@ class nsPaintedDisplayItem : public nsDisplayItem { */ class nsDisplayList { public: - typedef mozilla::ActiveScrolledRoot ActiveScrolledRoot; - typedef mozilla::layers::Layer Layer; - typedef mozilla::layers::LayerManager LayerManager; - typedef mozilla::layers::PaintedLayer PaintedLayer; - class Iterator { public: constexpr Iterator() : mCurrent(nullptr), mEnd(nullptr) {} @@ -3644,14 +3590,13 @@ class nsDisplayList { PAINT_COMPRESSED = 0x10, PAINT_IDENTICAL_DISPLAY_LIST = 0x20 }; - already_AddRefed PaintRoot( + already_AddRefed PaintRoot( nsDisplayListBuilder* aBuilder, gfxContext* aCtx, uint32_t aFlags, - mozilla::Maybe aDisplayListBuildTime); + Maybe aDisplayListBuildTime); - mozilla::FrameLayerBuilder* BuildLayers(nsDisplayListBuilder* aBuilder, - LayerManager* aLayerManager, - uint32_t aFlags, - bool aIsWidgetTransaction); + FrameLayerBuilder* BuildLayers(nsDisplayListBuilder* aBuilder, + layers::LayerManager* aLayerManager, + uint32_t aFlags, bool aIsWidgetTransaction); void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx, int32_t aAppUnitsPerDevPixel); @@ -3948,10 +3893,9 @@ class nsDisplayContainer final : public nsDisplayItem { nsRegion* aVisibleRegion) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override; @@ -3961,9 +3905,8 @@ class nsDisplayContainer final : public nsDisplayItem { nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder, bool* aSnap) const override; - mozilla::Maybe IsUniform( - nsDisplayListBuilder* aBuilder) const override { - return mozilla::Nothing(); + Maybe IsUniform(nsDisplayListBuilder* aBuilder) const override { + return Nothing(); } RetainedDisplayList* GetChildren() const override { return &mChildren; } @@ -3971,7 +3914,7 @@ class nsDisplayContainer final : public nsDisplayItem { return GetChildren(); } - mozilla::Maybe GetClipWithRespectToASR( + Maybe GetClipWithRespectToASR( nsDisplayListBuilder* aBuilder, const ActiveScrolledRoot* aASR) const override; @@ -3996,11 +3939,6 @@ class nsDisplayContainer final : public nsDisplayItem { class nsDisplayImageContainer : public nsPaintedDisplayItem { public: - typedef mozilla::LayerIntPoint LayerIntPoint; - typedef mozilla::LayoutDeviceRect LayoutDeviceRect; - typedef mozilla::layers::ImageContainer ImageContainer; - typedef mozilla::layers::ImageLayer ImageLayer; - nsDisplayImageContainer(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) : nsPaintedDisplayItem(aBuilder, aFrame) {} @@ -4012,12 +3950,12 @@ class nsDisplayImageContainer : public nsPaintedDisplayItem { virtual bool CanOptimizeToImageLayer(LayerManager* aManager, nsDisplayListBuilder* aBuilder); - already_AddRefed GetContainer(LayerManager* aManager, - nsDisplayListBuilder* aBuilder); - void ConfigureLayer(ImageLayer* aLayer, + already_AddRefed GetContainer( + LayerManager* aManager, nsDisplayListBuilder* aBuilder); + void ConfigureLayer(layers::ImageLayer* aLayer, const ContainerLayerParameters& aParameters); - virtual void UpdateDrawResult(mozilla::image::ImgDrawResult aResult) = 0; + virtual void UpdateDrawResult(image::ImgDrawResult aResult) = 0; virtual already_AddRefed GetImage() = 0; virtual nsRect GetDestRect() const = 0; @@ -4036,7 +3974,7 @@ class nsDisplayImageContainer : public nsPaintedDisplayItem { */ class nsDisplayGeneric : public nsPaintedDisplayItem { public: - typedef void (*PaintCallback)(nsIFrame* aFrame, DrawTarget* aDrawTarget, + typedef void (*PaintCallback)(nsIFrame* aFrame, gfx::DrawTarget* aDrawTarget, const nsRect& aDirtyRect, nsPoint aFramePt); // XXX: should be removed eventually @@ -4188,10 +4126,9 @@ class nsDisplayCaret : public nsPaintedDisplayItem { nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override; void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; protected: @@ -4216,10 +4153,9 @@ class nsDisplayBorder : public nsPaintedDisplayItem { nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; nsDisplayItemGeometry* AllocateGeometry( @@ -4267,27 +4203,24 @@ class nsDisplayBorder : public nsPaintedDisplayItem { nscoord radii[8]; if (mFrame->GetBorderRadii(radii)) { if (border.left > 0 || border.top > 0) { - nsSize cornerSize(radii[mozilla::eCornerTopLeftX], - radii[mozilla::eCornerTopLeftY]); + nsSize cornerSize(radii[eCornerTopLeftX], radii[eCornerTopLeftY]); result.OrWith(nsRect(borderBounds.TopLeft(), cornerSize)); } if (border.top > 0 || border.right > 0) { - nsSize cornerSize(radii[mozilla::eCornerTopRightX], - radii[mozilla::eCornerTopRightY]); + nsSize cornerSize(radii[eCornerTopRightX], radii[eCornerTopRightY]); result.OrWith( nsRect(borderBounds.TopRight() - nsPoint(cornerSize.width, 0), cornerSize)); } if (border.right > 0 || border.bottom > 0) { - nsSize cornerSize(radii[mozilla::eCornerBottomRightX], - radii[mozilla::eCornerBottomRightY]); + nsSize cornerSize(radii[eCornerBottomRightX], + radii[eCornerBottomRightY]); result.OrWith(nsRect(borderBounds.BottomRight() - nsPoint(cornerSize.width, cornerSize.height), cornerSize)); } if (border.bottom > 0 || border.left > 0) { - nsSize cornerSize(radii[mozilla::eCornerBottomLeftX], - radii[mozilla::eCornerBottomLeftY]); + nsSize cornerSize(radii[eCornerBottomLeftX], radii[eCornerBottomLeftY]); result.OrWith( nsRect(borderBounds.BottomLeft() - nsPoint(0, cornerSize.height), cornerSize)); @@ -4344,9 +4277,8 @@ class nsDisplaySolidColorBase : public nsPaintedDisplayItem { return result; } - mozilla::Maybe IsUniform( - nsDisplayListBuilder* aBuilder) const override { - return mozilla::Some(mColor); + Maybe IsUniform(nsDisplayListBuilder* aBuilder) const override { + return Some(mColor); } protected: @@ -4381,10 +4313,9 @@ class nsDisplaySolidColor : public nsDisplaySolidColorBase { void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; void WriteDebugInfo(std::stringstream& aStream) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; int32_t ZIndex() const override { @@ -4394,13 +4325,11 @@ class nsDisplaySolidColor : public nsDisplaySolidColorBase { return nsDisplaySolidColorBase::ZIndex(); } - void SetOverrideZIndex(int32_t aZIndex) { - mOverrideZIndex = mozilla::Some(aZIndex); - } + void SetOverrideZIndex(int32_t aZIndex) { mOverrideZIndex = Some(aZIndex); } private: nsRect mBounds; - mozilla::Maybe mOverrideZIndex; + Maybe mOverrideZIndex; }; /** @@ -4409,14 +4338,12 @@ class nsDisplaySolidColor : public nsDisplaySolidColorBase { * the find bar highlighter dimmer. */ class nsDisplaySolidColorRegion : public nsPaintedDisplayItem { - typedef mozilla::gfx::sRGBColor sRGBColor; - public: nsDisplaySolidColorRegion(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const nsRegion& aRegion, nscolor aColor) : nsPaintedDisplayItem(aBuilder, aFrame), mRegion(aRegion), - mColor(sRGBColor::FromABGR(aColor)) { + mColor(gfx::sRGBColor::FromABGR(aColor)) { NS_ASSERTION(NS_GET_A(aColor) > 0, "Don't create invisible nsDisplaySolidColorRegions!"); MOZ_COUNT_CTOR(nsDisplaySolidColorRegion); @@ -4445,10 +4372,9 @@ class nsDisplaySolidColorRegion : public nsPaintedDisplayItem { } bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; protected: @@ -4458,7 +4384,7 @@ class nsDisplaySolidColorRegion : public nsPaintedDisplayItem { private: nsRegion mRegion; - sRGBColor mColor; + gfx::sRGBColor mColor; }; enum class AppendedBackgroundType : uint8_t { @@ -4473,11 +4399,9 @@ enum class AppendedBackgroundType : uint8_t { */ class nsDisplayBackgroundImage : public nsDisplayImageContainer { public: - typedef mozilla::StyleGeometryBox StyleGeometryBox; - struct InitData { nsDisplayListBuilder* builder; - mozilla::ComputedStyle* backgroundStyle; + ComputedStyle* backgroundStyle; nsCOMPtr image; nsRect backgroundRect; nsRect fillArea; @@ -4496,7 +4420,7 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer { */ static InitData GetInitData(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, uint16_t aLayer, const nsRect& aBackgroundRect, - mozilla::ComputedStyle* aBackgroundStyle); + ComputedStyle* aBackgroundStyle); explicit nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const InitData& aInitData, @@ -4523,10 +4447,10 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer { nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const nsRect& aBackgroundRect, nsDisplayList* aList, bool aAllowWillPaintBorderOptimization = true, - mozilla::ComputedStyle* aComputedStyle = nullptr, + ComputedStyle* aComputedStyle = nullptr, const nsRect& aBackgroundOriginRect = nsRect(), nsIFrame* aSecondaryReferenceFrame = nullptr, - mozilla::Maybe* + Maybe* aAutoBuildingDisplayList = nullptr); LayerState GetLayerState( @@ -4534,12 +4458,11 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer { const ContainerLayerParameters& aParameters) override; already_AddRefed BuildLayer( nsDisplayListBuilder* aBuilder, LayerManager* aManager, - const ContainerLayerParameters& aContainerParameters) override; + const ContainerLayerParameters& aParameters) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, HitTestState* aState, nsTArray* aOutFrames) override; @@ -4547,8 +4470,7 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer { nsRegion* aVisibleRegion) override; nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder, bool* aSnap) const override; - mozilla::Maybe IsUniform( - nsDisplayListBuilder* aBuilder) const override; + Maybe IsUniform(nsDisplayListBuilder* aBuilder) const override; bool CanApplyOpacity() const override { return true; } @@ -4593,7 +4515,7 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer { already_AddRefed GetImage() override; nsRect GetDestRect() const override; - void UpdateDrawResult(mozilla::image::ImgDrawResult aResult) override { + void UpdateDrawResult(image::ImgDrawResult aResult) override { nsDisplayBackgroundGeometry::UpdateDrawResult(this, aResult); } @@ -4629,9 +4551,6 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer { } protected: - typedef class mozilla::layers::ImageContainer ImageContainer; - typedef class mozilla::layers::ImageLayer ImageLayer; - bool CanBuildWebRenderDisplayItems(LayerManager* aManager, nsDisplayListBuilder* aBuilder); nsRect GetBoundsInternal(nsDisplayListBuilder* aBuilder, @@ -4652,7 +4571,7 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer { // Cache the result of nsCSSRendering::FindBackground. Always null if // mIsThemed is true or if FindBackground returned false. - RefPtr mBackgroundStyle; + RefPtr mBackgroundStyle; nsCOMPtr mImage; nsIFrame* mDependentFrame; nsRect mBackgroundRect; // relative to the reference frame @@ -4684,7 +4603,7 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer { class nsDisplayTableBackgroundImage : public nsDisplayBackgroundImage { public: nsDisplayTableBackgroundImage(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, const InitData& aInitData, + nsIFrame* aFrame, const InitData& aData, nsIFrame* aCellFrame); ~nsDisplayTableBackgroundImage() override; @@ -4730,13 +4649,11 @@ class nsDisplayThemedBackground : public nsPaintedDisplayItem { HitTestState* aState, nsTArray* aOutFrames) override; nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder, bool* aSnap) const override; - mozilla::Maybe IsUniform( - nsDisplayListBuilder* aBuilder) const override; + Maybe IsUniform(nsDisplayListBuilder* aBuilder) const override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; bool MustPaintOnContentSide() const override { return true; } @@ -4781,7 +4698,7 @@ class nsDisplayThemedBackground : public nsPaintedDisplayItem { nsRect mBackgroundRect; nsRect mBounds; nsITheme::Transparency mThemeTransparency; - mozilla::StyleAppearance mAppearance; + StyleAppearance mAppearance; }; class nsDisplayTableThemedBackground : public nsDisplayThemedBackground { @@ -4822,18 +4739,16 @@ class nsDisplayTableThemedBackground : public nsDisplayThemedBackground { }; class nsDisplayBackgroundColor : public nsPaintedDisplayItem { - typedef mozilla::gfx::sRGBColor sRGBColor; - public: nsDisplayBackgroundColor(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const nsRect& aBackgroundRect, - const mozilla::ComputedStyle* aBackgroundStyle, + const ComputedStyle* aBackgroundStyle, const nscolor& aColor) : nsPaintedDisplayItem(aBuilder, aFrame), mBackgroundRect(aBackgroundRect), mHasStyle(aBackgroundStyle), mDependentFrame(nullptr), - mColor(sRGBColor::FromABGR(aColor)) { + mColor(gfx::sRGBColor::FromABGR(aColor)) { mState.mColor = mColor; if (mHasStyle) { @@ -4863,7 +4778,7 @@ class nsDisplayBackgroundColor : public nsPaintedDisplayItem { bool HasBackgroundClipText() const { MOZ_ASSERT(mHasStyle); - return mBottomLayerClip == mozilla::StyleGeometryBox::Text; + return mBottomLayerClip == StyleGeometryBox::Text; } LayerState GetLayerState( @@ -4876,15 +4791,13 @@ class nsDisplayBackgroundColor : public nsPaintedDisplayItem { nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aContainerParameters) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder, bool* aSnap) const override; - mozilla::Maybe IsUniform( - nsDisplayListBuilder* aBuilder) const override; + Maybe IsUniform(nsDisplayListBuilder* aBuilder) const override; void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, HitTestState* aState, nsTArray* aOutFrames) override; void ApplyOpacity(nsDisplayListBuilder* aBuilder, float aOpacity, @@ -4957,12 +4870,12 @@ class nsDisplayBackgroundColor : public nsPaintedDisplayItem { protected: const nsRect mBackgroundRect; const bool mHasStyle; - mozilla::StyleGeometryBox mBottomLayerClip; + StyleGeometryBox mBottomLayerClip; nsIFrame* mDependentFrame; - mozilla::gfx::sRGBColor mColor; + gfx::sRGBColor mColor; struct { - mozilla::gfx::sRGBColor mColor; + gfx::sRGBColor mColor; } mState; }; @@ -4970,7 +4883,7 @@ class nsDisplayTableBackgroundColor : public nsDisplayBackgroundColor { public: nsDisplayTableBackgroundColor(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const nsRect& aBackgroundRect, - const mozilla::ComputedStyle* aBackgroundStyle, + const ComputedStyle* aBackgroundStyle, const nscolor& aColor, nsIFrame* aAncestorFrame) : nsDisplayBackgroundColor(aBuilder, aFrame, aBackgroundRect, aBackgroundStyle, aColor), @@ -5057,10 +4970,9 @@ class nsDisplayBoxShadowOuter final : public nsPaintedDisplayItem { bool CanBuildWebRenderDisplayItems(); bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; nsRect GetBoundsInternal(); @@ -5117,16 +5029,14 @@ class nsDisplayBoxShadowInner : public nsPaintedDisplayItem { static bool CanCreateWebRenderCommands(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - const nsPoint& aReferencePoint); + const nsPoint& aReferenceOffset); static void CreateInsetBoxShadowWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - const StackingContextHelper& aSc, nsRegion& aVisibleRegion, - nsIFrame* aFrame, const nsRect& aBorderRect); + wr::DisplayListBuilder& aBuilder, const StackingContextHelper& aSc, + nsRegion& aVisibleRegion, nsIFrame* aFrame, const nsRect& aBorderRect); bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; private: @@ -5154,10 +5064,9 @@ class nsDisplayOutline final : public nsPaintedDisplayItem { } bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; bool IsInvisibleInRect(const nsRect& aRect) const override; nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override; @@ -5206,7 +5115,7 @@ class nsDisplayCompositorHitTestInfo final : public nsDisplayItem { nsDisplayCompositorHitTestInfo( nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const nsRect& aArea, - const mozilla::gfx::CompositorHitTestInfo& aHitTestFlags) + const gfx::CompositorHitTestInfo& aHitTestFlags) : nsDisplayItem(aBuilder, aFrame) { MOZ_COUNT_CTOR(nsDisplayCompositorHitTestInfo); mHitTestInfo.SetAreaAndInfo(aArea, aHitTestFlags); @@ -5219,10 +5128,9 @@ class nsDisplayCompositorHitTestInfo final : public nsDisplayItem { NS_DISPLAY_DECL_NAME("CompositorHitTestInfo", TYPE_COMPOSITOR_HITTEST_INFO) bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; int32_t ZIndex() const override; @@ -5233,11 +5141,11 @@ class nsDisplayCompositorHitTestInfo final : public nsDisplayItem { return nsRect(); } - const mozilla::HitTestInfo& GetHitTestInfo() final { return mHitTestInfo; } + const HitTestInfo& GetHitTestInfo() final { return mHitTestInfo; } private: - mozilla::HitTestInfo mHitTestInfo; - mozilla::Maybe mOverrideZIndex; + HitTestInfo mHitTestInfo; + Maybe mOverrideZIndex; }; /** @@ -5353,8 +5261,7 @@ class nsDisplayWrapList : public nsPaintedDisplayItem { nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override; nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder, bool* aSnap) const override; - mozilla::Maybe IsUniform( - nsDisplayListBuilder* aBuilder) const override; + Maybe IsUniform(nsDisplayListBuilder* aBuilder) const override; bool ComputeVisibility(nsDisplayListBuilder* aBuilder, nsRegion* aVisibleRegion) override; @@ -5443,10 +5350,9 @@ class nsDisplayWrapList : public nsPaintedDisplayItem { } bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; const ActiveScrolledRoot* GetFrameActiveScrolledRoot() { @@ -5636,10 +5542,9 @@ class nsDisplayOpacity : public nsDisplayWrapList { void WriteDebugInfo(std::stringstream& aStream) override; bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; float GetOpacity() const { return mOpacity; } @@ -5672,13 +5577,13 @@ class nsDisplayOpacity : public nsDisplayWrapList { struct { float mOpacity; - } mState; + } mState{}; }; class nsDisplayBlendMode : public nsDisplayWrapList { public: nsDisplayBlendMode(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsDisplayList* aList, mozilla::StyleBlend aBlendMode, + nsDisplayList* aList, StyleBlend aBlendMode, const ActiveScrolledRoot* aActiveScrolledRoot, const bool aIsForBackground); nsDisplayBlendMode(nsDisplayListBuilder* aBuilder, @@ -5709,10 +5614,9 @@ class nsDisplayBlendMode : public nsDisplayWrapList { nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; bool ComputeVisibility(nsDisplayListBuilder* aBuilder, @@ -5724,12 +5628,12 @@ class nsDisplayBlendMode : public nsDisplayWrapList { return false; } - mozilla::gfx::CompositionOp BlendMode(); + gfx::CompositionOp BlendMode(); bool CreatesStackingContextHelper() override { return true; } protected: - mozilla::StyleBlend mBlendMode; + StyleBlend mBlendMode; bool mIsForBackground; private: @@ -5739,7 +5643,7 @@ class nsDisplayBlendMode : public nsDisplayWrapList { class nsDisplayTableBlendMode : public nsDisplayBlendMode { public: nsDisplayTableBlendMode(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsDisplayList* aList, mozilla::StyleBlend aBlendMode, + nsDisplayList* aList, StyleBlend aBlendMode, const ActiveScrolledRoot* aActiveScrolledRoot, nsIFrame* aAncestorFrame, const bool aIsForBackground) : nsDisplayBlendMode(aBuilder, aFrame, aList, aBlendMode, @@ -5807,10 +5711,9 @@ class nsDisplayBlendContainer : public nsDisplayWrapList { const ContainerLayerParameters& aParameters) override; void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; bool CanMerge(const nsDisplayItem* aItem) const override { @@ -5912,8 +5815,6 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(nsDisplayOwnLayerFlags) */ class nsDisplayOwnLayer : public nsDisplayWrapList { public: - typedef mozilla::layers::ScrollbarData ScrollbarData; - enum OwnLayerType { OwnLayerForTransformWithRoundedClip, OwnLayerForStackingContext, @@ -5939,7 +5840,7 @@ class nsDisplayOwnLayer : public nsDisplayWrapList { nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, const ActiveScrolledRoot* aActiveScrolledRoot, nsDisplayOwnLayerFlags aFlags = nsDisplayOwnLayerFlags::None, - const ScrollbarData& aScrollbarData = ScrollbarData{}, + const layers::ScrollbarData& aScrollbarData = layers::ScrollbarData{}, bool aForceActive = true, bool aClearClipChain = false); nsDisplayOwnLayer(nsDisplayListBuilder* aBuilder, @@ -5960,14 +5861,12 @@ class nsDisplayOwnLayer : public nsDisplayWrapList { nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aContainerParameters) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; - bool UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) override; + bool UpdateScrollData(layers::WebRenderScrollData* aData, + layers::WebRenderLayerScrollData* aLayerData) override; LayerState GetLayerState( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override; @@ -6007,7 +5906,7 @@ class nsDisplayOwnLayer : public nsDisplayWrapList { * default-constructed (in particular with mDirection == Nothing()) * and can be ignored. */ - ScrollbarData mScrollbarData; + layers::ScrollbarData mScrollbarData; bool mForceActive; uint64_t mWrAnimationId; }; @@ -6044,7 +5943,7 @@ class nsDisplaySubDocument : public nsDisplayOwnLayer { nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override { if (mShouldFlatten) { - return mozilla::LayerState::LAYER_NONE; + return LayerState::LAYER_NONE; } return nsDisplayOwnLayer::GetLayerState(aBuilder, aManager, aParameters); } @@ -6059,7 +5958,7 @@ class nsDisplaySubDocument : public nsDisplayOwnLayer { protected: ViewID mScrollParentId; - bool mForceDispatchToContentRegion; + bool mForceDispatchToContentRegion{}; bool mShouldFlatten; nsSubDocumentFrame* mSubDocFrame; }; @@ -6097,7 +5996,7 @@ class nsDisplayStickyPosition : public nsDisplayOwnLayer { LayerState GetLayerState( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override { - return mozilla::LayerState::LAYER_ACTIVE; + return LayerState::LAYER_ACTIVE; } void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override { GetChildren()->Paint(aBuilder, aCtx, @@ -6105,15 +6004,13 @@ class nsDisplayStickyPosition : public nsDisplayOwnLayer { } bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; - bool UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) override; + bool UpdateScrollData(layers::WebRenderScrollData* aData, + layers::WebRenderLayerScrollData* aLayerData) override; const ActiveScrolledRoot* GetContainerASR() const { return mContainerASR; } @@ -6122,13 +6019,13 @@ class nsDisplayStickyPosition : public nsDisplayOwnLayer { private: NS_DISPLAY_ALLOW_CLONING() - void CalculateLayerScrollRanges( - mozilla::StickyScrollContainer* aStickyScrollContainer, - float aAppUnitsPerDevPixel, float aScaleX, float aScaleY, - mozilla::LayerRectAbsolute& aStickyOuter, - mozilla::LayerRectAbsolute& aStickyInner); + void CalculateLayerScrollRanges(StickyScrollContainer* aStickyScrollContainer, + float aAppUnitsPerDevPixel, float aScaleX, + float aScaleY, + LayerRectAbsolute& aStickyOuter, + LayerRectAbsolute& aStickyInner); - mozilla::StickyScrollContainer* GetStickyScrollContainer(); + StickyScrollContainer* GetStickyScrollContainer(); // This stores the ASR that this sticky container item would have assuming it // has no fixed descendants. This may be the same as the ASR returned by @@ -6179,7 +6076,7 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer { LayerState GetLayerState( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override { - return mozilla::LayerState::LAYER_ACTIVE_FORCE; + return LayerState::LAYER_ACTIVE_FORCE; } void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override { GetChildren()->Paint(aBuilder, aCtx, @@ -6195,14 +6092,12 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer { } bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; - bool UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) override; + bool UpdateScrollData(layers::WebRenderScrollData* aData, + layers::WebRenderLayerScrollData* aLayerData) override; void WriteDebugInfo(std::stringstream& aStream) override; protected: @@ -6264,7 +6159,7 @@ class nsDisplayScrollInfoLayer : public nsDisplayWrapList { public: nsDisplayScrollInfoLayer(nsDisplayListBuilder* aBuilder, nsIFrame* aScrolledFrame, nsIFrame* aScrollFrame, - const CompositorHitTestInfo& aHitInfo, + const gfx::CompositorHitTestInfo& aHitInfo, const nsRect& aHitArea); MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayScrollInfoLayer) @@ -6293,24 +6188,22 @@ class nsDisplayScrollInfoLayer : public nsDisplayWrapList { } void WriteDebugInfo(std::stringstream& aStream) override; - mozilla::UniquePtr ComputeScrollMetadata( + UniquePtr ComputeScrollMetadata( nsDisplayListBuilder* aBuilder, LayerManager* aLayerManager, const ContainerLayerParameters& aContainerParameters); - bool UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) override; + bool UpdateScrollData(layers::WebRenderScrollData* aData, + layers::WebRenderLayerScrollData* aLayerData) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; protected: nsIFrame* mScrollFrame; nsIFrame* mScrolledFrame; ViewID mScrollParentId; - CompositorHitTestInfo mHitInfo; + gfx::CompositorHitTestInfo mHitInfo; nsRect mHitArea; }; @@ -6347,7 +6240,7 @@ class nsDisplayZoom : public nsDisplaySubDocument { LayerState GetLayerState( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override { - return mozilla::LayerState::LAYER_ACTIVE; + return LayerState::LAYER_ACTIVE; } // Get the app units per dev pixel ratio of the child document. @@ -6371,7 +6264,7 @@ class nsDisplayAsyncZoom : public nsDisplayOwnLayer { nsDisplayAsyncZoom(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, const ActiveScrolledRoot* aActiveScrolledRoot, - mozilla::layers::FrameMetrics::ViewID aViewID); + layers::FrameMetrics::ViewID aViewID); nsDisplayAsyncZoom(nsDisplayListBuilder* aBuilder, const nsDisplayAsyncZoom& aOther) : nsDisplayOwnLayer(aBuilder, aOther), mViewID(aOther.mViewID) { @@ -6392,14 +6285,13 @@ class nsDisplayAsyncZoom : public nsDisplayOwnLayer { LayerState GetLayerState( nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override { - return mozilla::LayerState::LAYER_ACTIVE_FORCE; + return LayerState::LAYER_ACTIVE_FORCE; } - bool UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) override; + bool UpdateScrollData(layers::WebRenderScrollData* aData, + layers::WebRenderLayerScrollData* aLayerData) override; protected: - mozilla::layers::FrameMetrics::ViewID mViewID; + layers::FrameMetrics::ViewID mViewID; }; /** @@ -6477,8 +6369,6 @@ class nsDisplayEffectsBase : public nsDisplayWrapList { */ class nsDisplayMasksAndClipPaths : public nsDisplayEffectsBase { public: - typedef mozilla::layers::ImageLayer ImageLayer; - nsDisplayMasksAndClipPaths(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, const ActiveScrolledRoot* aActiveScrolledRoot); @@ -6548,13 +6438,12 @@ class nsDisplayMasksAndClipPaths : public nsDisplayEffectsBase { void SelectOpacityOptimization(const bool aUsingLayers) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; - mozilla::Maybe GetClipWithRespectToASR( + Maybe GetClipWithRespectToASR( nsDisplayListBuilder* aBuilder, const ActiveScrolledRoot* aASR) const override; @@ -6593,10 +6482,9 @@ class nsDisplayBackdropRootContainer : public nsDisplayWrapList { void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) override { @@ -6620,10 +6508,9 @@ class nsDisplayBackdropFilters : public nsDisplayWrapList { NS_DISPLAY_DECL_NAME("BackdropFilter", TYPE_BACKDROP_FILTER) bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; @@ -6715,10 +6602,9 @@ class nsDisplayFilters : public nsDisplayEffectsBase { const std::function& aPaintChildren); bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; bool CanCreateWebRenderCommands(); @@ -6745,9 +6631,8 @@ class nsDisplayFilters : public nsDisplayEffectsBase { * INVARIANT: The wrapped frame is non-null. */ class nsDisplayTransform : public nsPaintedDisplayItem { - using Matrix4x4 = mozilla::gfx::Matrix4x4; - using Matrix4x4Flagged = mozilla::gfx::Matrix4x4Flagged; - using Point3D = mozilla::gfx::Point3D; + using Matrix4x4 = gfx::Matrix4x4; + using Matrix4x4Flagged = gfx::Matrix4x4Flagged; using TransformReferenceBox = nsStyleTransformMatrix::TransformReferenceBox; public: @@ -6828,16 +6713,14 @@ class nsDisplayTransform : public nsPaintedDisplayItem { const ContainerLayerParameters& aContainerParameters) override; void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx, - const mozilla::Maybe& aPolygon); + const Maybe& aPolygon); bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; - bool UpdateScrollData( - mozilla::layers::WebRenderScrollData* aData, - mozilla::layers::WebRenderLayerScrollData* aLayerData) override; + bool UpdateScrollData(layers::WebRenderScrollData* aData, + layers::WebRenderLayerScrollData* aLayerData) override; bool ComputeVisibility(nsDisplayListBuilder* aBuilder, nsRegion* aVisibleRegion) override; @@ -6896,7 +6779,7 @@ class nsDisplayTransform : public nsPaintedDisplayItem { bool ShouldSkipTransform(nsDisplayListBuilder* aBuilder) const; Matrix4x4 GetTransformForRendering( - mozilla::LayoutDevicePoint* aOutOrigin = nullptr) const; + LayoutDevicePoint* aOutOrigin = nullptr) const; /** * Return the transform that is aggregation of all transform on the @@ -6948,9 +6831,9 @@ class nsDisplayTransform : public nsPaintedDisplayItem { return UntransformRect(aBuilder, GetPaintRect(), aOutRect); } - static Point3D GetDeltaToTransformOrigin(const nsIFrame* aFrame, - TransformReferenceBox&, - float aAppUnitsPerPixel); + static gfx::Point3D GetDeltaToTransformOrigin(const nsIFrame* aFrame, + TransformReferenceBox&, + float aAppUnitsPerPixel); /* * Returns true if aFrame has perspective applied from its containing @@ -6969,12 +6852,12 @@ class nsDisplayTransform : public nsPaintedDisplayItem { FrameTransformProperties(const nsIFrame* aFrame, TransformReferenceBox& aRefBox, float aAppUnitsPerPixel); - FrameTransformProperties( - const mozilla::StyleTranslate& aTranslate, - const mozilla::StyleRotate& aRotate, const mozilla::StyleScale& aScale, - const mozilla::StyleTransform& aTransform, - const mozilla::Maybe& aMotion, - const Point3D& aToTransformOrigin) + FrameTransformProperties(const StyleTranslate& aTranslate, + const StyleRotate& aRotate, + const StyleScale& aScale, + const StyleTransform& aTransform, + const Maybe& aMotion, + const gfx::Point3D& aToTransformOrigin) : mFrame(nullptr), mTranslate(aTranslate), mRotate(aRotate), @@ -6989,12 +6872,12 @@ class nsDisplayTransform : public nsPaintedDisplayItem { } const nsIFrame* mFrame; - const mozilla::StyleTranslate& mTranslate; - const mozilla::StyleRotate& mRotate; - const mozilla::StyleScale& mScale; - const mozilla::StyleTransform& mTransform; - const mozilla::Maybe mMotion; - const Point3D mToTransformOrigin; + const StyleTranslate& mTranslate; + const StyleRotate& mRotate; + const StyleScale& mScale; + const StyleTransform& mTransform; + const Maybe mMotion; + const gfx::Point3D mToTransformOrigin; }; /** @@ -7104,14 +6987,14 @@ class nsDisplayTransform : public nsPaintedDisplayItem { void Collect3DTransformLeaves(nsDisplayListBuilder* aBuilder, nsTArray& aLeaves); - using TransformPolygon = mozilla::layers::BSPPolygon; + using TransformPolygon = layers::BSPPolygon; void CollectSorted3DTransformLeaves(nsDisplayListBuilder* aBuilder, nsTArray& aLeaves); - mutable mozilla::Maybe mTransform; - mutable mozilla::Maybe mInverseTransform; + mutable Maybe mTransform; + mutable Maybe mInverseTransform; // Accumulated transform of ancestors on the preserves-3d chain. - mozilla::UniquePtr mTransformPreserves3D; + UniquePtr mTransformPreserves3D; RefPtr mAnimatedGeometryRootForChildren; RefPtr mAnimatedGeometryRootForScrollMetadata; nsRect mChildrenBuildingRect; @@ -7142,8 +7025,6 @@ class nsDisplayTransform : public nsPaintedDisplayItem { * APZ can scroll the child separately. */ class nsDisplayPerspective : public nsPaintedDisplayItem { - typedef mozilla::gfx::Point3D Point3D; - public: nsDisplayPerspective(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList); @@ -7181,10 +7062,9 @@ class nsDisplayPerspective : public nsPaintedDisplayItem { nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; already_AddRefed BuildLayer( @@ -7257,12 +7137,11 @@ class nsDisplayText final : public nsPaintedDisplayItem { } } - bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, - const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, - nsDisplayListBuilder* aDisplayListBuilder) final; + bool CreateWebRenderCommands(wr::DisplayListBuilder& aBuilder, + wr::IpcResourceUpdateQueue& aResources, + const StackingContextHelper& aSc, + layers::RenderRootStateManager* aManager, + nsDisplayListBuilder* aDisplayListBuilder) final; void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) final; nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) const final { @@ -7370,10 +7249,9 @@ class nsDisplaySVGWrapper : public nsDisplayWrapList { } bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) override; bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; }; @@ -7403,10 +7281,9 @@ class nsDisplayForeignObject : public nsDisplayWrapList { } bool CreateWebRenderCommands( - mozilla::wr::DisplayListBuilder& aBuilder, - mozilla::wr::IpcResourceUpdateQueue& aResources, + wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, - mozilla::layers::RenderRootStateManager* aManager, + layers::RenderRootStateManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) override; }; @@ -7550,7 +7427,7 @@ class PaintTelemetry { ~AutoRecordPaint(); private: - mozilla::TimeStamp mStart; + TimeStamp mStart; }; private: