Bug 795833 - Add a RequestRepaint method to nsIWidgetListener and use it in the android widget instead of invalidating the view. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Tue, 18 Dec 2012 16:42:02 +1300
changeset 125486 9c63294d0a871095fbb9bdb4b35008e0f86c8d48
parent 125485 2e0bc271e28f452bf046a488b5547ae65cdffc8f
child 125487 607731c891dd593d6c7d887526ba0d1b21c82ec9
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs795833
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
view/src/nsView.h
widget/android/nsWindow.cpp
widget/nsIWidgetListener.h
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -1068,16 +1068,25 @@ nsView::PaintWindow(nsIWidget* aWidget, 
 
 void
 nsView::DidPaintWindow()
 {
   nsCOMPtr<nsViewManager> vm = mViewManager;
   vm->DidPaintWindow();
 }
 
+void
+nsView::RequestRepaint()
+{
+  nsIPresShell* presShell = mViewManager->GetPresShell();
+  if (presShell) {
+    presShell->ScheduleViewManagerFlush();
+  }
+}
+
 nsEventStatus
 nsView::HandleEvent(nsGUIEvent* aEvent, bool aUseAttachedEvents)
 {
   NS_PRECONDITION(nullptr != aEvent->widget, "null widget ptr");
 
   nsEventStatus result = nsEventStatus_eIgnore;
   nsIView* view;
   if (aUseAttachedEvents) {
--- a/view/src/nsView.h
+++ b/view/src/nsView.h
@@ -165,16 +165,17 @@ public:
   virtual nsIPresShell* GetPresShell();
   virtual nsIView* GetView() { return this; }
   bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y);
   bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight);
   bool RequestWindowClose(nsIWidget* aWidget);
   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();
 
   nsPoint GetOffsetTo(const nsView* aOther) const;
   nsIWidget* GetNearestWidget(nsPoint* aOffset) const;
   nsPoint GetOffsetTo(const nsView* aOther, const int32_t aAPD) const;
   nsIWidget* GetNearestWidget(nsPoint* aOffset, const int32_t aAPD) const;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -267,20 +267,17 @@ nsWindow::ConfigureChildren(const nsTArr
 
     return NS_OK;
 }
 
 void
 nsWindow::RedrawAll()
 {
     if (mFocus && mFocus->mWidgetListener) {
-        nsIView* view = mFocus->mWidgetListener->GetView();
-        if (view && view->GetViewManager()) {
-            view->GetViewManager()->InvalidateView(view);
-        }
+        mFocus->mWidgetListener->RequestRepaint();
     }
 }
 
 NS_IMETHODIMP
 nsWindow::SetParent(nsIWidget *aNewParent)
 {
     if ((nsIWidget*)mParent == aNewParent)
         return NS_OK;
--- a/widget/nsIWidgetListener.h
+++ b/widget/nsIWidgetListener.h
@@ -129,16 +129,21 @@ public:
   virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags) { return false; }
 
   /**
    * On some platforms, indicates that a paint occurred.
    */
   virtual void DidPaintWindow() { }
 
   /**
+   * Request that layout schedules a repaint on the next refresh driver tick.
+   */
+  virtual void RequestRepaint() { }
+
+  /**
    * Handle an event.
    */
   virtual nsEventStatus HandleEvent(nsGUIEvent* event, bool useAttachedEvents)
   {
     return nsEventStatus_eIgnore;
   }
 };