Bug 1641246 - Remove nsDisplayResolution. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D77111
This commit is contained in:
Kartikaya Gupta 2020-05-27 22:17:09 +00:00
parent 994485ee93
commit b0ee5dd871
6 changed files with 3 additions and 71 deletions

View file

@ -2428,7 +2428,7 @@ class ContainerLayer : public Layer {
// be part of mTransform.
float mInheritedXScale;
float mInheritedYScale;
// For layers corresponding to an nsDisplayResolution, the resolution of the
// For layers corresponding to an nsDisplayAsyncZoom, the resolution of the
// associated pres shell; for other layers, 1.0.
float mPresShellResolution;
bool mUseIntermediateSurface;

View file

@ -5297,21 +5297,6 @@ void PresShell::SetRenderingState(const RenderingState& aState) {
}
}
// nsSubDocumentFrame uses a resolution different from 1.0 to determine if it
// needs to build a nsDisplayResolution item. So if we are going from or
// to 1.0 then we need to invalidate the subdoc frame so that item gets
// created/removed.
if (mResolution.valueOr(1.0) != aState.mResolution.valueOr(1.0) &&
(mResolution.valueOr(1.0) == 1.0 ||
aState.mResolution.valueOr(1.0) == 1.0)) {
if (nsIFrame* frame = GetRootFrame()) {
frame = nsLayoutUtils::GetCrossDocParentFrame(frame);
if (frame) {
frame->InvalidateFrame();
}
}
}
mRenderingStateFlags = aState.mRenderingStateFlags;
mResolution = aState.mResolution;
}

View file

@ -431,12 +431,9 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
clipState.ClipContainingBlockDescendantsToContentBox(aBuilder, this);
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
bool constructResolutionItem =
subdocRootFrame && (presShell->GetResolution() != 1.0);
bool constructZoomItem = subdocRootFrame && parentAPD != subdocAPD;
bool needsOwnLayer = false;
if (constructResolutionItem || constructZoomItem ||
presContext->IsRootContentDocument() ||
if (constructZoomItem || presContext->IsRootContentDocument() ||
(sf && sf->IsScrollingActive(aBuilder))) {
needsOwnLayer = true;
}
@ -525,7 +522,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// becomes the topmost. We do this below.
if (constructZoomItem) {
nsDisplayOwnLayerFlags zoomFlags = flags;
if (ignoreViewportScrolling && !constructResolutionItem) {
if (ignoreViewportScrolling) {
zoomFlags |= nsDisplayOwnLayerFlags::GenerateScrollableLayer;
}
childItems.AppendNewToTop<nsDisplayZoom>(aBuilder, subdocRootFrame, this,
@ -540,12 +537,6 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (ignoreViewportScrolling) {
flags |= nsDisplayOwnLayerFlags::GenerateScrollableLayer;
}
if (constructResolutionItem) {
childItems.AppendNewToTop<nsDisplayResolution>(aBuilder, subdocRootFrame,
this, &childItems, flags);
needsOwnLayer = false;
}
// We always want top level content documents to be in their own layer.
nsDisplaySubDocument* layerItem = MakeDisplayItem<nsDisplaySubDocument>(

View file

@ -65,8 +65,6 @@ DECLARE_DISPLAY_ITEM_TYPE(PLUGIN_READBACK, 0)
DECLARE_DISPLAY_ITEM_TYPE(PRINT_PLUGIN, 0)
DECLARE_DISPLAY_ITEM_TYPE(RANGE_FOCUS_RING, 0)
DECLARE_DISPLAY_ITEM_TYPE(REMOTE, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(RESOLUTION,
TYPE_RENDERS_NO_IMAGES | TYPE_IS_CONTAINER)
DECLARE_DISPLAY_ITEM_TYPE(SCROLL_INFO_LAYER,
TYPE_RENDERS_NO_IMAGES | TYPE_IS_CONTAINER)
DECLARE_DISPLAY_ITEM_TYPE(SELECTION_OVERLAY, TYPE_RENDERS_NO_IMAGES)

View file

@ -6548,29 +6548,6 @@ nsRegion nsDisplaySubDocument::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
return nsDisplayOwnLayer::GetOpaqueRegion(aBuilder, aSnap);
}
nsDisplayResolution::nsDisplayResolution(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,
nsSubDocumentFrame* aSubDocFrame,
nsDisplayList* aList,
nsDisplayOwnLayerFlags aFlags)
: nsDisplaySubDocument(aBuilder, aFrame, aSubDocFrame, aList, aFlags) {
MOZ_COUNT_CTOR(nsDisplayResolution);
}
already_AddRefed<Layer> nsDisplayResolution::BuildLayer(
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters) {
float rootLayerResolution = 1.0f;
ContainerLayerParameters containerParameters(
rootLayerResolution, rootLayerResolution, nsIntPoint(),
aContainerParameters);
RefPtr<Layer> layer =
nsDisplaySubDocument::BuildLayer(aBuilder, aManager, containerParameters);
return layer.forget();
}
/* static */
nsDisplayFixedPosition* nsDisplayFixedPosition::CreateForFixedBackground(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsIFrame* aSecondaryFrame,

View file

@ -6107,25 +6107,6 @@ class nsDisplaySubDocument : public nsDisplayOwnLayer {
nsSubDocumentFrame* mSubDocFrame;
};
/**
* A display item for subdocuments to capture the resolution from the presShell
* and ensure that it gets applied to all the right elements. This item creates
* a container layer.
*/
class nsDisplayResolution : public nsDisplaySubDocument {
public:
nsDisplayResolution(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsSubDocumentFrame* aSubDocFrame, nsDisplayList* aList,
nsDisplayOwnLayerFlags aFlags);
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayResolution)
NS_DISPLAY_DECL_NAME("Resolution", TYPE_RESOLUTION)
already_AddRefed<Layer> BuildLayer(
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters) override;
};
/**
* A display item used to represent sticky position elements. The contents
* gets its own layer and creates a stacking context, and the layer will have