From b9dcf6bcee62d7e0fa51dfc554c527601d775353 Mon Sep 17 00:00:00 2001 From: "silver%warwickcompsoc.co.uk" Date: Fri, 23 Dec 2005 21:04:35 +0000 Subject: [PATCH] Bug 321195 - stop cloning stylesheets from losing rule weighting and line numbers. r+sr=dbaron --- layout/style/nsCSSStyleRule.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/layout/style/nsCSSStyleRule.cpp b/layout/style/nsCSSStyleRule.cpp index 3446667f028..1af09358d09 100644 --- a/layout/style/nsCSSStyleRule.cpp +++ b/layout/style/nsCSSStyleRule.cpp @@ -743,6 +743,7 @@ MOZ_DECL_CTOR_COUNTER(nsCSSSelectorList) nsCSSSelectorList::nsCSSSelectorList(void) : mSelectors(nsnull), + mWeight(0), mNext(nsnull) { MOZ_COUNT_CTOR(nsCSSSelectorList); @@ -796,6 +797,7 @@ nsCSSSelectorList::Clone() delete list; return nsnull; } + lcopy->mWeight = l->mWeight; *list_cur = lcopy; list_cur = &lcopy->mNext; @@ -1263,7 +1265,8 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(nsCSSSelectorList* aSelector, mSelector(aSelector), mDeclaration(aDeclaration), mImportantRule(nsnull), - mDOMRule(nsnull) + mDOMRule(nsnull), + mLineNumber(0) { mDeclaration->AddRef(); } @@ -1274,7 +1277,8 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy) mSelector(aCopy.mSelector ? aCopy.mSelector->Clone() : nsnull), mDeclaration(aCopy.mDeclaration->Clone()), mImportantRule(nsnull), - mDOMRule(nsnull) + mDOMRule(nsnull), + mLineNumber(aCopy.mLineNumber) { if (mDeclaration) mDeclaration->AddRef(); @@ -1288,7 +1292,8 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(CSSStyleRuleImpl& aCopy, mSelector(aCopy.mSelector), mDeclaration(aDeclaration), mImportantRule(nsnull), - mDOMRule(aCopy.mDOMRule) + mDOMRule(aCopy.mDOMRule), + mLineNumber(aCopy.mLineNumber) { // The DOM rule is replacing |aCopy| with |this|, so transfer // the reverse pointer as well (and transfer ownership).