Bug 1451424 - emit a dispatch-to-content hittest region for all svg blobs. r?mstange,kats
MozReview-Commit-ID: 9yCF8dacZ7V
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -309,21 +309,26 @@ struct DIGroup
nsTHashtable<nsPtrHashKey<BlobItemData>> mDisplayItems;
nsPoint mAnimatedGeometryRootOrigin;
nsPoint mLastAnimatedGeometryRootOrigin;
IntRect mInvalidRect;
nsRect mGroupBounds;
int32_t mAppUnitsPerDevPixel;
gfx::Size mScale;
+ FrameMetrics::ViewID mScrollId;
LayerIntRect mLayerBounds;
Maybe<wr::ImageKey> mKey;
std::vector<RefPtr<SourceSurface>> mExternalSurfaces;
- DIGroup() : mAppUnitsPerDevPixel(0) {}
+ DIGroup()
+ : mAppUnitsPerDevPixel(0)
+ , mScrollId(FrameMetrics::NULL_SCROLL_ID)
+ {
+ }
void InvalidateRect(const IntRect& aRect)
{
// Empty rects get dropped
mInvalidRect = mInvalidRect.Union(aRect);
}
IntRect ItemBounds(nsDisplayItem* aItem)
@@ -645,19 +650,26 @@ struct DIGroup
}
void PushImage(wr::DisplayListBuilder& aBuilder, const LayoutDeviceRect& bounds)
{
wr::LayoutRect dest = wr::ToLayoutRect(bounds);
GP("PushImage: %f %f %f %f\n", dest.origin.x, dest.origin.y, dest.size.width, dest.size.height);
gfx::SamplingFilter sampleFilter = gfx::SamplingFilter::LINEAR; //nsLayoutUtils::GetSamplingFilterForFrame(aItem->Frame());
bool backfaceHidden = false;
+
+ // Emit a dispatch-to-content hit test region covering this area
+ auto hitInfo = CompositorHitTestInfo::eVisibleToHitTest |
+ CompositorHitTestInfo::eDispatchToContent;
+
+ aBuilder.SetHitTestInfo(mScrollId, hitInfo);
aBuilder.PushImage(dest, dest, !backfaceHidden,
wr::ToImageRendering(sampleFilter),
mKey.value());
+ aBuilder.ClearHitTestInfo();
}
void PaintItemRange(Grouper* aGrouper,
nsDisplayItem* aStartItem,
nsDisplayItem* aEndItem,
gfxContext* aContext,
WebRenderDrawEventRecorder* aRecorder) {
LayerIntSize size = mLayerBounds.Size();
@@ -1079,21 +1091,28 @@ WebRenderCommandBuilder::DoGroupingForDi
group.ClearItems();
if (group.mKey) {
IntSize size = groupBounds.Size().ScaleToNearestPixels(scale.width, scale.height, g.mAppUnitsPerDevPixel);
group.mInvalidRect = IntRect(IntPoint(0, 0), size);
mManager->AddImageKeyForDiscard(group.mKey.value());
group.mKey = Nothing();
}
}
+
+ FrameMetrics::ViewID scrollId = FrameMetrics::NULL_SCROLL_ID;
+ if (const ActiveScrolledRoot* asr = aWrappingItem->GetActiveScrolledRoot()) {
+ scrollId = asr->GetViewId();
+ }
+
g.mAppUnitsPerDevPixel = appUnitsPerDevPixel;
g.mTransform = Matrix::Scaling(scale.width, scale.height);
group.mAppUnitsPerDevPixel = appUnitsPerDevPixel;
group.mGroupBounds = groupBounds;
group.mScale = scale;
+ group.mScrollId = scrollId;
group.mLayerBounds = LayerIntRect::FromUnknownRect(group.mGroupBounds.ScaleToOutsidePixels(scale.width, scale.height, group.mAppUnitsPerDevPixel));
group.mAnimatedGeometryRootOrigin = group.mGroupBounds.TopLeft();
g.ConstructGroups(this, aBuilder, aResources, &group, aList, aSc);
mScrollingHelper.EndList(aSc);
}
void
WebRenderCommandBuilder::Destroy()