Bug 1257369 - Suppress the DisplayPort when scrolling via nsSliderFrame. r=kats

MozReview-Commit-ID: 8I3UfWlkdPq

--HG--
extra : rebase_source : 25b496ff5f3be9187cb8727982eaa094f85a0d1f
This commit is contained in:
Benoit Girard 2016-03-18 14:46:54 -04:00
Родитель cc35fdfce9
Коммит 65e8237702
2 изменённых файлов: 29 добавлений и 1 удалений

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

@ -22,11 +22,13 @@
#include "nsHTMLParts.h"
#include "nsIPresShell.h"
#include "nsCSSRendering.h"
#include "nsIDOMEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsScrollbarButtonFrame.h"
#include "nsISliderListener.h"
#include "nsIScrollableFrame.h"
#include "nsIScrollbarMediator.h"
#include "nsISupportsImpl.h"
#include "nsScrollbarFrame.h"
#include "nsRepeatService.h"
#include "nsBoxLayoutState.h"
@ -35,16 +37,19 @@
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "mozilla/Assertions.h" // for MOZ_ASSERT
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Telemetry.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "mozilla/layers/AsyncDragMetrics.h"
#include "mozilla/layers/InputAPZContext.h"
#include "mozilla/layers/ScrollInputMethods.h"
#include <algorithm>
using namespace mozilla;
using mozilla::layers::APZCCallbackHelper;
using mozilla::layers::AsyncDragMetrics;
using mozilla::layers::InputAPZContext;
using mozilla::layers::ScrollInputMethod;
@ -80,13 +85,20 @@ nsSliderFrame::nsSliderFrame(nsStyleContext* aContext):
mChange(0),
mDragFinished(true),
mUserChanged(false),
mScrollingWithAPZ(false)
mScrollingWithAPZ(false),
mSuppressionActive(false)
{
}
// stop timer
nsSliderFrame::~nsSliderFrame()
{
MOZ_ASSERT(!mSuppressionActive, "Should have un-suppress via StopDrag() first.");
if (mSuppressionActive) {
APZCCallbackHelper::SuppressDisplayport(false, PresContext() ?
PresContext()->PresShell() :
nullptr);
}
}
void
@ -1042,6 +1054,12 @@ nsSliderFrame::StartDrag(nsIDOMEvent* aEvent)
printf("Pressed mDragStart=%d\n",mDragStart);
#endif
if (!mScrollingWithAPZ && !mSuppressionActive) {
MOZ_ASSERT(PresContext()->PresShell());
APZCCallbackHelper::SuppressDisplayport(true, PresContext()->PresShell());
mSuppressionActive = true;
}
return NS_OK;
}
@ -1053,6 +1071,12 @@ nsSliderFrame::StopDrag()
mScrollingWithAPZ = false;
if (mSuppressionActive) {
MOZ_ASSERT(PresContext()->PresShell());
APZCCallbackHelper::SuppressDisplayport(false, PresContext()->PresShell());
mSuppressionActive = false;
}
#ifdef MOZ_WIDGET_GTK
nsIFrame* thumbFrame = mFrames.FirstChild();
if (thumbFrame) {

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

@ -195,6 +195,10 @@ private:
// causing the scroll position to jump.
bool mScrollingWithAPZ;
// true if displayport suppression is active, for more performant
// scrollbar-dragging behaviour.
bool mSuppressionActive;
static bool gMiddlePref;
static int32_t gSnapMultiplier;
}; // class nsSliderFrame