Bug 1352863 - Propagate the visible region from Layer to HitTestingTreeNode. r=kats

The propagation happens via LayerMetricsWrapper or WebRenderScrollDataWrapper.

MozReview-Commit-ID: GBZUnNn3zjN

--HG--
extra : rebase_source : 4c63269480154a95d5faedf1b4972f7d3373cb5a
This commit is contained in:
Botond Ballo 2017-05-24 15:47:14 -04:00
Родитель c697659438
Коммит 2d97e2ab3c
7 изменённых файлов: 53 добавлений и 0 удалений

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

@ -334,6 +334,19 @@ public:
return EventRegions();
}
LayerIntRegion GetVisibleRegion() const
{
MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->GetVisibleRegion();
}
return ViewAs<LayerPixel>(
TransformBy(mLayer->GetTransformTyped(), mLayer->GetVisibleRegion()),
PixelCastJustification::MovingDownToChildren);
}
bool HasTransformAnimation() const
{
MOZ_ASSERT(IsValid());

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

@ -626,6 +626,7 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
AttachNodeToTree(node, aParent, aNextSibling);
node->SetHitTestData(
GetEventRegions(aLayer),
aLayer.GetVisibleRegion(),
aLayer.GetTransformTyped(),
aLayer.GetClipRect() ? Some(ParentLayerIntRegion(*aLayer.GetClipRect())) : Nothing(),
GetEventRegionsOverride(aParent, aLayer));
@ -737,6 +738,7 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
ParentLayerIntRegion clipRegion = ComputeClipRegion(state->mController, aLayer);
node->SetHitTestData(
GetEventRegions(aLayer),
aLayer.GetVisibleRegion(),
aLayer.GetTransformTyped(),
Some(clipRegion),
GetEventRegionsOverride(aParent, aLayer));
@ -811,6 +813,7 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
ParentLayerIntRegion clipRegion = ComputeClipRegion(state->mController, aLayer);
node->SetHitTestData(
GetEventRegions(aLayer),
aLayer.GetVisibleRegion(),
aLayer.GetTransformTyped(),
Some(clipRegion),
GetEventRegionsOverride(aParent, aLayer));

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

@ -249,11 +249,13 @@ HitTestingTreeNode::GetLayersId() const
void
HitTestingTreeNode::SetHitTestData(const EventRegions& aRegions,
const LayerIntRegion& aVisibleRegion,
const CSSTransformMatrix& aTransform,
const Maybe<ParentLayerIntRegion>& aClipRegion,
const EventRegionsOverride& aOverride)
{
mEventRegions = aRegions;
mVisibleRegion = aVisibleRegion;
mTransform = aTransform;
mClipRegion = aClipRegion;
mOverride = aOverride;
@ -324,6 +326,12 @@ HitTestingTreeNode::GetTransform() const
return mTransform;
}
const LayerIntRegion&
HitTestingTreeNode::GetVisibleRegion() const
{
return mVisibleRegion;
}
void
HitTestingTreeNode::Dump(const char* aPrefix) const
{

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

@ -86,6 +86,7 @@ public:
/* Hit test related methods */
void SetHitTestData(const EventRegions& aRegions,
const LayerIntRegion& aVisibleRegion,
const CSSTransformMatrix& aTransform,
const Maybe<ParentLayerIntRegion>& aClipRegion,
const EventRegionsOverride& aOverride);
@ -120,6 +121,7 @@ public:
/* Returns the mOverride flag. */
EventRegionsOverride GetEventRegionsOverride() const;
const CSSTransformMatrix& GetTransform() const;
const LayerIntRegion& GetVisibleRegion() const;
/* Debug helpers */
void Dump(const char* aPrefix = "") const;
@ -162,6 +164,8 @@ private:
*/
EventRegions mEventRegions;
LayerIntRegion mVisibleRegion;
/* This is the transform from layer L. This does NOT include any async
* transforms. */
CSSTransformMatrix mTransform;

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

@ -37,6 +37,7 @@ WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner,
mTransform = aLayer->GetTransform();
mTransformIsPerspective = aLayer->GetTransformIsPerspective();
mEventRegions = aLayer->GetEventRegions();
mVisibleRegion = aLayer->GetVisibleRegion();
mReferentId = aLayer->AsRefLayer()
? Some(aLayer->AsRefLayer()->GetReferentId())
: Nothing();
@ -71,6 +72,12 @@ WebRenderLayerScrollData::GetScrollMetadata(const WebRenderScrollData& aOwner,
return aOwner.GetScrollMetadata(mScrollIds[aIndex]);
}
CSSTransformMatrix
WebRenderLayerScrollData::GetTransformTyped() const
{
return ViewAs<CSSTransformMatrix>(GetTransform());
}
WebRenderScrollData::WebRenderScrollData()
: mIsFirstPaint(false)
{

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

@ -49,8 +49,10 @@ public:
bool IsScrollInfoLayer() const { return mIsScrollInfoLayer; }
gfx::Matrix4x4 GetTransform() const { return mTransform; }
CSSTransformMatrix GetTransformTyped() const;
bool GetTransformIsPerspective() const { return mTransformIsPerspective; }
EventRegions GetEventRegions() const { return mEventRegions; }
const LayerIntRegion& GetVisibleRegion() const { return mVisibleRegion; }
Maybe<uint64_t> GetReferentId() const { return mReferentId; }
EventRegionsOverride GetEventRegionsOverride() const { return mEventRegionsOverride; }
const ScrollThumbData& GetScrollThumbData() const { return mScrollThumbData; }
@ -81,6 +83,7 @@ private:
gfx::Matrix4x4 mTransform;
bool mTransformIsPerspective;
EventRegions mEventRegions;
LayerIntRegion mVisibleRegion;
Maybe<uint64_t> mReferentId;
EventRegionsOverride mEventRegionsOverride;
ScrollThumbData mScrollThumbData;
@ -175,6 +178,7 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData>
WriteParam(aMsg, aParam.mTransform);
WriteParam(aMsg, aParam.mTransformIsPerspective);
WriteParam(aMsg, aParam.mEventRegions);
WriteParam(aMsg, aParam.mVisibleRegion);
WriteParam(aMsg, aParam.mReferentId);
WriteParam(aMsg, aParam.mEventRegionsOverride);
WriteParam(aMsg, aParam.mScrollThumbData);
@ -193,6 +197,7 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData>
&& ReadParam(aMsg, aIter, &aResult->mTransform)
&& ReadParam(aMsg, aIter, &aResult->mTransformIsPerspective)
&& ReadParam(aMsg, aIter, &aResult->mEventRegions)
&& ReadParam(aMsg, aIter, &aResult->mVisibleRegion)
&& ReadParam(aMsg, aIter, &aResult->mReferentId)
&& ReadParam(aMsg, aIter, &aResult->mEventRegionsOverride)
&& ReadParam(aMsg, aIter, &aResult->mScrollThumbData)

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

@ -257,6 +257,19 @@ public:
return EventRegions();
}
LayerIntRegion GetVisibleRegion() const
{
MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->GetVisibleRegion();
}
return ViewAs<LayerPixel>(
TransformBy(mLayer->GetTransformTyped(), mLayer->GetVisibleRegion()),
PixelCastJustification::MovingDownToChildren);
}
Maybe<uint64_t> GetReferentId() const
{
MOZ_ASSERT(IsValid());