зеркало из https://github.com/mozilla/pjs.git
Add a cloneNode hook for XTF (bug 280072). r+sr=jst
This commit is contained in:
Родитель
417295f31d
Коммит
d1c6e674bc
|
@ -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)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче