Backed out 8 changesets (bug 1610731) for reftest failures at dynamic-toolbar-fixed-bottom-1.html. CLOSED TREE

Backed out changeset a26b63d0248e (bug 1610731)
Backed out changeset c33e6fe22774 (bug 1610731)
Backed out changeset 840550c070e8 (bug 1610731)
Backed out changeset 7bffd6eb9ac7 (bug 1610731)
Backed out changeset a383a7100973 (bug 1610731)
Backed out changeset 8f2bae2ca274 (bug 1610731)
Backed out changeset 8d43fbe05f38 (bug 1610731)
Backed out changeset 035432f43d16 (bug 1610731)

--HG--
rename : layout/reftests/async-scrolling/dynamic-toolbar-sticky-top-1.html => layout/reftests/async-scrolling/dynamic-toolbar-fixed-bottom-1.html
This commit is contained in:
Brindusan Cristian 2020-04-04 00:47:08 +03:00
Родитель 6f67e5cdea
Коммит 66ab7a9660
18 изменённых файлов: 131 добавлений и 543 удалений

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

@ -569,31 +569,6 @@ struct ParamTraits<mozilla::gfx::RectTyped<T>> {
} }
}; };
template <class T>
struct ParamTraits<mozilla::gfx::RectAbsoluteTyped<T>> {
typedef mozilla::gfx::RectAbsoluteTyped<T> paramType;
static void Write(Message* msg, const paramType& param) {
WriteParam(msg, param.Left());
WriteParam(msg, param.Right());
WriteParam(msg, param.Top());
WriteParam(msg, param.Bottom());
}
static bool Read(const Message* msg, PickleIterator* iter,
paramType* result) {
auto l = result->Left();
auto r = result->Right();
auto t = result->Top();
auto b = result->Bottom();
bool retVal = (ReadParam(msg, iter, &l) && ReadParam(msg, iter, &r) &&
ReadParam(msg, iter, &t) && ReadParam(msg, iter, &b));
result->SetBox(l, r, t, b);
return retVal;
}
};
template <class T> template <class T>
struct ParamTraits<mozilla::gfx::IntRectTyped<T>> { struct ParamTraits<mozilla::gfx::IntRectTyped<T>> {
typedef mozilla::gfx::IntRectTyped<T> paramType; typedef mozilla::gfx::IntRectTyped<T> paramType;

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

@ -409,58 +409,38 @@ class MOZ_STACK_CLASS LayerMetricsWrapper final {
ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() const { ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
if (AtBottomLayer()) { // TODO: Restrict this only for AtBottomLayer.
return mLayer->GetFixedPositionScrollContainerId(); return mLayer->GetFixedPositionScrollContainerId();
}
return ScrollableLayerGuid::NULL_SCROLL_ID;
} }
SideBits GetFixedPositionSides() const { SideBits GetFixedPositionSides() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
if (AtBottomLayer()) { return mLayer->GetFixedPositionSides();
return mLayer->GetFixedPositionSides(); }
}
return SideBits::eNone; bool GetIsStickyPosition() const {
MOZ_ASSERT(IsValid());
return mLayer->GetIsStickyPosition();
} }
ScrollableLayerGuid::ViewID GetStickyScrollContainerId() const { ScrollableLayerGuid::ViewID GetStickyScrollContainerId() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
if (AtBottomLayer() && mLayer->GetIsStickyPosition()) { // TODO: Restrict this only for AtBottomLayer.
return mLayer->GetStickyScrollContainerId(); return mLayer->GetStickyScrollContainerId();
}
return ScrollableLayerGuid::NULL_SCROLL_ID;
} }
const LayerRectAbsolute& GetStickyScrollRangeOuter() const { const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
if (AtBottomLayer() && mLayer->GetIsStickyPosition()) { return mLayer->GetStickyScrollRangeOuter();
return mLayer->GetStickyScrollRangeOuter();
}
static const LayerRectAbsolute empty;
return empty;
} }
const LayerRectAbsolute& GetStickyScrollRangeInner() const { const LayerRectAbsolute& GetStickyScrollRangeInner() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
if (AtBottomLayer() && mLayer->GetIsStickyPosition()) { return mLayer->GetStickyScrollRangeInner();
return mLayer->GetStickyScrollRangeInner();
}
static const LayerRectAbsolute empty;
return empty;
}
Maybe<uint64_t> GetStickyPositionAnimationId() const {
MOZ_ASSERT(IsValid());
// This function is only really needed for template-compatibility with
// WebRenderScrollDataWrapper. Although it will be called, the return
// value is not used.
return Nothing();
} }
Maybe<uint64_t> GetZoomAnimationId() const { Maybe<uint64_t> GetZoomAnimationId() const {

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

@ -147,12 +147,16 @@ struct APZCTreeManager::TreeBuildingState {
// codepath. // codepath.
Maybe<uint64_t> mZoomAnimationId; Maybe<uint64_t> mZoomAnimationId;
// See corresponding members of APZCTreeManager. These are the same thing, but // This is populated with all the HitTestingTreeNodes that have a fixed
// on the tree-walking state. They are populated while walking the tree in // position animation id (which indicates that they need to be sampled for
// a layers update, and then moved into APZCTreeManager. // WebRender on the sampler thread).
std::vector<FixedPositionInfo> mFixedPositionInfo; std::vector<HitTestingTreeNode*> mFixedPositionNodesWithAnimationId;
std::vector<RootScrollbarInfo> mRootScrollbarInfo;
std::vector<StickyPositionInfo> mStickyPositionInfo; // This is populated with all the HitTestingTreeNodes that are scrollbar
// containers for the root viewport and have a scrollthumb animation id
// (which indicates that they need to be sampled for WebRender on the sampler
// thread).
std::vector<HitTestingTreeNode*> mRootScrollbars;
}; };
class APZCTreeManager::CheckerboardFlushObserver : public nsIObserver { class APZCTreeManager::CheckerboardFlushObserver : public nsIObserver {
@ -473,23 +477,13 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
state.mScrollThumbs.push_back(node); state.mScrollThumbs.push_back(node);
} else if (node->IsScrollbarContainerNode()) { } else if (node->IsScrollbarContainerNode()) {
// Only scrollbar containers for the root have an animation id. // Only scrollbar containers for the root have an animation id.
state.mRootScrollbarInfo.emplace_back( state.mRootScrollbars.push_back(node);
*(node->GetScrollbarAnimationId()),
node->GetScrollbarDirection());
} }
} }
// GetFixedPositionAnimationId is only set when webrender is enabled. // GetFixedPositionAnimationId is only set when webrender is enabled.
if (node->GetFixedPositionAnimationId().isSome()) { if (node->GetFixedPositionAnimationId().isSome()) {
state.mFixedPositionInfo.emplace_back( state.mFixedPositionNodesWithAnimationId.push_back(node);
*(node->GetFixedPositionAnimationId()),
node->GetFixedPosSides());
}
// GetStickyPositionAnimationId is only set when webrender is enabled.
if (node->GetStickyPositionAnimationId().isSome()) {
state.mStickyPositionInfo.emplace_back(
*(node->GetStickyPositionAnimationId()),
node->GetFixedPosSides());
} }
if (apzc && node->IsPrimaryHolder()) { if (apzc && node->IsPrimaryHolder()) {
state.mScrollTargets[apzc->GetGuid()] = node; state.mScrollTargets[apzc->GetGuid()] = node;
@ -636,9 +630,26 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
target->IsAncestorOf(thumb)); target->IsAncestorOf(thumb));
} }
mRootScrollbarInfo = std::move(state.mRootScrollbarInfo); mRootScrollbarInfo.clear();
mFixedPositionInfo = std::move(state.mFixedPositionInfo); // For non-webrender, and platforms without a dynamic toolbar,
mStickyPositionInfo = std::move(state.mStickyPositionInfo); // state.mRootScrollbarsWithAnimationId will be empty so this will be a
// no-op.
for (const HitTestingTreeNode* scrollbar : state.mRootScrollbars) {
MOZ_ASSERT(scrollbar->IsScrollbarContainerNode());
mRootScrollbarInfo.emplace_back(*(scrollbar->GetScrollbarAnimationId()),
scrollbar->GetScrollbarDirection());
}
mFixedPositionInfo.clear();
// For non-webrender, state.mFixedPositionNodesWithAnimationId will be empty
// so this will be a no-op.
for (HitTestingTreeNode* fixedPos :
state.mFixedPositionNodesWithAnimationId) {
MOZ_ASSERT(fixedPos->GetFixedPositionAnimationId().isSome());
mFixedPositionInfo.emplace_back(
fixedPos->GetFixedPositionAnimationId().value(),
fixedPos->GetFixedPosSides());
}
} }
for (size_t i = 0; i < state.mNodesToDestroy.Length(); i++) { for (size_t i = 0; i < state.mNodesToDestroy.Length(); i++) {
@ -817,8 +828,7 @@ void APZCTreeManager::SampleForWebRender(
if (info.mScrollDirection == ScrollDirection::eHorizontal) { if (info.mScrollDirection == ScrollDirection::eHorizontal) {
ScreenPoint translation = ScreenPoint translation =
AsyncCompositionManager::ComputeFixedMarginsOffset( AsyncCompositionManager::ComputeFixedMarginsOffset(
GetCompositorFixedLayerMargins(), SideBits::eBottom, mCompositorFixedLayerMargins, SideBits::eBottom, ScreenMargin());
ScreenMargin());
LayerToParentLayerMatrix4x4 transform = LayerToParentLayerMatrix4x4 transform =
LayerToParentLayerMatrix4x4::Translation(ViewAs<ParentLayerPixel>( LayerToParentLayerMatrix4x4::Translation(ViewAs<ParentLayerPixel>(
@ -832,7 +842,7 @@ void APZCTreeManager::SampleForWebRender(
for (const FixedPositionInfo& info : mFixedPositionInfo) { for (const FixedPositionInfo& info : mFixedPositionInfo) {
ScreenPoint translation = ScreenPoint translation =
AsyncCompositionManager::ComputeFixedMarginsOffset( AsyncCompositionManager::ComputeFixedMarginsOffset(
GetCompositorFixedLayerMargins(), info.mFixedPosSides, mCompositorFixedLayerMargins, info.mFixedPosSides,
mGeckoFixedLayerMargins); mGeckoFixedLayerMargins);
LayerToParentLayerMatrix4x4 transform = LayerToParentLayerMatrix4x4 transform =
@ -843,23 +853,6 @@ void APZCTreeManager::SampleForWebRender(
wr::ToWrTransformProperty(info.mFixedPositionAnimationId, transform)); wr::ToWrTransformProperty(info.mFixedPositionAnimationId, transform));
} }
for (const StickyPositionInfo& info : mStickyPositionInfo) {
ScreenPoint translation =
AsyncCompositionManager::ComputeFixedMarginsOffset(
GetCompositorFixedLayerMargins(), info.mFixedPosSides,
// For sticky layers, we don't need to factor
// mGeckoFixedLayerMargins because Gecko doesn't shift the
// position of sticky elements for dynamic toolbar movements.
ScreenMargin());
LayerToParentLayerMatrix4x4 transform =
LayerToParentLayerMatrix4x4::Translation(ViewAs<ParentLayerPixel>(
translation, PixelCastJustification::ScreenIsParentLayerForRoot));
transforms.AppendElement(
wr::ToWrTransformProperty(info.mStickyPositionAnimationId, transform));
}
aTxn.AppendTransformProperties(transforms); aTxn.AppendTransformProperties(transforms);
// Advance animations. It's important that this happens after // Advance animations. It's important that this happens after
@ -1200,10 +1193,14 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId(), node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId(),
aLayer.GetFixedPositionSides(), aLayer.GetFixedPositionSides(),
aLayer.GetFixedPositionAnimationId()); aLayer.GetFixedPositionAnimationId());
node->SetStickyPosData(aLayer.GetStickyScrollContainerId(), if (aLayer.GetIsStickyPosition()) {
aLayer.GetStickyScrollRangeOuter(), node->SetStickyPosData(aLayer.GetStickyScrollContainerId(),
aLayer.GetStickyScrollRangeInner(), aLayer.GetStickyScrollRangeOuter(),
aLayer.GetStickyPositionAnimationId()); aLayer.GetStickyScrollRangeInner());
} else {
node->SetStickyPosData(ScrollableLayerGuid::NULL_SCROLL_ID,
LayerRectAbsolute(), LayerRectAbsolute());
}
return node; return node;
} }
@ -1430,10 +1427,14 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId(), node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId(),
aLayer.GetFixedPositionSides(), aLayer.GetFixedPositionSides(),
aLayer.GetFixedPositionAnimationId()); aLayer.GetFixedPositionAnimationId());
node->SetStickyPosData(aLayer.GetStickyScrollContainerId(), if (aLayer.GetIsStickyPosition()) {
aLayer.GetStickyScrollRangeOuter(), node->SetStickyPosData(aLayer.GetStickyScrollContainerId(),
aLayer.GetStickyScrollRangeInner(), aLayer.GetStickyScrollRangeOuter(),
aLayer.GetStickyPositionAnimationId()); aLayer.GetStickyScrollRangeInner());
} else {
node->SetStickyPosData(ScrollableLayerGuid::NULL_SCROLL_ID,
LayerRectAbsolute(), LayerRectAbsolute());
}
return node; return node;
} }
@ -2103,7 +2104,7 @@ APZEventResult APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput) {
MutexAutoLock lock(mMapLock); MutexAutoLock lock(mMapLock);
touchData.mScreenPoint -= touchData.mScreenPoint -=
RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset( RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset(
GetCompositorFixedLayerMargins(), mFixedPosSidesForInputBlock, mCompositorFixedLayerMargins, mFixedPosSidesForInputBlock,
mGeckoFixedLayerMargins)); mGeckoFixedLayerMargins));
} }
} }
@ -3391,7 +3392,7 @@ Maybe<ScreenIntPoint> APZCTreeManager::ConvertToGecko(
MutexAutoLock mapLock(mMapLock); MutexAutoLock mapLock(mMapLock);
*geckoPoint -= *geckoPoint -=
RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset( RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset(
GetCompositorFixedLayerMargins(), mFixedPosSidesForInputBlock, mCompositorFixedLayerMargins, mFixedPosSidesForInputBlock,
mGeckoFixedLayerMargins)); mGeckoFixedLayerMargins));
} }
} }
@ -3465,8 +3466,8 @@ bool APZCTreeManager::IsStuckToRootContentAtBottom(
return false; return false;
} }
// We support the dynamic toolbar at top and bottom. // Currently we only support the dyanmic toolbar at bottom.
if ((aNode->GetFixedPosSides() & SideBits::eTopBottom) == SideBits::eNone) { if ((aNode->GetFixedPosSides() & SideBits::eBottom) == SideBits::eNone) {
return false; return false;
} }
@ -3561,7 +3562,7 @@ LayerToParentLayerMatrix4x4 APZCTreeManager::ComputeTransformForNode(
MutexAutoLock mapLock(mMapLock); MutexAutoLock mapLock(mMapLock);
translation = ViewAs<ParentLayerPixel>( translation = ViewAs<ParentLayerPixel>(
AsyncCompositionManager::ComputeFixedMarginsOffset( AsyncCompositionManager::ComputeFixedMarginsOffset(
GetCompositorFixedLayerMargins(), aNode->GetFixedPosSides(), mCompositorFixedLayerMargins, aNode->GetFixedPosSides(),
mGeckoFixedLayerMargins), mGeckoFixedLayerMargins),
PixelCastJustification::ScreenIsParentLayerForRoot); PixelCastJustification::ScreenIsParentLayerForRoot);
} }
@ -3574,8 +3575,8 @@ LayerToParentLayerMatrix4x4 APZCTreeManager::ComputeTransformForNode(
MutexAutoLock mapLock(mMapLock); MutexAutoLock mapLock(mMapLock);
translation = ViewAs<ParentLayerPixel>( translation = ViewAs<ParentLayerPixel>(
AsyncCompositionManager::ComputeFixedMarginsOffset( AsyncCompositionManager::ComputeFixedMarginsOffset(
GetCompositorFixedLayerMargins(), mCompositorFixedLayerMargins,
aNode->GetFixedPosSides() & SideBits::eTopBottom, aNode->GetFixedPosSides() & SideBits::eBottom,
// For sticky layers, we don't need to factor // For sticky layers, we don't need to factor
// mGeckoFixedLayerMargins because Gecko doesn't shift the // mGeckoFixedLayerMargins because Gecko doesn't shift the
// position of sticky elements for dynamic toolbar movements. // position of sticky elements for dynamic toolbar movements.
@ -3624,16 +3625,6 @@ already_AddRefed<GeckoContentController> APZCTreeManager::GetContentController(
return controller.forget(); return controller.forget();
} }
ScreenMargin APZCTreeManager::GetCompositorFixedLayerMargins() const {
RecursiveMutexAutoLock lock(mTreeLock);
ScreenMargin result = mCompositorFixedLayerMargins;
if (StaticPrefs::apz_fixed_margin_override_enabled()) {
result.top = StaticPrefs::apz_fixed_margin_override_top();
result.bottom = StaticPrefs::apz_fixed_margin_override_bottom();
}
return result;
}
bool APZCTreeManager::GetAPZTestData(LayersId aLayersId, bool APZCTreeManager::GetAPZTestData(LayersId aLayersId,
APZTestData* aOutData) { APZTestData* aOutData) {
AssertOnUpdaterThread(); AssertOnUpdaterThread();

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

@ -766,8 +766,6 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
const MutexAutoLock& aProofOfMapLock, const MutexAutoLock& aProofOfMapLock,
ClippedCompositionBoundsMap& aDestMap, ScrollableLayerGuid aGuid); ClippedCompositionBoundsMap& aDestMap, ScrollableLayerGuid aGuid);
ScreenMargin GetCompositorFixedLayerMargins() const;
protected: protected:
/* The input queue where input events are held until we know enough to /* The input queue where input events are held until we know enough to
* figure out where they're going. Protected so gtests can access it. * figure out where they're going. Protected so gtests can access it.
@ -818,8 +816,8 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
*/ */
bool mUsingAsyncZoomContainer; bool mUsingAsyncZoomContainer;
/** A lock that protects mApzcMap, mScrollThumbInfo, mRootScrollbarInfo, /** A lock that protects mApzcMap, mScrollThumbInfo, mRootScrollbarInfo, and
* mFixedPositionInfo, and mStickyPositionInfo. * mFixedPositionInfo.
*/ */
mutable mozilla::Mutex mMapLock; mutable mozilla::Mutex mMapLock;
@ -935,32 +933,6 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
*/ */
std::vector<FixedPositionInfo> mFixedPositionInfo; std::vector<FixedPositionInfo> mFixedPositionInfo;
/**
* A helper structure to store all the information needed to compute the
* async transform for a sticky position element on the sampler thread.
*/
struct StickyPositionInfo {
uint64_t mStickyPositionAnimationId;
SideBits mFixedPosSides;
StickyPositionInfo(const uint64_t& aStickyPositionAnimationId,
const SideBits aFixedPosSides)
: mStickyPositionAnimationId(aStickyPositionAnimationId),
mFixedPosSides(aFixedPosSides) {}
};
/**
* If this APZCTreeManager is being used with WebRender, this vector gets
* populated during a layers update. It holds a package of information needed
* to compute and set the async transforms on sticky position content. This
* information is extracted from the HitTestingTreeNodes for the WebRender
* case because accessing the HitTestingTreeNodes requires holding the tree
* lock which we cannot do on the WR sampler thread. mStickyPositionInfo,
* however, can be accessed while just holding the mMapLock which is safe to
* do on the sampler thread. mMapLock must be acquired while accessing or
* modifying mStickyPositionInfo.
*/
std::vector<StickyPositionInfo> mStickyPositionInfo;
/* Holds the zoom constraints for scrollable layers, as determined by the /* Holds the zoom constraints for scrollable layers, as determined by the
* the main-thread gecko code. This can only be accessed on the updater * the main-thread gecko code. This can only be accessed on the updater
* thread. */ * thread. */

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

@ -177,12 +177,10 @@ void HitTestingTreeNode::SetPrevSibling(HitTestingTreeNode* aSibling) {
void HitTestingTreeNode::SetStickyPosData( void HitTestingTreeNode::SetStickyPosData(
ScrollableLayerGuid::ViewID aStickyPosTarget, ScrollableLayerGuid::ViewID aStickyPosTarget,
const LayerRectAbsolute& aScrollRangeOuter, const LayerRectAbsolute& aScrollRangeOuter,
const LayerRectAbsolute& aScrollRangeInner, const LayerRectAbsolute& aScrollRangeInner) {
const Maybe<uint64_t>& aStickyPositionAnimationId) {
mStickyPosTarget = aStickyPosTarget; mStickyPosTarget = aStickyPosTarget;
mStickyScrollRangeOuter = aScrollRangeOuter; mStickyScrollRangeOuter = aScrollRangeOuter;
mStickyScrollRangeInner = aScrollRangeInner; mStickyScrollRangeInner = aScrollRangeInner;
mStickyPositionAnimationId = aStickyPositionAnimationId;
} }
ScrollableLayerGuid::ViewID HitTestingTreeNode::GetStickyPosTarget() const { ScrollableLayerGuid::ViewID HitTestingTreeNode::GetStickyPosTarget() const {
@ -197,10 +195,6 @@ const LayerRectAbsolute& HitTestingTreeNode::GetStickyScrollRangeInner() const {
return mStickyScrollRangeInner; return mStickyScrollRangeInner;
} }
Maybe<uint64_t> HitTestingTreeNode::GetStickyPositionAnimationId() const {
return mStickyPositionAnimationId;
}
void HitTestingTreeNode::MakeRoot() { void HitTestingTreeNode::MakeRoot() {
mParent = nullptr; mParent = nullptr;

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

@ -136,12 +136,10 @@ class HitTestingTreeNode {
/* Sticky pos info */ /* Sticky pos info */
void SetStickyPosData(ScrollableLayerGuid::ViewID aStickyPosTarget, void SetStickyPosData(ScrollableLayerGuid::ViewID aStickyPosTarget,
const LayerRectAbsolute& aScrollRangeOuter, const LayerRectAbsolute& aScrollRangeOuter,
const LayerRectAbsolute& aScrollRangeInner, const LayerRectAbsolute& aScrollRangeInner);
const Maybe<uint64_t>& aStickyPositionAnimationId);
ScrollableLayerGuid::ViewID GetStickyPosTarget() const; ScrollableLayerGuid::ViewID GetStickyPosTarget() const;
const LayerRectAbsolute& GetStickyScrollRangeOuter() const; const LayerRectAbsolute& GetStickyScrollRangeOuter() const;
const LayerRectAbsolute& GetStickyScrollRangeInner() const; const LayerRectAbsolute& GetStickyScrollRangeInner() const;
Maybe<uint64_t> GetStickyPositionAnimationId() const;
/* Convert |aPoint| into the LayerPixel space for the layer corresponding to /* Convert |aPoint| into the LayerPixel space for the layer corresponding to
* this node. |aTransform| is the complete (content + async) transform for * this node. |aTransform| is the complete (content + async) transform for
@ -207,9 +205,6 @@ class HitTestingTreeNode {
ScrollableLayerGuid::ViewID mStickyPosTarget; ScrollableLayerGuid::ViewID mStickyPosTarget;
LayerRectAbsolute mStickyScrollRangeOuter; LayerRectAbsolute mStickyScrollRangeOuter;
LayerRectAbsolute mStickyScrollRangeInner; LayerRectAbsolute mStickyScrollRangeInner;
// This is only set if WebRender is enabled. It holds the animation id that
// we use to adjust sticky position content for the toolbar.
Maybe<uint64_t> mStickyPositionAnimationId;
/* Let {L,M} be the {layer, scrollable metrics} pair that this node /* Let {L,M} be the {layer, scrollable metrics} pair that this node
* corresponds to in the layer tree. mEventRegions contains the event regions * corresponds to in the layer tree. mEventRegions contains the event regions

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

@ -23,7 +23,6 @@ WebRenderLayerScrollData::WebRenderLayerScrollData()
mEventRegionsOverride(EventRegionsOverride::NoOverride), mEventRegionsOverride(EventRegionsOverride::NoOverride),
mFixedPositionSides(mozilla::SideBits::eNone), mFixedPositionSides(mozilla::SideBits::eNone),
mFixedPosScrollContainerId(ScrollableLayerGuid::NULL_SCROLL_ID), mFixedPosScrollContainerId(ScrollableLayerGuid::NULL_SCROLL_ID),
mStickyPosScrollContainerId(ScrollableLayerGuid::NULL_SCROLL_ID),
mRenderRoot(wr::RenderRoot::Default) {} mRenderRoot(wr::RenderRoot::Default) {}
WebRenderLayerScrollData::~WebRenderLayerScrollData() = default; WebRenderLayerScrollData::~WebRenderLayerScrollData() = default;

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

@ -124,34 +124,6 @@ class WebRenderLayerScrollData final {
return mFixedPosScrollContainerId; return mFixedPosScrollContainerId;
} }
void SetStickyPositionScrollContainerId(ScrollableLayerGuid::ViewID aId) {
mStickyPosScrollContainerId = aId;
}
ScrollableLayerGuid::ViewID GetStickyPositionScrollContainerId() const {
return mStickyPosScrollContainerId;
}
void SetStickyScrollRangeOuter(const LayerRectAbsolute& scrollRange) {
mStickyScrollRangeOuter = scrollRange;
}
const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
return mStickyScrollRangeOuter;
}
void SetStickyScrollRangeInner(const LayerRectAbsolute& scrollRange) {
mStickyScrollRangeInner = scrollRange;
}
const LayerRectAbsolute& GetStickyScrollRangeInner() const {
return mStickyScrollRangeInner;
}
void SetStickyPositionAnimationId(const uint64_t& aId) {
mStickyPositionAnimationId = Some(aId);
}
Maybe<uint64_t> GetStickyPositionAnimationId() const {
return mStickyPositionAnimationId;
}
wr::RenderRoot GetRenderRoot() { return mRenderRoot; } wr::RenderRoot GetRenderRoot() { return mRenderRoot; }
void SetZoomAnimationId(const uint64_t& aId) { mZoomAnimationId = Some(aId); } void SetZoomAnimationId(const uint64_t& aId) { mZoomAnimationId = Some(aId); }
@ -199,10 +171,6 @@ class WebRenderLayerScrollData final {
Maybe<uint64_t> mFixedPositionAnimationId; Maybe<uint64_t> mFixedPositionAnimationId;
SideBits mFixedPositionSides; SideBits mFixedPositionSides;
ScrollableLayerGuid::ViewID mFixedPosScrollContainerId; ScrollableLayerGuid::ViewID mFixedPosScrollContainerId;
ScrollableLayerGuid::ViewID mStickyPosScrollContainerId;
LayerRectAbsolute mStickyScrollRangeOuter;
LayerRectAbsolute mStickyScrollRangeInner;
Maybe<uint64_t> mStickyPositionAnimationId;
wr::RenderRoot mRenderRoot; wr::RenderRoot mRenderRoot;
Maybe<uint64_t> mZoomAnimationId; Maybe<uint64_t> mZoomAnimationId;
Maybe<ScrollableLayerGuid::ViewID> mAsyncZoomContainerId; Maybe<ScrollableLayerGuid::ViewID> mAsyncZoomContainerId;
@ -306,10 +274,6 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData> {
WriteParam(aMsg, aParam.mFixedPositionAnimationId); WriteParam(aMsg, aParam.mFixedPositionAnimationId);
WriteParam(aMsg, aParam.mFixedPositionSides); WriteParam(aMsg, aParam.mFixedPositionSides);
WriteParam(aMsg, aParam.mFixedPosScrollContainerId); WriteParam(aMsg, aParam.mFixedPosScrollContainerId);
WriteParam(aMsg, aParam.mStickyPosScrollContainerId);
WriteParam(aMsg, aParam.mStickyScrollRangeOuter);
WriteParam(aMsg, aParam.mStickyScrollRangeInner);
WriteParam(aMsg, aParam.mStickyPositionAnimationId);
WriteParam(aMsg, aParam.mRenderRoot); WriteParam(aMsg, aParam.mRenderRoot);
WriteParam(aMsg, aParam.mZoomAnimationId); WriteParam(aMsg, aParam.mZoomAnimationId);
WriteParam(aMsg, aParam.mAsyncZoomContainerId); WriteParam(aMsg, aParam.mAsyncZoomContainerId);
@ -331,10 +295,6 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData> {
ReadParam(aMsg, aIter, &aResult->mFixedPositionAnimationId) && ReadParam(aMsg, aIter, &aResult->mFixedPositionAnimationId) &&
ReadParam(aMsg, aIter, &aResult->mFixedPositionSides) && ReadParam(aMsg, aIter, &aResult->mFixedPositionSides) &&
ReadParam(aMsg, aIter, &aResult->mFixedPosScrollContainerId) && ReadParam(aMsg, aIter, &aResult->mFixedPosScrollContainerId) &&
ReadParam(aMsg, aIter, &aResult->mStickyPosScrollContainerId) &&
ReadParam(aMsg, aIter, &aResult->mStickyScrollRangeOuter) &&
ReadParam(aMsg, aIter, &aResult->mStickyScrollRangeInner) &&
ReadParam(aMsg, aIter, &aResult->mStickyPositionAnimationId) &&
ReadParam(aMsg, aIter, &aResult->mRenderRoot) && ReadParam(aMsg, aIter, &aResult->mRenderRoot) &&
ReadParam(aMsg, aIter, &aResult->mZoomAnimationId) && ReadParam(aMsg, aIter, &aResult->mZoomAnimationId) &&
ReadParam(aMsg, aIter, &aResult->mAsyncZoomContainerId); ReadParam(aMsg, aIter, &aResult->mAsyncZoomContainerId);

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

@ -304,69 +304,46 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper final {
Maybe<uint64_t> GetFixedPositionAnimationId() const { Maybe<uint64_t> GetFixedPositionAnimationId() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
return mLayer->GetFixedPositionAnimationId();
if (AtBottomLayer()) {
return mLayer->GetFixedPositionAnimationId();
}
return Nothing();
} }
ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() const { ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
return mLayer->GetFixedPositionScrollContainerId();
if (AtBottomLayer()) {
return mLayer->GetFixedPositionScrollContainerId();
}
return ScrollableLayerGuid::NULL_SCROLL_ID;
} }
SideBits GetFixedPositionSides() const { SideBits GetFixedPositionSides() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
return mLayer->GetFixedPositionSides();
}
if (AtBottomLayer()) { bool GetIsStickyPosition() const {
return mLayer->GetFixedPositionSides(); MOZ_ASSERT(IsValid());
}
return SideBits::eNone; // TODO: Bug 1610731 Implement this for WebRender.
return false;
} }
ScrollableLayerGuid::ViewID GetStickyScrollContainerId() const { ScrollableLayerGuid::ViewID GetStickyScrollContainerId() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
if (AtBottomLayer()) { // TODO: Bug 1610731 Implement this for WebRender.
return mLayer->GetStickyPositionScrollContainerId();
}
return ScrollableLayerGuid::NULL_SCROLL_ID; return ScrollableLayerGuid::NULL_SCROLL_ID;
} }
const LayerRectAbsolute& GetStickyScrollRangeOuter() const { const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
static const LayerRectAbsolute dummy;
if (AtBottomLayer()) { // TODO: Bug 1610731 Implement this for WebRender.
return mLayer->GetStickyScrollRangeOuter(); return dummy;
}
static const LayerRectAbsolute empty;
return empty;
} }
const LayerRectAbsolute& GetStickyScrollRangeInner() const { const LayerRectAbsolute& GetStickyScrollRangeInner() const {
MOZ_ASSERT(IsValid()); MOZ_ASSERT(IsValid());
static const LayerRectAbsolute dummy;
if (AtBottomLayer()) { // TODO: Bug 1610731 Implement this for WebRender.
return mLayer->GetStickyScrollRangeInner(); return dummy;
}
static const LayerRectAbsolute empty;
return empty;
}
Maybe<uint64_t> GetStickyPositionAnimationId() const {
MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->GetStickyPositionAnimationId();
}
return Nothing();
} }
Maybe<uint64_t> GetZoomAnimationId() const { Maybe<uint64_t> GetZoomAnimationId() const {

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

@ -6873,12 +6873,13 @@ bool nsDisplayOwnLayer::IsScrollbarContainer() const {
layers::ScrollbarLayerType::Container; layers::ScrollbarLayerType::Container;
} }
bool nsDisplayOwnLayer::IsRootScrollbarContainer() const { bool nsDisplayOwnLayer::IsRootScrollbarContainerWithDynamicToolbar() const {
if (!IsScrollbarContainer()) { if (!IsScrollbarContainer()) {
return false; return false;
} }
return mFrame->PresContext()->IsRootContentDocumentCrossProcess() && return mFrame->PresContext()->IsRootContentDocumentCrossProcess() &&
mFrame->PresContext()->HasDynamicToolbar() &&
mScrollbarData.mTargetViewId == mScrollbarData.mTargetViewId ==
nsLayoutUtils::ScrollIdForRootScrollFrame(mFrame->PresContext()); nsLayoutUtils::ScrollIdForRootScrollFrame(mFrame->PresContext());
} }
@ -6891,20 +6892,6 @@ bool nsDisplayOwnLayer::IsFixedPositionLayer() const {
return GetType() == DisplayItemType::TYPE_FIXED_POSITION; return GetType() == DisplayItemType::TYPE_FIXED_POSITION;
} }
bool nsDisplayOwnLayer::IsStickyPositionLayer() const {
return GetType() == DisplayItemType::TYPE_STICKY_POSITION;
}
bool nsDisplayOwnLayer::HasDynamicToolbar() const {
if (!mFrame->PresContext()->IsRootContentDocumentCrossProcess()) {
return false;
}
return mFrame->PresContext()->HasDynamicToolbar() ||
// For tests on Android, this pref is set to simulate the dynamic
// toolbar
StaticPrefs::apz_fixed_margin_override_enabled();
}
// nsDisplayOpacity uses layers for rendering // nsDisplayOpacity uses layers for rendering
already_AddRefed<Layer> nsDisplayOwnLayer::BuildLayer( already_AddRefed<Layer> nsDisplayOwnLayer::BuildLayer(
nsDisplayListBuilder* aBuilder, LayerManager* aManager, nsDisplayListBuilder* aBuilder, LayerManager* aManager,
@ -6930,11 +6917,10 @@ bool nsDisplayOwnLayer::CreateWebRenderCommands(
const StackingContextHelper& aSc, RenderRootStateManager* aManager, const StackingContextHelper& aSc, RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) { nsDisplayListBuilder* aDisplayListBuilder) {
Maybe<wr::WrAnimationProperty> prop; Maybe<wr::WrAnimationProperty> prop;
bool needsProp = aManager->LayerManager()->AsyncPanZoomEnabled() && bool needsProp =
(IsScrollThumbLayer() || IsZoomingLayer() || aManager->LayerManager()->AsyncPanZoomEnabled() &&
(IsFixedPositionLayer() && HasDynamicToolbar()) || (IsScrollThumbLayer() || IsZoomingLayer() || IsFixedPositionLayer() ||
(IsStickyPositionLayer() && HasDynamicToolbar()) || IsRootScrollbarContainerWithDynamicToolbar());
(IsRootScrollbarContainer() && HasDynamicToolbar()));
if (needsProp) { if (needsProp) {
// APZ is enabled and this is a scroll thumb or zooming layer, so we need // APZ is enabled and this is a scroll thumb or zooming layer, so we need
@ -6972,11 +6958,8 @@ bool nsDisplayOwnLayer::CreateWebRenderCommands(
bool nsDisplayOwnLayer::UpdateScrollData( bool nsDisplayOwnLayer::UpdateScrollData(
mozilla::layers::WebRenderScrollData* aData, mozilla::layers::WebRenderScrollData* aData,
mozilla::layers::WebRenderLayerScrollData* aLayerData) { mozilla::layers::WebRenderLayerScrollData* aLayerData) {
bool isRelevantToApz = bool isRelevantToApz = (IsScrollThumbLayer() || IsScrollbarContainer() ||
(IsScrollThumbLayer() || IsScrollbarContainer() || IsZoomingLayer() || IsZoomingLayer() || IsFixedPositionLayer());
(IsFixedPositionLayer() && HasDynamicToolbar()) ||
(IsStickyPositionLayer() && HasDynamicToolbar()));
if (!isRelevantToApz) { if (!isRelevantToApz) {
return false; return false;
} }
@ -6990,21 +6973,16 @@ bool nsDisplayOwnLayer::UpdateScrollData(
return true; return true;
} }
if (IsFixedPositionLayer() && HasDynamicToolbar()) { if (IsFixedPositionLayer()) {
aLayerData->SetFixedPositionAnimationId(mWrAnimationId); aLayerData->SetFixedPositionAnimationId(mWrAnimationId);
return true; return true;
} }
if (IsStickyPositionLayer() && HasDynamicToolbar()) {
aLayerData->SetStickyPositionAnimationId(mWrAnimationId);
return true;
}
MOZ_ASSERT(IsScrollbarContainer() || IsScrollThumbLayer()); MOZ_ASSERT(IsScrollbarContainer() || IsScrollThumbLayer());
aLayerData->SetScrollbarData(mScrollbarData); aLayerData->SetScrollbarData(mScrollbarData);
if (IsRootScrollbarContainer() && HasDynamicToolbar()) { if (IsRootScrollbarContainerWithDynamicToolbar()) {
aLayerData->SetScrollbarAnimationId(mWrAnimationId); aLayerData->SetScrollbarAnimationId(mWrAnimationId);
return true; return true;
} }
@ -7346,8 +7324,7 @@ bool nsDisplayFixedPosition::UpdateScrollData(
} }
aLayerData->SetFixedPositionScrollContainerId(GetScrollTargetId()); aLayerData->SetFixedPositionScrollContainerId(GetScrollTargetId());
} }
nsDisplayOwnLayer::UpdateScrollData(aData, aLayerData); return nsDisplayOwnLayer::UpdateScrollData(aData, aLayerData) | true;
return true;
} }
void nsDisplayFixedPosition::WriteDebugInfo(std::stringstream& aStream) { void nsDisplayFixedPosition::WriteDebugInfo(std::stringstream& aStream) {
@ -7467,11 +7444,23 @@ already_AddRefed<Layer> nsDisplayStickyPosition::BuildLayer(
stickyScrollContainer->ScrollFrame()->GetScrolledFrame()->GetContent()); stickyScrollContainer->ScrollFrame()->GetScrolledFrame()->GetContent());
float factor = presContext->AppUnitsPerDevPixel(); float factor = presContext->AppUnitsPerDevPixel();
LayerRectAbsolute stickyOuter; nsRectAbsolute outer;
LayerRectAbsolute stickyInner; nsRectAbsolute inner;
CalculateLayerScrollRanges( stickyScrollContainer->GetScrollRanges(mFrame, &outer, &inner);
stickyScrollContainer, factor, aContainerParameters.mXScale, LayerRectAbsolute stickyOuter(
aContainerParameters.mYScale, stickyOuter, stickyInner); NSAppUnitsToFloatPixels(outer.X(), factor) * aContainerParameters.mXScale,
NSAppUnitsToFloatPixels(outer.Y(), factor) * aContainerParameters.mYScale,
NSAppUnitsToFloatPixels(outer.XMost(), factor) *
aContainerParameters.mXScale,
NSAppUnitsToFloatPixels(outer.YMost(), factor) *
aContainerParameters.mYScale);
LayerRectAbsolute stickyInner(
NSAppUnitsToFloatPixels(inner.X(), factor) * aContainerParameters.mXScale,
NSAppUnitsToFloatPixels(inner.Y(), factor) * aContainerParameters.mYScale,
NSAppUnitsToFloatPixels(inner.XMost(), factor) *
aContainerParameters.mXScale,
NSAppUnitsToFloatPixels(inner.YMost(), factor) *
aContainerParameters.mYScale);
layer->SetStickyPositionData(scrollId, stickyOuter, stickyInner); layer->SetStickyPositionData(scrollId, stickyOuter, stickyInner);
return layer.forget(); return layer.forget();
@ -7491,7 +7480,11 @@ static nscoord DistanceToRange(nscoord min, nscoord max) {
return 0; return 0;
} }
StickyScrollContainer* nsDisplayStickyPosition::GetStickyScrollContainer() { bool nsDisplayStickyPosition::CreateWebRenderCommands(
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc, RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) {
StickyScrollContainer* stickyScrollContainer = StickyScrollContainer* stickyScrollContainer =
StickyScrollContainer::GetStickyScrollContainerForFrame(mFrame); StickyScrollContainer::GetStickyScrollContainerForFrame(mFrame);
if (stickyScrollContainer) { if (stickyScrollContainer) {
@ -7511,15 +7504,6 @@ StickyScrollContainer* nsDisplayStickyPosition::GetStickyScrollContainer() {
stickyScrollContainer = nullptr; stickyScrollContainer = nullptr;
} }
} }
return stickyScrollContainer;
}
bool nsDisplayStickyPosition::CreateWebRenderCommands(
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc, RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) {
StickyScrollContainer* stickyScrollContainer = GetStickyScrollContainer();
Maybe<wr::SpaceAndClipChainHelper> saccHelper; Maybe<wr::SpaceAndClipChainHelper> saccHelper;
@ -7655,7 +7639,7 @@ bool nsDisplayStickyPosition::CreateWebRenderCommands(
wr::WrStackingContextClip::ClipChain(aBuilder.CurrentClipChainId()); wr::WrStackingContextClip::ClipChain(aBuilder.CurrentClipChainId());
StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this, StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this,
aBuilder, params); aBuilder, params);
nsDisplayOwnLayer::CreateWebRenderCommands(aBuilder, aResources, sc, nsDisplayWrapList::CreateWebRenderCommands(aBuilder, aResources, sc,
aManager, aDisplayListBuilder); aManager, aDisplayListBuilder);
} }
@ -7666,62 +7650,6 @@ bool nsDisplayStickyPosition::CreateWebRenderCommands(
return true; return true;
} }
void nsDisplayStickyPosition::CalculateLayerScrollRanges(
StickyScrollContainer* aStickyScrollContainer, float aAppUnitsPerDevPixel,
float aScaleX, float aScaleY, LayerRectAbsolute& aStickyOuter,
LayerRectAbsolute& aStickyInner) {
nsRectAbsolute outer;
nsRectAbsolute inner;
aStickyScrollContainer->GetScrollRanges(mFrame, &outer, &inner);
aStickyOuter.SetBox(
NSAppUnitsToFloatPixels(outer.X(), aAppUnitsPerDevPixel) * aScaleX,
NSAppUnitsToFloatPixels(outer.Y(), aAppUnitsPerDevPixel) * aScaleY,
NSAppUnitsToFloatPixels(outer.XMost(), aAppUnitsPerDevPixel) * aScaleX,
NSAppUnitsToFloatPixels(outer.YMost(), aAppUnitsPerDevPixel) * aScaleY);
aStickyInner.SetBox(
NSAppUnitsToFloatPixels(inner.X(), aAppUnitsPerDevPixel) * aScaleX,
NSAppUnitsToFloatPixels(inner.Y(), aAppUnitsPerDevPixel) * aScaleY,
NSAppUnitsToFloatPixels(inner.XMost(), aAppUnitsPerDevPixel) * aScaleX,
NSAppUnitsToFloatPixels(inner.YMost(), aAppUnitsPerDevPixel) * aScaleY);
}
bool nsDisplayStickyPosition::UpdateScrollData(
mozilla::layers::WebRenderScrollData* aData,
mozilla::layers::WebRenderLayerScrollData* aLayerData) {
bool hasDynamicToolbar = HasDynamicToolbar();
if (aLayerData && hasDynamicToolbar) {
StickyScrollContainer* stickyScrollContainer = GetStickyScrollContainer();
if (stickyScrollContainer) {
float auPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
float cumulativeResolution =
mFrame->PresShell()->GetCumulativeResolution();
LayerRectAbsolute stickyOuter;
LayerRectAbsolute stickyInner;
CalculateLayerScrollRanges(stickyScrollContainer, auPerDevPixel,
cumulativeResolution, cumulativeResolution,
stickyOuter, stickyInner);
aLayerData->SetStickyScrollRangeOuter(stickyOuter);
aLayerData->SetStickyScrollRangeInner(stickyInner);
SideBits sides =
nsLayoutUtils::GetSideBitsForFixedPositionContent(mFrame);
aLayerData->SetFixedPositionSides(sides);
ViewID scrollId =
nsLayoutUtils::FindOrCreateIDFor(stickyScrollContainer->ScrollFrame()
->GetScrolledFrame()
->GetContent());
aLayerData->SetStickyPositionScrollContainerId(scrollId);
}
}
// Return true if either there is a dynamic toolbar affecting this sticky
// item or the OwnLayer base implementation returns true for some other
// reason.
bool ret = hasDynamicToolbar;
ret |= nsDisplayOwnLayer::UpdateScrollData(aData, aLayerData);
return ret;
}
nsDisplayScrollInfoLayer::nsDisplayScrollInfoLayer( nsDisplayScrollInfoLayer::nsDisplayScrollInfoLayer(
nsDisplayListBuilder* aBuilder, nsIFrame* aScrolledFrame, nsDisplayListBuilder* aBuilder, nsIFrame* aScrolledFrame,
nsIFrame* aScrollFrame, const CompositorHitTestInfo& aHitInfo, nsIFrame* aScrollFrame, const CompositorHitTestInfo& aHitInfo,

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

@ -49,7 +49,6 @@
#include "nsAutoLayoutPhase.h" #include "nsAutoLayoutPhase.h"
#include "nsDisplayItemTypes.h" #include "nsDisplayItemTypes.h"
#include "RetainedDisplayListHelpers.h" #include "RetainedDisplayListHelpers.h"
#include "Units.h"
#include <stdint.h> #include <stdint.h>
#include "nsTHashtable.h" #include "nsTHashtable.h"
@ -78,7 +77,6 @@ class TransformReferenceBox;
namespace mozilla { namespace mozilla {
class FrameLayerBuilder; class FrameLayerBuilder;
class PresShell; class PresShell;
class StickyScrollContainer;
namespace layers { namespace layers {
struct FrameMetrics; struct FrameMetrics;
class RenderRootStateManager; class RenderRootStateManager;
@ -6100,11 +6098,9 @@ class nsDisplayOwnLayer : public nsDisplayWrapList {
nsDisplayOwnLayerFlags GetFlags() { return mFlags; } nsDisplayOwnLayerFlags GetFlags() { return mFlags; }
bool IsScrollThumbLayer() const; bool IsScrollThumbLayer() const;
bool IsScrollbarContainer() const; bool IsScrollbarContainer() const;
bool IsRootScrollbarContainer() const; bool IsRootScrollbarContainerWithDynamicToolbar() const;
bool IsZoomingLayer() const; bool IsZoomingLayer() const;
bool IsFixedPositionLayer() const; bool IsFixedPositionLayer() const;
bool IsStickyPositionLayer() const;
bool HasDynamicToolbar() const;
protected: protected:
nsDisplayOwnLayerFlags mFlags; nsDisplayOwnLayerFlags mFlags;
@ -6239,23 +6235,11 @@ class nsDisplayStickyPosition : public nsDisplayOwnLayer {
mozilla::layers::RenderRootStateManager* aManager, mozilla::layers::RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) override; nsDisplayListBuilder* aDisplayListBuilder) override;
bool UpdateScrollData(
mozilla::layers::WebRenderScrollData* aData,
mozilla::layers::WebRenderLayerScrollData* aLayerData) override;
const ActiveScrolledRoot* GetContainerASR() const { return mContainerASR; } const ActiveScrolledRoot* GetContainerASR() const { return mContainerASR; }
private: private:
NS_DISPLAY_ALLOW_CLONING() NS_DISPLAY_ALLOW_CLONING()
void CalculateLayerScrollRanges(
mozilla::StickyScrollContainer* aStickyScrollContainer,
float aAppUnitsPerDevPixel, float aScaleX, float aScaleY,
mozilla::LayerRectAbsolute& aStickyOuter,
mozilla::LayerRectAbsolute& aStickyInner);
mozilla::StickyScrollContainer* GetStickyScrollContainer();
// This stores the ASR that this sticky container item would have assuming it // This stores the ASR that this sticky container item would have assuming it
// has no fixed descendants. This may be the same as the ASR returned by // has no fixed descendants. This may be the same as the ASR returned by
// GetActiveScrolledRoot(), or it may be a descendant of that. // GetActiveScrolledRoot(), or it may be a descendant of that.

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

@ -1,15 +1,15 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<!-- <!--
Tests that setting a fixed top margin in the compositor results Tests that setting a fixed bottom margin in AsyncCompositionManager results
in the margin being applied to an element fixed to the top. in the margin being applied to an element fixed to the bottom.
The fixed margin is specified as a test-pref in reftest.list. The fixed margin is specified as a test-pref in reftest.list.
The purpose of the fixed margin is to compensate for the transform that the The purpose of the fixed margin is to compensate for the transform that the
dynamic toolbar applies to the entire content area. We don't have a way of dynamic toolbar applies to the entire content area. We don't have a way of
simulating that transform in a reftest, so the fixed margin in isolation will simulating that transform in a reftest, so the fixed margin in isolation will
cause the fixed element to be offset from the top of the screen, and in cause the fixed element to be offset from the bottom of the screen, and in
the ref page we use a regular CSS "margin-top" to match the rendering. the ref page we use a regular CSS "margin-bottom" to match the rendering.
--> -->
<html> <html>
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
@ -25,7 +25,7 @@ html {
width: 100%; width: 100%;
height: 200px; height: 200px;
position: fixed; position: fixed;
top: 0; bottom: 0;
background: red; background: red;
} }
</style> </style>

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

@ -1,25 +0,0 @@
<!DOCTYPE HTML>
<html>
<meta name="viewport" content="width=device-width">
<style>
html {
scrollbar-width: none;
}
#scrolled {
height: 2000px;
width: 100%;
}
#fixed {
width: 100%;
height: 200px;
position: fixed;
top: 0;
background: red;
margin-top: 50px;
}
</style>
<body>
<div id="scrolled"></div>
<div id="fixed"></div>
</body>
</html>

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

@ -1,29 +0,0 @@
<html>
<meta name="viewport" content="width=device-width">
<style>
html {
scrollbar-width: none;
}
#scrolled {
display: flex;
justify-content: space-around;
align-items: flex-start;
height: 2000px;
width: 100%;
}
#sticky {
width: 100%;
height: 200px;
position: sticky;
bottom: 70px;
background: red;
align-self: flex-end;
}
</style>
<body>
<div id="scrolled">
<div id="sticky"></div>
</div>
</body>
</html>

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

@ -1,41 +0,0 @@
<!DOCTYPE HTML>
<!--
Tests that setting a fixed bottom margin in the compositor results
in the margin being applied to an element sticky to the bottom.
The fixed margin is specified as a test-pref in reftest.list.
The purpose of the fixed margin is to compensate for the transform that the
dynamic toolbar applies to the entire content area. We don't have a way of
simulating that transform in a reftest, so the fixed margin in isolation will
cause the sticky element to be offset from the bottom of the screen.
-->
<html>
<meta name="viewport" content="width=device-width">
<style>
html {
scrollbar-width: none;
}
#scrolled {
display: flex;
justify-content: space-around;
align-items: flex-start;
height: 2000px;
width: 100%;
}
#sticky {
width: 100%;
height: 200px;
position: sticky;
bottom: 20px;
background: red;
align-self: flex-end;
}
</style>
<body>
<div id="scrolled">
<div id="sticky"></div>
</div>
</body>
</html>

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

@ -1,29 +0,0 @@
<html>
<meta name="viewport" content="width=device-width">
<style>
html {
scrollbar-width: none;
}
#scrolled {
display: flex;
justify-content: space-around;
align-items: flex-start;
height: 2000px;
width: 100%;
}
#sticky {
width: 100%;
height: 200px;
position: sticky;
top: 70px;
background: red;
align-self: flex-start;
}
</style>
<body>
<div id="scrolled">
<div id="sticky"></div>
</div>
</body>
</html>

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

@ -1,40 +0,0 @@
<!DOCTYPE HTML>
<!--
Tests that setting a fixed top margin in the compositor results
in the margin being applied to an element sticky to the top.
The fixed margin is specified as a test-pref in reftest.list.
The purpose of the fixed margin is to compensate for the transform that the
dynamic toolbar applies to the entire content area. We don't have a way of
simulating that transform in a reftest, so the fixed margin in isolation will
cause the fixed element to be offset from the top of the screen.
-->
<html>
<meta name="viewport" content="width=device-width">
<style>
html {
scrollbar-width: none;
}
#scrolled {
display: flex;
justify-content: space-around;
align-items: flex-start;
height: 2000px;
width: 100%;
}
#sticky {
width: 100%;
height: 200px;
position: sticky;
top: 20px;
background: red;
}
</style>
<body>
<div id="scrolled">
<div id="sticky"></div>
</div>
</body>
</html>

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

@ -98,7 +98,4 @@ fuzzy-if(!webrender,111-112,600-600) pref(apz.allow_zooming,true) == async-scrol
# for this test, apz.allow_zooming is needed to ensure we take the containerless scrolling codepath that creates # for this test, apz.allow_zooming is needed to ensure we take the containerless scrolling codepath that creates
# an async zoom container (since we are testing a regression in that codepath) # an async zoom container (since we are testing a regression in that codepath)
skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.bottom,50) == dynamic-toolbar-fixed-bottom-1.html dynamic-toolbar-fixed-bottom-1-ref.html skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.bottom,50) fails-if(geckoview&&webrender) == dynamic-toolbar-fixed-bottom-1.html dynamic-toolbar-fixed-bottom-1-ref.html
skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.bottom,50) == dynamic-toolbar-sticky-bottom-1.html dynamic-toolbar-sticky-bottom-1-ref.html
skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.top,50) == dynamic-toolbar-fixed-top-1.html dynamic-toolbar-fixed-top-1-ref.html
skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.top,50) fails-if(geckoview&&!webrender) == dynamic-toolbar-sticky-top-1.html dynamic-toolbar-sticky-top-1-ref.html # bug 1627326 for geckoview&&!webrender