author | Boris Zbarsky <bzbarsky@mit.edu> |
Fri, 18 Jun 2010 12:23:05 -0400 | |
changeset 43793 | d594bc58ca6b5520ac9258eee4a3a42cfd87791d |
parent 43792 | 9ec74c8e5690b593b569c435d8edf55a78e6b44a |
child 43794 | dee1e84a95aa4c3273b64f9d767179d6037096d1 |
push id | 1 |
push user | root |
push date | Tue, 26 Apr 2011 22:38:44 +0000 |
treeherder | mozilla-beta@bfdb6e623a36 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dbaron |
bugs | 494117 |
milestone | 1.9.3a6pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/base/RestyleTracker.cpp +++ b/layout/base/RestyleTracker.cpp @@ -138,17 +138,17 @@ RestyleTracker::ProcessOneRestyle(Elemen nsChangeHint aChangeHint) { NS_PRECONDITION((aRestyleHint & eRestyle_LaterSiblings) == 0, "Someone should have handled this before calling us"); NS_PRECONDITION(aElement->GetCurrentDoc() == mFrameConstructor->mDocument, "Element has unexpected document"); nsIFrame* primaryFrame = aElement->GetPrimaryFrame(); - if (aRestyleHint & eRestyle_Self) { + if (aRestyleHint & eRestyle_Subtree) { mFrameConstructor->RestyleElement(aElement, primaryFrame, aChangeHint, *this); } else if (aChangeHint && (primaryFrame || (aChangeHint & nsChangeHint_ReconstructFrame))) { // Don't need to recompute style; just apply the hint nsStyleChangeList changeList; changeList.AppendChange(primaryFrame, aElement, aChangeHint); @@ -171,17 +171,17 @@ RestyleTracker::ProcessRestyles() LaterSiblingCollector siblingCollector = { this, &laterSiblingArr }; mPendingRestyles.Enumerate(CollectLaterSiblings, &siblingCollector); for (PRUint32 i = 0; i < laterSiblingArr.Length(); ++i) { Element* element = laterSiblingArr[i]; for (nsIContent* sibling = element->GetNextSibling(); sibling; sibling = sibling->GetNextSibling()) { if (sibling->IsElement() && - AddPendingRestyle(sibling->AsElement(), eRestyle_Self, + AddPendingRestyle(sibling->AsElement(), eRestyle_Subtree, NS_STYLE_HINT_NONE)) { // Nothing else to do here; we'll handle the following // siblings when we get to |sibling| in laterSiblingArr. break; } } }
--- a/layout/base/RestyleTracker.h +++ b/layout/base/RestyleTracker.h @@ -191,17 +191,17 @@ inline PRBool RestyleTracker::AddPending nsRestyleHint(existingData.mRestyleHint | aRestyleHint); NS_UpdateHint(existingData.mChangeHint, aMinChangeHint); mPendingRestyles.Put(aElement, existingData); // We can only treat this element as a restyle root if we would // actually restyle its descendants (so either call // ReResolveStyleContext on it or just reframe it). - if ((aRestyleHint & eRestyle_Self) || + if ((aRestyleHint & eRestyle_Subtree) || (aMinChangeHint & nsChangeHint_ReconstructFrame)) { for (const Element* cur = aElement; !cur->HasFlag(RootBit()); ) { nsIContent* parent = cur->GetFlattenedTreeParent(); // Stop if we have no parent or the parent is not an element or // we're part of the viewport scrollbars (because those are not // frametree descendants of the primary frame of the root // element). // XXXbz maybe the primary frame of the root should be the root scrollframe?
--- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -11353,17 +11353,17 @@ nsCSSFrameConstructor::ReframeContaining } void nsCSSFrameConstructor::RestyleForEmptyChange(Element* aContainer) { // In some cases (:empty + E, :empty ~ E), a change if the content of // an element requires restyling its grandparent, because it changes // its parent's :empty state. - nsRestyleHint hint = eRestyle_Self; + nsRestyleHint hint = eRestyle_Subtree; nsIContent* grandparent = aContainer->GetParent(); if (grandparent && (grandparent->GetFlags() & NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS)) { hint = nsRestyleHint(hint | eRestyle_LaterSiblings); } PostRestyleEvent(aContainer, hint, NS_STYLE_HINT_NONE); } @@ -11403,47 +11403,47 @@ nsCSSFrameConstructor::RestyleForAppend( } if (wasEmpty) { RestyleForEmptyChange(aContainer); return; } } if (selectorFlags & NODE_HAS_SLOW_SELECTOR) { - PostRestyleEvent(aContainer, eRestyle_Self, NS_STYLE_HINT_NONE); + PostRestyleEvent(aContainer, eRestyle_Subtree, NS_STYLE_HINT_NONE); // Restyling the container is the most we can do here, so we're done. return; } if (selectorFlags & NODE_HAS_EDGE_CHILD_SELECTOR) { // restyle the last element child before this node for (nsIContent* cur = aFirstNewContent->GetPreviousSibling(); cur; cur = cur->GetPreviousSibling()) { if (cur->IsElement()) { - PostRestyleEvent(cur->AsElement(), eRestyle_Self, NS_STYLE_HINT_NONE); + PostRestyleEvent(cur->AsElement(), eRestyle_Subtree, NS_STYLE_HINT_NONE); break; } } } } // Needed since we can't use PostRestyleEvent on non-elements (with -// eRestyle_LaterSiblings or nsRestyleHint(eRestyle_Self | +// eRestyle_LaterSiblings or nsRestyleHint(eRestyle_Subtree | // eRestyle_LaterSiblings) as appropriate). static void RestyleSiblingsStartingWith(nsCSSFrameConstructor *aFrameConstructor, nsIContent *aStartingSibling /* may be null */) { for (nsIContent *sibling = aStartingSibling; sibling; sibling = sibling->GetNextSibling()) { if (sibling->IsElement()) { aFrameConstructor-> PostRestyleEvent(sibling->AsElement(), - nsRestyleHint(eRestyle_Self | eRestyle_LaterSiblings), + nsRestyleHint(eRestyle_Subtree | eRestyle_LaterSiblings), NS_STYLE_HINT_NONE); break; } } } // Restyling for a ContentInserted or CharacterDataChanged notification. // This could be used for ContentRemoved as well if we got the @@ -11481,17 +11481,17 @@ nsCSSFrameConstructor::RestyleForInsertO } if (wasEmpty) { RestyleForEmptyChange(aContainer); return; } } if (selectorFlags & NODE_HAS_SLOW_SELECTOR) { - PostRestyleEvent(aContainer, eRestyle_Self, NS_STYLE_HINT_NONE); + PostRestyleEvent(aContainer, eRestyle_Subtree, NS_STYLE_HINT_NONE); // Restyling the container is the most we can do here, so we're done. return; } if (selectorFlags & NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS) { // Restyle all later siblings. RestyleSiblingsStartingWith(this, aChild->GetNextSibling()); } @@ -11503,34 +11503,34 @@ nsCSSFrameConstructor::RestyleForInsertO content; content = content->GetNextSibling()) { if (content == aChild) { passedChild = PR_TRUE; continue; } if (content->IsElement()) { if (passedChild) { - PostRestyleEvent(content->AsElement(), eRestyle_Self, + PostRestyleEvent(content->AsElement(), eRestyle_Subtree, NS_STYLE_HINT_NONE); } break; } } // restyle the previously-last element child if it is before this node passedChild = PR_FALSE; for (nsIContent* content = aContainer->GetLastChild(); content; content = content->GetPreviousSibling()) { if (content == aChild) { passedChild = PR_TRUE; continue; } if (content->IsElement()) { if (passedChild) { - PostRestyleEvent(content->AsElement(), eRestyle_Self, + PostRestyleEvent(content->AsElement(), eRestyle_Subtree, NS_STYLE_HINT_NONE); } break; } } } } @@ -11563,17 +11563,17 @@ nsCSSFrameConstructor::RestyleForRemove( } if (isEmpty) { RestyleForEmptyChange(aContainer); return; } } if (selectorFlags & NODE_HAS_SLOW_SELECTOR) { - PostRestyleEvent(aContainer, eRestyle_Self, NS_STYLE_HINT_NONE); + PostRestyleEvent(aContainer, eRestyle_Subtree, NS_STYLE_HINT_NONE); // Restyling the container is the most we can do here, so we're done. return; } if (selectorFlags & NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS) { // Restyle all later siblings. RestyleSiblingsStartingWith(this, aFollowingSibling); } @@ -11585,30 +11585,30 @@ nsCSSFrameConstructor::RestyleForRemove( content; content = content->GetNextSibling()) { if (content == aFollowingSibling) { reachedFollowingSibling = PR_TRUE; // do NOT continue here; we might want to restyle this node } if (content->IsElement()) { if (reachedFollowingSibling) { - PostRestyleEvent(content->AsElement(), eRestyle_Self, + PostRestyleEvent(content->AsElement(), eRestyle_Subtree, NS_STYLE_HINT_NONE); } break; } } // restyle the now-last element child if it was before aOldChild reachedFollowingSibling = (aFollowingSibling == nsnull); for (nsIContent* content = aContainer->GetLastChild(); content; content = content->GetPreviousSibling()) { if (content->IsElement()) { if (reachedFollowingSibling) { - PostRestyleEvent(content->AsElement(), eRestyle_Self, NS_STYLE_HINT_NONE); + PostRestyleEvent(content->AsElement(), eRestyle_Subtree, NS_STYLE_HINT_NONE); } break; } if (content == aFollowingSibling) { reachedFollowingSibling = PR_TRUE; } } }
--- a/layout/base/nsChangeHint.h +++ b/layout/base/nsChangeHint.h @@ -139,14 +139,14 @@ inline PRBool NS_IsHintSubset(nsChangeHi nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame) /** * |nsRestyleHint| is a bitfield for the result of |HasStateDependentStyle| * and |HasAttributeDependentStyle|. All values have an implied "and * descendants." When no restyling is necessary, use |nsRestyleHint(0)|. */ enum nsRestyleHint { - eRestyle_Self = 0x1, + eRestyle_Subtree = 0x1, eRestyle_LaterSiblings = 0x2 }; #endif /* nsChangeHint_h___ */
--- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3621,24 +3621,24 @@ PresShell::RecreateFramesFor(nsIContent* InvalidateAccessibleSubtree(aContent); #endif return rv; } void nsIPresShell::PostRecreateFramesFor(Element* aElement) { - FrameConstructor()->PostRestyleEvent(aElement, eRestyle_Self, + FrameConstructor()->PostRestyleEvent(aElement, eRestyle_Subtree, nsChangeHint_ReconstructFrame); } void nsIPresShell::RestyleForAnimation(Element* aElement) { - FrameConstructor()->PostAnimationRestyleEvent(aElement, eRestyle_Self, + FrameConstructor()->PostAnimationRestyleEvent(aElement, eRestyle_Subtree, NS_STYLE_HINT_NONE); } void PresShell::ClearFrameRefs(nsIFrame* aFrame) { mPresContext->EventStateManager()->ClearFrameRefs(aFrame); @@ -4897,17 +4897,17 @@ PresShell::DocumentStatesChanged(nsIDocu NS_PRECONDITION(!mIsDocumentGone, "Unexpected DocumentStatesChanged"); NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); if (mDidInitialReflow && mStyleSet->HasDocumentStateDependentStyle(mPresContext, mDocument->GetRootElement(), aStateMask)) { mFrameConstructor->PostRestyleEvent(mDocument->GetRootElement(), - eRestyle_Self, NS_STYLE_HINT_NONE); + eRestyle_Subtree, NS_STYLE_HINT_NONE); VERIFY_STYLE_TREE; } } void PresShell::AttributeWillChange(nsIDocument* aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, @@ -5074,17 +5074,17 @@ nsIPresShell::ReconstructStyleDataIntern return; } if (!root) { // No content to restyle return; } - mFrameConstructor->PostRestyleEvent(root, eRestyle_Self, NS_STYLE_HINT_NONE); + mFrameConstructor->PostRestyleEvent(root, eRestyle_Subtree, NS_STYLE_HINT_NONE); #ifdef ACCESSIBILITY InvalidateAccessibleSubtree(nsnull); #endif } void nsIPresShell::ReconstructStyleDataExternal()
--- a/layout/mathml/nsMathMLTokenFrame.cpp +++ b/layout/mathml/nsMathMLTokenFrame.cpp @@ -271,17 +271,17 @@ void nsMathMLTokenFrame::ProcessTextData() { // see if the style changes from normal to italic or vice-versa if (!SetTextStyle()) return; // explicitly request a re-resolve to pick up the change of style PresContext()->PresShell()->FrameConstructor()-> - PostRestyleEvent(mContent->AsElement(), eRestyle_Self, NS_STYLE_HINT_NONE); + PostRestyleEvent(mContent->AsElement(), eRestyle_Subtree, NS_STYLE_HINT_NONE); } /////////////////////////////////////////////////////////////////////////// // For <mi>, if the content is not a single character, turn the font to // normal (this function will also query attributes from the mstyle hierarchy) // Returns PR_TRUE if there is a style change. // // http://www.w3.org/TR/2003/REC-MathML2-20031021/chapter3.html#presm.commatt
--- a/layout/mathml/nsMathMLmtableFrame.cpp +++ b/layout/mathml/nsMathMLmtableFrame.cpp @@ -520,17 +520,17 @@ nsMathMLmtableOuterFrame::AttributeChang } } } } } // Explicitly request a re-resolve and reflow in our subtree to pick up any changes presContext->PresShell()->FrameConstructor()-> - PostRestyleEvent(mContent->AsElement(), eRestyle_Self, + PostRestyleEvent(mContent->AsElement(), eRestyle_Subtree, nsChangeHint_ReflowFrame); return NS_OK; } nsIFrame* nsMathMLmtableOuterFrame::GetRowFrameAt(nsPresContext* aPresContext, PRInt32 aRowIndex) @@ -700,17 +700,17 @@ nsMathMLmtableFrame::SetInitialChildList void nsMathMLmtableFrame::RestyleTable() { // re-sync MathML specific style data that may have changed MapAllAttributesIntoCSS(this); // Explicitly request a re-resolve and reflow in our subtree to pick up any changes PresContext()->PresShell()->FrameConstructor()-> - PostRestyleEvent(mContent->AsElement(), eRestyle_Self, + PostRestyleEvent(mContent->AsElement(), eRestyle_Subtree, nsChangeHint_ReflowFrame); } // -------- // implementation of nsMathMLmtrFrame nsIFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) @@ -761,17 +761,17 @@ nsMathMLmtrFrame::AttributeChanged(PRInt UnsetAttr(kNameSpaceID_None, nsGkAtoms::_moz_math_columnalign_, PR_FALSE); MapColAttributesIntoCSS(tableFrame, this, cellFrame); } } // Explicitly request a re-resolve and reflow in our subtree to pick up any changes presContext->PresShell()->FrameConstructor()-> - PostRestyleEvent(mContent->AsElement(), eRestyle_Self, + PostRestyleEvent(mContent->AsElement(), eRestyle_Subtree, nsChangeHint_ReflowFrame); return NS_OK; } // -------- // implementation of nsMathMLmtdFrame
--- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -2351,17 +2351,17 @@ nsCSSRuleProcessor::HasStateDependentSty nsRestyleHint hint = nsRestyleHint(0); if (cascade) { nsCSSSelector **iter = cascade->mStateSelectors.Elements(), **end = iter + cascade->mStateSelectors.Length(); for(; iter != end; ++iter) { nsCSSSelector* selector = *iter; nsRestyleHint possibleChange = IsSiblingOperator(selector->mOperator) ? - eRestyle_LaterSiblings : eRestyle_Self; + eRestyle_LaterSiblings : eRestyle_Subtree; // If hint already includes all the bits of possibleChange, // don't bother calling SelectorMatches, since even if it returns false // hint won't change. TreeMatchContext treeContext(PR_FALSE, nsRuleWalker::eLinksVisitedOrUnvisited); NodeMatchContext nodeContext(aData->mStateMask, PR_FALSE); if ((possibleChange & ~hint) && @@ -2393,17 +2393,17 @@ struct AttributeEnumData { static void AttributeEnumFunc(nsCSSSelector* aSelector, AttributeEnumData* aData) { AttributeRuleProcessorData *data = aData->data; nsRestyleHint possibleChange = IsSiblingOperator(aSelector->mOperator) ? - eRestyle_LaterSiblings : eRestyle_Self; + eRestyle_LaterSiblings : eRestyle_Subtree; // If enumData->change already includes all the bits of possibleChange, don't // bother calling SelectorMatches, since even if it returns false // enumData->change won't change. TreeMatchContext treeContext(PR_FALSE, nsRuleWalker::eLinksVisitedOrUnvisited); NodeMatchContext nodeContext(0, PR_FALSE); if ((possibleChange & ~(aData->change)) && @@ -2425,17 +2425,17 @@ nsCSSRuleProcessor::HasAttributeDependen // hasn't changed yet. if (aData->mAttrHasChanged) { // check for the lwtheme and lwthemetextcolor attribute on root XUL elements if ((aData->mAttribute == nsGkAtoms::lwtheme || aData->mAttribute == nsGkAtoms::lwthemetextcolor) && aData->mNameSpaceID == kNameSpaceID_XUL && aData->mElement == aData->mElement->GetOwnerDoc()->GetRootElement()) { - data.change = nsRestyleHint(data.change | eRestyle_Self); + data.change = nsRestyleHint(data.change | eRestyle_Subtree); } } RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext); // Since we get both before and after notifications for attributes, we // don't have to ignore aData->mAttribute while matching. Just check // whether we have selectors relevant to aData->mAttribute that we
--- a/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/layout/style/nsHTMLCSSStyleSheet.cpp @@ -151,17 +151,17 @@ nsHTMLCSSStyleSheet::HasDocumentStateDep // Test if style is dependent on attribute /* virtual */ nsRestyleHint nsHTMLCSSStyleSheet::HasAttributeDependentStyle(AttributeRuleProcessorData* aData) { // Perhaps should check that it's XUL, SVG, (or HTML) namespace, but // it doesn't really matter. if (aData->mAttrHasChanged && aData->mAttribute == nsGkAtoms::style) { - return eRestyle_Self; + return eRestyle_Subtree; } return nsRestyleHint(0); } NS_IMETHODIMP nsHTMLCSSStyleSheet::MediumFeaturesChanged(nsPresContext* aPresContext, PRBool* aRulesChanged)
--- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -274,17 +274,17 @@ nsHTMLStyleSheet::RulesMatching(ElementR nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData) { if (aData->mIsHTMLContent && aData->mContentTag == nsGkAtoms::a && aData->IsLink() && ((mActiveRule && (aData->mStateMask & NS_EVENT_STATE_ACTIVE)) || (mLinkRule && (aData->mStateMask & NS_EVENT_STATE_VISITED)) || (mVisitedRule && (aData->mStateMask & NS_EVENT_STATE_VISITED)))) { - return eRestyle_Self; + return eRestyle_Subtree; } return nsRestyleHint(0); } /* virtual */ PRBool nsHTMLStyleSheet::HasDocumentStateDependentStyle(StateRuleProcessorData* aData) { @@ -304,25 +304,25 @@ nsHTMLStyleSheet::HasAttributeDependentS // needed. // Result is true for |href| changes on HTML links if we have link rules. Element *element = aData->mElement; if (aData->mAttribute == nsGkAtoms::href && (mLinkRule || mVisitedRule || mActiveRule) && element->IsHTML() && aData->mContentTag == nsGkAtoms::a) { - return eRestyle_Self; + return eRestyle_Subtree; } // Don't worry about the mDocumentColorRule since it only applies // to descendants of body, when we're already reresolving. // Handle the content style rules. if (element->IsAttributeMapped(aData->mAttribute)) { - return eRestyle_Self; + return eRestyle_Subtree; } return nsRestyleHint(0); } NS_IMETHODIMP nsHTMLStyleSheet::MediumFeaturesChanged(nsPresContext* aPresContext, PRBool* aRulesChanged)
--- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -1176,17 +1176,17 @@ struct StatefulData : public StateRulePr nsRestyleHint mHint; }; static PRBool SheetHasDocumentStateStyle(nsIStyleRuleProcessor* aProcessor, void *aData) { StatefulData* data = (StatefulData*)aData; if (aProcessor->HasDocumentStateDependentStyle(data)) { - data->mHint = eRestyle_Self; + data->mHint = eRestyle_Subtree; return PR_FALSE; // don't continue } return PR_TRUE; // continue } // Test if style is dependent on a document state. PRBool nsStyleSet::HasDocumentStateDependentStyle(nsPresContext* aPresContext,