From c3e4aef0b48cbc5d2fc07ec117dd8d5876bae384 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 31 Jul 2017 15:27:30 -0400 Subject: [PATCH] Bug 1384616 - Save APZ-relevant scrollbar data into the WR scroll data for layers-free transactions. r=jrmuizel MozReview-Commit-ID: 6DQz9N6Wq0H --HG-- extra : rebase_source : 8a113d4a53e1562b55cc05a0bc411675a2ca9eb1 --- gfx/layers/wr/WebRenderScrollData.h | 6 ++++++ layout/painting/nsDisplayList.cpp | 24 +++++++++++++++++++++++- layout/painting/nsDisplayList.h | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gfx/layers/wr/WebRenderScrollData.h b/gfx/layers/wr/WebRenderScrollData.h index 09509aaf7bce..78341116340c 100644 --- a/gfx/layers/wr/WebRenderScrollData.h +++ b/gfx/layers/wr/WebRenderScrollData.h @@ -70,10 +70,16 @@ public: void SetReferentId(uint64_t aReferentId) { mReferentId = Some(aReferentId); } Maybe GetReferentId() const { return mReferentId; } EventRegionsOverride GetEventRegionsOverride() const { return mEventRegionsOverride; } + + void SetScrollThumbData(const ScrollThumbData& aData) { mScrollThumbData = aData; } const ScrollThumbData& GetScrollThumbData() const { return mScrollThumbData; } + void SetScrollbarAnimationId(const uint64_t& aId) { mScrollbarAnimationId = aId; } const uint64_t& GetScrollbarAnimationId() const { return mScrollbarAnimationId; } + void SetScrollbarTargetContainerId(FrameMetrics::ViewID aId) { mScrollbarTargetContainerId = aId; } FrameMetrics::ViewID GetScrollbarTargetContainerId() const { return mScrollbarTargetContainerId; } + void SetIsScrollbarContainer() { mIsScrollbarContainer = true; } bool IsScrollbarContainer() const { return mIsScrollbarContainer; } + void SetFixedPositionScrollContainerId(FrameMetrics::ViewID aId) { mFixedPosScrollContainerId = aId; } FrameMetrics::ViewID GetFixedPositionScrollContainerId() const { return mFixedPosScrollContainerId; } diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 5b55f0323833..90278896e387 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -6390,6 +6390,28 @@ nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder, return layer.forget(); } +bool +nsDisplayOwnLayer::UpdateScrollData(mozilla::layers::WebRenderScrollData* aData, + mozilla::layers::WebRenderLayerScrollData* aLayerData) +{ + bool ret = false; + if (IsScrollThumbLayer()) { + ret = true; + if (aLayerData) { + aLayerData->SetScrollThumbData(mThumbData); + aLayerData->SetScrollbarTargetContainerId(mScrollTarget); + } + } + if (mFlags & SCROLLBAR_CONTAINER) { + ret = true; + if (aLayerData) { + aLayerData->SetIsScrollbarContainer(); + aLayerData->SetScrollbarTargetContainerId(mScrollTarget); + } + } + return ret; +} + nsDisplaySubDocument::nsDisplaySubDocument(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, uint32_t aFlags) @@ -6697,7 +6719,7 @@ nsDisplayFixedPosition::UpdateScrollData(mozilla::layers::WebRenderScrollData* a Frame()->PresContext()); aLayerData->SetFixedPositionScrollContainerId(id); } - return true; + return nsDisplayOwnLayer::UpdateScrollData(aData, aLayerData) | true; } TableType diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index dce3413f5e1a..ae0eb8ad5a3c 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -4150,6 +4150,8 @@ public: virtual already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aContainerParameters) override; + virtual bool UpdateScrollData(mozilla::layers::WebRenderScrollData* aData, + mozilla::layers::WebRenderLayerScrollData* aLayerData) override; virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) override;