mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset fdd33ef9606e (bug 969250) for m5 test failures
This commit is contained in:
parent
2c24f80da6
commit
9511e52432
@ -2430,7 +2430,7 @@ EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
|
||||
actualDevPixelScrollAmount.y = 0;
|
||||
}
|
||||
|
||||
nsIScrollbarMediator::ScrollSnapMode snapMode = nsIScrollbarMediator::DISABLE_SNAP;
|
||||
nsIScrollableFrame::ScrollSnapMode snapMode = nsIScrollableFrame::DISABLE_SNAP;
|
||||
nsIAtom* origin = nullptr;
|
||||
switch (aEvent->deltaMode) {
|
||||
case nsIDOMWheelEvent::DOM_DELTA_LINE:
|
||||
|
@ -1126,24 +1126,21 @@ GetOnePixelRangeAroundPoint(nsPoint aPoint, bool aIsHorizontal)
|
||||
}
|
||||
|
||||
void
|
||||
ScrollFrameHelper::ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
ScrollFrameHelper::ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection)
|
||||
{
|
||||
ScrollByUnit(aScrollbar, nsIScrollableFrame::SMOOTH, aDirection,
|
||||
nsIScrollableFrame::PAGES, aSnap);
|
||||
nsIScrollableFrame::PAGES);
|
||||
}
|
||||
|
||||
void
|
||||
ScrollFrameHelper::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
ScrollFrameHelper::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection)
|
||||
{
|
||||
ScrollByUnit(aScrollbar, nsIScrollableFrame::INSTANT, aDirection,
|
||||
nsIScrollableFrame::WHOLE, aSnap);
|
||||
nsIScrollableFrame::WHOLE);
|
||||
}
|
||||
|
||||
void
|
||||
ScrollFrameHelper::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
ScrollFrameHelper::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection)
|
||||
{
|
||||
bool isHorizontal = aScrollbar->IsHorizontal();
|
||||
nsIntPoint delta;
|
||||
@ -1160,8 +1157,7 @@ ScrollFrameHelper::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection
|
||||
}
|
||||
nsIntPoint overflow;
|
||||
ScrollBy(delta, nsIScrollableFrame::LINES, nsIScrollableFrame::SMOOTH,
|
||||
&overflow, nsGkAtoms::other, nsIScrollableFrame::NOT_MOMENTUM,
|
||||
aSnap);
|
||||
&overflow, nsGkAtoms::other);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1196,24 +1192,11 @@ ScrollFrameHelper::ThumbMoved(nsScrollbarFrame* aScrollbar,
|
||||
ScrollTo(dest, nsIScrollableFrame::INSTANT, &allowedRange);
|
||||
}
|
||||
|
||||
void
|
||||
ScrollFrameHelper::ScrollbarReleased(nsScrollbarFrame* aScrollbar)
|
||||
{
|
||||
// Scrollbar scrolling does not result in fling gestures, clear any
|
||||
// accumulated velocity
|
||||
mVelocityQueue.Reset();
|
||||
|
||||
// Perform scroll snapping, if needed. Scrollbar movement uses the same
|
||||
// smooth scrolling animation as keyboard scrolling.
|
||||
ScrollSnap(mDestination, nsIScrollableFrame::SMOOTH);
|
||||
}
|
||||
|
||||
void
|
||||
ScrollFrameHelper::ScrollByUnit(nsScrollbarFrame* aScrollbar,
|
||||
nsIScrollableFrame::ScrollMode aMode,
|
||||
int32_t aDirection,
|
||||
nsIScrollableFrame::ScrollUnit aUnit,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
nsIScrollableFrame::ScrollUnit aUnit)
|
||||
{
|
||||
MOZ_ASSERT(aScrollbar != nullptr);
|
||||
bool isHorizontal = aScrollbar->IsHorizontal();
|
||||
@ -1224,8 +1207,7 @@ ScrollFrameHelper::ScrollByUnit(nsScrollbarFrame* aScrollbar,
|
||||
delta.y = aDirection;
|
||||
}
|
||||
nsIntPoint overflow;
|
||||
ScrollBy(delta, aUnit, aMode, &overflow, nsGkAtoms::other,
|
||||
nsIScrollableFrame::NOT_MOMENTUM, aSnap);
|
||||
ScrollBy(delta, aUnit, aMode, &overflow, nsGkAtoms::other);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -2097,7 +2079,7 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
|
||||
nsIScrollableFrame::ScrollMode aMode,
|
||||
nsIAtom *aOrigin,
|
||||
const nsRect* aRange,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
nsIScrollableFrame::ScrollSnapMode aSnap)
|
||||
{
|
||||
|
||||
if (aSnap == nsIScrollableFrame::ENABLE_SNAP) {
|
||||
@ -3366,7 +3348,7 @@ ScrollFrameHelper::ScrollBy(nsIntPoint aDelta,
|
||||
nsIntPoint* aOverflow,
|
||||
nsIAtom *aOrigin,
|
||||
nsIScrollableFrame::ScrollMomentum aMomentum,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
nsIScrollableFrame::ScrollSnapMode aSnap)
|
||||
{
|
||||
// When a smooth scroll is being processed on a frame, mouse wheel and trackpad
|
||||
// momentum scroll event updates must notcancel the SMOOTH or SMOOTH_MSD
|
||||
@ -3498,7 +3480,7 @@ ScrollFrameHelper::ScrollBy(nsIntPoint aDelta,
|
||||
}
|
||||
|
||||
void
|
||||
ScrollFrameHelper::ScrollSnap(nsIScrollableFrame::ScrollMode aMode)
|
||||
ScrollFrameHelper::ScrollSnap()
|
||||
{
|
||||
float flingSensitivity = gfxPrefs::ScrollSnapPredictionSensitivity();
|
||||
int maxVelocity = gfxPrefs::ScrollSnapPredictionMaxVelocity();
|
||||
@ -3511,7 +3493,7 @@ ScrollFrameHelper::ScrollSnap(nsIScrollableFrame::ScrollMode aMode)
|
||||
predictedOffset.Clamp(maxOffset);
|
||||
nsPoint pos = GetScrollPosition();
|
||||
nsPoint destinationPos = pos + predictedOffset;
|
||||
ScrollSnap(destinationPos, aMode);
|
||||
ScrollSnap(destinationPos);
|
||||
}
|
||||
|
||||
void
|
||||
@ -3521,8 +3503,7 @@ ScrollFrameHelper::FlingSnap(const mozilla::CSSPoint& aDestination)
|
||||
}
|
||||
|
||||
void
|
||||
ScrollFrameHelper::ScrollSnap(const nsPoint &aDestination,
|
||||
nsIScrollableFrame::ScrollMode aMode)
|
||||
ScrollFrameHelper::ScrollSnap(const nsPoint &aDestination)
|
||||
{
|
||||
nsRect scrollRange = GetScrollRangeForClamping();
|
||||
nsPoint pos = GetScrollPosition();
|
||||
@ -3530,7 +3511,7 @@ ScrollFrameHelper::ScrollSnap(const nsPoint &aDestination,
|
||||
if (GetSnapPointForDestination(nsIScrollableFrame::DEVICE_PIXELS,
|
||||
pos,
|
||||
snapDestination)) {
|
||||
ScrollTo(snapDestination, aMode);
|
||||
ScrollTo(snapDestination, nsIScrollableFrame::SMOOTH_MSD);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,9 +181,8 @@ public:
|
||||
void SetResolution(const gfxSize& aResolution);
|
||||
void SetResolutionAndScaleTo(const gfxSize& aResolution);
|
||||
void FlingSnap(const mozilla::CSSPoint& aDestination);
|
||||
void ScrollSnap(nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
|
||||
void ScrollSnap(const nsPoint &aDestination,
|
||||
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
|
||||
void ScrollSnap();
|
||||
void ScrollSnap(const nsPoint &aDestination);
|
||||
|
||||
protected:
|
||||
nsRect GetScrollRangeForClamping() const;
|
||||
@ -201,8 +200,7 @@ public:
|
||||
*/
|
||||
void ScrollTo(nsPoint aScrollPosition, nsIScrollableFrame::ScrollMode aMode,
|
||||
const nsRect* aRange = nullptr,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) {
|
||||
nsIScrollableFrame::ScrollSnapMode aSnap = nsIScrollableFrame::DISABLE_SNAP) {
|
||||
ScrollToWithOrigin(aScrollPosition, aMode, nsGkAtoms::other, aRange,
|
||||
aSnap);
|
||||
}
|
||||
@ -231,8 +229,7 @@ public:
|
||||
nsIScrollableFrame::ScrollMode aMode, nsIntPoint* aOverflow,
|
||||
nsIAtom* aOrigin = nullptr,
|
||||
nsIScrollableFrame::ScrollMomentum aMomentum = nsIScrollableFrame::NOT_MOMENTUM,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP);
|
||||
nsIScrollableFrame::ScrollSnapMode aSnap = nsIScrollableFrame::DISABLE_SNAP);
|
||||
/**
|
||||
* @note This method might destroy the frame, pres shell and other objects.
|
||||
*/
|
||||
@ -383,26 +380,17 @@ public:
|
||||
nsTArray<FrameMetrics>* aOutput) const;
|
||||
|
||||
// nsIScrollbarMediator
|
||||
void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP);
|
||||
void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP);
|
||||
void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP);
|
||||
void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection);
|
||||
void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection);
|
||||
void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection);
|
||||
void RepeatButtonScroll(nsScrollbarFrame* aScrollbar);
|
||||
void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
||||
nscoord aOldPos,
|
||||
nscoord aNewPos);
|
||||
void ScrollbarReleased(nsScrollbarFrame* aScrollbar);
|
||||
void ScrollByUnit(nsScrollbarFrame* aScrollbar,
|
||||
nsIScrollableFrame::ScrollMode aMode,
|
||||
int32_t aDirection,
|
||||
nsIScrollableFrame::ScrollUnit aUnit,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP);
|
||||
nsIScrollableFrame::ScrollUnit aUnit);
|
||||
|
||||
// owning references to the nsIAnonymousContentCreator-built content
|
||||
nsCOMPtr<nsIContent> mHScrollbarContent;
|
||||
@ -532,8 +520,7 @@ protected:
|
||||
nsIScrollableFrame::ScrollMode aMode,
|
||||
nsIAtom *aOrigin, // nullptr indicates "other" origin
|
||||
const nsRect* aRange,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP);
|
||||
nsIScrollableFrame::ScrollSnapMode aSnap = nsIScrollableFrame::DISABLE_SNAP);
|
||||
|
||||
void CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin = nullptr);
|
||||
|
||||
@ -722,8 +709,7 @@ public:
|
||||
*/
|
||||
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
||||
const nsRect* aRange = nullptr,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP)
|
||||
nsIScrollableFrame::ScrollSnapMode aSnap = nsIScrollableFrame::DISABLE_SNAP)
|
||||
MOZ_OVERRIDE {
|
||||
mHelper.ScrollTo(aScrollPosition, aMode, aRange, aSnap);
|
||||
}
|
||||
@ -751,8 +737,7 @@ public:
|
||||
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
||||
nsIntPoint* aOverflow, nsIAtom* aOrigin = nullptr,
|
||||
nsIScrollableFrame::ScrollMomentum aMomentum = nsIScrollableFrame::NOT_MOMENTUM,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP)
|
||||
nsIScrollableFrame::ScrollSnapMode aSnap = nsIScrollableFrame::DISABLE_SNAP)
|
||||
MOZ_OVERRIDE {
|
||||
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum, aSnap);
|
||||
}
|
||||
@ -860,20 +845,14 @@ public:
|
||||
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
||||
|
||||
// nsIScrollbarMediator
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByPage(aScrollbar, aDirection, aSnap);
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByPage(aScrollbar, aDirection);
|
||||
}
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByWhole(aScrollbar, aDirection, aSnap);
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByWhole(aScrollbar, aDirection);
|
||||
}
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByLine(aScrollbar, aDirection, aSnap);
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByLine(aScrollbar, aDirection);
|
||||
}
|
||||
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE {
|
||||
mHelper.RepeatButtonScroll(aScrollbar);
|
||||
@ -883,9 +862,6 @@ public:
|
||||
nscoord aNewPos) MOZ_OVERRIDE {
|
||||
mHelper.ThumbMoved(aScrollbar, aOldPos, aNewPos);
|
||||
}
|
||||
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE {
|
||||
mHelper.ScrollbarReleased(aScrollbar);
|
||||
}
|
||||
virtual void VisibilityChanged(bool aVisible) MOZ_OVERRIDE {}
|
||||
virtual nsIFrame* GetScrollbarBox(bool aVertical) MOZ_OVERRIDE {
|
||||
return mHelper.GetScrollbarBox(aVertical);
|
||||
@ -1114,8 +1090,7 @@ public:
|
||||
*/
|
||||
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
||||
const nsRect* aRange = nullptr,
|
||||
ScrollSnapMode aSnap = nsIScrollbarMediator::DISABLE_SNAP)
|
||||
MOZ_OVERRIDE {
|
||||
ScrollSnapMode aSnap = nsIScrollableFrame::DISABLE_SNAP) MOZ_OVERRIDE {
|
||||
mHelper.ScrollTo(aScrollPosition, aMode, aRange, aSnap);
|
||||
}
|
||||
/**
|
||||
@ -1139,8 +1114,7 @@ public:
|
||||
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
|
||||
nsIntPoint* aOverflow, nsIAtom* aOrigin = nullptr,
|
||||
nsIScrollableFrame::ScrollMomentum aMomentum = nsIScrollableFrame::NOT_MOMENTUM,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP)
|
||||
nsIScrollableFrame::ScrollSnapMode aSnap = nsIScrollableFrame::DISABLE_SNAP)
|
||||
MOZ_OVERRIDE {
|
||||
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum, aSnap);
|
||||
}
|
||||
@ -1255,20 +1229,14 @@ public:
|
||||
return nsBoxFrame::IsFrameOfType(aFlags);
|
||||
}
|
||||
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByPage(aScrollbar, aDirection, aSnap);
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByPage(aScrollbar, aDirection);
|
||||
}
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByWhole(aScrollbar, aDirection, aSnap);
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByWhole(aScrollbar, aDirection);
|
||||
}
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByLine(aScrollbar, aDirection, aSnap);
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE {
|
||||
mHelper.ScrollByLine(aScrollbar, aDirection);
|
||||
}
|
||||
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE {
|
||||
mHelper.RepeatButtonScroll(aScrollbar);
|
||||
@ -1278,9 +1246,6 @@ public:
|
||||
nscoord aNewPos) MOZ_OVERRIDE {
|
||||
mHelper.ThumbMoved(aScrollbar, aOldPos, aNewPos);
|
||||
}
|
||||
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE {
|
||||
mHelper.ScrollbarReleased(aScrollbar);
|
||||
}
|
||||
virtual void VisibilityChanged(bool aVisible) MOZ_OVERRIDE {}
|
||||
virtual nsIFrame* GetScrollbarBox(bool aVertical) MOZ_OVERRIDE {
|
||||
return mHelper.GetScrollbarBox(aVertical);
|
||||
|
@ -207,6 +207,13 @@ public:
|
||||
* been started since the last actual user input.
|
||||
*/
|
||||
enum ScrollMomentum { NOT_MOMENTUM, SYNTHESIZED_MOMENTUM_EVENT };
|
||||
/**
|
||||
* When set to ENABLE_SNAP, additional scrolling will be performed after the
|
||||
* scroll operation to maintain the constraints set by CSS Scroll snapping.
|
||||
* The additional scrolling may include asynchronous smooth scrolls that
|
||||
* continue to animate after the initial scroll position has been set.
|
||||
*/
|
||||
enum ScrollSnapMode { DISABLE_SNAP, ENABLE_SNAP };
|
||||
/**
|
||||
* @note This method might destroy the frame, pres shell and other objects.
|
||||
* Clamps aScrollPosition to GetScrollRange and sets the scroll position
|
||||
@ -218,8 +225,7 @@ public:
|
||||
*/
|
||||
virtual void ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
|
||||
const nsRect* aRange = nullptr,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) = 0;
|
||||
ScrollSnapMode aSnap = DISABLE_SNAP) = 0;
|
||||
/**
|
||||
* @note This method might destroy the frame, pres shell and other objects.
|
||||
* Scrolls to a particular position in integer CSS pixels.
|
||||
@ -274,8 +280,7 @@ public:
|
||||
nsIntPoint* aOverflow = nullptr,
|
||||
nsIAtom* aOrigin = nullptr,
|
||||
ScrollMomentum aMomentum = NOT_MOMENTUM,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) = 0;
|
||||
ScrollSnapMode aSnap = DISABLE_SNAP) = 0;
|
||||
|
||||
/**
|
||||
* Perform scroll snapping, possibly resulting in a smooth scroll to
|
||||
|
@ -24,25 +24,14 @@ public:
|
||||
* aDirection is either -1, 0, or 1.
|
||||
*/
|
||||
|
||||
/**
|
||||
* When set to ENABLE_SNAP, additional scrolling will be performed after the
|
||||
* scroll operation to maintain the constraints set by CSS Scroll snapping.
|
||||
* The additional scrolling may include asynchronous smooth scrolls that
|
||||
* continue to animate after the initial scroll position has been set.
|
||||
*/
|
||||
enum ScrollSnapMode { DISABLE_SNAP, ENABLE_SNAP };
|
||||
|
||||
/**
|
||||
* One of the following three methods is called when the scrollbar's button is
|
||||
* clicked.
|
||||
* @note These methods might destroy the frame, pres shell, and other objects.
|
||||
*/
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
ScrollSnapMode aSnap = DISABLE_SNAP) = 0;
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
ScrollSnapMode aSnap = DISABLE_SNAP) = 0;
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
ScrollSnapMode aSnap = DISABLE_SNAP) = 0;
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection) = 0;
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection) = 0;
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection) = 0;
|
||||
/**
|
||||
* RepeatButtonScroll is called when the scrollbar's button is held down. When the
|
||||
* button is first clicked the increment is set; RepeatButtonScroll adds this
|
||||
@ -60,11 +49,6 @@ public:
|
||||
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
||||
nscoord aOldPos,
|
||||
nscoord aNewPos) = 0;
|
||||
/**
|
||||
* Called when the scroll bar thumb, slider, or any other component is
|
||||
* released.
|
||||
*/
|
||||
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) = 0;
|
||||
virtual void VisibilityChanged(bool aVisible) = 0;
|
||||
|
||||
/**
|
||||
|
@ -326,10 +326,8 @@ nsListBoxBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
///////////// nsIScrollbarMediator ///////////////
|
||||
|
||||
void
|
||||
nsListBoxBodyFrame::ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
nsListBoxBodyFrame::ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection)
|
||||
{
|
||||
// CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
|
||||
MOZ_ASSERT(aScrollbar != nullptr);
|
||||
aScrollbar->SetIncrementToPage(aDirection);
|
||||
nsWeakFrame weakFrame(this);
|
||||
@ -341,10 +339,8 @@ nsListBoxBodyFrame::ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirectio
|
||||
}
|
||||
|
||||
void
|
||||
nsListBoxBodyFrame::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
nsListBoxBodyFrame::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection)
|
||||
{
|
||||
// CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
|
||||
MOZ_ASSERT(aScrollbar != nullptr);
|
||||
aScrollbar->SetIncrementToWhole(aDirection);
|
||||
nsWeakFrame weakFrame(this);
|
||||
@ -356,10 +352,8 @@ nsListBoxBodyFrame::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirecti
|
||||
}
|
||||
|
||||
void
|
||||
nsListBoxBodyFrame::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
nsListBoxBodyFrame::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection)
|
||||
{
|
||||
// CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
|
||||
MOZ_ASSERT(aScrollbar != nullptr);
|
||||
aScrollbar->SetIncrementToLine(aDirection);
|
||||
nsWeakFrame weakFrame(this);
|
||||
|
@ -54,20 +54,13 @@ public:
|
||||
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsIAtom* aAttribute, int32_t aModType) MOZ_OVERRIDE;
|
||||
|
||||
// nsIScrollbarMediator
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode snapMode
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE;
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode snapMode
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE;
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode snapMode
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE;
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE;
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE;
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE;
|
||||
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE;
|
||||
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
||||
int32_t aOldPos,
|
||||
int32_t aNewPos) MOZ_OVERRIDE;
|
||||
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE {}
|
||||
virtual void VisibilityChanged(bool aVisible) MOZ_OVERRIDE;
|
||||
virtual nsIFrame* GetScrollbarBox(bool aVertical) MOZ_OVERRIDE;
|
||||
virtual void ScrollbarActivityStarted() const MOZ_OVERRIDE {}
|
||||
|
@ -141,19 +141,19 @@ nsScrollbarButtonFrame::HandleButtonPress(nsPresContext* aPresContext,
|
||||
case 0:
|
||||
sb->SetIncrementToLine(direction);
|
||||
if (m) {
|
||||
m->ScrollByLine(sb, direction, nsIScrollbarMediator::ENABLE_SNAP);
|
||||
m->ScrollByLine(sb, direction);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
sb->SetIncrementToPage(direction);
|
||||
if (m) {
|
||||
m->ScrollByPage(sb, direction, nsIScrollbarMediator::ENABLE_SNAP);
|
||||
m->ScrollByPage(sb, direction);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
sb->SetIncrementToWhole(direction);
|
||||
if (m) {
|
||||
m->ScrollByWhole(sb, direction, nsIScrollbarMediator::ENABLE_SNAP);
|
||||
m->ScrollByWhole(sb, direction);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
@ -187,15 +187,6 @@ nsScrollbarButtonFrame::HandleRelease(nsPresContext* aPresContext,
|
||||
// we're not active anymore
|
||||
mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::active, true);
|
||||
StopRepeat();
|
||||
nsIFrame* scrollbar;
|
||||
GetParentWithTag(nsGkAtoms::scrollbar, this, scrollbar);
|
||||
nsScrollbarFrame* sb = do_QueryFrame(scrollbar);
|
||||
if (sb) {
|
||||
nsIScrollbarMediator* m = sb->GetScrollbarMediator();
|
||||
if (m) {
|
||||
m->ScrollbarReleased(sb);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -264,8 +264,7 @@ nsSliderFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
nsIScrollbarMediator* mediator = scrollbarFrame->GetScrollbarMediator();
|
||||
scrollbarFrame->SetIncrementToWhole(direction);
|
||||
if (mediator) {
|
||||
mediator->ScrollByWhole(scrollbarFrame, direction,
|
||||
nsIScrollbarMediator::ENABLE_SNAP);
|
||||
mediator->ScrollByWhole(scrollbarFrame, direction);
|
||||
}
|
||||
}
|
||||
// 'this' might be destroyed here
|
||||
@ -1154,14 +1153,6 @@ nsSliderFrame::HandleRelease(nsPresContext* aPresContext,
|
||||
{
|
||||
StopRepeat();
|
||||
|
||||
nsIFrame* scrollbar = GetScrollbar();
|
||||
nsScrollbarFrame* sb = do_QueryFrame(scrollbar);
|
||||
if (sb) {
|
||||
nsIScrollbarMediator* m = sb->GetScrollbarMediator();
|
||||
if (m) {
|
||||
m->ScrollbarReleased(sb);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1270,7 +1261,7 @@ nsSliderFrame::PageScroll(nscoord aChange)
|
||||
nsIScrollbarMediator* m = sb->GetScrollbarMediator();
|
||||
sb->SetIncrementToPage(aChange);
|
||||
if (m) {
|
||||
m->ScrollByPage(sb, aChange, nsIScrollbarMediator::ENABLE_SNAP);
|
||||
m->ScrollByPage(sb, aChange);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4200,29 +4200,23 @@ nsTreeBodyFrame::ScrollHorzInternal(const ScrollParts& aParts, int32_t aPosition
|
||||
}
|
||||
|
||||
void
|
||||
nsTreeBodyFrame::ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
nsTreeBodyFrame::ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection)
|
||||
{
|
||||
// CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
|
||||
MOZ_ASSERT(aScrollbar != nullptr);
|
||||
ScrollByPages(aDirection);
|
||||
}
|
||||
|
||||
void
|
||||
nsTreeBodyFrame::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
nsTreeBodyFrame::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection)
|
||||
{
|
||||
// CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
|
||||
MOZ_ASSERT(aScrollbar != nullptr);
|
||||
int32_t newIndex = aDirection < 0 ? 0 : mTopRowIndex;
|
||||
ScrollToRow(newIndex);
|
||||
}
|
||||
|
||||
void
|
||||
nsTreeBodyFrame::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap)
|
||||
nsTreeBodyFrame::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection)
|
||||
{
|
||||
// CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
|
||||
MOZ_ASSERT(aScrollbar != nullptr);
|
||||
ScrollByLines(aDirection);
|
||||
}
|
||||
|
@ -133,20 +133,13 @@ public:
|
||||
virtual bool PseudoMatches(nsCSSSelector* aSelector) MOZ_OVERRIDE;
|
||||
|
||||
// nsIScrollbarMediator
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE;
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE;
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
nsIScrollbarMediator::ScrollSnapMode aSnap
|
||||
= nsIScrollbarMediator::DISABLE_SNAP) MOZ_OVERRIDE;
|
||||
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE;
|
||||
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE;
|
||||
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection) MOZ_OVERRIDE;
|
||||
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE;
|
||||
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,
|
||||
nscoord aOldPos,
|
||||
nscoord aNewPos) MOZ_OVERRIDE;
|
||||
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) MOZ_OVERRIDE {}
|
||||
virtual void VisibilityChanged(bool aVisible) MOZ_OVERRIDE { Invalidate(); }
|
||||
virtual nsIFrame* GetScrollbarBox(bool aVertical) MOZ_OVERRIDE {
|
||||
ScrollParts parts = GetScrollParts();
|
||||
|
Loading…
Reference in New Issue
Block a user