Attachment #160405: approach 3 (less risky version) for bug #227361

View | Details | Raw Unified | Return to bug 227361
Collapse All | Expand All

(-)nsScrollPortView.cpp (-2 lines)
Line     Link Here 
 Lines 30-60    Link Here 
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
31
 * use your version of this file under the terms of the MPL, indicate your
31
 * use your version of this file under the terms of the MPL, indicate your
32
 * decision by deleting the provisions above and replace them with the notice
32
 * decision by deleting the provisions above and replace them with the notice
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
34
 * the provisions above, a recipient may use your version of this file under
34
 * the provisions above, a recipient may use your version of this file under
35
 * the terms of any one of the MPL, the GPL or the LGPL.
35
 * the terms of any one of the MPL, the GPL or the LGPL.
36
 *
36
 *
37
 * ***** END LICENSE BLOCK ***** */
37
 * ***** END LICENSE BLOCK ***** */
38
38
39
#include "nsScrollPortView.h"
39
#include "nsScrollPortView.h"
40
#include "nsIWidget.h"
40
#include "nsIWidget.h"
41
#include "nsUnitConversion.h"
41
#include "nsUnitConversion.h"
42
#include "nsPresContext.h"
43
#include "nsIDeviceContext.h"
42
#include "nsIDeviceContext.h"
44
#include "nsGUIEvent.h"
43
#include "nsGUIEvent.h"
45
#include "nsWidgetsCID.h"
44
#include "nsWidgetsCID.h"
46
#include "nsViewsCID.h"
45
#include "nsViewsCID.h"
47
#include "nsIScrollableView.h"
46
#include "nsIScrollableView.h"
48
#include "nsIFrame.h"
49
#include "nsILookAndFeel.h"
47
#include "nsILookAndFeel.h"
50
#include "nsISupportsArray.h"
48
#include "nsISupportsArray.h"
51
#include "nsIScrollPositionListener.h"
49
#include "nsIScrollPositionListener.h"
52
#include "nsIRegion.h"
50
#include "nsIRegion.h"
53
#include "nsViewManager.h"
51
#include "nsViewManager.h"
54
#include "nsIPrefBranch.h"
52
#include "nsIPrefBranch.h"
55
#include "nsIPrefService.h"
53
#include "nsIPrefService.h"
56
#include "nsCOMPtr.h"
54
#include "nsCOMPtr.h"
57
#include "nsIServiceManagerUtils.h"
55
#include "nsIServiceManagerUtils.h"
58
56
59
#include <math.h>
57
#include <math.h>
60
58
(-)nsView.cpp (-2 lines)
Line     Link Here 
 Lines 29-54    Link Here 
29
 * under the terms of either the GPL or the LGPL, and not to allow others to
29
 * under the terms of either the GPL or the LGPL, and not to allow others to
30
 * use your version of this file under the terms of the MPL, indicate your
30
 * use your version of this file under the terms of the MPL, indicate your
31
 * decision by deleting the provisions above and replace them with the notice
31
 * decision by deleting the provisions above and replace them with the notice
32
 * and other provisions required by the GPL or the LGPL. If you do not delete
32
 * and other provisions required by the GPL or the LGPL. If you do not delete
33
 * the provisions above, a recipient may use your version of this file under
33
 * the provisions above, a recipient may use your version of this file under
34
 * the terms of any one of the MPL, the GPL or the LGPL.
34
 * the terms of any one of the MPL, the GPL or the LGPL.
35
 *
35
 *
36
 * ***** END LICENSE BLOCK ***** */
36
 * ***** END LICENSE BLOCK ***** */
