diff --git a/mozilla/layout/style/nsCSSStyleSheet.cpp b/mozilla/layout/style/nsCSSStyleSheet.cpp index 02bda7b11c6..a7a81fa845a 100644 --- a/mozilla/layout/style/nsCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsCSSStyleSheet.cpp @@ -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(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; }