mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-02 20:20:00 +00:00
Fix problem with MDG not allowing calculated values to write to readonly instance nodes. Bug 280823, r=aaronr+smaug
This commit is contained in:
parent
9179f0a5b4
commit
100ff910cf
@ -367,7 +367,10 @@ nsXFormsMDGEngine::Recalculate(nsXFormsMDGSet* aChangedNodes)
|
|||||||
rv = xpath_res->GetStringValue(nodeval);
|
rv = xpath_res->GetStringValue(nodeval);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = SetNodeValue(g->mContextNode, nodeval, PR_FALSE, nsnull);
|
rv = SetNodeValueInternal(g->mContextNode,
|
||||||
|
nodeval,
|
||||||
|
PR_FALSE,
|
||||||
|
PR_TRUE);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
NS_ENSURE_TRUE(aChangedNodes->AddNode(g->mContextNode),
|
NS_ENSURE_TRUE(aChangedNodes->AddNode(g->mContextNode),
|
||||||
NS_ERROR_FAILURE);
|
NS_ERROR_FAILURE);
|
||||||
@ -609,8 +612,21 @@ nsXFormsMDGEngine::GetNodeValue(nsIDOMNode *aContextNode,
|
|||||||
nsresult
|
nsresult
|
||||||
nsXFormsMDGEngine::SetNodeValue(nsIDOMNode *aContextNode,
|
nsXFormsMDGEngine::SetNodeValue(nsIDOMNode *aContextNode,
|
||||||
const nsAString &aNodeValue,
|
const nsAString &aNodeValue,
|
||||||
PRBool aMarkNode,
|
|
||||||
PRBool *aNodeChanged)
|
PRBool *aNodeChanged)
|
||||||
|
{
|
||||||
|
return SetNodeValueInternal(aContextNode,
|
||||||
|
aNodeValue,
|
||||||
|
PR_TRUE,
|
||||||
|
PR_FALSE,
|
||||||
|
aNodeChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsXFormsMDGEngine::SetNodeValueInternal(nsIDOMNode *aContextNode,
|
||||||
|
const nsAString &aNodeValue,
|
||||||
|
PRBool aMarkNode,
|
||||||
|
PRBool aIsCalculate,
|
||||||
|
PRBool *aNodeChanged)
|
||||||
{
|
{
|
||||||
if (aNodeChanged) {
|
if (aNodeChanged) {
|
||||||
*aNodeChanged = PR_FALSE;
|
*aNodeChanged = PR_FALSE;
|
||||||
@ -619,7 +635,9 @@ nsXFormsMDGEngine::SetNodeValue(nsIDOMNode *aContextNode,
|
|||||||
const nsXFormsNodeState* ns = GetNodeState(aContextNode);
|
const nsXFormsNodeState* ns = GetNodeState(aContextNode);
|
||||||
NS_ENSURE_TRUE(ns, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(ns, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
if (ns->IsReadonly()) {
|
// If the node is read-only and not set by a @calculate MIP,
|
||||||
|
// ignore the call
|
||||||
|
if (ns->IsReadonly() && !aIsCalculate) {
|
||||||
///
|
///
|
||||||
/// @todo Better feedback for readonly nodes? (XXX)
|
/// @todo Better feedback for readonly nodes? (XXX)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -313,6 +313,20 @@ protected:
|
|||||||
*/
|
*/
|
||||||
nsresult Invalidate();
|
nsresult Invalidate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of a node.
|
||||||
|
|
||||||
|
* @param aContextNode The node to set the value for
|
||||||
|
* @param aNodeValue The value
|
||||||
|
* @param aMarkNode Whether to mark node as changed
|
||||||
|
* @param aNodeChanged Was node changed?
|
||||||
|
* @param aIsCalculate Is it a @calculate setting the value?
|
||||||
|
*/
|
||||||
|
nsresult SetNodeValueInternal(nsIDOMNode *aContextNode,
|
||||||
|
const nsAString &aNodeValue,
|
||||||
|
PRBool aMarkNode = PR_TRUE,
|
||||||
|
PRBool aIsCalculate = PR_FALSE,
|
||||||
|
PRBool *aNodeChanged = nsnull);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -382,16 +396,14 @@ public:
|
|||||||
nsresult MarkNodeAsChanged(nsIDOMNode *aContextNode);
|
nsresult MarkNodeAsChanged(nsIDOMNode *aContextNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of a node. (used by nsXFormsMDG)
|
* Set the value of a node -- the public version of SetNodeValueInternal().
|
||||||
|
*
|
||||||
* @param aContextNode The node to set the value for
|
* @param aContextNode The node to set the value for
|
||||||
* @param aNodeValue The value
|
* @param aNodeValue The value
|
||||||
* @param aMarkNode Whether to mark node as changed
|
|
||||||
* @param aNodeChanged Was node changed?
|
* @param aNodeChanged Was node changed?
|
||||||
*/
|
*/
|
||||||
nsresult SetNodeValue(nsIDOMNode *aContextNode,
|
nsresult SetNodeValue(nsIDOMNode *aContextNode,
|
||||||
const nsAString &aNodeValue,
|
const nsAString &aNodeValue,
|
||||||
PRBool aMarkNode = PR_TRUE,
|
|
||||||
PRBool *aNodeChanged = nsnull);
|
PRBool *aNodeChanged = nsnull);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -841,7 +841,6 @@ nsXFormsModelElement::SetNodeValue(nsIDOMNode *aContextNode,
|
|||||||
{
|
{
|
||||||
return mMDG.SetNodeValue(aContextNode,
|
return mMDG.SetNodeValue(aContextNode,
|
||||||
aNodeValue,
|
aNodeValue,
|
||||||
PR_TRUE,
|
|
||||||
aNodeChanged);
|
aNodeChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user