@@ -200,9 +200,9 @@ void nsViewManager::FlushDelayedResize() {
200
200
201
201
// Convert aIn from being relative to and in appunits of aFromView, to being
202
202
// relative to and in appunits of aToView.
203
- static nsRegion ConvertRegionBetweenViews (const nsRegion & aIn,
204
- nsView* aFromView, nsView* aToView) {
205
- nsRegion out = aIn;
203
+ static nsRect ConvertRectBetweenViews (const nsRect & aIn, nsView* aFromView ,
204
+ nsView* aToView) {
205
+ nsRect out = aIn;
206
206
out.MoveBy (aFromView->GetOffsetTo (aToView));
207
207
out = out.ScaleToOtherAppUnitsRoundOut (
208
208
aFromView->GetViewManager ()->AppUnitsPerDevPixel (),
@@ -413,33 +413,20 @@ void nsViewManager::FlushDirtyRegionToWidget(nsView* aView) {
413
413
NS_ASSERTION (aView->GetViewManager () == this,
414
414
"FlushDirtyRegionToWidget called on view we don't own");
415
415
416
- if (!aView->HasNonEmptyDirtyRegion ()) {
416
+ if (!aView->IsDirty ()) {
417
417
return ;
418
418
}
419
419
420
- nsRegion& dirtyRegion = aView->GetDirtyRegion ();
420
+ const nsRect dirtyRegion = aView->GetDimensions ();
421
421
nsView* nearestViewWithWidget = aView;
422
422
while (!nearestViewWithWidget->HasWidget () &&
423
423
nearestViewWithWidget->GetParent()) {
424
424
nearestViewWithWidget = nearestViewWithWidget->GetParent ();
425
425
}
426
- nsRegion r =
427
- ConvertRegionBetweenViews (dirtyRegion, aView, nearestViewWithWidget);
428
-
426
+ nsRect r = ConvertRectBetweenViews(dirtyRegion, aView, nearestViewWithWidget);
429
427
nsViewManager* widgetVM = nearestViewWithWidget->GetViewManager ();
430
428
widgetVM->InvalidateWidgetArea (nearestViewWithWidget, r);
431
- dirtyRegion.SetEmpty();
432
- }
433
-
434
- void nsViewManager::InvalidateView (nsView* aView) {
435
- // Mark the entire view as damaged
436
- InvalidateView (aView, aView->GetDimensions ());
437
- }
438
-
439
- static void AddDirtyRegion (nsView* aView, const nsRegion& aDamagedRegion) {
440
- nsRegion& dirtyRegion = aView->GetDirtyRegion ();
441
- dirtyRegion.Or (dirtyRegion, aDamagedRegion);
442
- dirtyRegion.SimplifyOutward (8 );
429
+ aView->SetIsDirty (false );
443
430
}
444
431
445
432
void nsViewManager::PostPendingUpdate () {
@@ -500,41 +487,20 @@ static bool ShouldIgnoreInvalidation(nsViewManager* aVM) {
500
487
return false ;
501
488
}
502
489
503
- void nsViewManager::InvalidateView (nsView* aView, const nsRect& aRect ) {
490
+ void nsViewManager::InvalidateView (nsView* aView) {
504
491
// If painting is suppressed in the presshell or an ancestor drop all
505
492
// invalidates, it will invalidate everything when it unsuppresses.
506
493
if (ShouldIgnoreInvalidation (this )) {
507
494
return ;
508
495
}
509
496
510
- InvalidateViewNoSuppression (aView, aRect);
511
- }
512
-
513
- void nsViewManager::InvalidateViewNoSuppression (nsView* aView,
514
- const nsRect& aRect) {
515
- MOZ_ASSERT (nullptr != aView, " null view" );
516
-
517
497
NS_ASSERTION (aView->GetViewManager () == this,
518
- "InvalidateViewNoSuppression called on view we don't own");
498
+ "InvalidateView called on view we don't own");
519
499
520
- nsRect damagedRect (aRect);
521
- if (damagedRect.IsEmpty()) {
500
+ if (aView->GetBounds ().IsEmpty()) {
522
501
return ;
523
502
}
524
-
525
- nsView* displayRoot = GetDisplayRootFor (aView);
526
- nsViewManager* displayRootVM = displayRoot->GetViewManager ();
527
- // Propagate the update to the displayRoot, since iframes, for example,
528
- // can overlap each other and be translucent. So we have to possibly
529
- // invalidate our rect in each of the widgets we have lying about.
530
- damagedRect.MoveBy (aView->GetOffsetTo (displayRoot));
531
- int32_t rootAPD = displayRootVM->AppUnitsPerDevPixel ();
532
- int32_t APD = AppUnitsPerDevPixel ();
533
- damagedRect = damagedRect.ScaleToOtherAppUnitsRoundOut (APD, rootAPD);
534
-
535
- // accumulate this rectangle in the view's dirty region, so we can
536
- // process it later.
537
- AddDirtyRegion (displayRoot, nsRegion (damagedRect));
503
+ GetDisplayRootFor (aView)->SetIsDirty(true );
538
504
}
539
505
540
506
void nsViewManager::InvalidateAllViews () {
0 commit comments