Bug 1449478 - Avoid clobbering transforms in the WebRenderScrollData. r=jrmuizel

Due to an oversight in bug 1423370, the code I added was setting the
transform on a WebRenderLayerScrollData after initializing it, but the
initialization might have populated the transform. Thus the
transform-set that I added would have clobbered the transform. This
updates the code to combine the two transforms instead which avoids
the clobber.

MozReview-Commit-ID: 4mKJTLSMD9J

--HG--
extra : rebase_source : c486c5866739ab040d81f9f9a43b2b8a04c2d383
This commit is contained in:
Kartikaya Gupta 2018-03-28 06:32:06 -04:00
Родитель 989795493b
Коммит 1ad07c54db
5 изменённых файлов: 14 добавлений и 7 удалений

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

@ -74,10 +74,10 @@ StackingContextHelper::ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const
return wr::ToLayoutRect(rect);
}
gfx::Matrix4x4
const Maybe<gfx::Matrix4x4>&
StackingContextHelper::GetTransformForScrollData() const
{
return mTransformForScrollData.valueOr(gfx::Matrix4x4());
return mTransformForScrollData;
}
} // namespace layers

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

@ -75,7 +75,7 @@ public:
return mInheritedTransform;
}
gfx::Matrix4x4 GetTransformForScrollData() const;
const Maybe<gfx::Matrix4x4>& GetTransformForScrollData() const;
bool AffectsClipPositioning() const { return mAffectsClipPositioning; }

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

@ -1313,8 +1313,8 @@ WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(nsDisplayList* a
int32_t descendants = mLayerScrollData.size() - layerCountBeforeRecursing;
mLayerScrollData.emplace_back();
mLayerScrollData.back().Initialize(mManager->GetScrollData(), item, descendants, stopAtAsr);
mLayerScrollData.back().SetTransform(aSc.GetTransformForScrollData());
mLayerScrollData.back().Initialize(mManager->GetScrollData(), item,
descendants, stopAtAsr, aSc.GetTransformForScrollData());
} else if (mLayerScrollData.size() != layerCountBeforeRecursing &&
!eventRegions.IsEmpty()) {
// We are not forcing a new layer for |item|, but we did create some

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

@ -42,7 +42,8 @@ void
WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner,
nsDisplayItem* aItem,
int32_t aDescendantCount,
const ActiveScrolledRoot* aStopAtAsr)
const ActiveScrolledRoot* aStopAtAsr,
const Maybe<gfx::Matrix4x4>& aTransform)
{
MOZ_ASSERT(aDescendantCount >= 0); // Ensure value is valid
MOZ_ASSERT(mDescendantCount == -1); // Don't allow re-setting an already set value
@ -50,6 +51,11 @@ WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner,
MOZ_ASSERT(aItem);
aItem->UpdateScrollData(&aOwner, this);
if (aTransform) {
// mTransform might have been set by the UpdateScrollData call above, so
// we should combine rather than clobber
mTransform = *aTransform * mTransform;
}
for (const ActiveScrolledRoot* asr = aItem->GetActiveScrolledRoot();
asr && asr != aStopAtAsr;
asr = asr->mParent) {

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

@ -47,7 +47,8 @@ public:
void Initialize(WebRenderScrollData& aOwner,
nsDisplayItem* aItem,
int32_t aDescendantCount,
const ActiveScrolledRoot* aStopAtAsr);
const ActiveScrolledRoot* aStopAtAsr,
const Maybe<gfx::Matrix4x4>& aTransform);
int32_t GetDescendantCount() const;
size_t GetScrollMetadataCount() const;