/**
   aRegion is given in device coordinates!!
   aContext may be null, in which case layers should be used for
   rendering.
*/
void nsViewManager::Refresh(nsView *aView, const nsIntRegion& aRegion,
                            bool aWillSendDidPaint)
{
    NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");

    // damageRegion is the damaged area, in twips, relative to the view origin
    nsRegion damageRegion = aRegion.ToAppUnits(AppUnitsPerDevPixel());
    // move region from widget coordinates into view coordinates
    damageRegion.MoveBy(-aView->ViewToWidgetOffset());

    if (damageRegion.IsEmpty()) {
#ifdef DEBUG_roc
        nsRect viewRect = aView->GetDimensions();
        nsRect damageRect = damageRegion.GetBounds();
        printf("XXX Damage rectangle (%d,%d,%d,%d) does not intersect the widget's view (%d,%d,%d,%d)!\n",
               damageRect.x, damageRect.y, damageRect.width, damageRect.height,
               viewRect.x, viewRect.y, viewRect.width, viewRect.height);
#endif
        return;
    }

    nsIWidget *widget = aView->GetWidget();
    if (!widget) {
        return;
    }

    NS_ASSERTION(!IsPainting(), "recursive painting not permitted");
    if (IsPainting()) {
        RootViewManager()->mRecursiveRefreshPending = true;
        return;
    }

    {
        nsAutoScriptBlocker scriptBlocker;
        SetPainting(true);

        NS_ASSERTION(GetDisplayRootFor(aView) == aView,
                     "Widgets that we paint must all be display roots");

        if (mPresShell) {
#ifdef DEBUG_INVALIDATIONS
            printf("--COMPOSITE-- %p\n", mPresShell);
#endif
            mPresShell->Paint(aView, damageRegion,
                              nsIPresShell::PAINT_COMPOSITE |
                              (aWillSendDidPaint ? nsIPresShell::PAINT_WILL_SEND_DID_PAINT : 0));
#ifdef DEBUG_INVALIDATIONS
            printf("--ENDCOMPOSITE--\n");
#endif
            mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT);
        }

        SetPainting(false);
    }

    if (RootViewManager()->mRecursiveRefreshPending) {
        RootViewManager()->mRecursiveRefreshPending = false;
        InvalidateAllViews();
    }
}
Exemple #2
0
void RichTxt::Paint(PageDraw& pw, RichContext rc, const PaintInfo& _pi) const
{
	PaintInfo pi = _pi;
	int parti = 0;
	int pos = 0;
	RichPara::Number n;
	while(rc.py < pi.bottom && parti < part.GetCount()) {
		if(part[parti].Is<RichTable>()) {
			pi.tablesel--;
			const RichTable& tab = GetTable(parti);
			tab.Paint(pw, rc, pi);
			rc.py = tab.GetHeight(rc);
			pi.tablesel -= tab.GetTableCount();
		}
		else {
			const Para& pp = part[parti].Get<Para>();
			if(pp.number) {
				n.TestReset(*pp.number);
				n.Next(*pp.number);
			}
			PageY next = GetNextPageY(parti, rc);
			if(next >= pi.top) {
				int nbefore = 0;
				int nline = 0;
				if(pp.keepnext && parti + 1 < part.GetCount() && part[parti + 1].Is<Para>()) {
					Sync(parti + 1, rc);
					const Para& pp = part[parti + 1].Get<Para>();
					nbefore = pp.before;
					nline = pp.linecy[0];
				}
				RichPara p = Get(parti, rc.styles);
				if(pi.spellingchecker) {
					if(!pp.checked) {
						pp.spellerrors = (*pi.spellingchecker)(p);
						pp.checked = true;
					}
				}
				else {
					pp.checked = false;
					pp.spellerrors.Clear();
				}
				if(IsPainting(pw, pi.zoom, rc.page, rc.py, next))
					p.Paint(pw, rc.page, rc.py, pi, n, pp.spellerrors, nbefore, nline);
			}
			rc.py = next;
		}
		int l = GetPartLength(parti) + 1;
		pi.highlightpara -= l;
		pi.sell -= l;
		pi.selh -= l;
		pos += l;
		++parti;
	}
}
Exemple #3
0
void Progress::Create() {
	if(IsPainting() || IsOpen() || cancel)
		return;
	stop.Hide();
	if(owner)
		Open(owner);
	else
		Open();
	SetFocus();
	Show();
	modality.Begin(this);
	if(total) Set(pos, total);
	Setxt();
	Sync();
	Process();
}
Exemple #4
0
NS_IMETHODIMP
nsViewManager::IsPainting(bool& aIsPainting)
{
  aIsPainting = IsPainting();
  return NS_OK;
}
void
nsViewManager::IsPainting(bool& aIsPainting)
{
    aIsPainting = IsPainting();
}
Exemple #6
0
bool Draw::IsPainting(int x, int y, int cx, int cy) const
{
	return IsPainting(RectC(x, y, cx, cy));
}