Bug 1384616 - Save APZ-relevant data from fixed-pos items in the WR scroll data for layers-free transactions. r=jrmuizel

MozReview-Commit-ID: HAFnrCVM9pZ

--HG--
extra : rebase_source : 9b7f5f7a3487501061b0526bfc92b06ef5593a88
This commit is contained in:
Kartikaya Gupta 2017-07-31 15:27:29 -04:00
Родитель 89f405f2be
Коммит 4ed905c664
5 изменённых файлов: 30 добавлений и 1 удалений

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

@ -74,6 +74,7 @@ public:
const uint64_t& GetScrollbarAnimationId() const { return mScrollbarAnimationId; }
FrameMetrics::ViewID GetScrollbarTargetContainerId() const { return mScrollbarTargetContainerId; }
bool IsScrollbarContainer() const { return mIsScrollbarContainer; }
void SetFixedPositionScrollContainerId(FrameMetrics::ViewID aId) { mFixedPosScrollContainerId = aId; }
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const { return mFixedPosScrollContainerId; }
void Dump(const WebRenderScrollData& aOwner) const;

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

@ -2087,13 +2087,20 @@ nsLayoutUtils::SetFixedPositionLayerData(Layer* aLayer,
}
}
ViewID id = ScrollIdForRootScrollFrame(aPresContext);
aLayer->SetFixedPositionData(id, anchor, sides);
}
FrameMetrics::ViewID
nsLayoutUtils::ScrollIdForRootScrollFrame(nsPresContext* aPresContext)
{
ViewID id = FrameMetrics::NULL_SCROLL_ID;
if (nsIFrame* rootScrollFrame = aPresContext->PresShell()->GetRootScrollFrame()) {
if (nsIContent* content = rootScrollFrame->GetContent()) {
id = FindOrCreateIDFor(content);
}
}
aLayer->SetFixedPositionData(id, anchor, sides);
return id;
}
bool

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

@ -572,6 +572,12 @@ public:
nsPresContext* aPresContext,
const ContainerLayerParameters& aContainerParameters);
/**
* Get the scroll id for the root scrollframe of the presshell of the given
* prescontext. Returns NULL_SCROLL_ID if it couldn't be found.
*/
static FrameMetrics::ViewID ScrollIdForRootScrollFrame(nsPresContext* aPresContext);
/**
* Return true if aPresContext's viewport has a displayport.
*/

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

@ -6688,6 +6688,18 @@ bool nsDisplayFixedPosition::TryMerge(nsDisplayItem* aItem) {
return true;
}
bool
nsDisplayFixedPosition::UpdateScrollData(mozilla::layers::WebRenderScrollData* aData,
mozilla::layers::WebRenderLayerScrollData* aLayerData)
{
if (aLayerData) {
FrameMetrics::ViewID id = nsLayoutUtils::ScrollIdForRootScrollFrame(
Frame()->PresContext());
aLayerData->SetFixedPositionScrollContainerId(id);
}
return true;
}
TableType
GetTableTypeFromFrame(nsIFrame* aFrame)
{

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

@ -4297,6 +4297,9 @@ public:
return mAnimatedGeometryRootForScrollMetadata;
}
virtual bool UpdateScrollData(mozilla::layers::WebRenderScrollData* aData,
mozilla::layers::WebRenderLayerScrollData* aLayerData) override;
protected:
// For background-attachment:fixed
nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,