XTF doesn't properly handle readonly and readwrite. Bug 391905, r=olli sr=peterv a=jonas

This commit is contained in:
aaronr@us.ibm.com 2007-09-05 16:15:28 -07:00
parent a8ab6d3130
commit 9b3a9e0110

View File

@ -527,7 +527,14 @@ nsXTFElementWrapper::GetExistingAttrNameFromQName(const nsAString& aStr) const
PRInt32
nsXTFElementWrapper::IntrinsicState() const
{
return nsXTFElementWrapperBase::IntrinsicState() | mIntrinsicState;
PRInt32 retState = nsXTFElementWrapperBase::IntrinsicState();
if (mIntrinsicState & NS_EVENT_STATE_MOZ_READONLY) {
retState &= ~NS_EVENT_STATE_MOZ_READWRITE;
} else if (mIntrinsicState & NS_EVENT_STATE_MOZ_READWRITE) {
retState &= ~NS_EVENT_STATE_MOZ_READONLY;
}
return retState | mIntrinsicState;
}
void
@ -879,6 +886,10 @@ nsXTFElementWrapper::SetIntrinsicState(PRInt32 aNewState)
if (!doc || !bits)
return NS_OK;
NS_WARN_IF_FALSE(!((aNewState & NS_EVENT_STATE_MOZ_READONLY) &&
(aNewState & NS_EVENT_STATE_MOZ_READWRITE)),
"Both READONLY and READWRITE are being set. Yikes!!!");
mIntrinsicState = aNewState;
mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
doc->ContentStatesChanged(this, nsnull, bits);