Expose IntrinsicState() to XTF elements. Bug 297061, r=smaug+alex, sr=bryner, a=asa

git-svn-id: svn://10.0.0.236/trunk@174467 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
allan%beaufour.dk
2005-06-11 11:19:08 +00:00
parent 39cb0d47f3
commit bbcaa71606
3 changed files with 40 additions and 2 deletions

View File

@@ -21,6 +21,7 @@
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (original author)
* Allan Beaufour <allan@beaufour.dk>
*
* 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);
};

View File

@@ -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)

View File

@@ -100,6 +100,8 @@ public:
PRUint32 GetAttrCount() const;
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
virtual PRInt32 IntrinsicState() const;
virtual void BeginAddingChildren();
virtual void DoneAddingChildren();
@@ -136,6 +138,12 @@ protected:
PRUint32 mNotificationMask;
nsCOMPtr<nsIXTFAttributeHandler> mAttributeHandler;
/*
* The intrinsic state of the element.
* @see nsIContent::IntrinsicState()
*/
PRInt32 mIntrinsicState;
};
class nsXTFStyledElementWrapper : public nsXTFElementWrapper