[XForms] repeat doesn't update on value change. Bug 362308, r=surkov+olli

This commit is contained in:
aaronr%us.ibm.com 2007-03-16 02:06:06 +00:00
parent 851a527ed4
commit 24bb1112c5
6 changed files with 52 additions and 5 deletions

View File

@ -49,7 +49,7 @@ interface nsIDOMElement;
/**
* Interface implemented by all XForms form control classes.
*/
[uuid(8c84afe1-e071-4d45-b3da-c5aa93154343)]
[uuid(eb02b76b-6df8-4633-8c53-e86101273339)]
interface nsIXFormsControl : nsIXFormsContextControl
{
/**
@ -104,6 +104,12 @@ interface nsIXFormsControl : nsIXFormsContextControl
*/
readonly attribute boolean usesModelBinding;
/**
* Is true when the control uses single node binding. Will return false
* when the control uses node-set binding (i.e. repeat and itemset).
*/
readonly attribute boolean usesSingleNodeBinding;
/**
* These represent the default intrinsic states for controls when they are
* enabled and disabled.

View File

@ -268,6 +268,13 @@ nsXFormsControlStub::GetUsesModelBinding(PRBool *aRes)
return NS_OK;
}
NS_IMETHODIMP
nsXFormsControlStub::GetUsesSingleNodeBinding(PRBool *aRes)
{
*aRes = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsXFormsControlStub::GetOnDeferredBindList(PRBool *aOnList)
{

View File

@ -107,6 +107,7 @@ public:
NS_IMETHOD TryFocus(PRBool* aOK);
NS_IMETHOD IsEventTarget(PRBool *aOK);
NS_IMETHOD GetUsesModelBinding(PRBool *aRes);
NS_IMETHOD GetUsesSingleNodeBinding(PRBool *aRes);
NS_IMETHOD GetDefaultIntrinsicState(PRInt32 *aRes);
NS_IMETHOD GetDisabledIntrinsicState(PRInt32 *aRes);

View File

@ -72,6 +72,7 @@ public:
// nsIXFormsControlBase overrides
NS_IMETHOD Bind(PRBool *aContextChanged);
NS_IMETHOD Refresh();
NS_IMETHOD GetUsesSingleNodeBinding(PRBool *aUsesSNB);
// nsIXFormsSelectChild
NS_DECL_NSIXFORMSSELECTCHILD
@ -342,6 +343,15 @@ nsXFormsItemSetElement::Refresh()
return NS_OK;
}
NS_IMETHODIMP
nsXFormsItemSetElement::GetUsesSingleNodeBinding(PRBool *aUsesSNB)
{
NS_ENSURE_ARG_POINTER(aUsesSNB);
*aUsesSNB = PR_FALSE;
return NS_OK;
}
NS_HIDDEN_(nsresult)
NS_NewXFormsItemSetElement(nsIXTFElement **aResult)
{

View File

@ -1226,10 +1226,24 @@ nsXFormsModelElement::RefreshSubTree(nsXFormsControlListItem *aCurrent,
nsCOMArray<nsIDOMNode> *deps = nsnull;
if (usesModelBinding) {
if (!boundNode) {
// If a control uses a model binding, but has no bound node a
// rebuild is the only thing that'll (eventually) change it
current = current->NextSibling();
continue;
PRBool usesSNB = PR_TRUE;
control->GetUsesSingleNodeBinding(&usesSNB);
// If the control doesn't use single node binding (and can thus be
// bound to many nodes), the above test for boundNode means nothing.
// We'll need to continue on with the work this function does so that
// any controls that this control contains can be tested for whether
// they may need to refresh.
if (usesSNB) {
// If a control uses a model binding, but has no bound node a
// rebuild is the only thing that'll (eventually) change it. We
// don't need to worry about contained controls (like a label)
// since the fact that there is no bound node means that this
// control (and contained controls) need to behave as if
// irrelevant per spec.
current = current->NextSibling();
continue;
}
}
} else {
// Get dependencies

View File

@ -347,6 +347,7 @@ public:
NS_IMETHOD Refresh();
NS_IMETHOD TryFocus(PRBool* aOK);
NS_IMETHOD IsEventTarget(PRBool *aOK);
NS_IMETHOD GetUsesSingleNodeBinding(PRBool *aUsesSNB);
// nsIXFormsRepeatElement
NS_DECL_NSIXFORMSREPEATELEMENT
@ -1261,6 +1262,14 @@ nsXFormsRepeatElement::IsEventTarget(PRBool *aOK)
return NS_OK;
}
NS_IMETHODIMP
nsXFormsRepeatElement::GetUsesSingleNodeBinding(PRBool *aUsesSNB)
{
NS_ENSURE_ARG_POINTER(aUsesSNB);
*aUsesSNB = PR_FALSE;
return NS_OK;
}
/**
* @todo This function will be part of the general schema support, so it will
* only live here until this is implemented there. (XXX)