From 7675f794c13e504dce28dc14a9ddabf449a1fde0 Mon Sep 17 00:00:00 2001 From: Ethan Lin Date: Fri, 25 Aug 2017 16:36:15 +0800 Subject: [PATCH] Bug 1393706 - Compute display item's visibility when creating fallback data in layers-free mode. r=jrmuizel MozReview-Commit-ID: 6eUnABLce2Z --HG-- extra : rebase_source : 1a1b462897ef838c70eb8613501b940c06dd0f99 --- gfx/layers/wr/WebRenderLayerManager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gfx/layers/wr/WebRenderLayerManager.cpp b/gfx/layers/wr/WebRenderLayerManager.cpp index 41d42180b19c..f678faa2d015 100644 --- a/gfx/layers/wr/WebRenderLayerManager.cpp +++ b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -516,6 +516,13 @@ WebRenderLayerManager::GenerateFallbackData(nsDisplayItem* aItem, clippedBounds = itemBounds.Intersect(clip.GetClipRect()); } + // nsDisplayItem::Paint() may refer the variables that come from ComputeVisibility(). + // So we should call ComputeVisibility() before painting. e.g.: nsDisplayBoxShadowInner + // uses mVisibleRegion in Paint() and mVisibleRegion is computed in + // nsDisplayBoxShadowInner::ComputeVisibility(). + nsRegion visibleRegion(clippedBounds); + aItem->ComputeVisibility(aDisplayListBuilder, &visibleRegion); + const int32_t appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel(); LayerRect bounds = ViewAs( LayoutDeviceRect::FromAppUnits(clippedBounds, appUnitsPerDevPixel),