зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1143665 - Remove the ambiguous scroll position being passed around in scroll started/stop notifications. r=roc,ehsan
This commit is contained in:
Родитель
2ebce4887b
Коммит
52c482890f
|
@ -3239,14 +3239,14 @@ nsDocShell::RemoveWeakScrollObserver(nsIScrollObserver* aObserver)
|
|||
}
|
||||
|
||||
void
|
||||
nsDocShell::NotifyAsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos)
|
||||
nsDocShell::NotifyAsyncPanZoomStarted()
|
||||
{
|
||||
nsTObserverArray<nsWeakPtr>::ForwardIterator iter(mScrollObservers);
|
||||
while (iter.HasMore()) {
|
||||
nsWeakPtr ref = iter.GetNext();
|
||||
nsCOMPtr<nsIScrollObserver> obs = do_QueryReferent(ref);
|
||||
if (obs) {
|
||||
obs->AsyncPanZoomStarted(aScrollPos);
|
||||
obs->AsyncPanZoomStarted();
|
||||
} else {
|
||||
mScrollObservers.RemoveElement(ref);
|
||||
}
|
||||
|
@ -3257,20 +3257,20 @@ nsDocShell::NotifyAsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos)
|
|||
nsCOMPtr<nsIDocShell> kid = do_QueryInterface(ChildAt(i));
|
||||
if (kid) {
|
||||
nsDocShell* docShell = static_cast<nsDocShell*>(kid.get());
|
||||
docShell->NotifyAsyncPanZoomStarted(aScrollPos);
|
||||
docShell->NotifyAsyncPanZoomStarted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocShell::NotifyAsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos)
|
||||
nsDocShell::NotifyAsyncPanZoomStopped()
|
||||
{
|
||||
nsTObserverArray<nsWeakPtr>::ForwardIterator iter(mScrollObservers);
|
||||
while (iter.HasMore()) {
|
||||
nsWeakPtr ref = iter.GetNext();
|
||||
nsCOMPtr<nsIScrollObserver> obs = do_QueryReferent(ref);
|
||||
if (obs) {
|
||||
obs->AsyncPanZoomStopped(aScrollPos);
|
||||
obs->AsyncPanZoomStopped();
|
||||
} else {
|
||||
mScrollObservers.RemoveElement(ref);
|
||||
}
|
||||
|
@ -3281,7 +3281,7 @@ nsDocShell::NotifyAsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos)
|
|||
nsCOMPtr<nsIDocShell> kid = do_QueryInterface(ChildAt(i));
|
||||
if (kid) {
|
||||
nsDocShell* docShell = static_cast<nsDocShell*>(kid.get());
|
||||
docShell->NotifyAsyncPanZoomStopped(aScrollPos);
|
||||
docShell->NotifyAsyncPanZoomStopped();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,10 +262,10 @@ public:
|
|||
|
||||
// Notify Scroll observers when an async panning/zooming transform
|
||||
// has started being applied
|
||||
void NotifyAsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos);
|
||||
void NotifyAsyncPanZoomStarted();
|
||||
// Notify Scroll observers when an async panning/zooming transform
|
||||
// is no longer applied
|
||||
void NotifyAsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos);
|
||||
void NotifyAsyncPanZoomStopped();
|
||||
|
||||
// Add new profile timeline markers to this docShell. This will only add
|
||||
// markers if the docShell is currently recording profile timeline markers.
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include "Units.h"
|
||||
|
||||
#define NS_ISCROLLOBSERVER_IID \
|
||||
{ 0x00bc10e3, 0xaa59, 0x4aa3, \
|
||||
{ 0x88, 0xe9, 0x43, 0x0a, 0x01, 0xa3, 0x88, 0x04 } }
|
||||
{ 0xaa5026eb, 0x2f88, 0x4026, \
|
||||
{ 0xa4, 0x6b, 0xf4, 0x59, 0x6b, 0x4e, 0xdf, 0x00 } }
|
||||
|
||||
class nsIScrollObserver : public nsISupports
|
||||
{
|
||||
|
@ -28,13 +28,13 @@ public:
|
|||
* Called when an async panning/zooming transform has started being applied
|
||||
* and passed the scroll offset
|
||||
*/
|
||||
virtual void AsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos) {};
|
||||
virtual void AsyncPanZoomStarted() {};
|
||||
|
||||
/**
|
||||
* Called when an async panning/zooming transform is no longer applied
|
||||
* and passed the scroll offset
|
||||
*/
|
||||
virtual void AsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos) {};
|
||||
virtual void AsyncPanZoomStopped() {};
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollObserver, NS_ISCROLLOBSERVER_IID)
|
||||
|
|
|
@ -575,8 +575,6 @@ BrowserElementChild.prototype = {
|
|||
e.stopPropagation();
|
||||
let detail = {
|
||||
state: e.state,
|
||||
scrollX: e.scrollX,
|
||||
scrollY: e.scrollY,
|
||||
};
|
||||
sendAsyncMsg('scrollviewchange', detail);
|
||||
},
|
||||
|
|
|
@ -8,14 +8,10 @@ enum ScrollState {"started", "stopped"};
|
|||
|
||||
dictionary ScrollViewChangeEventInit : EventInit {
|
||||
ScrollState state = "started";
|
||||
float scrollX = 0;
|
||||
float scrollY = 0;
|
||||
};
|
||||
|
||||
[Constructor(DOMString type, optional ScrollViewChangeEventInit eventInit),
|
||||
ChromeOnly]
|
||||
interface ScrollViewChangeEvent : Event {
|
||||
readonly attribute ScrollState state;
|
||||
readonly attribute float scrollX;
|
||||
readonly attribute float scrollY;
|
||||
};
|
||||
|
|
|
@ -314,7 +314,7 @@ APZEventState::ProcessAPZStateChange(const nsCOMPtr<nsIDocument>& aDocument,
|
|||
nsCOMPtr<nsIDocShell> docshell(aDocument->GetDocShell());
|
||||
if (docshell && sf) {
|
||||
nsDocShell* nsdocshell = static_cast<nsDocShell*>(docshell.get());
|
||||
nsdocshell->NotifyAsyncPanZoomStarted(sf->GetScrollPositionCSSPixels());
|
||||
nsdocshell->NotifyAsyncPanZoomStarted();
|
||||
}
|
||||
}
|
||||
mActiveAPZTransforms++;
|
||||
|
@ -336,7 +336,7 @@ APZEventState::ProcessAPZStateChange(const nsCOMPtr<nsIDocument>& aDocument,
|
|||
nsCOMPtr<nsIDocShell> docshell(aDocument->GetDocShell());
|
||||
if (docshell && sf) {
|
||||
nsDocShell* nsdocshell = static_cast<nsDocShell*>(docshell.get());
|
||||
nsdocshell->NotifyAsyncPanZoomStopped(sf->GetScrollPositionCSSPixels());
|
||||
nsdocshell->NotifyAsyncPanZoomStopped();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1131,7 +1131,7 @@ SelectionCarets::NotifySelectionChanged(nsIDOMDocument* aDoc,
|
|||
}
|
||||
|
||||
static void
|
||||
DispatchScrollViewChangeEvent(nsIPresShell *aPresShell, const dom::ScrollState aState, const mozilla::CSSIntPoint aScrollPos)
|
||||
DispatchScrollViewChangeEvent(nsIPresShell *aPresShell, const dom::ScrollState aState)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc = aPresShell->GetDocument();
|
||||
if (doc) {
|
||||
|
@ -1140,8 +1140,6 @@ DispatchScrollViewChangeEvent(nsIPresShell *aPresShell, const dom::ScrollState a
|
|||
detail.mBubbles = true;
|
||||
detail.mCancelable = false;
|
||||
detail.mState = aState;
|
||||
detail.mScrollX = aScrollPos.x;
|
||||
detail.mScrollY = aScrollPos.y;
|
||||
nsRefPtr<ScrollViewChangeEvent> event =
|
||||
ScrollViewChangeEvent::Constructor(doc, NS_LITERAL_STRING("scrollviewchange"), detail);
|
||||
|
||||
|
@ -1152,26 +1150,25 @@ DispatchScrollViewChangeEvent(nsIPresShell *aPresShell, const dom::ScrollState a
|
|||
}
|
||||
|
||||
void
|
||||
SelectionCarets::AsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos)
|
||||
SelectionCarets::AsyncPanZoomStarted()
|
||||
{
|
||||
if (mVisible) {
|
||||
mInAsyncPanZoomGesture = true;
|
||||
SetVisibility(false);
|
||||
|
||||
SELECTIONCARETS_LOG("Dispatch scroll started with position x=%d, y=%d",
|
||||
aScrollPos.x, aScrollPos.y);
|
||||
DispatchScrollViewChangeEvent(mPresShell, dom::ScrollState::Started, aScrollPos);
|
||||
SELECTIONCARETS_LOG("Dispatch scroll started");
|
||||
DispatchScrollViewChangeEvent(mPresShell, dom::ScrollState::Started);
|
||||
} else {
|
||||
nsRefPtr<dom::Selection> selection = GetSelection();
|
||||
if (selection && selection->RangeCount() && selection->IsCollapsed()) {
|
||||
mInAsyncPanZoomGesture = true;
|
||||
DispatchScrollViewChangeEvent(mPresShell, dom::ScrollState::Started, aScrollPos);
|
||||
DispatchScrollViewChangeEvent(mPresShell, dom::ScrollState::Started);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SelectionCarets::AsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos)
|
||||
SelectionCarets::AsyncPanZoomStopped()
|
||||
{
|
||||
if (mInAsyncPanZoomGesture) {
|
||||
mInAsyncPanZoomGesture = false;
|
||||
|
@ -1182,10 +1179,9 @@ SelectionCarets::AsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos)
|
|||
DispatchSelectionStateChangedEvent(GetSelection(),
|
||||
SelectionState::Updateposition);
|
||||
|
||||
SELECTIONCARETS_LOG("Dispatch scroll stopped with position x=%d, y=%d",
|
||||
aScrollPos.x, aScrollPos.y);
|
||||
SELECTIONCARETS_LOG("Dispatch scroll stopped");
|
||||
|
||||
DispatchScrollViewChangeEvent(mPresShell, dom::ScrollState::Stopped, aScrollPos);
|
||||
DispatchScrollViewChangeEvent(mPresShell, dom::ScrollState::Stopped);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1199,8 +1195,7 @@ SelectionCarets::ScrollPositionChanged()
|
|||
// Dispatch event to notify gaia to hide selection bubble.
|
||||
// Positions will be updated when scroll is end, so no need to calculate
|
||||
// and keep scroll positions here. An arbitrary (0, 0) is sent instead.
|
||||
DispatchScrollViewChangeEvent(mPresShell, dom::ScrollState::Started,
|
||||
mozilla::CSSIntPoint(0, 0));
|
||||
DispatchScrollViewChangeEvent(mPresShell, dom::ScrollState::Started);
|
||||
|
||||
SELECTIONCARETS_LOG("Launch scroll end detector");
|
||||
LaunchScrollEndDetector();
|
||||
|
|
|
@ -84,8 +84,8 @@ public:
|
|||
virtual void ScrollPositionChanged() override;
|
||||
|
||||
// AsyncPanZoom started/stopped callbacks from nsIScrollObserver
|
||||
virtual void AsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos) override;
|
||||
virtual void AsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos) override;
|
||||
virtual void AsyncPanZoomStarted() override;
|
||||
virtual void AsyncPanZoomStopped() override;
|
||||
|
||||
void Init();
|
||||
void Terminate();
|
||||
|
|
Загрузка…
Ссылка в новой задаче