diff --git a/mozilla/content/xtf/public/nsIXTFElementWrapper.idl b/mozilla/content/xtf/public/nsIXTFElementWrapper.idl index 9a40004684e..12018426357 100644 --- a/mozilla/content/xtf/public/nsIXTFElementWrapper.idl +++ b/mozilla/content/xtf/public/nsIXTFElementWrapper.idl @@ -21,6 +21,7 @@ * * Contributor(s): * Alex Fritze (original author) + * Allan Beaufour * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -42,7 +43,7 @@ interface nsIAtom; interface nsIDOMElement; interface nsIDOMDocument; -[scriptable, uuid(e71b0b11-45e3-422b-b589-9ea4629e36ec)] +[scriptable, uuid(444d0276-3302-4d35-a74e-25c4e9c483c9)] interface nsIXTFElementWrapper : nsISupports { readonly attribute nsIDOMElement elementNode; @@ -53,5 +54,11 @@ interface nsIXTFElementWrapper : nsISupports * by the NOTIFY_* constants in nsIXTFElement and nsIXTFVisual: */ attribute unsigned long notificationMask; + + /** + * Sets the intrinsic state for the element. + * @see nsIContent::IntrinsicState(). + */ + void setIntrinsicState(in long newState); }; diff --git a/mozilla/content/xtf/src/nsXTFElementWrapper.cpp b/mozilla/content/xtf/src/nsXTFElementWrapper.cpp index 83e1535e0bd..a8125a7bccc 100644 --- a/mozilla/content/xtf/src/nsXTFElementWrapper.cpp +++ b/mozilla/content/xtf/src/nsXTFElementWrapper.cpp @@ -55,7 +55,8 @@ nsXTFElementWrapper::nsXTFElementWrapper(nsINodeInfo* aNodeInfo) : nsXTFElementWrapperBase(aNodeInfo), - mNotificationMask(0) + mNotificationMask(0), + mIntrinsicState(0) { } @@ -415,6 +416,12 @@ nsXTFElementWrapper::GetExistingAttrNameFromQName(const nsAString& aStr) const return nodeInfo; } +PRInt32 +nsXTFElementWrapper::IntrinsicState() const +{ + return mIntrinsicState; +} + //---------------------------------------------------------------------- // nsIDOMNode methods: @@ -704,6 +711,22 @@ nsXTFElementWrapper::HandleDOMEvent(nsPresContext* aPresContext, return rv; } +NS_IMETHODIMP +nsXTFElementWrapper::SetIntrinsicState(PRInt32 aNewState) +{ + nsIDocument *doc = GetCurrentDoc(); + PRInt32 bits = mIntrinsicState ^ aNewState; + + if (!doc || !bits) + return NS_OK; + + mIntrinsicState = aNewState; + mozAutoDocUpdate(doc, UPDATE_CONTENT_STATE, PR_TRUE); + doc->ContentStatesChanged(this, nsnull, bits); + + return NS_OK; +} + // nsXTFStyleableElementWrapper nsXTFStyledElementWrapper::nsXTFStyledElementWrapper(nsINodeInfo* aNodeInfo) diff --git a/mozilla/content/xtf/src/nsXTFElementWrapper.h b/mozilla/content/xtf/src/nsXTFElementWrapper.h index 630d48f66bf..9423c267baa 100644 --- a/mozilla/content/xtf/src/nsXTFElementWrapper.h +++ b/mozilla/content/xtf/src/nsXTFElementWrapper.h @@ -100,6 +100,8 @@ public: PRUint32 GetAttrCount() const; virtual already_AddRefed GetExistingAttrNameFromQName(const nsAString& aStr) const; + virtual PRInt32 IntrinsicState() const; + virtual void BeginAddingChildren(); virtual void DoneAddingChildren(); @@ -136,6 +138,12 @@ protected: PRUint32 mNotificationMask; nsCOMPtr mAttributeHandler; + + /* + * The intrinsic state of the element. + * @see nsIContent::IntrinsicState() + */ + PRInt32 mIntrinsicState; }; class nsXTFStyledElementWrapper : public nsXTFElementWrapper