[XForms] bug 396179 - cannot insert elements from xforms namespace using origin attribute on insert element, r=me, Olli.Pettay, patch by Merle Sterling

This commit is contained in:
surkov.alexander%gmail.com 2007-10-04 07:26:15 +00:00
Родитель 9bcd257405
Коммит 3575308549
2 изменённых файлов: 7 добавлений и 30 удалений

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

@ -2500,28 +2500,12 @@ nsXFormsUtils::GetModelFromNode(nsIDOMNode *aNode, nsIDOMNode **aModel)
nsXFormsUtils::IsNodeAssocWithModel(nsIDOMNode *aNode, nsIDOMNode *aModel)
{
nsCOMPtr<nsIDOMNode> modelNode;
nsAutoString namespaceURI;
aNode->GetNamespaceURI(namespaceURI);
// If the node is in the XForms namespace and XTF based, then it should
// be able to be handled by GetModel. Otherwise it is probably an instance
// node in a instance document.
if (namespaceURI.EqualsLiteral(NS_NAMESPACE_XFORMS)) {
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);
nsCOMPtr<nsIModelElementPrivate> modelPriv = GetModel(element);
modelNode = do_QueryInterface(modelPriv);
} else {
// We are assuming that if the node coming in isn't a proper XForms element,
// then it is an instance element in an instance doc. Now we just have
// to determine if the given model contains this instance document.
nsCOMPtr<nsIDOMNode> instNode;
nsresult rv =
nsXFormsUtils::GetInstanceNodeForData(aNode, getter_AddRefs(instNode));
if (NS_SUCCEEDED(rv) && instNode) {
instNode->GetParentNode(getter_AddRefs(modelNode));
}
// Determine if the given model contains this instance document.
nsCOMPtr<nsIDOMNode> modelNode, instNode;
nsresult rv =
nsXFormsUtils::GetInstanceNodeForData(aNode, getter_AddRefs(instNode));
if (NS_SUCCEEDED(rv) && instNode) {
instNode->GetParentNode(getter_AddRefs(modelNode));
}
return modelNode && (modelNode == aModel);

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

@ -674,14 +674,7 @@ public:
* instance() function.
* The provided node can be an instance node from an instance
* document and thus be associated to the model in that way (model elements
* contain instance elements). Otherwise the node will be an XForms element
* that was used as the context node of the XPath expression (i.e the
* XForms control has an attribute that contains an XPath expression).
* Form controls are associated with model elements either explicitly through
* single-node binding or implicitly (if model cannot by calculated, it
* will use the first model element encountered in the document). The model
* can also be inherited from a containing element like xforms:group or
* xforms:repeat.
* contain instance elements).
*/
static NS_HIDDEN_(PRBool) IsNodeAssocWithModel(nsIDOMNode *aNode,
nsIDOMNode *aModel);