mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 1349750 - Add an 'is async-draggable' flag to ScrollThumbData. r=kats
This flag is set to false if there are any conditions that only the main thread knows about that prevent the thumb from being async-dragged. MozReview-Commit-ID: Gl7f7bY0QnA --HG-- extra : rebase_source : 60ab680a3995e3b5c0e1b4482ca0e7142352bbd2
This commit is contained in:
parent
3bc007b384
commit
bae009bd63
@ -22,13 +22,16 @@ struct ScrollThumbData {
|
||||
ScrollThumbData()
|
||||
: mDirection(ScrollDirection::NONE)
|
||||
, mThumbRatio(0.0f)
|
||||
, mIsAsyncDraggable(false)
|
||||
{}
|
||||
ScrollThumbData(ScrollDirection aDirection,
|
||||
float aThumbRatio,
|
||||
CSSCoord aThumbLength)
|
||||
CSSCoord aThumbLength,
|
||||
bool aIsAsyncDraggable)
|
||||
: mDirection(aDirection)
|
||||
, mThumbRatio(aThumbRatio)
|
||||
, mThumbLength(aThumbLength)
|
||||
, mIsAsyncDraggable(aIsAsyncDraggable)
|
||||
{}
|
||||
|
||||
ScrollDirection mDirection;
|
||||
@ -37,11 +40,14 @@ struct ScrollThumbData {
|
||||
// CSS pixels of the scrollframe's space).
|
||||
float mThumbRatio;
|
||||
CSSCoord mThumbLength;
|
||||
// Whether the scrollbar thumb can be dragged asynchronously.
|
||||
bool mIsAsyncDraggable;
|
||||
|
||||
bool operator==(const ScrollThumbData& aOther) const {
|
||||
return mDirection == aOther.mDirection &&
|
||||
mThumbRatio == aOther.mThumbRatio &&
|
||||
mThumbLength == aOther.mThumbLength;
|
||||
mThumbLength == aOther.mThumbLength &&
|
||||
mIsAsyncDraggable == aOther.mIsAsyncDraggable;
|
||||
}
|
||||
bool operator!=(const ScrollThumbData& aOther) const {
|
||||
return !(*this == aOther);
|
||||
|
@ -332,6 +332,21 @@ nsSliderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
nsBoxFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
||||
}
|
||||
|
||||
static bool
|
||||
UsesCustomScrollbarMediator(nsIFrame* scrollbarBox) {
|
||||
if (nsScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox)) {
|
||||
if (nsIScrollbarMediator* mediator = scrollbarFrame->GetScrollbarMediator()) {
|
||||
nsIScrollableFrame* scrollFrame = do_QueryFrame(mediator);
|
||||
// The scrollbar mediator is not the scroll frame.
|
||||
// That means this scroll frame has a custom scrollbar mediator.
|
||||
if (!scrollFrame) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
nsSliderFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
@ -376,6 +391,9 @@ nsSliderFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
||||
CSSCoord thumbLength = NSAppUnitsToFloatPixels(
|
||||
isHorizontal ? thumbRect.width : thumbRect.height, appUnitsPerCss);
|
||||
|
||||
nsIFrame* scrollbarBox = GetScrollbar();
|
||||
bool isAsyncDraggable = !UsesCustomScrollbarMediator(scrollbarBox);
|
||||
|
||||
nsDisplayListBuilder::AutoContainerASRTracker contASRTracker(aBuilder);
|
||||
nsDisplayListCollection tempLists;
|
||||
nsBoxFrame::BuildDisplayListForChildren(aBuilder, aDirtyRect, tempLists);
|
||||
@ -399,7 +417,8 @@ nsSliderFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
||||
flags, scrollTargetId,
|
||||
ScrollThumbData{scrollDirection,
|
||||
GetThumbRatio(),
|
||||
thumbLength}));
|
||||
thumbLength,
|
||||
isAsyncDraggable}));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1036,19 +1055,10 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent)
|
||||
return;
|
||||
}
|
||||
|
||||
nsScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox);
|
||||
if (!scrollbarFrame) {
|
||||
// Custom scrollbar mediators are not supported in the APZ codepath.
|
||||
if (UsesCustomScrollbarMediator(scrollbarBox)) {
|
||||
return;
|
||||
}
|
||||
if (nsIScrollbarMediator* mediator = scrollbarFrame->GetScrollbarMediator()) {
|
||||
nsIScrollableFrame* scrollFrame = do_QueryFrame(mediator);
|
||||
// The scrollbar mediator is not the scroll frame.
|
||||
// That means this scroll frame has a custom scrollbar mediator.
|
||||
// That's not supported in the APZ codepath.
|
||||
if (!scrollFrame) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool isHorizontal = IsXULHorizontal();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user