37
37
38
#include "nsView.h"
38
#include "nsView.h"
39
#include "nsIWidget.h"
39
#include "nsIWidget.h"
40
#include "nsViewManager.h"
40
#include "nsViewManager.h"
41
#include "nsIFrame.h"
42
#include "nsPresContext.h"
43
#include "nsIWidget.h"
41
#include "nsIWidget.h"
44
#include "nsIButton.h"
42
#include "nsIButton.h"
45
#include "nsGUIEvent.h"
43
#include "nsGUIEvent.h"
46
#include "nsIDeviceContext.h"
44
#include "nsIDeviceContext.h"
47
#include "nsIComponentManager.h"
45
#include "nsIComponentManager.h"
48
#include "nsIRenderingContext.h"
46
#include "nsIRenderingContext.h"
49
#include "nsTransform2D.h"
47
#include "nsTransform2D.h"
50
#include "nsIScrollableView.h"
48
#include "nsIScrollableView.h"
51
#include "nsVoidArray.h"
49
#include "nsVoidArray.h"
52
#include "nsGfxCIID.h"
50
#include "nsGfxCIID.h"
53
#include "nsIRegion.h"
51
#include "nsIRegion.h"
54
#include "nsIInterfaceRequestor.h"
52
#include "nsIInterfaceRequestor.h"
(-)nsViewManager.h (-1 / +18 lines)
Line     Link Here 
 Lines 31-55    Link Here 
31
 * decision by deleting the provisions above and replace them with the notice
31
 * decision by deleting the provisions above and replace them with the notice
32
 * and other provisions required by the GPL or the LGPL. If you do not delete
32
 * and other provisions required by the GPL or the LGPL. If you do not delete
33
 * the provisions above, a recipient may use your version of this file under
33
 * the provisions above, a recipient may use your version of this file under
34
 * the terms of any one of the MPL, the GPL or the LGPL.
34
 * the terms of any one of the MPL, the GPL or the LGPL.
35
 *
35
 *
36
 * ***** END LICENSE BLOCK ***** */
36
 * ***** END LICENSE BLOCK ***** */
37
37
38
#ifndef nsViewManager_h___
38
#ifndef nsViewManager_h___
39
#define nsViewManager_h___
39
#define nsViewManager_h___
40
#include "nsCOMPtr.h"
40
#include "nsCOMPtr.h"
41
#include "nsIViewManager.h"
41
#include "nsIViewManager.h"
42
#include "nsCRT.h"
42
#include "nsCRT.h"
43
#include "nsPresContext.h"
44
#include "nsIWidget.h"
43
#include "nsIWidget.h"
45
#include "nsITimer.h"
44
#include "nsITimer.h"
46
#include "prtime.h"
45
#include "prtime.h"
47
#include "prinrval.h"
46
#include "prinrval.h"
48
#include "nsVoidArray.h"
47
#include "nsVoidArray.h"
49
#include "nsIScrollableView.h"
48
#include "nsIScrollableView.h"
50
#include "nsIRegion.h"
49
#include "nsIRegion.h"
51
#include "nsIBlender.h"
50
#include "nsIBlender.h"
52
#include "nsIEventQueueService.h"
51
#include "nsIEventQueueService.h"
53
#include "nsIEventQueue.h"
52
#include "nsIEventQueue.h"
54
#include "nsView.h"
53
#include "nsView.h"
55
54
 Lines 348-371   private: Link Here 
348
347
349
  // Utilities used to size the offscreen drawing surface
348
  // Utilities used to size the offscreen drawing surface
350
349
351
  /**
350
  /**
352
   * Determine the maximum and width and height of all of the
351
   * Determine the maximum and width and height of all of the
353
   * view manager's widgets.
352
   * view manager's widgets.
354
   *
353
   *
355
   * @param aMaxWidgetBounds the maximum width and height of all view managers
354
   * @param aMaxWidgetBounds the maximum width and height of all view managers
356
   * widgets on exit.
355
   * widgets on exit.
357
   */
356
   */
358
  void GetMaxWidgetBounds(nsRect& aMaxWidgetBounds) const;
357
  void GetMaxWidgetBounds(nsRect& aMaxWidgetBounds) const;
