[XForms] UI dependencies not working for index() changes. Bug 335525, r=smaug+doronr
git-svn-id: svn://10.0.0.236/trunk@198316 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -47,7 +47,7 @@ interface nsIDOMNode;
|
||||
* Private interface implemented by the model element for other
|
||||
* elements to use.
|
||||
*/
|
||||
[uuid(3efcd516-387a-4d8b-bbeb-2fcc9a930814)]
|
||||
[uuid(74238f22-d112-4bed-a8dc-cc228df52c2e)]
|
||||
interface nsIModelElementPrivate : nsIXFormsModelElement
|
||||
{
|
||||
/**
|
||||
@@ -207,4 +207,12 @@ interface nsIModelElementPrivate : nsIXFormsModelElement
|
||||
* event has been fired on the XForms document.
|
||||
*/
|
||||
readonly attribute boolean hasDOMContentFired;
|
||||
|
||||
/**
|
||||
* Force rebinding (and refreshing) of a control. Also handles rebinding and
|
||||
* refreshing of child controls, if necessary.
|
||||
*
|
||||
* @param control The control to rebind.
|
||||
*/
|
||||
void forceRebind(in nsIXFormsControl control);
|
||||
};
|
||||
|
||||
@@ -2540,6 +2540,26 @@ nsXFormsModelElement::GetHasDOMContentFired(PRBool *aLoaded)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsModelElement::ForceRebind(nsIXFormsControl* aControl)
|
||||
{
|
||||
if (!aControl) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsXFormsControlListItem* controlItem = mFormControls.FindControl(aControl);
|
||||
NS_ENSURE_STATE(controlItem);
|
||||
|
||||
PRBool rebindChildren;
|
||||
nsresult rv = aControl->Bind(&rebindChildren);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aControl->Refresh();
|
||||
// XXX: no rv-check, see bug 336608
|
||||
|
||||
// Refresh children
|
||||
return RefreshSubTree(controlItem->FirstChild(), rebindChildren);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsXFormsModelElement::Startup()
|
||||
|
||||
@@ -573,6 +573,7 @@ nsXFormsRepeatElement::RemoveIndexUser(nsIXFormsControl *aControl)
|
||||
NS_IMETHODIMP
|
||||
nsXFormsRepeatElement::IndexHasChanged()
|
||||
{
|
||||
NS_ENSURE_STATE(mModel);
|
||||
///
|
||||
/// @bug We need to handle \<bind\> elements too (XXX)
|
||||
|
||||
@@ -580,17 +581,11 @@ nsXFormsRepeatElement::IndexHasChanged()
|
||||
// they are rebound and refreshed().
|
||||
nsCOMArray<nsIXFormsControl> indexes(mIndexUsers);
|
||||
|
||||
PRBool contextChange;
|
||||
nsresult rv;
|
||||
for (PRInt32 i = 0; i < indexes.Count(); ++i) {
|
||||
nsCOMPtr<nsIXFormsControl> control = indexes[i];
|
||||
rv = control->Bind(&contextChange);
|
||||
rv = mModel->ForceRebind(control);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = control->Refresh();
|
||||
if (contextChange) {
|
||||
// XXX: bug 335525
|
||||
NS_WARNING("Need to refresh children of index() user!\n");
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
Reference in New Issue
Block a user