Avoid nsIStyledContent QI in RuleProcessorData (bug 309927). r+sr=dbaron.

This commit is contained in:
bryner%brianryner.com 2005-09-25 06:09:27 +00:00
parent 176d660efb
commit 04c16c894f

View File

@ -2684,11 +2684,14 @@ RuleProcessorData::RuleProcessorData(nsPresContext* aPresContext,
mPresContext->EventStateManager()->GetContentState(aContent, mEventState);
// get the styledcontent interface and the ID
if (NS_SUCCEEDED(aContent->QueryInterface(NS_GET_IID(nsIStyledContent), (void**)&mStyledContent))) {
NS_ASSERTION(mStyledContent, "Succeeded but returned null");
if (aContent->IsContentOfType(nsIContent::eELEMENT)) {
mStyledContent = NS_STATIC_CAST(nsIStyledContent*, aContent);
mContentID = mStyledContent->GetID();
}
NS_ASSERTION(nsCOMPtr<nsIStyledContent>(do_QueryInterface(aContent)) == mStyledContent,
"nsIStyledContent must agree with IsContentOfType(eELEMENT)");
// see if there are attributes for the content
mHasAttributes = aContent->GetAttrCount() > 0;
@ -2734,8 +2737,6 @@ RuleProcessorData::~RuleProcessorData()
if (mParentData)
mParentData->Destroy(mPresContext);
NS_IF_RELEASE(mStyledContent);
delete mLanguage;
}