359
358
359
  void DoSetWindowDimensions(nscoord aWidth, nscoord aHeight)
360
  {
361
    //nsRect oldDim;
362
    nsRect newDim(0, 0, aWidth, aHeight);
363
    //mRootView->GetDimensions(oldDim);
364
    //if (oldDim != newDim) {
365
      mRootView->SetDimensions(newDim);
366
      if (mObserver)
367
        mObserver->ResizeReflow(mRootView, aWidth, aHeight);
368
    //}
369
  }
370
371
360
public: // NOT in nsIViewManager, so private to the view module
372
public: // NOT in nsIViewManager, so private to the view module
361
  nsView* GetRootView() const { return mRootView; }
373
  nsView* GetRootView() const { return mRootView; }
362
  nsView* GetMouseEventGrabber() const;
374
  nsView* GetMouseEventGrabber() const;
363
	nsView* GetKeyEventGrabber() const { return mKeyGrabber; }
375
	nsView* GetKeyEventGrabber() const { return mKeyGrabber; }
364
376
365
  nsEventStatus HandleEvent(nsView* aView, nsGUIEvent* aEvent, PRBool aCaptured);
377
  nsEventStatus HandleEvent(nsView* aView, nsGUIEvent* aEvent, PRBool aCaptured);
366
378
367
  /**
379
  /**
368
   * Called to inform the view manager that a view has scrolled.
380
   * Called to inform the view manager that a view has scrolled.
369
   * The view manager will invalidate any widgets which may need
381
   * The view manager will invalidate any widgets which may need
370
   * to be rerendered.
382
   * to be rerendered.
371
   * @param aView view to paint. should be root view
383
   * @param aView view to paint. should be root view
 Lines 386-409   private: Link Here 
386
  nsIDeviceContext  *mContext;
398
  nsIDeviceContext  *mContext;
387
  float             mTwipsToPixels;
399
  float             mTwipsToPixels;
388
  float             mPixelsToTwips;
400
  float             mPixelsToTwips;
389
  nsIViewObserver   *mObserver;
401
  nsIViewObserver   *mObserver;
390
  nsView            *mMouseGrabber;
402
  nsView            *mMouseGrabber;
391
  nsView            *mKeyGrabber;
403
  nsView            *mKeyGrabber;
392
  PRInt32           mUpdateCnt;
404
  PRInt32           mUpdateCnt;
393
  PRInt32           mUpdateBatchCnt;
405
  PRInt32           mUpdateBatchCnt;
394
  nsIScrollableView *mRootScrollable;
406
  nsIScrollableView *mRootScrollable;
395
  PRInt32           mCachingWidgetChanges;
407
  PRInt32           mCachingWidgetChanges;
396
  nscolor           mDefaultBackgroundColor;
408
  nscolor           mDefaultBackgroundColor;
397
  nsPoint           mMouseLocation; // device units, relative to mRootView
409
  nsPoint           mMouseLocation; // device units, relative to mRootView
410
411
  // A rect storing the size for a resize that we delayed until the root
412
  // view becomes visible again.
413
  nsSize            mDelayedResize;
414
398
  nsCOMPtr<nsIBlender> mBlender;
415
  nsCOMPtr<nsIBlender> mBlender;
399
  nsISupportsArray  *mCompositeListeners;
416
  nsISupportsArray  *mCompositeListeners;
400
  nsCOMPtr<nsIFactory> mRegionFactory;
417
  nsCOMPtr<nsIFactory> mRegionFactory;
401
  nsView            *mRootView;
418
  nsView            *mRootView;
402
  nsCOMPtr<nsIEventQueueService>  mEventQueueService;
419
  nsCOMPtr<nsIEventQueueService>  mEventQueueService;
403
  nsCOMPtr<nsIEventQueue>         mInvalidateEventQueue;
420
  nsCOMPtr<nsIEventQueue>         mInvalidateEventQueue;
404
  nsCOMPtr<nsIEventQueue>         mSynthMouseMoveEventQueue;
421
  nsCOMPtr<nsIEventQueue>         mSynthMouseMoveEventQueue;
405
  PRPackedBool      mRefreshEnabled;
422
  PRPackedBool      mRefreshEnabled;
406
  PRPackedBool      mPainting;
423
  PRPackedBool      mPainting;
407
  PRPackedBool      mRecursiveRefreshPending;
424
  PRPackedBool      mRecursiveRefreshPending;
408
  PRPackedBool      mAllowDoubleBuffering;
425
  PRPackedBool      mAllowDoubleBuffering;
409
  PRPackedBool      mHasPendingInvalidates;
426
  PRPackedBool      mHasPendingInvalidates;
(-)nsViewManager.cpp (-14 / +61 lines)
Line     Link Here 
 Lines 54-77    Link Here 
54
#include "nsCOMPtr.h"
54
#include "nsCOMPtr.h"
55
#include "nsIEventQueue.h"
55
#include "nsIEventQueue.h"
56
#include "nsIEventQueueService.h"
56
#include "nsIEventQueueService.h"
57
#include "nsIServiceManager.h"
57
#include "nsIServiceManager.h"
58
#include "nsGUIEvent.h"
58
#include "nsGUIEvent.h"
59
#include "nsIPrefBranch.h"
59
#include "nsIPrefBranch.h"
60
#include "nsIPrefService.h"
60
#include "nsIPrefService.h"
61
#include "nsRegion.h"
61
#include "nsRegion.h"
62
#include "nsInt64.h"
62
#include "nsInt64.h"
63
#include "nsScrollPortView.h"
63
#include "nsScrollPortView.h"
64
#include "nsHashtable.h"
64
#include "nsHashtable.h"
65
65
66
// XXX Hack
67
#include "nsIPresShell.h"
68
#include "nsIBaseWindow.h"
69
#include "nsPresContext.h"
70
66
static NS_DEFINE_IID(kBlenderCID, NS_BLENDER_CID);
71
static NS_DEFINE_IID(kBlenderCID, NS_BLENDER_CID);
67
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
72
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
68
static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
73
static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
69
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
74
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
70
75
71
#define ARENA_ALLOCATE(var, pool, type) \
76
#define ARENA_ALLOCATE(var, pool, type) \
72
    {void *_tmp_; PL_ARENA_ALLOCATE(_tmp_, pool, sizeof(type)); \
77
    {void *_tmp_; PL_ARENA_ALLOCATE(_tmp_, pool, sizeof(type)); \
73
    var = NS_REINTERPRET_CAST(type*, _tmp_); }
78
    var = NS_REINTERPRET_CAST(type*, _tmp_); }
74
/**
79
/**
75
   XXX TODO XXX
80
   XXX TODO XXX
76
81
77
   DeCOMify newly private methods
82
   DeCOMify newly private methods
 Lines 403-426   static PRInt32 CompareZIndex(PRInt32 aZI Link Here 
403
                             PRInt32 aZIndex2, PRBool aTopMost2, PRBool aIsAuto2) 
408
                             PRInt32 aZIndex2, PRBool aTopMost2, PRBool aIsAuto2) 
404
{
409
{
405
  NS_ASSERTION(!aIsAuto1 || aZIndex1 == 0,"auto is set and the z-index is not 0");
410
  NS_ASSERTION(!aIsAuto1 || aZIndex1 == 0,"auto is set and the z-index is not 0");
406
  NS_ASSERTION(!aIsAuto2 || aZIndex2 == 0,"auto is set and the z-index is not 0");
411
  NS_ASSERTION(!aIsAuto2 || aZIndex2 == 0,"auto is set and the z-index is not 0");
407
412
408
  if (aZIndex1 != aZIndex2) {
413
  if (aZIndex1 != aZIndex2) {
409
    return aZIndex1 - aZIndex2;
414
    return aZIndex1 - aZIndex2;
410
  } else {
415
  } else {
411
    return aTopMost1 - aTopMost2;
416
    return aTopMost1 - aTopMost2;
412
  }
417
  }
413
}
418
}
414
419
420
static PRBool IsViewVisible(nsView *aView)
421
{
422
  for (nsIView *view = aView; view; view = view->GetParent()) {
423
    if (view->GetVisibility() == nsViewVisibility_kHide)
424
      return PR_FALSE;
425
#if 0
426
    if (view->HasWidget()) {
427
      PRBool visible = PR_TRUE;
428
      view->GetWidget()->IsVisible(visible);
429
      if (!visible)
430
        return PR_FALSE;
431
    }
432
#endif
433
  }
434
  // Find out if the root view is visible by asking the docshell (this
435
  // won't be needed anymore if we link view trees across chrome / content
436
  // boundaries.
437
  nsCOMPtr<nsIViewObserver> vo;
438
  aView->GetViewManager()->GetViewObserver(*getter_AddRefs(vo));
439
  nsCOMPtr<nsIPresShell> shell = do_QueryInterface(vo);
440
  if (!shell)
441
    return PR_FALSE;
442
  nsCOMPtr<nsISupports> container = shell->GetPresContext()->GetContainer();
443
  nsCOMPtr<nsIBaseWindow> bw = do_QueryInterface(container);
444
  if (!bw)
445
    return PR_FALSE;
446
  PRBool res = PR_TRUE;
447
  bw->GetVisibility(&res);
448
  return res;
449
}
450
415
void
451
void
416
nsViewManager::PostInvalidateEvent()
452
nsViewManager::PostInvalidateEvent()
417
{
453
{
418
  nsCOMPtr<nsIEventQueue> eventQueue;
454
  nsCOMPtr<nsIEventQueue> eventQueue;
419
  mEventQueueService->GetSpecialEventQueue(
455
  mEventQueueService->GetSpecialEventQueue(
420
    nsIEventQueueService::UI_THREAD_EVENT_QUEUE, getter_AddRefs(eventQueue));
456
    nsIEventQueueService::UI_THREAD_EVENT_QUEUE, getter_AddRefs(eventQueue));
421
  NS_ASSERTION(nsnull != eventQueue, "Event queue is null");
457
  NS_ASSERTION(nsnull != eventQueue, "Event queue is null");
422
458
423
  if (eventQueue != mInvalidateEventQueue) {
459
  if (eventQueue != mInvalidateEventQueue) {
424
    nsInvalidateEvent* ev = new nsInvalidateEvent(this);
460
    nsInvalidateEvent* ev = new nsInvalidateEvent(this);
425
    eventQueue->PostEvent(ev);
461
    eventQueue->PostEvent(ev);
426
    mInvalidateEventQueue = eventQueue;
462
    mInvalidateEventQueue = eventQueue;
 Lines 429-452   nsViewManager::PostInvalidateEvent() Link Here 
429
465
430
#undef DEBUG_MOUSE_LOCATION
466
#undef DEBUG_MOUSE_LOCATION
431
467
432
PRInt32 nsViewManager::mVMCount = 0;
468
PRInt32 nsViewManager::mVMCount = 0;
433
nsIRenderingContext* nsViewManager::gCleanupContext = nsnull;
469
nsIRenderingContext* nsViewManager::gCleanupContext = nsnull;
434
470
435
// Weakly held references to all of the view managers
471
// Weakly held references to all of the view managers
436
nsVoidArray* nsViewManager::gViewManagers = nsnull;
472
nsVoidArray* nsViewManager::gViewManagers = nsnull;
437
PRUint32 nsViewManager::gLastUserEventTime = 0;
473
PRUint32 nsViewManager::gLastUserEventTime = 0;
438
474
439
nsViewManager::nsViewManager()
475
nsViewManager::nsViewManager()
440
  : mMouseLocation(NSCOORD_NONE, NSCOORD_NONE)
476
  : mMouseLocation(NSCOORD_NONE, NSCOORD_NONE)
477
  , mDelayedResize(NSCOORD_NONE, NSCOORD_NONE)
441
{
478
{
442
  if (gViewManagers == nsnull) {
479
  if (gViewManagers == nsnull) {
443
    NS_ASSERTION(mVMCount == 0, "View Manager count is incorrect");
480
    NS_ASSERTION(mVMCount == 0, "View Manager count is incorrect");
444
    // Create an array to hold a list of view managers
481
    // Create an array to hold a list of view managers
445
    gViewManagers = new nsVoidArray;
482
    gViewManagers = new nsVoidArray;
446
  }
483
  }
447
 
484
 
448
  if (gCleanupContext == nsnull) {
485
  if (gCleanupContext == nsnull) {
449
    /* XXX: This should use a device to create a matching |nsIRenderingContext| object */
