backout bug 967236

--HG--
extra : rebase_source : 6feb306f0c211594987c3f7ce904f671b0a11b99
This commit is contained in:
Olli Pettay 2014-02-07 00:11:36 +02:00
parent d4be11de22
commit 4af62215c9
2 changed files with 30 additions and 41 deletions

View File

@ -1180,8 +1180,6 @@ PresShell::Destroy()
}
mHaveShutDown = true;
EvictTouches();
}
void
@ -6177,37 +6175,40 @@ PresShell::RecordMouseLocation(WidgetGUIEvent* aEvent)
}
static void
EvictTouchPoint(nsRefPtr<dom::Touch>& aTouch,
nsIDocument* aLimitToDocument = nullptr)
EvictTouchPoint(nsRefPtr<dom::Touch>& aTouch)
{
nsIWidget *widget = nullptr;
// is there an easier/better way to dig out the widget?
nsCOMPtr<nsINode> node(do_QueryInterface(aTouch->mTarget));
if (node) {
nsIDocument* doc = node->GetCurrentDoc();
if (doc) {
nsIPresShell* presShell = doc->GetShell();
if (presShell) {
nsIFrame* frame = presShell->GetRootFrame();
if (frame) {
nsPoint pt(aTouch->mRefPoint.x, aTouch->mRefPoint.y);
nsCOMPtr<nsIWidget> widget = frame->GetView()->GetNearestWidget(&pt);
if (widget) {
WidgetTouchEvent event(true, NS_TOUCH_END, widget);
event.widget = widget;
event.time = PR_IntervalNow();
event.touches.AppendElement(aTouch);
nsEventStatus status;
widget->DispatchEvent(&event, status);
return;
}
}
}
}
if (!node) {
return;
}
if (!node || !aLimitToDocument || node->OwnerDoc() == aLimitToDocument) {
// We couldn't dispatch touchend. Remove the touch from gCaptureTouchList
// explicitly.
nsIPresShell::gCaptureTouchList->Remove(aTouch->Identifier());
nsIDocument* doc = node->GetCurrentDoc();
if (!doc) {
return;
}
nsIPresShell *presShell = doc->GetShell();
if (!presShell) {
return;
}
nsIFrame* frame = presShell->GetRootFrame();
if (!frame) {
return;
}
nsPoint pt(aTouch->mRefPoint.x, aTouch->mRefPoint.y);
widget = frame->GetView()->GetNearestWidget(&pt);
if (!widget) {
return;
}
WidgetTouchEvent event(true, NS_TOUCH_END, widget);
event.widget = widget;
event.time = PR_IntervalNow();
event.touches.AppendElement(aTouch);
nsEventStatus status;
widget->DispatchEvent(&event, status);
}
static PLDHashOperator
@ -6220,16 +6221,6 @@ AppendToTouchList(const uint32_t& aKey, nsRefPtr<dom::Touch>& aData, void *aTouc
return PL_DHASH_NEXT;
}
void
PresShell::EvictTouches()
{
nsTArray< nsRefPtr<dom::Touch> > touches;
gCaptureTouchList->Enumerate(&AppendToTouchList, &touches);
for (uint32_t i = 0; i < touches.Length(); ++i) {
EvictTouchPoint(touches[i], mDocument);
}
}
static PLDHashOperator
FindAnyTarget(const uint32_t& aKey, nsRefPtr<dom::Touch>& aData,
void* aAnyTarget)

View File

@ -705,8 +705,6 @@ protected:
static void ClearImageVisibilityVisited(nsView* aView, bool aClear);
static void MarkImagesInListVisible(const nsDisplayList& aList);
void EvictTouches();
// A list of images that are visible or almost visible.
nsTHashtable< nsRefPtrHashKey<nsIImageLoadingContent> > mVisibleImages;