Bug 1120358 - Part 1: Handle scroll position change that is not triggered by APZ. r=roc

This commit is contained in:
Jeremy Chen 2015-01-15 00:42:00 -05:00
Родитель 2e4d6e0f27
Коммит fe8fc4f7aa
2 изменённых файлов: 18 добавлений и 5 удалений

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

@ -78,6 +78,7 @@ SelectionCarets::SelectionCarets(nsIPresShell* aPresShell)
, mCaretCenterToDownPointOffsetY(0)
, mDragMode(NONE)
, mAsyncPanZoomEnabled(false)
, mInAsyncPanZoomGesture(false)
, mEndCaretVisible(false)
, mStartCaretVisible(false)
, mSelectionVisibleInScrollFrames(true)
@ -1183,6 +1184,7 @@ DispatchScrollViewChangeEvent(nsIPresShell *aPresShell, const dom::ScrollState a
void
SelectionCarets::AsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos)
{
mInAsyncPanZoomGesture = true;
SetVisibility(false);
SELECTIONCARETS_LOG("Dispatch scroll started with position x=%d, y=%d",
@ -1193,6 +1195,7 @@ SelectionCarets::AsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos)
void
SelectionCarets::AsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos)
{
mInAsyncPanZoomGesture = false;
SELECTIONCARETS_LOG("Update selection carets after APZ is stopped!");
UpdateSelectionCarets();
@ -1209,12 +1212,20 @@ SelectionCarets::AsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos)
void
SelectionCarets::ScrollPositionChanged()
{
if (!mAsyncPanZoomEnabled && mVisible) {
SetVisibility(false);
//TODO: handling scrolling for selection bubble when APZ is off
if (mVisible) {
if (!mAsyncPanZoomEnabled) {
SetVisibility(false);
//TODO: handling scrolling for selection bubble when APZ is off
SELECTIONCARETS_LOG("Launch scroll end detector");
LaunchScrollEndDetector();
SELECTIONCARETS_LOG("Launch scroll end detector");
LaunchScrollEndDetector();
} else {
if (!mInAsyncPanZoomGesture) {
UpdateSelectionCarets();
DispatchSelectionStateChangedEvent(GetSelection(),
SelectionState::Updateposition);
}
}
}
}

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

@ -260,6 +260,8 @@ private:
// True if AsyncPanZoom is enabled
bool mAsyncPanZoomEnabled;
// True if AsyncPanZoom is started
bool mInAsyncPanZoomGesture;
bool mEndCaretVisible;
bool mStartCaretVisible;