486
    /* XXX: This should use a device to create a matching |nsIRenderingContext| object */
450
    CallCreateInstance(kRenderingContextCID, &gCleanupContext);
487
    CallCreateInstance(kRenderingContextCID, &gCleanupContext);
451
    NS_ASSERTION(gCleanupContext,
488
    NS_ASSERTION(gCleanupContext,
452
                 "Wasn't able to create a graphics context for cleanup");
489
                 "Wasn't able to create a graphics context for cleanup");
 Lines 605-655   NS_IMETHODIMP nsViewManager::SetRootView Link Here 
605
      parent->InsertChild(mRootView, nsnull);
642
      parent->InsertChild(mRootView, nsnull);
606
    }
643
    }
607
644
608
    mRootView->SetZIndex(PR_FALSE, 0, PR_FALSE);
645
    mRootView->SetZIndex(PR_FALSE, 0, PR_FALSE);
609
  }
646
  }
610
647
611
  return NS_OK;
648
  return NS_OK;
612
}
649
}
613
650
614
NS_IMETHODIMP nsViewManager::GetWindowDimensions(nscoord *aWidth, nscoord *aHeight)
651
NS_IMETHODIMP nsViewManager::GetWindowDimensions(nscoord *aWidth, nscoord *aHeight)
615
{
652
{
616
  if (nsnull != mRootView) {
653
  if (nsnull != mRootView) {
617
    nsRect dim;
654
    if (mDelayedResize == nsSize(NSCOORD_NONE, NSCOORD_NONE)) {
618
    mRootView->GetDimensions(dim);
655
      nsRect dim;
619
    *aWidth = dim.width;
656
      mRootView->GetDimensions(dim);
620
    *aHeight = dim.height;
657
      *aWidth = dim.width;
658
      *aHeight = dim.height;
659
    } else {
660
      *aWidth = mDelayedResize.width;
661
      *aHeight = mDelayedResize.height;
662
    }
621
  }
663
  }
622
  else
664
  else
623
    {
665
    {
624
      *aWidth = 0;
666
      *aWidth = 0;
625
      *aHeight = 0;
667
      *aHeight = 0;
626
    }
668
    }
627
  return NS_OK;
669
  return NS_OK;
628
}
670
}
629
671
630
NS_IMETHODIMP nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight)
672
NS_IMETHODIMP nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight)
631
{
673
{
632
  // Resize the root view
674
  if (mRootView) {
633
  if (nsnull != mRootView) {
675
    if (IsViewVisible(mRootView) || mRootView->GetDimensions().IsEmpty()) {
634
    nsRect dim(0, 0, aWidth, aHeight);
676
      DoSetWindowDimensions(aWidth, aHeight);
635
    mRootView->SetDimensions(dim);
677
    } else {
678
      mDelayedResize.SizeTo(aWidth, aHeight);
679
    }
636
  }
680
  }
637
681
638
  //printf("new dims: %d %d\n", aWidth, aHeight);
639
  // Inform the presentation shell that we've been resized
640
  if (nsnull != mObserver)
641
    mObserver->ResizeReflow(mRootView, aWidth, aHeight);
642
  //printf("reflow done\n");
643
644
  return NS_OK;
682
  return NS_OK;
645
}
683
}
646
684
647
NS_IMETHODIMP nsViewManager::ResetScrolling(void)
685
NS_IMETHODIMP nsViewManager::ResetScrolling(void)
648
{
686
{
649
  if (nsnull != mRootScrollable)
687
  if (nsnull != mRootScrollable)
650
    mRootScrollable->ComputeScrollOffsets(PR_TRUE);
688
    mRootScrollable->ComputeScrollOffsets(PR_TRUE);
651
689
652
  return NS_OK;
690
  return NS_OK;
653
}
691
}
654
692
655
/* Check the prefs to see whether we should do double buffering or not... */
693
/* Check the prefs to see whether we should do double buffering or not... */
 Lines 1825-1848   NS_IMETHODIMP nsViewManager::DispatchEve Link Here 
