Bug 1420512 - Try unifying data structures for scrollbar container and scrollbar thumb info. r=botond

MozReview-Commit-ID: 9zPkrA3CwsN

--HG--
extra : rebase_source : b52bef52576558f03afc65120a40a5312ae7eba3
This commit is contained in:
Daniel Zielas 2018-03-02 19:00:03 +01:00
parent e0c2cdb52a
commit 471ef50beb
21 changed files with 263 additions and 216 deletions

View File

@ -3,6 +3,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_gfx_layers_LayerAttributes_h
#define mozilla_gfx_layers_LayerAttributes_h
@ -17,56 +18,83 @@ template <typename T> struct ParamTraits;
namespace mozilla {
namespace layers {
// Data stored for scroll thumb container layers.
struct ScrollThumbData {
ScrollThumbData()
: mThumbRatio(0.0f)
, mIsAsyncDraggable(false)
{}
ScrollThumbData(ScrollDirection aDirection,
float aThumbRatio,
CSSCoord aThumbStart,
CSSCoord aThumbLength,
bool aIsAsyncDraggable,
CSSCoord aScrollTrackStart,
CSSCoord aScrollTrackLength)
enum class ScrollbarLayerType : uint8_t { None, Thumb, Container };
/**
* It stores data for scroll thumb layer or container layers.
*/
struct ScrollbarData {
ScrollbarData() = default;
ScrollbarData(ScrollDirection aDirection,
ScrollbarLayerType aScrollbarLayerType,
float aThumbRatio,
CSSCoord aThumbStart,
CSSCoord aThumbLength,
bool aThumbIsAsyncDraggable,
CSSCoord aScrollTrackStart,
CSSCoord aScrollTrackLength)
: mDirection(Some(aDirection))
, mScrollbarLayerType(aScrollbarLayerType)
, mThumbRatio(aThumbRatio)
, mThumbStart(aThumbStart)
, mThumbLength(aThumbLength)
, mIsAsyncDraggable(aIsAsyncDraggable)
, mThumbIsAsyncDraggable(aThumbIsAsyncDraggable)
, mScrollTrackStart(aScrollTrackStart)
, mScrollTrackLength(aScrollTrackLength)
{}
/**
* The mDirection contains a direction if mScrollbarLayerType is Thumb
* or Container, otherwise it's empty.
*/
Maybe<ScrollDirection> mDirection;
// The scrollbar thumb ratio is the ratio of the thumb position (in the CSS
// pixels of the scrollframe's parent's space) to the scroll position (in the
// CSS pixels of the scrollframe's space).
float mThumbRatio;
/**
* Indicate what kind of layer this data is for. All possibilities are defined in
* enum ScrollbarLayerType
*/
ScrollbarLayerType mScrollbarLayerType = ScrollbarLayerType::None;
/**
* The scrollbar thumb ratio is the ratio of the thumb position (in the CSS
* pixels of the scrollframe's parent's space) to the scroll position (in the
* CSS pixels of the scrollframe's space).
*/
float mThumbRatio = 0.0f;
CSSCoord mThumbStart;
CSSCoord mThumbLength;
// Whether the scrollbar thumb can be dragged asynchronously.
bool mIsAsyncDraggable;
/**
* Whether the scrollbar thumb can be dragged asynchronously.
*/
bool mThumbIsAsyncDraggable = false;
CSSCoord mScrollTrackStart;
CSSCoord mScrollTrackLength;
uint64_t mTargetViewId = FrameMetrics::NULL_SCROLL_ID;
bool operator==(const ScrollThumbData& aOther) const {
bool operator==(const ScrollbarData& aOther) const {
return mDirection == aOther.mDirection &&
mScrollbarLayerType == aOther.mScrollbarLayerType &&
mThumbRatio == aOther.mThumbRatio &&
mThumbStart == aOther.mThumbStart &&
mThumbLength == aOther.mThumbLength &&
mIsAsyncDraggable == aOther.mIsAsyncDraggable &&
mThumbIsAsyncDraggable == aOther.mThumbIsAsyncDraggable &&
mScrollTrackStart == aOther.mScrollTrackStart &&
mScrollTrackLength == aOther.mScrollTrackLength;
mScrollTrackLength == aOther.mScrollTrackLength &&
mTargetViewId == aOther.mTargetViewId;
}
bool operator!=(const ScrollThumbData& aOther) const {
bool operator!=(const ScrollbarData& aOther) const {
return !(*this == aOther);
}
};
// Infrequently changing layer attributes that require no special
// serialization work.
/**
* Infrequently changing layer attributes that require no special
* serialization work.
*/
class SimpleLayerAttributes final
{
friend struct IPC::ParamTraits<mozilla::layers::SimpleLayerAttributes>;
@ -78,16 +106,15 @@ public:
mContentFlags(0),
mOpacity(1.0f),
mIsFixedPosition(false),
mScrollbarTargetContainerId(FrameMetrics::NULL_SCROLL_ID),
mMixBlendMode(gfx::CompositionOp::OP_OVER),
mForceIsolatedGroup(false)
{
}
//
// Setters.
// All set methods return true if values changed, false otherwise.
//
/**
* Setters.
* All set methods return true if values changed, false otherwise.
*/
bool SetPostScale(float aXScale, float aYScale) {
if (mPostXScale == aXScale && mPostYScale == aYScale) {
@ -97,6 +124,7 @@ public:
mPostYScale = aYScale;
return true;
}
bool SetContentFlags(uint32_t aFlags) {
if (aFlags == mContentFlags) {
return false;
@ -104,6 +132,7 @@ public:
mContentFlags = aFlags;
return true;
}
bool SetOpacity(float aOpacity) {
if (aOpacity == mOpacity) {
return false;
@ -111,6 +140,7 @@ public:
mOpacity = aOpacity;
return true;
}
bool SetIsFixedPosition(bool aFixedPosition) {
if (mIsFixedPosition == aFixedPosition) {
return false;
@ -118,27 +148,30 @@ public:
mIsFixedPosition = aFixedPosition;
return true;
}
bool SetScrollThumbData(FrameMetrics::ViewID aScrollId, const ScrollThumbData& aThumbData) {
if (mScrollbarTargetContainerId == aScrollId &&
mThumbData == aThumbData)
bool SetScrollbarData(const ScrollbarData& aScrollbarData) {
if (mScrollbarData == aScrollbarData)
{
return false;
}
mScrollbarTargetContainerId = aScrollId;
mThumbData = aThumbData;
mScrollbarData = aScrollbarData;
return true;
}
bool SetScrollbarContainer(FrameMetrics::ViewID aScrollId,
bool SetScrollbarContainer(FrameMetrics::ViewID aTargetViewId,
ScrollDirection aDirection) {
if (mScrollbarContainerDirection &&
*mScrollbarContainerDirection == aDirection &&
mScrollbarTargetContainerId == aScrollId) {
if (mScrollbarData.mScrollbarLayerType == ScrollbarLayerType::Container &&
mScrollbarData.mDirection &&
*mScrollbarData.mDirection == aDirection &&
mScrollbarData.mTargetViewId == aTargetViewId) {
return false;
}
mScrollbarContainerDirection = Some(aDirection);
mScrollbarTargetContainerId = aScrollId;
mScrollbarData.mDirection = Some(aDirection);
mScrollbarData.mTargetViewId = aTargetViewId;
mScrollbarData.mScrollbarLayerType = ScrollbarLayerType::Container;
return true;
}
bool SetMixBlendMode(gfx::CompositionOp aMixBlendMode) {
if (mMixBlendMode == aMixBlendMode) {
return false;
@ -146,6 +179,7 @@ public:
mMixBlendMode = aMixBlendMode;
return true;
}
bool SetForceIsolatedGroup(bool aForceIsolatedGroup) {
if (mForceIsolatedGroup == aForceIsolatedGroup) {
return false;
@ -153,6 +187,7 @@ public:
mForceIsolatedGroup = aForceIsolatedGroup;
return true;
}
bool SetTransform(const gfx::Matrix4x4& aMatrix) {
if (mTransform == aMatrix) {
return false;
@ -160,6 +195,7 @@ public:
mTransform = aMatrix;
return true;
}
bool SetTransformIsPerspective(bool aIsPerspective) {
if (mTransformIsPerspective == aIsPerspective) {
return false;
@ -167,6 +203,7 @@ public:
mTransformIsPerspective = aIsPerspective;
return true;
}
bool SetScrolledClip(const Maybe<LayerClip>& aScrolledClip) {
if (mScrolledClip == aScrolledClip) {
return false;
@ -174,12 +211,13 @@ public:
mScrolledClip = aScrolledClip;
return true;
}
bool SetFixedPositionData(FrameMetrics::ViewID aScrollId,
bool SetFixedPositionData(FrameMetrics::ViewID aTargetViewId,
const LayerPoint& aAnchor,
int32_t aSides)
{
if (mFixedPositionData &&
mFixedPositionData->mScrollId == aScrollId &&
mFixedPositionData->mScrollId == aTargetViewId &&
mFixedPositionData->mAnchor == aAnchor &&
mFixedPositionData->mSides == aSides) {
return false;
@ -187,11 +225,12 @@ public:
if (!mFixedPositionData) {
mFixedPositionData.emplace();
}
mFixedPositionData->mScrollId = aScrollId;
mFixedPositionData->mScrollId = aTargetViewId;
mFixedPositionData->mAnchor = aAnchor;
mFixedPositionData->mSides = aSides;
return true;
}
bool SetStickyPositionData(FrameMetrics::ViewID aScrollId,
LayerRectAbsolute aOuter, LayerRectAbsolute aInner)
{
@ -209,19 +248,15 @@ public:
return true;
}
// This returns true if scrolling info is equivalent for the purposes of
// APZ hit testing.
/**
* This returns true if scrolling info is equivalent for the purposes of
* APZ hit testing.
*/
bool HitTestingInfoIsEqual(const SimpleLayerAttributes& aOther) const {
if (mScrollbarContainerDirection != aOther.mScrollbarContainerDirection) {
if (mScrollbarData != aOther.mScrollbarData) {
return false;
}
if (mScrollbarTargetContainerId != aOther.mScrollbarTargetContainerId) {
return false;
}
if (mThumbData != aOther.mThumbData) {
return false;
}
if (FixedPositionScrollContainerId() != aOther.FixedPositionScrollContainerId()) {
if (GetFixedPositionScrollContainerId() != aOther.GetFixedPositionScrollContainerId()) {
return false;
}
if (mTransform != aOther.mTransform) {
@ -230,70 +265,91 @@ public:
return true;
}
//
// Getters.
//
/**
* Getters.
*/
float PostXScale() const {
float GetPostXScale() const {
return mPostXScale;
}
float PostYScale() const {
float GetPostYScale() const {
return mPostYScale;
}
uint32_t ContentFlags() const {
uint32_t GetContentFlags() const {
return mContentFlags;
}
float Opacity() const {
float GetOpacity() const {
return mOpacity;
}
bool IsFixedPosition() const {
return mIsFixedPosition;
}
FrameMetrics::ViewID ScrollbarTargetContainerId() const {
return mScrollbarTargetContainerId;
FrameMetrics::ViewID GetScrollbarTargetViewId() const {
return mScrollbarData.mTargetViewId;
}
const ScrollThumbData& ThumbData() const {
return mThumbData;
const ScrollbarData& GetScrollbarData() const {
return mScrollbarData;
}
Maybe<ScrollDirection> GetScrollbarContainerDirection() const {
return mScrollbarContainerDirection;
return (mScrollbarData.mScrollbarLayerType == ScrollbarLayerType::Container)
? mScrollbarData.mDirection
: Nothing();
}
gfx::CompositionOp MixBlendMode() const {
gfx::CompositionOp GetMixBlendMode() const {
return mMixBlendMode;
}
bool ForceIsolatedGroup() const {
bool GetForceIsolatedGroup() const {
return mForceIsolatedGroup;
}
const gfx::Matrix4x4& Transform() const {
const gfx::Matrix4x4& GetTransform() const {
return mTransform;
}
bool TransformIsPerspective() const {
bool GetTransformIsPerspective() const {
return mTransformIsPerspective;
}
const Maybe<LayerClip>& ScrolledClip() const {
const Maybe<LayerClip>& GetScrolledClip() const {
return mScrolledClip;
}
FrameMetrics::ViewID FixedPositionScrollContainerId() const {
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const {
return mFixedPositionData
? mFixedPositionData->mScrollId
: FrameMetrics::NULL_SCROLL_ID;
}
LayerPoint FixedPositionAnchor() const {
LayerPoint GetFixedPositionAnchor() const {
return mFixedPositionData ? mFixedPositionData->mAnchor : LayerPoint();
}
int32_t FixedPositionSides() const {
int32_t GetFixedPositionSides() const {
return mFixedPositionData ? mFixedPositionData->mSides : eSideBitsNone;
}
bool IsStickyPosition() const {
return !!mStickyPositionData;
}
FrameMetrics::ViewID StickyScrollContainerId() const {
FrameMetrics::ViewID GetStickyScrollContainerId() const {
return mStickyPositionData->mScrollId;
}
const LayerRectAbsolute& StickyScrollRangeOuter() const {
const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
return mStickyPositionData->mOuter;
}
const LayerRectAbsolute& StickyScrollRangeInner() const {
const LayerRectAbsolute& GetStickyScrollRangeInner() const {
return mStickyPositionData->mInner;
}
@ -306,9 +362,7 @@ public:
mContentFlags == aOther.mContentFlags &&
mOpacity == aOther.mOpacity &&
mIsFixedPosition == aOther.mIsFixedPosition &&
mScrollbarTargetContainerId == aOther.mScrollbarTargetContainerId &&
mThumbData == aOther.mThumbData &&
mScrollbarContainerDirection == aOther.mScrollbarContainerDirection &&
mScrollbarData == aOther.mScrollbarData &&
mMixBlendMode == aOther.mMixBlendMode &&
mForceIsolatedGroup == aOther.mForceIsolatedGroup;
}
@ -322,9 +376,7 @@ private:
uint32_t mContentFlags;
float mOpacity;
bool mIsFixedPosition;
uint64_t mScrollbarTargetContainerId;
ScrollThumbData mThumbData;
Maybe<ScrollDirection> mScrollbarContainerDirection;
ScrollbarData mScrollbarData;
gfx::CompositionOp mMixBlendMode;
bool mForceIsolatedGroup;
@ -342,8 +394,10 @@ private:
};
Maybe<StickyPositionData> mStickyPositionData;
// This class may only contain plain-old-data members that can be safely
// copied over IPC. Make sure to add new members to operator ==.
/**
* This class may only contain plain-old-data members that can be safely
* copied over IPC. Make sure to add new members to operator ==.
*/
};
} // namespace layers

View File

@ -410,11 +410,11 @@ public:
return EventRegionsOverride::NoOverride;
}
const ScrollThumbData& GetScrollThumbData() const
const ScrollbarData& GetScrollbarData() const
{
MOZ_ASSERT(IsValid());
return mLayer->GetScrollThumbData();
return mLayer->GetScrollbarData();
}
uint64_t GetScrollbarAnimationId() const
@ -430,7 +430,7 @@ public:
{
MOZ_ASSERT(IsValid());
return mLayer->GetScrollbarTargetContainerId();
return mLayer->GetScrollbarTargetViewId();
}
Maybe<ScrollDirection> GetScrollbarContainerDirection() const

View File

@ -549,7 +549,7 @@ Layer::CalculateScissorRect(const RenderTargetIntRect& aCurrentScissorRect)
Maybe<ParentLayerIntRect>
Layer::GetScrolledClipRect() const
{
const Maybe<LayerClip> clip = mSimpleAttrs.ScrolledClip();
const Maybe<LayerClip> clip = mSimpleAttrs.GetScrolledClip();
return clip ? Some(clip->GetClipRect()) : Nothing();
}
@ -589,7 +589,7 @@ Layer::IsScrollableWithoutContent() const
Matrix4x4
Layer::GetTransform() const
{
Matrix4x4 transform = mSimpleAttrs.Transform();
Matrix4x4 transform = mSimpleAttrs.GetTransform();
transform.PostScale(GetPostXScale(), GetPostYScale(), 1.0f);
if (const ContainerLayer* c = AsContainerLayer()) {
transform.PreScale(c->GetPreXScale(), c->GetPreYScale(), 1.0f);
@ -633,7 +633,7 @@ Layer::HasTransformAnimation() const
void
Layer::ApplyPendingUpdatesForThisTransaction()
{
if (mPendingTransform && *mPendingTransform != mSimpleAttrs.Transform()) {
if (mPendingTransform && *mPendingTransform != mSimpleAttrs.GetTransform()) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PendingUpdatesForThisTransaction", this));
mSimpleAttrs.SetTransform(*mPendingTransform);
MutatedSimple();
@ -658,7 +658,7 @@ Layer::ApplyPendingUpdatesForThisTransaction()
float
Layer::GetLocalOpacity()
{
float opacity = mSimpleAttrs.Opacity();
float opacity = mSimpleAttrs.GetOpacity();
if (HostLayer* shadow = AsHostLayer())
opacity = shadow->GetShadowOpacity();
return std::min(std::max(opacity, 0.0f), 1.0f);
@ -678,15 +678,15 @@ Layer::GetEffectiveOpacity()
CompositionOp
Layer::GetEffectiveMixBlendMode()
{
if (mSimpleAttrs.MixBlendMode() != CompositionOp::OP_OVER)
return mSimpleAttrs.MixBlendMode();
if (mSimpleAttrs.GetMixBlendMode() != CompositionOp::OP_OVER)
return mSimpleAttrs.GetMixBlendMode();
for (ContainerLayer* c = GetParent(); c && !c->UseIntermediateSurface();
c = c->GetParent()) {
if(c->mSimpleAttrs.MixBlendMode() != CompositionOp::OP_OVER)
return c->mSimpleAttrs.MixBlendMode();
if(c->mSimpleAttrs.GetMixBlendMode() != CompositionOp::OP_OVER)
return c->mSimpleAttrs.GetMixBlendMode();
}
return mSimpleAttrs.MixBlendMode();
return mSimpleAttrs.GetMixBlendMode();
}
Matrix4x4
@ -1766,14 +1766,14 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
if (mClipRect) {
AppendToString(aStream, *mClipRect, " [clip=", "]");
}
if (mSimpleAttrs.ScrolledClip()) {
AppendToString(aStream, mSimpleAttrs.ScrolledClip()->GetClipRect(), " [scrolled-clip=", "]");
if (const Maybe<size_t>& ix = mSimpleAttrs.ScrolledClip()->GetMaskLayerIndex()) {
if (mSimpleAttrs.GetScrolledClip()) {
AppendToString(aStream, mSimpleAttrs.GetScrolledClip()->GetClipRect(), " [scrolled-clip=", "]");
if (const Maybe<size_t>& ix = mSimpleAttrs.GetScrolledClip()->GetMaskLayerIndex()) {
AppendToString(aStream, ix.value(), " [scrolled-mask=", "]");
}
}
if (1.0 != mSimpleAttrs.PostXScale() || 1.0 != mSimpleAttrs.PostYScale()) {
aStream << nsPrintfCString(" [postScale=%g, %g]", mSimpleAttrs.PostXScale(), mSimpleAttrs.PostYScale()).get();
if (1.0 != mSimpleAttrs.GetPostXScale() || 1.0 != mSimpleAttrs.GetPostYScale()) {
aStream << nsPrintfCString(" [postScale=%g, %g]", mSimpleAttrs.GetPostXScale(), mSimpleAttrs.GetPostYScale()).get();
}
if (!GetBaseTransform().IsIdentity()) {
AppendToString(aStream, GetBaseTransform(), " [transform=", "]");
@ -1816,12 +1816,12 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
if (GetScrollbarContainerDirection().isSome()) {
aStream << " [scrollbar]";
}
if (Maybe<ScrollDirection> thumbDirection = GetScrollThumbData().mDirection) {
if (Maybe<ScrollDirection> thumbDirection = GetScrollbarData().mDirection) {
if (*thumbDirection == ScrollDirection::eVertical) {
aStream << nsPrintfCString(" [vscrollbar=%" PRIu64 "]", GetScrollbarTargetContainerId()).get();
aStream << nsPrintfCString(" [vscrollbar=%" PRIu64 "]", GetScrollbarTargetViewId()).get();
}
if (*thumbDirection == ScrollDirection::eHorizontal) {
aStream << nsPrintfCString(" [hscrollbar=%" PRIu64 "]", GetScrollbarTargetContainerId()).get();
aStream << nsPrintfCString(" [hscrollbar=%" PRIu64 "]", GetScrollbarTargetViewId()).get();
}
}
if (GetIsFixedPosition()) {
@ -1967,11 +1967,11 @@ Layer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
// Component alpha
layer->set_calpha(static_cast<bool>(GetContentFlags() & CONTENT_COMPONENT_ALPHA));
// Vertical or horizontal bar
if (Maybe<ScrollDirection> thumbDirection = GetScrollThumbData().mDirection) {
layer->set_direct(*thumbDirection == ScrollDirection::eVertical ?
if (GetScrollbarData().mScrollbarLayerType == layers::ScrollbarLayerType::Thumb) {
layer->set_direct(*GetScrollbarData().mDirection == ScrollDirection::eVertical ?
LayersPacket::Layer::VERTICAL :
LayersPacket::Layer::HORIZONTAL);
layer->set_barid(GetScrollbarTargetContainerId());
layer->set_barid(GetScrollbarTargetViewId());
}
// Mask layer

View File

@ -1025,7 +1025,7 @@ public:
bool GetForceIsolatedGroup() const
{
return mSimpleAttrs.ForceIsolatedGroup();
return mSimpleAttrs.GetForceIsolatedGroup();
}
/**
@ -1263,9 +1263,9 @@ public:
* of the scroll frame scrolled by the thumb, and other data related to the
* thumb.
*/
void SetScrollThumbData(FrameMetrics::ViewID aScrollId, const ScrollThumbData& aThumbData)
void SetScrollbarData(const ScrollbarData& aThumbData)
{
if (mSimpleAttrs.SetScrollThumbData(aScrollId, aThumbData)) {
if (mSimpleAttrs.SetScrollbarData(aThumbData)) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ScrollbarData", this));
MutatedSimple();
}
@ -1291,12 +1291,12 @@ public:
}
// These getters can be used anytime.
float GetOpacity() { return mSimpleAttrs.Opacity(); }
gfx::CompositionOp GetMixBlendMode() const { return mSimpleAttrs.MixBlendMode(); }
float GetOpacity() { return mSimpleAttrs.GetOpacity(); }
gfx::CompositionOp GetMixBlendMode() const { return mSimpleAttrs.GetMixBlendMode(); }
const Maybe<ParentLayerIntRect>& GetClipRect() const { return mClipRect; }
const Maybe<LayerClip>& GetScrolledClip() const { return mSimpleAttrs.ScrolledClip(); }
const Maybe<LayerClip>& GetScrolledClip() const { return mSimpleAttrs.GetScrolledClip(); }
Maybe<ParentLayerIntRect> GetScrolledClipRect() const;
uint32_t GetContentFlags() { return mSimpleAttrs.ContentFlags(); }
uint32_t GetContentFlags() { return mSimpleAttrs.GetContentFlags(); }
const LayerIntRegion& GetVisibleRegion() const { return mVisibleRegion; }
const ScrollMetadata& GetScrollMetadata(uint32_t aIndex) const;
const FrameMetrics& GetFrameMetrics(uint32_t aIndex) const;
@ -1326,21 +1326,21 @@ public:
// Same as GetTransform(), but returns the transform as a strongly-typed
// matrix. Eventually this will replace GetTransform().
const CSSTransformMatrix GetTransformTyped() const;
const gfx::Matrix4x4& GetBaseTransform() const { return mSimpleAttrs.Transform(); }
const gfx::Matrix4x4& GetBaseTransform() const { return mSimpleAttrs.GetTransform(); }
// Note: these are virtual because ContainerLayerComposite overrides them.
virtual float GetPostXScale() const { return mSimpleAttrs.PostXScale(); }
virtual float GetPostYScale() const { return mSimpleAttrs.PostYScale(); }
virtual float GetPostXScale() const { return mSimpleAttrs.GetPostXScale(); }
virtual float GetPostYScale() const { return mSimpleAttrs.GetPostYScale(); }
bool GetIsFixedPosition() { return mSimpleAttrs.IsFixedPosition(); }
bool GetTransformIsPerspective() const { return mSimpleAttrs.TransformIsPerspective(); }
bool GetTransformIsPerspective() const { return mSimpleAttrs.GetTransformIsPerspective(); }
bool GetIsStickyPosition() { return mSimpleAttrs.IsStickyPosition(); }
FrameMetrics::ViewID GetFixedPositionScrollContainerId() { return mSimpleAttrs.FixedPositionScrollContainerId(); }
LayerPoint GetFixedPositionAnchor() { return mSimpleAttrs.FixedPositionAnchor(); }
int32_t GetFixedPositionSides() { return mSimpleAttrs.FixedPositionSides(); }
FrameMetrics::ViewID GetStickyScrollContainerId() { return mSimpleAttrs.StickyScrollContainerId(); }
const LayerRectAbsolute& GetStickyScrollRangeOuter() { return mSimpleAttrs.StickyScrollRangeOuter(); }
const LayerRectAbsolute& GetStickyScrollRangeInner() { return mSimpleAttrs.StickyScrollRangeInner(); }
FrameMetrics::ViewID GetScrollbarTargetContainerId() { return mSimpleAttrs.ScrollbarTargetContainerId(); }
const ScrollThumbData& GetScrollThumbData() const { return mSimpleAttrs.ThumbData(); }
FrameMetrics::ViewID GetFixedPositionScrollContainerId() { return mSimpleAttrs.GetFixedPositionScrollContainerId(); }
LayerPoint GetFixedPositionAnchor() { return mSimpleAttrs.GetFixedPositionAnchor(); }
int32_t GetFixedPositionSides() { return mSimpleAttrs.GetFixedPositionSides(); }
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(); }
Layer* GetMaskLayer() const { return mMaskLayer; }

View File

@ -24,7 +24,7 @@ namespace layers {
class APZCTreeManager;
class LayerMetricsWrapper;
struct ScrollThumbData;
struct ScrollbarData;
/**
* This interface exposes APZ methods related to "sampling" (i.e. reading the
@ -58,7 +58,7 @@ public:
LayerToParentLayerMatrix4x4 ComputeTransformForScrollThumb(
const LayerToParentLayerMatrix4x4& aCurrentTransform,
const LayerMetricsWrapper& aContent,
const ScrollThumbData& aThumbData,
const ScrollbarData& aThumbData,
bool aScrollbarIsDescendant,
AsyncTransformComponentMatrix* aOutClipTransform);

View File

@ -634,7 +634,7 @@ APZCTreeManager::PushStateToWR(wr::TransactionBuilder& aTxn,
scrollTargetNode->GetTransform().ToUnknownMatrix(),
scrollTargetApzc,
aMetrics,
aNode->GetScrollThumbData(),
aNode->GetScrollbarData(),
scrollTargetNode->IsAncestorOf(aNode),
nullptr);
});
@ -865,8 +865,7 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
aLayer.IsBackfaceHidden());
node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
aLayer.GetScrollbarAnimationId(),
aLayer.GetScrollThumbData(),
aLayer.GetScrollbarContainerDirection());
aLayer.GetScrollbarData());
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId());
return node;
}
@ -1086,8 +1085,7 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
// when those properties change.
node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
aLayer.GetScrollbarAnimationId(),
aLayer.GetScrollThumbData(),
aLayer.GetScrollbarContainerDirection());
aLayer.GetScrollbarData());
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId());
return node;
}
@ -1213,7 +1211,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
// If we're starting an async scrollbar drag
if (apzDragEnabled && startsDrag && hitScrollbarNode &&
hitScrollbarNode->IsScrollThumbNode() &&
hitScrollbarNode->GetScrollThumbData().mIsAsyncDraggable) {
hitScrollbarNode->GetScrollbarData().mThumbIsAsyncDraggable) {
SetupScrollbarDrag(mouseInput, hitScrollbarNode.get(), apzc.get());
}
@ -1593,7 +1591,7 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
mInScrollbarTouchDrag = gfxPrefs::APZDragEnabled() &&
gfxPrefs::APZTouchDragEnabled() && hitScrollbarNode &&
hitScrollbarNode->IsScrollThumbNode() &&
hitScrollbarNode->GetScrollThumbData().mIsAsyncDraggable;
hitScrollbarNode->GetScrollbarData().mThumbIsAsyncDraggable;
MOZ_ASSERT(touchBehaviors.Length() == aInput.mTouches.Length());
for (size_t i = 0; i < touchBehaviors.Length(); i++) {
@ -1768,7 +1766,7 @@ APZCTreeManager::SetupScrollbarDrag(MouseInput& aMouseInput,
return;
}
const ScrollThumbData& thumbData = aScrollThumbNode->GetScrollThumbData();
const ScrollbarData& thumbData = aScrollThumbNode->GetScrollbarData();
MOZ_ASSERT(thumbData.mDirection.isSome());
// Record the thumb's position at the start of the drag.
@ -3006,7 +3004,7 @@ APZCTreeManager::ComputeTransformForNode(const HitTestingTreeNode* aNode) const
scrollTargetNode->GetTransform().ToUnknownMatrix(),
scrollTargetApzc,
aMetrics,
aNode->GetScrollThumbData(),
aNode->GetScrollbarData(),
scrollTargetNode->IsAncestorOf(aNode),
nullptr);
});
@ -3060,7 +3058,7 @@ APZCTreeManager::ComputeTransformForScrollThumb(
const Matrix4x4& aScrollableContentTransform,
AsyncPanZoomController* aApzc,
const FrameMetrics& aMetrics,
const ScrollThumbData& aThumbData,
const ScrollbarData& aScrollbarData,
bool aScrollbarIsDescendant,
AsyncTransformComponentMatrix* aOutClipTransform)
{
@ -3083,7 +3081,7 @@ APZCTreeManager::ComputeTransformForScrollThumb(
// on the painted content, we need to adjust it based on asyncTransform so that
// it reflects what the user is actually seeing now.
AsyncTransformComponentMatrix scrollbarTransform;
if (*aThumbData.mDirection == ScrollDirection::eVertical) {
if (*aScrollbarData.mDirection == ScrollDirection::eVertical) {
const ParentLayerCoord asyncScrollY = asyncTransform._42;
const float asyncZoomY = asyncTransform._22;
@ -3098,7 +3096,7 @@ APZCTreeManager::ComputeTransformForScrollThumb(
// Here we convert the scrollbar thumb ratio into a true unitless ratio by
// dividing out the conversion factor from the scrollframe's parent's space
// to the scrollframe's space.
const float ratio = aThumbData.mThumbRatio /
const float ratio = aScrollbarData.mThumbRatio /
(aMetrics.GetPresShellResolution() * asyncZoomY);
// The scroll thumb needs to be translated in opposite direction of the
// async scroll. This is because scrolling down, which translates the layer
@ -3135,7 +3133,7 @@ APZCTreeManager::ComputeTransformForScrollThumb(
scrollbarTransform.PostScale(1.f, yScale, 1.f);
scrollbarTransform.PostTranslate(0, yTranslation, 0);
}
if (*aThumbData.mDirection == ScrollDirection::eHorizontal) {
if (*aScrollbarData.mDirection == ScrollDirection::eHorizontal) {
// See detailed comments under the VERTICAL case.
const ParentLayerCoord asyncScrollX = asyncTransform._41;
@ -3145,7 +3143,7 @@ APZCTreeManager::ComputeTransformForScrollThumb(
const CSSToParentLayerScale effectiveZoom(aMetrics.GetZoom().xScale * asyncZoomX);
const float ratio = aThumbData.mThumbRatio /
const float ratio = aScrollbarData.mThumbRatio /
(aMetrics.GetPresShellResolution() * asyncZoomX);
ParentLayerCoord xTranslation = -asyncScrollX * ratio;

View File

@ -524,7 +524,7 @@ public:
const gfx::Matrix4x4& aScrollableContentTransform,
AsyncPanZoomController* aApzc,
const FrameMetrics& aMetrics,
const ScrollThumbData& aThumbData,
const ScrollbarData& aScrollbarData,
bool aScrollbarIsDescendant,
AsyncTransformComponentMatrix* aOutClipTransform);

View File

@ -67,7 +67,7 @@ APZSampler::SampleAnimations(const LayerMetricsWrapper& aLayer,
LayerToParentLayerMatrix4x4
APZSampler::ComputeTransformForScrollThumb(const LayerToParentLayerMatrix4x4& aCurrentTransform,
const LayerMetricsWrapper& aContent,
const ScrollThumbData& aThumbData,
const ScrollbarData& aThumbData,
bool aScrollbarIsDescendant,
AsyncTransformComponentMatrix* aOutClipTransform)
{

View File

@ -981,9 +981,10 @@ nsEventStatus AsyncPanZoomController::HandleDragEvent(const MouseInput& aEvent,
return nsEventStatus_eConsumeNoDefault;
}
const ScrollThumbData& thumbData = node->GetScrollThumbData();
MOZ_ASSERT(thumbData.mDirection.isSome());
ScrollDirection direction = *thumbData.mDirection;
const ScrollbarData& scrollbarData = node->GetScrollbarData();
MOZ_ASSERT(scrollbarData.mScrollbarLayerType == layers::ScrollbarLayerType::Thumb);
MOZ_ASSERT(scrollbarData.mDirection.isSome());
ScrollDirection direction = *scrollbarData.mDirection;
bool isMouseAwayFromThumb = false;
if (int snapMultiplier = gfxPrefs::SliderSnapMultiplier()) {
@ -1009,12 +1010,12 @@ nsEventStatus AsyncPanZoomController::HandleDragEvent(const MouseInput& aEvent,
if (isMouseAwayFromThumb) {
thumbPosition = aInitialThumbPos;
} else {
thumbPosition = ConvertScrollbarPoint(aEvent.mLocalOrigin, thumbData) -
thumbPosition = ConvertScrollbarPoint(aEvent.mLocalOrigin, scrollbarData) -
aDragMetrics.mScrollbarDragOffset;
}
CSSCoord maxThumbPos = thumbData.mScrollTrackLength;
maxThumbPos -= thumbData.mThumbLength;
CSSCoord maxThumbPos = scrollbarData.mScrollTrackLength;
maxThumbPos -= scrollbarData.mThumbLength;
float scrollPercent = thumbPosition / maxThumbPos;
@ -1704,7 +1705,7 @@ AsyncPanZoomController::ConvertToGecko(const ScreenIntPoint& aPoint, LayoutDevic
CSSCoord
AsyncPanZoomController::ConvertScrollbarPoint(const ParentLayerPoint& aScrollbarPoint,
const ScrollThumbData& aThumbData) const
const ScrollbarData& aThumbData) const
{
RecursiveMutexAutoLock lock(mRecursiveMutex);

View File

@ -503,7 +503,7 @@ public:
* Only the component in the direction of scrolling is returned.
*/
CSSCoord ConvertScrollbarPoint(const ParentLayerPoint& aScrollbarPoint,
const ScrollThumbData& aThumbData) const;
const ScrollbarData& aThumbData) const;
void NotifyMozMouseScrollEvent(const nsString& aString) const;

View File

@ -96,43 +96,39 @@ HitTestingTreeNode::SetLastChild(HitTestingTreeNode* aChild)
void
HitTestingTreeNode::SetScrollbarData(FrameMetrics::ViewID aScrollViewId,
const uint64_t& aScrollbarAnimationId,
const ScrollThumbData& aThumbData,
const Maybe<ScrollDirection>& aScrollContainerDirection)
const ScrollbarData& aScrollbarData)
{
mScrollViewId = aScrollViewId;
mScrollbarAnimationId = aScrollbarAnimationId;
mScrollThumbData = aThumbData;
mScrollbarContainerDirection = aScrollContainerDirection;
mScrollbarData = aScrollbarData;
}
bool
HitTestingTreeNode::MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetrics) const
{
return IsScrollThumbNode() &&
mScrollThumbData.mDirection == aDragMetrics.mDirection &&
mScrollbarData.mDirection == aDragMetrics.mDirection &&
mScrollViewId == aDragMetrics.mViewId;
}
bool
HitTestingTreeNode::IsScrollThumbNode() const
{
return mScrollThumbData.mDirection.isSome();
return mScrollbarData.mScrollbarLayerType == layers::ScrollbarLayerType::Thumb;
}
bool
HitTestingTreeNode::IsScrollbarNode() const
{
return mScrollbarContainerDirection.isSome() || IsScrollThumbNode();
return mScrollbarData.mScrollbarLayerType != layers::ScrollbarLayerType::None;
}
ScrollDirection
HitTestingTreeNode::GetScrollbarDirection() const
{
MOZ_ASSERT(IsScrollbarNode());
if (mScrollThumbData.mDirection.isSome()) {
return *(mScrollThumbData.mDirection);
}
return *mScrollbarContainerDirection;
MOZ_ASSERT(mScrollbarData.mDirection.isSome());
return *mScrollbarData.mDirection;
}
FrameMetrics::ViewID
@ -147,10 +143,10 @@ HitTestingTreeNode::GetScrollbarAnimationId() const
return mScrollbarAnimationId;
}
const ScrollThumbData&
HitTestingTreeNode::GetScrollThumbData() const
const ScrollbarData&
HitTestingTreeNode::GetScrollbarData() const
{
return mScrollThumbData;
return mScrollbarData;
}
void
@ -391,7 +387,7 @@ HitTestingTreeNode::Dump(const char* aPrefix) const
(mFixedPosTarget != FrameMetrics::NULL_SCROLL_ID) ? nsPrintfCString("fixed=%" PRIu64 " ", mFixedPosTarget).get() : "",
Stringify(mEventRegions).c_str(), Stringify(mTransform).c_str(),
mClipRegion ? Stringify(mClipRegion.ref()).c_str() : "none",
mScrollbarContainerDirection.isSome() ? " scrollbar" : "",
mScrollbarData.mDirection.isSome() ? " scrollbar" : "",
IsScrollThumbNode() ? " scrollthumb" : "");
if (mLastChild) {
mLastChild->Dump(nsPrintfCString("%s ", aPrefix).get());

View File

@ -97,15 +97,14 @@ public:
void SetScrollbarData(FrameMetrics::ViewID aScrollViewId,
const uint64_t& aScrollbarAnimationId,
const ScrollThumbData& aThumbData,
const Maybe<ScrollDirection>& aScrollContainerDirection);
const ScrollbarData& aScrollbarData);
bool MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetrics) const;
bool IsScrollbarNode() const; // Scroll thumb or scrollbar container layer.
// This can only be called if IsScrollbarNode() is true
ScrollDirection GetScrollbarDirection() const;
bool IsScrollThumbNode() const; // Scroll thumb container layer.
FrameMetrics::ViewID GetScrollTargetId() const;
const ScrollThumbData& GetScrollThumbData() const;
const ScrollbarData& GetScrollbarData() const;
const uint64_t& GetScrollbarAnimationId() const;
/* Fixed pos info */
@ -150,11 +149,8 @@ private:
// use to move the thumb node to reflect async scrolling.
uint64_t mScrollbarAnimationId;
// This is set for scroll thumb Container layers only.
ScrollThumbData mScrollThumbData;
// This is set for scroll track Container layers only.
Maybe<ScrollDirection> mScrollbarContainerDirection;
// This is set for scrollbar Container and Thumb layers.
ScrollbarData mScrollbarData;
FrameMetrics::ViewID mFixedPosTarget;

View File

@ -753,9 +753,9 @@ MoveScrollbarForLayerMargin(Layer* aRoot, FrameMetrics::ViewID aRootScrollId,
// adjustment on the layer tree.
Layer* scrollbar = BreadthFirstSearch<ReverseIterator>(aRoot,
[aRootScrollId](Layer* aNode) {
return (aNode->GetScrollThumbData().mDirection.isSome() &&
*aNode->GetScrollThumbData().mDirection == ScrollDirection::eHorizontal &&
aNode->GetScrollbarTargetContainerId() == aRootScrollId);
return (aNode->GetScrollbarData().mDirection.isSome() &&
*aNode->GetScrollbarData().mDirection == ScrollDirection::eHorizontal &&
aNode->GetScrollbarTargetViewId() == aRootScrollId);
});
if (scrollbar) {
// Shift the horizontal scrollbar down into the new space exposed by the
@ -1034,7 +1034,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
ExpandRootClipRect(layer, fixedLayerMargins);
if (layer->GetScrollThumbData().mDirection.isSome()) {
if (layer->GetScrollbarData().mScrollbarLayerType == layers::ScrollbarLayerType::Thumb) {
ApplyAsyncTransformToScrollbar(layer);
}
});
@ -1050,7 +1050,7 @@ LayerIsScrollbarTarget(const LayerMetricsWrapper& aTarget, Layer* aScrollbar)
}
const FrameMetrics& metrics = aTarget.Metrics();
MOZ_ASSERT(metrics.IsScrollable());
if (metrics.GetScrollId() != aScrollbar->GetScrollbarTargetContainerId()) {
if (metrics.GetScrollId() != aScrollbar->GetScrollbarTargetViewId()) {
return false;
}
return !metrics.IsScrollInfoLayer();
@ -1069,7 +1069,7 @@ ApplyAsyncTransformToScrollbarForContent(const RefPtr<APZSampler>& aSampler,
aSampler->ComputeTransformForScrollThumb(
aScrollbar->GetLocalTransformTyped(),
aContent,
aScrollbar->GetScrollThumbData(),
aScrollbar->GetScrollbarData(),
aScrollbarIsDescendant,
&clipTransform);

View File

@ -108,15 +108,15 @@ public:
// post-scales.
virtual float GetPostXScale() const override {
if (mScaleToResolution) {
return mSimpleAttrs.PostXScale() * mPresShellResolution;
return mSimpleAttrs.GetPostXScale() * mPresShellResolution;
}
return mSimpleAttrs.PostXScale();
return mSimpleAttrs.GetPostXScale();
}
virtual float GetPostYScale() const override {
if (mScaleToResolution) {
return mSimpleAttrs.PostYScale() * mPresShellResolution;
return mSimpleAttrs.GetPostYScale() * mPresShellResolution;
}
return mSimpleAttrs.PostYScale();
return mSimpleAttrs.GetPostYScale();
}
virtual const char* Name() const override { return "ContainerLayerComposite"; }

View File

@ -77,8 +77,8 @@ public:
void SetReferentId(LayersId aReferentId) { mReferentId = Some(aReferentId); }
Maybe<LayersId> GetReferentId() const { return mReferentId; }
void SetScrollThumbData(const ScrollThumbData& aData) { mScrollThumbData = aData; }
const ScrollThumbData& GetScrollThumbData() const { return mScrollThumbData; }
void SetScrollbarData(const ScrollbarData& aData) { mScrollbarData = aData; }
const ScrollbarData& GetScrollbarData() const { return mScrollbarData; }
void SetScrollbarAnimationId(const uint64_t& aId) { mScrollbarAnimationId = aId; }
const uint64_t& GetScrollbarAnimationId() const { return mScrollbarAnimationId; }
void SetScrollbarTargetContainerId(FrameMetrics::ViewID aId) { mScrollbarTargetContainerId = aId; }
@ -115,7 +115,7 @@ private:
LayerIntRegion mVisibleRegion;
Maybe<LayersId> mReferentId;
EventRegionsOverride mEventRegionsOverride;
ScrollThumbData mScrollThumbData;
ScrollbarData mScrollbarData;
uint64_t mScrollbarAnimationId;
FrameMetrics::ViewID mScrollbarTargetContainerId;
Maybe<ScrollDirection> mScrollbarContainerDirection;
@ -201,15 +201,15 @@ private:
namespace IPC {
// When ScrollThumbData is stored on the layer tree, it's part of
// When ScrollbarData is stored on the layer tree, it's part of
// SimpleAttributes which itself uses PlainOldDataSerializer, so
// we don't need a ParamTraits specialization for ScrollThumbData
// separately. Here, however, ScrollThumbData is stored as part
// we don't need a ParamTraits specialization for ScrollbarData
// separately. Here, however, ScrollbarData is stored as part
// of WebRenderLayerScrollData whose fields are serialized
// individually, so we do.
template<>
struct ParamTraits<mozilla::layers::ScrollThumbData>
: public PlainOldDataSerializer<mozilla::layers::ScrollThumbData>
struct ParamTraits<mozilla::layers::ScrollbarData>
: public PlainOldDataSerializer<mozilla::layers::ScrollbarData>
{ };
template<>
@ -228,7 +228,7 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData>
WriteParam(aMsg, aParam.mVisibleRegion);
WriteParam(aMsg, aParam.mReferentId);
WriteParam(aMsg, aParam.mEventRegionsOverride);
WriteParam(aMsg, aParam.mScrollThumbData);
WriteParam(aMsg, aParam.mScrollbarData);
WriteParam(aMsg, aParam.mScrollbarAnimationId);
WriteParam(aMsg, aParam.mScrollbarTargetContainerId);
WriteParam(aMsg, aParam.mScrollbarContainerDirection);
@ -246,7 +246,7 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData>
&& ReadParam(aMsg, aIter, &aResult->mVisibleRegion)
&& ReadParam(aMsg, aIter, &aResult->mReferentId)
&& ReadParam(aMsg, aIter, &aResult->mEventRegionsOverride)
&& ReadParam(aMsg, aIter, &aResult->mScrollThumbData)
&& ReadParam(aMsg, aIter, &aResult->mScrollbarData)
&& ReadParam(aMsg, aIter, &aResult->mScrollbarAnimationId)
&& ReadParam(aMsg, aIter, &aResult->mScrollbarTargetContainerId)
&& ReadParam(aMsg, aIter, &aResult->mScrollbarContainerDirection)

View File

@ -285,10 +285,10 @@ public:
return mLayer->GetEventRegionsOverride();
}
const ScrollThumbData& GetScrollThumbData() const
const ScrollbarData& GetScrollbarData() const
{
MOZ_ASSERT(IsValid());
return mLayer->GetScrollThumbData();
return mLayer->GetScrollbarData();
}
uint64_t GetScrollbarAnimationId() const

View File

@ -3383,7 +3383,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
aBuilder->CurrentActiveScrolledRoot(),
nsDisplayOwnLayerFlags::eNone,
mozilla::layers::FrameMetrics::NULL_SCROLL_ID,
ScrollThumbData{}, /* aForceActive = */ false));
ScrollbarData{}, /* aForceActive = */ false));
if (aCreatedContainerItem) {
*aCreatedContainerItem = true;
}

View File

@ -6886,7 +6886,7 @@ nsDisplayOwnLayer::nsDisplayOwnLayer(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsDisplayList* aList,
const ActiveScrolledRoot* aActiveScrolledRoot,
nsDisplayOwnLayerFlags aFlags, ViewID aScrollTarget,
const ScrollThumbData& aThumbData,
const ScrollbarData& aThumbData,
bool aForceActive,
bool aClearClipChain)
: nsDisplayWrapList(aBuilder, aFrame, aList, aActiveScrolledRoot, aClearClipChain)
@ -6928,7 +6928,7 @@ nsDisplayOwnLayer::GetLayerState(nsDisplayListBuilder* aBuilder,
bool
nsDisplayOwnLayer::IsScrollThumbLayer() const
{
return mThumbData.mDirection.isSome();
return mThumbData.mScrollbarLayerType == layers::ScrollbarLayerType::Thumb;
}
bool
@ -6950,7 +6950,8 @@ nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder,
aContainerParameters, nullptr,
FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR);
if (IsScrollThumbLayer()) {
layer->SetScrollThumbData(mScrollTarget, mThumbData);
mThumbData.mTargetViewId = mScrollTarget;
layer->SetScrollbarData(mThumbData);
}
if (mFlags & nsDisplayOwnLayerFlags::eScrollbarContainer) {
ScrollDirection dir = (mFlags & nsDisplayOwnLayerFlags::eVerticalScrollbar)
@ -7006,7 +7007,7 @@ nsDisplayOwnLayer::UpdateScrollData(mozilla::layers::WebRenderScrollData* aData,
if (IsScrollThumbLayer()) {
ret = true;
if (aLayerData) {
aLayerData->SetScrollThumbData(mThumbData);
aLayerData->SetScrollbarData(mThumbData);
aLayerData->SetScrollbarAnimationId(mWrAnimationId);
aLayerData->SetScrollbarTargetContainerId(mScrollTarget);
}

View File

@ -5478,7 +5478,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(nsDisplayOwnLayerFlags)
*/
class nsDisplayOwnLayer : public nsDisplayWrapList {
public:
typedef mozilla::layers::ScrollThumbData ScrollThumbData;
typedef mozilla::layers::ScrollbarData ScrollbarData;
/**
* @param aFlags eGenerateSubdocInvalidations :
@ -5496,7 +5496,7 @@ public:
const ActiveScrolledRoot* aActiveScrolledRoot,
nsDisplayOwnLayerFlags aFlags = nsDisplayOwnLayerFlags::eNone,
ViewID aScrollTarget = mozilla::layers::FrameMetrics::NULL_SCROLL_ID,
const ScrollThumbData& aThumbData = ScrollThumbData{},
const ScrollbarData& aThumbData = ScrollbarData{},
bool aForceActive = true,
bool aClearClipChain = false);
#ifdef NS_BUILD_REFCNT_LOGGING
@ -5551,7 +5551,7 @@ protected:
// stores information about the scroll thumb. Otherwise, mThumbData will be
// default-constructed (in particular with mDirection == Nothing())
// and can be ignored.
ScrollThumbData mThumbData;
ScrollbarData mThumbData;
bool mForceActive;
uint64_t mWrAnimationId;
};

View File

@ -1391,7 +1391,7 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
MakeDisplayItem<nsDisplayOwnLayer>(aBuilder, this, &masterList, ownLayerASR,
nsDisplayOwnLayerFlags::eNone,
mozilla::layers::FrameMetrics::NULL_SCROLL_ID,
mozilla::layers::ScrollThumbData{}, true, true));
mozilla::layers::ScrollbarData{}, true, true));
}
}

View File

@ -54,7 +54,7 @@ using mozilla::layers::APZCCallbackHelper;
using mozilla::layers::AsyncDragMetrics;
using mozilla::layers::InputAPZContext;
using mozilla::layers::ScrollDirection;
using mozilla::layers::ScrollThumbData;
using mozilla::layers::ScrollbarData;
bool nsSliderFrame::gMiddlePref = false;
int32_t nsSliderFrame::gSnapMultiplier;
@ -460,13 +460,14 @@ nsSliderFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
aLists.Content()->AppendToTop(
MakeDisplayItem<nsDisplayOwnLayer>(aBuilder, this, &masterList, ownLayerASR,
flags, scrollTargetId,
ScrollThumbData{scrollDirection,
GetThumbRatio(),
thumbStart,
thumbLength,
isAsyncDraggable,
sliderTrackStart,
sliderTrackLength}));
ScrollbarData{scrollDirection,
layers::ScrollbarLayerType::Thumb,
GetThumbRatio(),
thumbStart,
thumbLength,
isAsyncDraggable,
sliderTrackStart,
sliderTrackLength}));
return;
}