Bug 1521644 - In containerless mode, move handling of pres shell resolution from nsDisplayResolution to nsDisplayAsyncZoom. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D17171

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2019-02-01 18:30:50 +00:00
Родитель d68203346f
Коммит 9468a30c0e
1 изменённых файлов: 32 добавлений и 11 удалений

Просмотреть файл

@ -2471,8 +2471,11 @@ FrameLayerBuilder* nsDisplayList::BuildLayers(nsDisplayListBuilder* aBuilder,
rootLayer->SetScrollMetadata(nsTArray<ScrollMetadata>());
}
ContainerLayerParameters containerParameters(presShell->GetResolution(),
presShell->GetResolution());
float rootLayerResolution = gfxPrefs::LayoutUseContainersForRootFrames()
? presShell->GetResolution()
: 1.0f;
ContainerLayerParameters containerParameters(rootLayerResolution,
rootLayerResolution);
{
PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Layerization);
@ -2492,10 +2495,12 @@ FrameLayerBuilder* nsDisplayList::BuildLayers(nsDisplayListBuilder* aBuilder,
if (!root) {
return nullptr;
}
// Root is being scaled up by the X/Y resolution. Scale it back down.
root->SetPostScale(1.0f / containerParameters.mXScale,
1.0f / containerParameters.mYScale);
root->SetScaleToResolution(containerParameters.mXScale);
if (gfxPrefs::LayoutUseContainersForRootFrames()) {
// Root is being scaled up by the X/Y resolution. Scale it back down.
root->SetPostScale(1.0f / containerParameters.mXScale,
1.0f / containerParameters.mYScale);
root->SetScaleToResolution(containerParameters.mXScale);
}
auto callback = [root](ScrollableLayerGuid::ViewID aScrollId) -> bool {
return nsLayoutUtils::ContainsMetricsWithId(root, aScrollId);
@ -6573,15 +6578,22 @@ already_AddRefed<Layer> nsDisplayResolution::BuildLayer(
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters) {
nsIPresShell* presShell = mFrame->PresShell();
float rootLayerResolution = gfxPrefs::LayoutUseContainersForRootFrames()
? presShell->GetResolution()
: 1.0f;
ContainerLayerParameters containerParameters(
presShell->GetResolution(), presShell->GetResolution(), nsIntPoint(),
rootLayerResolution, rootLayerResolution, nsIntPoint(),
aContainerParameters);
RefPtr<Layer> layer =
nsDisplaySubDocument::BuildLayer(aBuilder, aManager, containerParameters);
layer->SetPostScale(1.0f / presShell->GetResolution(),
1.0f / presShell->GetResolution());
layer->AsContainerLayer()->SetScaleToResolution(presShell->GetResolution());
if (gfxPrefs::LayoutUseContainersForRootFrames()) {
layer->SetPostScale(1.0f / presShell->GetResolution(),
1.0f / presShell->GetResolution());
layer->AsContainerLayer()->SetScaleToResolution(presShell->GetResolution());
}
return layer.forget();
}
@ -7174,11 +7186,20 @@ nsDisplayAsyncZoom::~nsDisplayAsyncZoom() {
already_AddRefed<Layer> nsDisplayAsyncZoom::BuildLayer(
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters) {
nsIPresShell* presShell = mFrame->PresShell();
ContainerLayerParameters containerParameters(
presShell->GetResolution(), presShell->GetResolution(), nsIntPoint(),
aContainerParameters);
RefPtr<Layer> layer =
nsDisplayOwnLayer::BuildLayer(aBuilder, aManager, aContainerParameters);
nsDisplayOwnLayer::BuildLayer(aBuilder, aManager, containerParameters);
layer->SetIsAsyncZoomContainer(Some(mViewID));
layer->SetPostScale(1.0f / presShell->GetResolution(),
1.0f / presShell->GetResolution());
layer->AsContainerLayer()->SetScaleToResolution(presShell->GetResolution());
return layer.forget();
}