Separate refresh from revalidate in nsXFormsModelElement (bug 279059). Patch by allan@beaufour.dk, r=aaronr@us.ibm.com, sr=me.

This commit is contained in:
bryner%brianryner.com 2005-02-01 20:23:41 +00:00
Родитель 22c76f166e
Коммит 28ecb4e167
2 изменённых файлов: 21 добавлений и 7 удалений

Просмотреть файл

@ -446,6 +446,8 @@ nsXFormsModelElement::Rebuild()
// TODO: Clear graph and re-attach elements
mControlsNeedingRefresh.Clear();
// 1 . Clear graph
nsresult rv;
rv = mMDG.Clear();
@ -635,9 +637,8 @@ nsXFormsModelElement::Revalidate()
}
if (rebind || refresh) {
DispatchEvents(control, boundNode);
///
/// @todo Should be moved to Refresh() (XXX)
control->Refresh();
if (mControlsNeedingRefresh.IndexOf(control) == -1)
mControlsNeedingRefresh.AppendElement(control);
}
}
@ -654,9 +655,15 @@ nsXFormsModelElement::Refresh()
printf("nsXFormsModelElement::Refresh()\n");
#endif
/// @todo Any refreshing is for the moment done in Revalidate(), so we do
/// not need to do anything here. But the refreshing part should probably
/// be moved to Refresh()... (XXX)
PRInt32 controlCount = mControlsNeedingRefresh.Count();
for (PRInt32 i = 0; i < controlCount; ++i) {
nsIXFormsControl* control = NS_STATIC_CAST(nsIXFormsControl*,
mControlsNeedingRefresh[i]);
if (control)
control->Refresh();
}
mControlsNeedingRefresh.Clear();
return NS_OK;
}
@ -753,6 +760,7 @@ NS_IMETHODIMP
nsXFormsModelElement::RemoveFormControl(nsIXFormsControl *aControl)
{
mFormControls.RemoveElement(aControl);
mControlsNeedingRefresh.RemoveElement(aControl);
return NS_OK;
}

Просмотреть файл

@ -145,9 +145,15 @@ private:
/** The MDG for this model */
nsXFormsMDGEngine mMDG;
/** List of changed nodes, ie. nodes that have not been informed about changes yet */
/**
* List of changed nodes, ie. nodes that have not been informed about
* changes yet
*/
nsXFormsMDGSet mChangedNodes;
/* Controls that need to a Refresh() */
nsVoidArray mControlsNeedingRefresh;
// This flag indicates whether or not the document fired DOMContentLoaded
PRBool mDocumentLoaded;
};