Bug 1347820 - Label ScrollSelectionIntoViewEvent for nsSelection. r=heycam

Since GetParentObject has a chance returning nullptr, we keep the original
code path as a fallback.

MozReview-Commit-ID: LCJefr1ZH6t

--HG--
extra : rebase_source : 16b791d9555e9d3fb6e00233868249cbd08d944f
This commit is contained in:
Jeremy Chen 2017-03-16 15:33:00 +08:00
parent eec9e38f44
commit 6034613c83

View File

@ -6183,9 +6183,18 @@ Selection::PostScrollSelectionIntoViewEvent(
mScrollEvent.Revoke();
RefPtr<ScrollSelectionIntoViewEvent> ev =
new ScrollSelectionIntoViewEvent(this, aRegion, aVertical, aHorizontal,
aFlags);
nsresult rv = NS_DispatchToCurrentThread(ev);
new ScrollSelectionIntoViewEvent(this, aRegion, aVertical, aHorizontal,
aFlags);
nsresult rv;
nsIDocument* doc = GetParentObject();
if (doc) {
rv = doc->Dispatch("ScrollSelectionIntoViewEvent",
TaskCategory::Other,
ev.forget());
} else {
rv = NS_DispatchToCurrentThread(ev);
}
NS_ENSURE_SUCCESS(rv, rv);
mScrollEvent = ev;