mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1454485 - Stop passing around the scroll view and container direction since it's already in the scrollbar data. r=botond
MozReview-Commit-ID: 3t4uLBQZSAi
This commit is contained in:
parent
878b4beba1
commit
abcf2e229e
@ -91,6 +91,10 @@ struct ScrollbarData {
|
||||
bool operator!=(const ScrollbarData& aOther) const {
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
bool IsThumb() const {
|
||||
return mScrollbarLayerType == ScrollbarLayerType::Thumb;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -277,20 +281,10 @@ public:
|
||||
return mIsFixedPosition;
|
||||
}
|
||||
|
||||
FrameMetrics::ViewID GetScrollbarTargetViewId() const {
|
||||
return mScrollbarData.mTargetViewId;
|
||||
}
|
||||
|
||||
const ScrollbarData& GetScrollbarData() const {
|
||||
return mScrollbarData;
|
||||
}
|
||||
|
||||
Maybe<ScrollDirection> GetScrollbarContainerDirection() const {
|
||||
return (mScrollbarData.mScrollbarLayerType == ScrollbarLayerType::Container)
|
||||
? mScrollbarData.mDirection
|
||||
: Nothing();
|
||||
}
|
||||
|
||||
gfx::CompositionOp GetMixBlendMode() const {
|
||||
return mMixBlendMode;
|
||||
}
|
||||
|
@ -426,19 +426,6 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
FrameMetrics::ViewID GetScrollbarTargetContainerId() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
return mLayer->GetScrollbarTargetViewId();
|
||||
}
|
||||
|
||||
Maybe<ScrollDirection> GetScrollbarContainerDirection() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mLayer->GetScrollbarContainerDirection();
|
||||
}
|
||||
|
||||
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
@ -618,6 +618,15 @@ Layer::GetLocalTransformTyped()
|
||||
return ViewAs<LayerToParentLayerMatrix4x4>(GetLocalTransform());
|
||||
}
|
||||
|
||||
bool
|
||||
Layer::IsScrollbarContainer() const
|
||||
{
|
||||
const ScrollbarData& data = GetScrollbarData();
|
||||
return (data.mScrollbarLayerType == ScrollbarLayerType::Container)
|
||||
? data.mDirection.isSome()
|
||||
: false;
|
||||
}
|
||||
|
||||
bool
|
||||
Layer::HasOpacityAnimation() const
|
||||
{
|
||||
@ -1813,15 +1822,17 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
if (Is3DContextLeaf()) {
|
||||
aStream << " [is3DContextLeaf]";
|
||||
}
|
||||
if (GetScrollbarContainerDirection().isSome()) {
|
||||
if (IsScrollbarContainer()) {
|
||||
aStream << " [scrollbar]";
|
||||
}
|
||||
if (Maybe<ScrollDirection> thumbDirection = GetScrollbarData().mDirection) {
|
||||
if (*thumbDirection == ScrollDirection::eVertical) {
|
||||
aStream << nsPrintfCString(" [vscrollbar=%" PRIu64 "]", GetScrollbarTargetViewId()).get();
|
||||
}
|
||||
if (*thumbDirection == ScrollDirection::eHorizontal) {
|
||||
aStream << nsPrintfCString(" [hscrollbar=%" PRIu64 "]", GetScrollbarTargetViewId()).get();
|
||||
if (GetScrollbarData().IsThumb()) {
|
||||
if (Maybe<ScrollDirection> thumbDirection = GetScrollbarData().mDirection) {
|
||||
if (*thumbDirection == ScrollDirection::eVertical) {
|
||||
aStream << nsPrintfCString(" [vscrollbar=%" PRIu64 "]", GetScrollbarData().mTargetViewId).get();
|
||||
}
|
||||
if (*thumbDirection == ScrollDirection::eHorizontal) {
|
||||
aStream << nsPrintfCString(" [hscrollbar=%" PRIu64 "]", GetScrollbarData().mTargetViewId).get();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GetIsFixedPosition()) {
|
||||
@ -1971,7 +1982,7 @@ Layer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
|
||||
layer->set_direct(*GetScrollbarData().mDirection == ScrollDirection::eVertical ?
|
||||
LayersPacket::Layer::VERTICAL :
|
||||
LayersPacket::Layer::HORIZONTAL);
|
||||
layer->set_barid(GetScrollbarTargetViewId());
|
||||
layer->set_barid(GetScrollbarData().mTargetViewId);
|
||||
}
|
||||
|
||||
// Mask layer
|
||||
|
@ -1328,10 +1328,8 @@ public:
|
||||
FrameMetrics::ViewID GetStickyScrollContainerId() { return mSimpleAttrs.GetStickyScrollContainerId(); }
|
||||
const LayerRectAbsolute& GetStickyScrollRangeOuter() { return mSimpleAttrs.GetStickyScrollRangeOuter(); }
|
||||
const LayerRectAbsolute& GetStickyScrollRangeInner() { return mSimpleAttrs.GetStickyScrollRangeInner(); }
|
||||
FrameMetrics::ViewID GetScrollbarTargetViewId() { return mSimpleAttrs.GetScrollbarTargetViewId(); }
|
||||
const ScrollbarData& GetScrollbarData() const { return mSimpleAttrs.GetScrollbarData(); }
|
||||
bool IsScrollbarContainer() { return mSimpleAttrs.GetScrollbarContainerDirection().isSome(); }
|
||||
Maybe<ScrollDirection> GetScrollbarContainerDirection() { return mSimpleAttrs.GetScrollbarContainerDirection(); }
|
||||
bool IsScrollbarContainer() const;
|
||||
Layer* GetMaskLayer() const { return mMaskLayer; }
|
||||
bool HasPendingTransform() const { return mPendingTransform; }
|
||||
|
||||
|
@ -878,8 +878,7 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
|
||||
: Nothing(),
|
||||
GetEventRegionsOverride(aParent, aLayer),
|
||||
aLayer.IsBackfaceHidden());
|
||||
node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
|
||||
aLayer.GetScrollbarAnimationId(),
|
||||
node->SetScrollbarData(aLayer.GetScrollbarAnimationId(),
|
||||
aLayer.GetScrollbarData());
|
||||
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId());
|
||||
return node;
|
||||
@ -1098,8 +1097,7 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
|
||||
// Note: if layer properties must be propagated to nodes, RecvUpdate in
|
||||
// LayerTransactionParent.cpp must ensure that APZ will be notified
|
||||
// when those properties change.
|
||||
node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
|
||||
aLayer.GetScrollbarAnimationId(),
|
||||
node->SetScrollbarData(aLayer.GetScrollbarAnimationId(),
|
||||
aLayer.GetScrollbarData());
|
||||
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId());
|
||||
return node;
|
||||
|
@ -27,7 +27,6 @@ HitTestingTreeNode::HitTestingTreeNode(AsyncPanZoomController* aApzc,
|
||||
: mApzc(aApzc)
|
||||
, mIsPrimaryApzcHolder(aIsPrimaryHolder)
|
||||
, mLayersId(aLayersId)
|
||||
, mScrollViewId(FrameMetrics::NULL_SCROLL_ID)
|
||||
, mScrollbarAnimationId(0)
|
||||
, mFixedPosTarget(FrameMetrics::NULL_SCROLL_ID)
|
||||
, mIsBackfaceHidden(false)
|
||||
@ -94,11 +93,9 @@ HitTestingTreeNode::SetLastChild(HitTestingTreeNode* aChild)
|
||||
}
|
||||
|
||||
void
|
||||
HitTestingTreeNode::SetScrollbarData(FrameMetrics::ViewID aScrollViewId,
|
||||
const uint64_t& aScrollbarAnimationId,
|
||||
HitTestingTreeNode::SetScrollbarData(const uint64_t& aScrollbarAnimationId,
|
||||
const ScrollbarData& aScrollbarData)
|
||||
{
|
||||
mScrollViewId = aScrollViewId;
|
||||
mScrollbarAnimationId = aScrollbarAnimationId;
|
||||
mScrollbarData = aScrollbarData;
|
||||
}
|
||||
@ -108,7 +105,7 @@ HitTestingTreeNode::MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetric
|
||||
{
|
||||
return IsScrollThumbNode() &&
|
||||
mScrollbarData.mDirection == aDragMetrics.mDirection &&
|
||||
mScrollViewId == aDragMetrics.mViewId;
|
||||
mScrollbarData.mTargetViewId == aDragMetrics.mViewId;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -134,7 +131,7 @@ HitTestingTreeNode::GetScrollbarDirection() const
|
||||
FrameMetrics::ViewID
|
||||
HitTestingTreeNode::GetScrollTargetId() const
|
||||
{
|
||||
return mScrollViewId;
|
||||
return mScrollbarData.mTargetViewId;
|
||||
}
|
||||
|
||||
const uint64_t&
|
||||
|
@ -95,8 +95,7 @@ public:
|
||||
|
||||
/* Scrollbar info */
|
||||
|
||||
void SetScrollbarData(FrameMetrics::ViewID aScrollViewId,
|
||||
const uint64_t& aScrollbarAnimationId,
|
||||
void SetScrollbarData(const uint64_t& aScrollbarAnimationId,
|
||||
const ScrollbarData& aScrollbarData);
|
||||
bool MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetrics) const;
|
||||
bool IsScrollbarNode() const; // Scroll thumb or scrollbar container layer.
|
||||
@ -140,10 +139,6 @@ private:
|
||||
|
||||
LayersId mLayersId;
|
||||
|
||||
// This is set for both scroll track and scroll thumb Container layers, and
|
||||
// represents the scroll id of the scroll frame scrolled by the scrollbar.
|
||||
FrameMetrics::ViewID mScrollViewId;
|
||||
|
||||
// This is only set to non-zero if WebRender is enabled, and only for HTTNs
|
||||
// where IsScrollThumbNode() returns true. It holds the animation id that we
|
||||
// use to move the thumb node to reflect async scrolling.
|
||||
|
@ -755,7 +755,7 @@ MoveScrollbarForLayerMargin(Layer* aRoot, FrameMetrics::ViewID aRootScrollId,
|
||||
[aRootScrollId](Layer* aNode) {
|
||||
return (aNode->GetScrollbarData().mDirection.isSome() &&
|
||||
*aNode->GetScrollbarData().mDirection == ScrollDirection::eHorizontal &&
|
||||
aNode->GetScrollbarTargetViewId() == aRootScrollId);
|
||||
aNode->GetScrollbarData().mTargetViewId == aRootScrollId);
|
||||
});
|
||||
if (scrollbar) {
|
||||
// Shift the horizontal scrollbar down into the new space exposed by the
|
||||
@ -1050,7 +1050,7 @@ LayerIsScrollbarTarget(const LayerMetricsWrapper& aTarget, Layer* aScrollbar)
|
||||
}
|
||||
const FrameMetrics& metrics = aTarget.Metrics();
|
||||
MOZ_ASSERT(metrics.IsScrollable());
|
||||
if (metrics.GetScrollId() != aScrollbar->GetScrollbarTargetViewId()) {
|
||||
if (metrics.GetScrollId() != aScrollbar->GetScrollbarData().mTargetViewId) {
|
||||
return false;
|
||||
}
|
||||
return !metrics.IsScrollInfoLayer();
|
||||
|
@ -300,21 +300,6 @@ public:
|
||||
return mLayer->GetScrollbarAnimationId();
|
||||
}
|
||||
|
||||
FrameMetrics::ViewID GetScrollbarTargetContainerId() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mLayer->GetScrollbarData().mTargetViewId;
|
||||
}
|
||||
|
||||
Maybe<ScrollDirection> GetScrollbarContainerDirection() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
const ScrollbarData& data = mLayer->GetScrollbarData();
|
||||
return (data.mScrollbarLayerType == ScrollbarLayerType::Container)
|
||||
? data.mDirection
|
||||
: Nothing();
|
||||
}
|
||||
|
||||
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
Loading…
Reference in New Issue
Block a user