1825
          if (NS_FAILED(CreateRegion(getter_AddRefs(region))))
1863
          if (NS_FAILED(CreateRegion(getter_AddRefs(region))))
1826
            break;
1864
            break;
1827
1865
1828
          const nsRect& damrect = *((nsPaintEvent*)aEvent)->rect;
1866
          const nsRect& damrect = *((nsPaintEvent*)aEvent)->rect;
1829
          region->SetTo(damrect.x, damrect.y, damrect.width, damrect.height);
1867
          region->SetTo(damrect.x, damrect.y, damrect.width, damrect.height);
1830
        }
1868
        }
1831
        
1869
        
1832
        if (region->IsEmpty())
1870
        if (region->IsEmpty())
1833
          break;
1871
          break;
1834
1872
1835
        // Refresh the view
1873
        // Refresh the view
1836
        if (mRefreshEnabled) {
1874
        if (mRefreshEnabled) {
1875
          // If an ancestor widget was hidden and then shown, we could
1876
          // have a delayed resize to handle.
1877
          if (view == mRootView &&
1878
              mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
1879
              IsViewVisible(view)) {
1880
            DoSetWindowDimensions(mDelayedResize.width, mDelayedResize.height);
1881
            mDelayedResize.SizeTo(NSCOORD_NONE, NSCOORD_NONE);
1882
          }
1883
1837
          Refresh(view, ((nsPaintEvent*)aEvent)->renderingContext, region,
1884
          Refresh(view, ((nsPaintEvent*)aEvent)->renderingContext, region,
1838
                  NS_VMREFRESH_DOUBLE_BUFFER);
1885
                  NS_VMREFRESH_DOUBLE_BUFFER);
1839
        } else {
1886
        } else {
1840
          // since we got an NS_PAINT event, we need to
1887
          // since we got an NS_PAINT event, we need to
1841
          // draw something so we don't get blank areas.
1888
          // draw something so we don't get blank areas.
1842
          nsRect damRect;
1889
          nsRect damRect;
1843
          region->GetBoundingBox(&damRect.x, &damRect.y, &damRect.width, &damRect.height);
1890
          region->GetBoundingBox(&damRect.x, &damRect.y, &damRect.width, &damRect.height);
1844
          float p2t;
1891
          float p2t;
1845
          p2t = mContext->DevUnitsToAppUnits();
1892
          p2t = mContext->DevUnitsToAppUnits();
1846
          damRect.ScaleRoundOut(p2t);
1893
          damRect.ScaleRoundOut(p2t);
1847
          DefaultRefresh(view, &damRect);
1894
          DefaultRefresh(view, &damRect);
1848
        
1895
        

Return to bug 227361