From 0c5f6b76a220373632bebed6182d898cd74a1509 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Tue, 18 Dec 2012 16:42:02 +1300 Subject: [PATCH] Bug 795833 - Add a RequestRepaint method to nsIWidgetListener and use it in the android widget instead of invalidating the view. r=roc --- view/src/nsView.cpp | 9 +++++++++ view/src/nsView.h | 1 + widget/android/nsWindow.cpp | 5 +---- widget/nsIWidgetListener.h | 5 +++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index cebff256c0c..25edaa2f4f5 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -1073,6 +1073,15 @@ nsView::DidPaintWindow() vm->DidPaintWindow(); } +void +nsView::RequestRepaint() +{ + nsIPresShell* presShell = mViewManager->GetPresShell(); + if (presShell) { + presShell->ScheduleViewManagerFlush(); + } +} + nsEventStatus nsView::HandleEvent(nsGUIEvent* aEvent, bool aUseAttachedEvents) { diff --git a/view/src/nsView.h b/view/src/nsView.h index a5695cf1f26..590f8171c7a 100644 --- a/view/src/nsView.h +++ b/view/src/nsView.h @@ -170,6 +170,7 @@ public: void WillPaintWindow(nsIWidget* aWidget, bool aWillSendDidPaint); bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags); void DidPaintWindow(); + void RequestRepaint() MOZ_OVERRIDE; nsEventStatus HandleEvent(nsGUIEvent* aEvent, bool aUseAttachedEvents); virtual ~nsView(); diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index e1cb54ed4fa..ea81ba7ecb9 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -272,10 +272,7 @@ void nsWindow::RedrawAll() { if (mFocus && mFocus->mWidgetListener) { - nsIView* view = mFocus->mWidgetListener->GetView(); - if (view && view->GetViewManager()) { - view->GetViewManager()->InvalidateView(view); - } + mFocus->mWidgetListener->RequestRepaint(); } } diff --git a/widget/nsIWidgetListener.h b/widget/nsIWidgetListener.h index 8a585bd5ba9..0966f1e523e 100644 --- a/widget/nsIWidgetListener.h +++ b/widget/nsIWidgetListener.h @@ -133,6 +133,11 @@ public: */ virtual void DidPaintWindow() { } + /** + * Request that layout schedules a repaint on the next refresh driver tick. + */ + virtual void RequestRepaint() { } + /** * Handle an event. */