Esempio n. 1
0
void
nsViewManager::ProcessPendingUpdates()
{
  if (!IsRootVM()) {
    RootViewManager()->ProcessPendingUpdates();
    return;
  }

  if (IsRefreshDriverPaintingEnabled()) {
    mPresShell->GetPresContext()->RefreshDriver()->RevokeViewManagerFlush();
    if (mHasPendingUpdates) {
      mHasPendingUpdates = false;
      
      // Flush things like reflows and plugin widget geometry updates by
      // calling WillPaint on observer presShells.
      if (mPresShell) {
        CallWillPaintOnObservers(true);
      }
      ProcessPendingUpdatesForView(mRootView, true);
      CallDidPaintOnObserver();
    }
  } else if (mHasPendingUpdates) {
    ProcessPendingUpdatesForView(mRootView, true);
    mHasPendingUpdates = false;
  }
}
Esempio n. 2
0
void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
                                                 bool aFlushDirtyRegion)
{
  NS_ASSERTION(IsRootVM(), "Updates will be missed");

  // Protect against a null-view.
  if (!aView) {
    return;
  }

  if (aView->HasWidget()) {
    aView->ResetWidgetBounds(false, true);
  }

  // process pending updates in child view.
  for (nsView* childView = aView->GetFirstChild(); childView;
       childView = childView->GetNextSibling()) {
    ProcessPendingUpdatesForView(childView, aFlushDirtyRegion);
  }

  // Push out updates after we've processed the children; ensures that
  // damage is applied based on the final widget geometry
  if (aFlushDirtyRegion) {
    FlushDirtyRegionToWidget(aView);
  }
}
Esempio n. 3
0
void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
        bool aFlushDirtyRegion)
{
    NS_ASSERTION(IsRootVM(), "Updates will be missed");

    // Protect against a null-view.
    if (!aView) {
        return;
    }

    if (aView->HasWidget()) {
        aView->ResetWidgetBounds(false, true);
    }

    // process pending updates in child view.
    for (nsView* childView = aView->GetFirstChild(); childView;
            childView = childView->GetNextSibling()) {
        ProcessPendingUpdatesForView(childView, aFlushDirtyRegion);
    }

    // Push out updates after we've processed the children; ensures that
    // damage is applied based on the final widget geometry
    if (aFlushDirtyRegion) {
        nsIWidget *widget = aView->GetWidget();
        if (widget && widget->NeedsPaint()) {
            // If an ancestor widget was hidden and then shown, we could
            // have a delayed resize to handle.
            for (nsViewManager *vm = this; vm;
                    vm = vm->mRootView->GetParent()
                         ? vm->mRootView->GetParent()->GetViewManager()
                         : nullptr) {
                if (vm->mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
                        vm->mRootView->IsEffectivelyVisible() &&
                        mPresShell && mPresShell->IsVisible()) {
                    vm->FlushDelayedResize(true);
                    vm->InvalidateView(vm->mRootView);
                }
            }

            NS_ASSERTION(aView->HasWidget(), "Must have a widget!");

#ifdef DEBUG_INVALIDATIONS
            printf("---- PAINT START ----PresShell(%p), nsView(%p), nsIWidget(%p)\n", mPresShell, aView, widget);
#endif
            nsAutoScriptBlocker scriptBlocker;
            NS_ASSERTION(aView->HasWidget(), "Must have a widget!");
            aView->GetWidget()->WillPaint();
            SetPainting(true);
            mPresShell->Paint(aView, nsRegion(),
                              nsIPresShell::PAINT_LAYERS |
                              nsIPresShell::PAINT_WILL_SEND_DID_PAINT);
#ifdef DEBUG_INVALIDATIONS
            printf("---- PAINT END ----\n");
#endif
            aView->SetForcedRepaint(false);
            SetPainting(false);
        }
        FlushDirtyRegionToWidget(aView);
    }
}
Esempio n. 4
0
bool
nsViewManager::ProcessPendingUpdates()
{
  if (!IsRootVM()) {
    return RootViewManager()->ProcessPendingUpdates();
  }

  mPresShell->GetPresContext()->RefreshDriver()->RevokeViewManagerFlush();
  return ProcessPendingUpdatesForView(mRootView, true);
}
void
nsViewManager::ProcessPendingUpdates()
{
  if (!IsRootVM()) {
    RootViewManager()->ProcessPendingUpdates();
    return;
  }

  if (IsRefreshDriverPaintingEnabled()) {
    mPresShell->GetPresContext()->RefreshDriver()->RevokeViewManagerFlush();
      
    // Flush things like reflows by calling WillPaint on observer presShells.
    if (mPresShell) {
      CallWillPaintOnObservers(true);
    }
    ProcessPendingUpdatesForView(mRootView, true);
  } else {
    ProcessPendingUpdatesForView(mRootView, true);
  }
}
Esempio n. 6
0
void
nsViewManager::UpdateWidgetGeometry()
{
  if (!IsRootVM()) {
    RootViewManager()->UpdateWidgetGeometry();
    return;
  }

  if (mHasPendingWidgetGeometryChanges) {
    ProcessPendingUpdatesForView(mRootView, false);
    mHasPendingWidgetGeometryChanges = false;
  }
}
Esempio n. 7
0
void
nsViewManager::ProcessPendingUpdates()
{
  if (!IsRootVM()) {
    RootViewManager()->ProcessPendingUpdates();
    return;
  }

  if (mHasPendingUpdates) {
    ProcessPendingUpdatesForView(mRootView, true);
    mHasPendingUpdates = false;
  }
}
Esempio n. 8
0
bool nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
                                                 bool aFlushDirtyRegion)
{
  NS_ASSERTION(IsRootVM(), "Updates will be missed");

  // Protect against a null-view.
  if (!aView) {
    return false;
  }

  if (aView->HasWidget()) {
    aView->ResetWidgetBounds(false, true);
  }

  // process pending updates in child view.
  bool skipped = false;
  for (nsView* childView = aView->GetFirstChild(); childView;
       childView = childView->GetNextSibling()) {
    skipped |= ProcessPendingUpdatesForView(childView, aFlushDirtyRegion);
  }

  // Push out updates after we've processed the children; ensures that
  // damage is applied based on the final widget geometry
  if (aFlushDirtyRegion) {
    nsIWidget *widget = aView->GetWidget();
    if (widget && widget->NeedsPaint()) {
      if (aView->PendingRefresh() && aView->SkippedPaints() < 5) {
        aView->SkippedPaint();
        skipped = true;
      } else {
        aView->ClearSkippedPaints();
        aView->SetPendingRefresh(false);
        widget->SetNeedsPaint(false);
        SetPainting(true);
#ifdef DEBUG_INVALIDATIONS
        printf("---- PAINT START ----PresShell(%p), nsView(%p), nsIWidget(%p)\n", mPresShell, aView, widget);
#endif
        nsAutoScriptBlocker scriptBlocker;
        mPresShell->Paint(aView, nsRegion(), nsIPresShell::PaintType_NoComposite, false);
#ifdef DEBUG_INVALIDATIONS
        printf("---- PAINT END ----\n");
#endif
        SetPainting(false);
      }
    }
    FlushDirtyRegionToWidget(aView);
  }
  return skipped;
}
void
nsViewManager::UpdateWidgetGeometry()
{
  if (!IsRootVM()) {
    RootViewManager()->UpdateWidgetGeometry();
    return;
  }

  if (mHasPendingWidgetGeometryChanges) {
    if (IsRefreshDriverPaintingEnabled()) {
      mHasPendingWidgetGeometryChanges = false;
    }
    ProcessPendingUpdatesForView(mRootView, false);
    if (!IsRefreshDriverPaintingEnabled()) {
      mHasPendingWidgetGeometryChanges = false;
    }
  }
}