Add a cloneNode hook for XTF (bug 280072). r+sr=jst

This commit is contained in:
bryner%brianryner.com 2005-01-28 03:49:44 +00:00
Родитель 417295f31d
Коммит d1c6e674bc
4 изменённых файлов: 27 добавлений и 4 удалений

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

@ -43,7 +43,7 @@ interface nsIDOMElement;
interface nsIDOMNode;
interface nsIDOMEvent;
[scriptable, uuid(e29224e9-429e-4bcc-98de-ee7fc10e5866)]
[scriptable, uuid(61077434-18c8-4d2d-956c-7c389a7e9bba)]
interface nsIXTFElement : nsISupports
{
// called when the wrapper object is being destroyed.
@ -153,5 +153,10 @@ interface nsIXTFElement : nsISupports
// If the return value is true, the event is marked as handled and
// other default handlers won't be able to handle it again.
boolean handleDefault(in nsIDOMEvent aEvent);
// Set this element to be equivalent to |aElement|. This does not need
// to worry about copying attributes or child nodes, but should copy any
// other needed state.
void cloneState(in nsIDOMElement aElement);
};

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

@ -395,13 +395,15 @@ nsXTFElementWrapper::CloneNode(PRBool aDeep, nsIDOMNode **aResult)
mAttributeHandler->GetAttributeNameAt(i, getter_AddRefs(attrName));
if (attrName) {
nsAutoString value;
if (NS_SUCCEEDED(mAttributeHandler->GetAttribute(attrName, value)));
if (NS_SUCCEEDED(mAttributeHandler->GetAttribute(attrName, value)))
it->SetAttr(kNameSpaceID_None, attrName, value, PR_TRUE);
}
}
}
kungFuDeathGrip.swap(*aResult);
}
wrapper->CloneState(this);
return rv;
}

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

@ -43,8 +43,7 @@
#include "nsIXTFElementWrapperPrivate.h"
#include "nsXMLElement.h"
#include "nsIXTFAttributeHandler.h"
class nsIXTFElement;
#include "nsIXTFElement.h"
typedef nsXMLElement nsXTFElementWrapperBase;
@ -119,6 +118,11 @@ public:
PRUint32 aFlags,
nsEventStatus* aEventStatus);
nsresult CloneState(nsIDOMElement *aElement)
{
return GetXTFElement()->CloneState(aElement);
}
protected:
// to be implemented by subclasses:
virtual nsIXTFElement *GetXTFElement() const = 0;

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

@ -191,6 +191,12 @@ nsXFormsStubElement::OnCreated(nsIXTFGenericElementWrapper *aWrapper)
return NS_OK;
}
NS_IMETHODIMP
nsXFormsStubElement::CloneState(nsIDOMElement *aElement)
{
return NS_OK;
}
nsresult
NS_NewXFormsStubElement(nsIXTFElement **aResult)
{
@ -373,6 +379,12 @@ nsXFormsXMLVisualStub::OnCreated(nsIXTFXMLVisualWrapper *aWrapper)
return NS_OK;
}
NS_IMETHODIMP
nsXFormsXMLVisualStub::CloneState(nsIDOMElement *aElement)
{
return NS_OK;
}
nsresult
NS_NewXFormsXMLVisualStub(nsIXTFElement **aResult)
{