Bug 1273766 - part3: purge NS_UpdateHint inline. r=heycam

MozReview-Commit-ID: IIOT9jq8hOl

--HG--
extra : rebase_source : dfb3d874ce4419f32f13e662bd495e97ac9cac10
This commit is contained in:
Jeremy Chen 2016-05-23 11:26:03 +08:00
Родитель 0f24420a8f
Коммит 685cf4c3d8
19 изменённых файлов: 134 добавлений и 143 удалений

Просмотреть файл

@ -593,10 +593,10 @@ HTMLCanvasElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
if (aAttribute == nsGkAtoms::width ||
aAttribute == nsGkAtoms::height)
{
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
retval |= NS_STYLE_HINT_REFLOW;
} else if (aAttribute == nsGkAtoms::moz_opaque)
{
NS_UpdateHint(retval, NS_STYLE_HINT_VISUAL);
retval |= NS_STYLE_HINT_VISUAL;
}
return retval;
}

Просмотреть файл

@ -66,7 +66,7 @@ HTMLDetailsElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
nsChangeHint hint =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::open) {
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
hint |= nsChangeHint_ReconstructFrame;
}
return hint;
}

Просмотреть файл

@ -195,7 +195,7 @@ HTMLFrameSetElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::rows ||
aAttribute == nsGkAtoms::cols) {
NS_UpdateHint(retval, mCurrentRowColHint);
retval |= mCurrentRowColHint;
}
return retval;
}

Просмотреть файл

@ -343,11 +343,11 @@ HTMLImageElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::usemap ||
aAttribute == nsGkAtoms::ismap) {
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
retval |= NS_STYLE_HINT_FRAMECHANGE;
} else if (aAttribute == nsGkAtoms::alt) {
if (aModType == nsIDOMMutationEvent::ADDITION ||
aModType == nsIDOMMutationEvent::REMOVAL) {
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
retval |= NS_STYLE_HINT_FRAMECHANGE;
}
}
return retval;

Просмотреть файл

@ -4954,20 +4954,20 @@ HTMLInputElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
// The presence or absence of the 'directory' attribute determines what
// buttons we show for type=file.
aAttribute == nsGkAtoms::directory) {
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
retval |= NS_STYLE_HINT_FRAMECHANGE;
} else if (mType == NS_FORM_INPUT_IMAGE &&
(aAttribute == nsGkAtoms::alt ||
aAttribute == nsGkAtoms::value)) {
// We might need to rebuild our alt text. Just go ahead and
// reconstruct our frame. This should be quite rare..
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
retval |= NS_STYLE_HINT_FRAMECHANGE;
} else if (aAttribute == nsGkAtoms::value) {
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
retval |= NS_STYLE_HINT_REFLOW;
} else if (aAttribute == nsGkAtoms::size &&
IsSingleLineTextControl(false)) {
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
retval |= NS_STYLE_HINT_REFLOW;
} else if (PlaceholderApplies() && aAttribute == nsGkAtoms::placeholder) {
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
retval |= NS_STYLE_HINT_FRAMECHANGE;
}
return retval;
}

Просмотреть файл

@ -65,7 +65,7 @@ HTMLLegendElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
nsChangeHint retval =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::align) {
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
retval |= NS_STYLE_HINT_REFLOW;
}
return retval;
}

Просмотреть файл

@ -174,7 +174,7 @@ HTMLOptionElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
if (aAttribute == nsGkAtoms::label ||
aAttribute == nsGkAtoms::text) {
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
retval |= NS_STYLE_HINT_REFLOW;
}
return retval;
}

Просмотреть файл

@ -1413,7 +1413,7 @@ HTMLSelectElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::multiple ||
aAttribute == nsGkAtoms::size) {
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
retval |= NS_STYLE_HINT_FRAMECHANGE;
}
return retval;
}

Просмотреть файл

@ -436,11 +436,11 @@ HTMLTextAreaElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::rows ||
aAttribute == nsGkAtoms::cols) {
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
retval |= NS_STYLE_HINT_REFLOW;
} else if (aAttribute == nsGkAtoms::wrap) {
NS_UpdateHint(retval, nsChangeHint_ReconstructFrame);
retval |= nsChangeHint_ReconstructFrame;
} else if (aAttribute == nsGkAtoms::placeholder) {
NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
retval |= NS_STYLE_HINT_FRAMECHANGE;
}
return retval;
}

Просмотреть файл

@ -59,7 +59,7 @@ SVGTransformableElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
aAttribute == nsGkAtoms::mozAnimateMotionDummyAttr) {
nsIFrame* frame =
const_cast<SVGTransformableElement*>(this)->GetPrimaryFrame();
NS_UpdateHint(retval, nsChangeHint_InvalidateRenderingObservers);
retval |= nsChangeHint_InvalidateRenderingObservers;
if (!frame || (frame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
return retval;
}
@ -81,11 +81,11 @@ SVGTransformableElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
if (isAdditionOrRemoval) {
// Reconstruct the frame tree to handle stacking context changes:
NS_UpdateHint(retval, nsChangeHint_ReconstructFrame);
retval |= nsChangeHint_ReconstructFrame;
} else {
// We just assume the old and new transforms are different.
NS_UpdateHint(retval, nsChangeHint_UpdatePostTransformOverflow |
nsChangeHint_UpdateTransformLayer);
retval |= nsChangeHint_UpdatePostTransformOverflow |
nsChangeHint_UpdateTransformLayer;
}
}
return retval;

Просмотреть файл

@ -883,7 +883,7 @@ nsSVGElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
// It would be nice to only reconstruct the frame if the value returned by
// SVGTests::PassesConditionalProcessingTests has changed, but we don't
// know that
NS_UpdateHint(retval, nsChangeHint_ReconstructFrame);
retval |= nsChangeHint_ReconstructFrame;
}
return retval;
}

Просмотреть файл

@ -793,7 +793,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
frame->GetContentInsertionFrame() != frame) {
// The frame has positioned children that need to be reparented, or
// it can't easily be converted to/from being an abs-pos container correctly.
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
hint |= nsChangeHint_ReconstructFrame;
} else {
for (nsIFrame *cont = frame; cont;
cont = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(cont)) {
@ -1063,7 +1063,7 @@ RestyleManager::RestyleElement(Element* aElement,
if (aRestyleHint & eRestyle_SomeDescendants) {
mRebuildAllRestyleHint |= eRestyle_Subtree;
}
NS_UpdateHint(mRebuildAllExtraHint, aMinHint);
mRebuildAllExtraHint |= aMinHint;
StartRebuildAllStyleData(aRestyleTracker);
return;
}
@ -1212,7 +1212,7 @@ RestyleManager::ContentStateChanged(nsIContent* aContent,
bool repaint = false;
theme->WidgetStateChanged(primaryFrame, app, nullptr, &repaint, nullptr);
if (repaint) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
}
}
}
@ -1248,7 +1248,7 @@ RestyleManager::ContentStateChanged(nsIContent* aContent,
// Exposing information to the page about whether the link is
// visited or not isn't really something we can worry about here.
// FIXME: We could probably do this a bit better.
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
}
PostRestyleEvent(aElement, rshint, hint);
@ -1342,7 +1342,7 @@ RestyleManager::AttributeChanged(Element* aElement,
theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute,
&repaint, aOldValue);
if (repaint)
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
}
}
@ -1652,7 +1652,7 @@ RestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
"the only bits allowed in aRestyleHint are eRestyle_Subtree and "
"eRestyle_ForceDescendants");
NS_UpdateHint(mRebuildAllExtraHint, aExtraHint);
mRebuildAllExtraHint |= aExtraHint;
mRebuildAllRestyleHint |= aRestyleHint;
// Processing the style changes could cause a flush that propagates to
@ -1969,7 +1969,7 @@ RestyleManager::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
"eRestyle_SomeDescendants");
mDoRebuildAllStyleData = true;
NS_UpdateHint(mRebuildAllExtraHint, aExtraHint);
mRebuildAllExtraHint |= aExtraHint;
mRebuildAllRestyleHint |= aRestyleHint;
// Get a restyle event posted if necessary
@ -2749,7 +2749,7 @@ ElementRestyler::AddLayerChangesForAnimation()
!mFrame->StyleDisplay()->HasTransformStyle()) {
continue;
}
NS_UpdateHint(hint, layerInfo.mChangeHint);
hint |= layerInfo.mChangeHint;
}
}
if (hint) {
@ -2795,8 +2795,9 @@ ElementRestyler::CaptureChange(nsStyleContext* aOldContext,
ourChange &= ~nsChangeHint_UpdateEffects;
}
NS_UpdateHint(ourChange, aChangeToAssume);
if (NS_UpdateHint(mHintsHandled, ourChange)) {
ourChange |= aChangeToAssume;
if (!NS_IsHintSubset(ourChange, mHintsHandled)) {
mHintsHandled |= ourChange;
if (!(ourChange & nsChangeHint_ReconstructFrame) || mContent) {
LOG_RESTYLE("appending change %s",
RestyleManager::ChangeHintToString(ourChange).get());
@ -2805,8 +2806,8 @@ ElementRestyler::CaptureChange(nsStyleContext* aOldContext,
LOG_RESTYLE("change has already been handled");
}
}
NS_UpdateHint(mHintsNotHandledForDescendants,
NS_HintsNotHandledForDescendantsIn(ourChange));
mHintsNotHandledForDescendants |=
NS_HintsNotHandledForDescendantsIn(ourChange);
LOG_RESTYLE("mHintsNotHandledForDescendants = %s",
RestyleManager::ChangeHintToString(mHintsNotHandledForDescendants).get());
}
@ -3270,7 +3271,8 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint)
mContent->OwnerDoc()->FlushPendingLinkUpdates();
nsAutoPtr<RestyleTracker::RestyleData> restyleData;
if (mRestyleTracker.GetRestyleData(mContent->AsElement(), restyleData)) {
if (NS_UpdateHint(mHintsHandled, restyleData->mChangeHint)) {
if (!NS_IsHintSubset(restyleData->mChangeHint, mHintsHandled)) {
mHintsHandled |= restyleData->mChangeHint;
mChangeList->AppendChange(mFrame, mContent, restyleData->mChangeHint);
}
mSelectorsForDescendants.AppendElements(
@ -4003,7 +4005,7 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
mTreeMatchContext);
if (!newContext) {
// This pseudo should no longer exist; gotta reframe
NS_UpdateHint(mHintsHandled, nsChangeHint_ReconstructFrame);
mHintsHandled |= nsChangeHint_ReconstructFrame;
mChangeList->AppendChange(aSelf, element,
nsChangeHint_ReconstructFrame);
// We're reframing anyway; just keep the same context
@ -4739,7 +4741,7 @@ ElementRestyler::MaybeReframeForPseudo(CSSPseudoElementType aPseudoType,
// Have to create the new ::before/::after frame.
LOG_RESTYLE("MaybeReframeForPseudo, appending "
"nsChangeHint_ReconstructFrame");
NS_UpdateHint(mHintsHandled, nsChangeHint_ReconstructFrame);
mHintsHandled |= nsChangeHint_ReconstructFrame;
mChangeList->AppendChange(aFrame, aContent, nsChangeHint_ReconstructFrame);
}
}

Просмотреть файл

@ -465,7 +465,7 @@ RestyleTracker::AddPendingRestyleToTable(Element* aElement,
(existingData->mRestyleHint & eRestyle_LaterSiblings) != 0;
existingData->mRestyleHint =
nsRestyleHint(existingData->mRestyleHint | aRestyleHint);
NS_UpdateHint(existingData->mChangeHint, aMinChangeHint);
existingData->mChangeHint |= aMinChangeHint;
if (aRestyleHintData) {
existingData->mRestyleHintData.mSelectorsForDescendants
.AppendElements(aRestyleHintData->mSelectorsForDescendants);

Просмотреть файл

@ -220,15 +220,6 @@ inline void operator>=(nsChangeHint s1, nsChangeHint s2) {}
// Operators on nsChangeHints
// Merge the "src" hint into the "dst" hint
// Returns true iff the destination changed
inline bool NS_UpdateHint(nsChangeHint& aDest, nsChangeHint aSrc) {
nsChangeHint r = (nsChangeHint)(aDest | aSrc);
bool changed = (int)r != (int)aDest;
aDest = r;
return changed;
}
// Returns true iff the second hint contains all the hints of the first hint
inline bool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) {
return (aSubset & aSuperSet) == aSubset;
@ -326,14 +317,14 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {
// If NeedDirtyReflow is *not* set, then NeedReflow is a
// non-inherited hint.
NS_UpdateHint(result, nsChangeHint_NeedReflow);
result |= nsChangeHint_NeedReflow;
}
if (NS_IsHintSubset(nsChangeHint_ReflowChangesSizeOrPosition,
aChangeHint)) {
// If NeedDirtyReflow is *not* set, then ReflowChangesSizeOrPosition is a
// non-inherited hint.
NS_UpdateHint(result, nsChangeHint_ReflowChangesSizeOrPosition);
result |= nsChangeHint_ReflowChangesSizeOrPosition;
}
}
@ -341,7 +332,7 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
NS_IsHintSubset(nsChangeHint_ClearAncestorIntrinsics, aChangeHint)) {
// If ClearDescendantIntrinsics is *not* set, then
// ClearAncestorIntrinsics is a non-inherited hint.
NS_UpdateHint(result, nsChangeHint_ClearAncestorIntrinsics);
result |= nsChangeHint_ClearAncestorIntrinsics;
}
MOZ_ASSERT(NS_IsHintSubset(result,

Просмотреть файл

@ -768,7 +768,7 @@ nsPresContext::UpdateAfterPreferencesChanged()
nsChangeHint hint = nsChangeHint(0);
if (mPrefChangePendingNeedsReflow) {
NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
hint |= NS_STYLE_HINT_REFLOW;
}
// Preferences require rerunning selector matching because we rebuild

Просмотреть файл

@ -88,7 +88,7 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChange
int32_t last = mCount - 1;
if ((0 < mCount) && aFrame && (aFrame == mArray[last].mFrame)) { // same as last frame
NS_UpdateHint(mArray[last].mHint, aHint);
mArray[last].mHint |= aHint;
}
else {
if (mCount == mArraySize) {

Просмотреть файл

@ -941,7 +941,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
NS_ASSERTION(NS_IsHintSubset(difference, maxDifference), \
"CalcDifference() returned bigger hint than " \
"MaxDifference()"); \
NS_UpdateHint(hint, difference); \
hint |= difference; \
if (!difference) { \
*aEqualStructs |= NS_STYLE_INHERIT_BIT(struct_); \
} \
@ -1054,7 +1054,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
if (!thisVis != !otherVis) {
// One style context has a style-if-visited and the other doesn't.
// Presume a difference.
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
} else if (thisVis && !NS_IsHintSubset(nsChangeHint_RepaintFrame, hint)) {
// Both style contexts have a style-if-visited.
bool change = false;
@ -1171,7 +1171,7 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther,
}
if (change) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
}
}

Просмотреть файл

@ -916,18 +916,17 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
// Markers currently contribute to nsSVGPathGeometryFrame::mRect,
// so we need a reflow as well as a repaint. No intrinsic sizes need
// to change, so nsChangeHint_NeedReflow is sufficient.
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
NS_UpdateHint(hint, nsChangeHint_NeedDirtyReflow); // XXX remove me: bug 876085
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
return hint;
return nsChangeHint_UpdateEffects |
nsChangeHint_NeedReflow |
nsChangeHint_NeedDirtyReflow | // XXX remove me: bug 876085
nsChangeHint_RepaintFrame;
}
if (mFill != aOther.mFill ||
mStroke != aOther.mStroke ||
mFillOpacity != aOther.mFillOpacity ||
mStrokeOpacity != aOther.mStrokeOpacity) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
if (HasStroke() != aOther.HasStroke() ||
(!HasStroke() && HasFill() != aOther.HasFill())) {
// Frame bounds and overflow rects depend on whether we "have" fill or
@ -936,12 +935,12 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
// bounds) and whether we have fill or not just changed. In either case we
// need to reflow so the frame rect is updated.
// XXXperf this is a waste on non nsSVGPathGeometryFrames.
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
NS_UpdateHint(hint, nsChangeHint_NeedDirtyReflow); // XXX remove me: bug 876085
hint |= nsChangeHint_NeedReflow |
nsChangeHint_NeedDirtyReflow; // XXX remove me: bug 876085
}
if (PaintURIChanged(mFill, aOther.mFill) ||
PaintURIChanged(mStroke, aOther.mStroke)) {
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
hint |= nsChangeHint_UpdateEffects;
}
}
@ -955,10 +954,10 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
mStrokeLinecap != aOther.mStrokeLinecap ||
mStrokeLinejoin != aOther.mStrokeLinejoin ||
mTextAnchor != aOther.mTextAnchor) {
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
NS_UpdateHint(hint, nsChangeHint_NeedDirtyReflow); // XXX remove me: bug 876085
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
return hint;
return hint |
nsChangeHint_NeedReflow |
nsChangeHint_NeedDirtyReflow | // XXX remove me: bug 876085
nsChangeHint_RepaintFrame;
}
if (hint & nsChangeHint_RepaintFrame) {
@ -978,16 +977,15 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
mStrokeDasharrayFromObject != aOther.mStrokeDasharrayFromObject ||
mStrokeDashoffsetFromObject != aOther.mStrokeDashoffsetFromObject ||
mStrokeWidthFromObject != aOther.mStrokeWidthFromObject) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
return hint;
return hint | nsChangeHint_RepaintFrame;
}
// length of stroke dasharrays are the same (tested above) - check entries
for (uint32_t i=0; i<mStrokeDasharrayLength; i++)
for (uint32_t i=0; i<mStrokeDasharrayLength; i++) {
if (mStrokeDasharray[i] != aOther.mStrokeDasharray[i]) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
return hint;
return hint | nsChangeHint_RepaintFrame;
}
}
return hint;
}
@ -1286,32 +1284,32 @@ nsChangeHint nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aOther) cons
nsChangeHint hint = nsChangeHint(0);
if (mClipPath != aOther.mClipPath) {
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_UpdateEffects |
nsChangeHint_RepaintFrame;
// clip-path changes require that we update the PreEffectsBBoxProperty,
// which is done during overflow computation.
NS_UpdateHint(hint, nsChangeHint_UpdateOverflow);
hint |= nsChangeHint_UpdateOverflow;
}
if (mDominantBaseline != aOther.mDominantBaseline) {
// XXXjwatt: why NS_STYLE_HINT_REFLOW? Isn't that excessive?
NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
hint |= NS_STYLE_HINT_REFLOW;
} else if (mVectorEffect != aOther.mVectorEffect) {
// Stroke currently affects nsSVGPathGeometryFrame::mRect, and
// vector-effect affect stroke. As a result we need to reflow if
// vector-effect changes in order to have nsSVGPathGeometryFrame::
// ReflowSVG called to update its mRect. No intrinsic sizes need
// to change so nsChangeHint_NeedReflow is sufficient.
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
NS_UpdateHint(hint, nsChangeHint_NeedDirtyReflow); // XXX remove me: bug 876085
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_NeedReflow |
nsChangeHint_NeedDirtyReflow | // XXX remove me: bug 876085
nsChangeHint_RepaintFrame;
} else if (mStopColor != aOther.mStopColor ||
mFloodColor != aOther.mFloodColor ||
mLightingColor != aOther.mLightingColor ||
mStopOpacity != aOther.mStopOpacity ||
mFloodOpacity != aOther.mFloodOpacity ||
mMaskType != aOther.mMaskType) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
}
hint |= mMask.CalcDifference(aOther.mMask);
@ -1513,7 +1511,7 @@ nsStylePosition::CalcDifference(const nsStylePosition& aOther,
// Changes to "z-index" require a repaint.
if (mZIndex != aOther.mZIndex) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
}
// Changes to "object-fit" & "object-position" require a repaint. They
@ -1521,8 +1519,8 @@ nsStylePosition::CalcDifference(const nsStylePosition& aOther,
// can adjust the size & position of the subdocument.
if (mObjectFit != aOther.mObjectFit ||
mObjectPosition != aOther.mObjectPosition) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame |
nsChangeHint_NeedReflow);
hint |= nsChangeHint_RepaintFrame |
nsChangeHint_NeedReflow;
}
if (mOrder != aOther.mOrder) {
@ -1599,13 +1597,13 @@ nsStylePosition::CalcDifference(const nsStylePosition& aOther,
if (mJustifyContent != aOther.mJustifyContent ||
mJustifyItems != aOther.mJustifyItems ||
mJustifySelf != aOther.mJustifySelf) {
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
hint |= nsChangeHint_NeedReflow;
}
// 'align-content' doesn't apply to a single-line flexbox but we don't know
// if we're a flex container at this point so we can't optimize for that.
if (mAlignContent != aOther.mAlignContent) {
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
hint |= nsChangeHint_NeedReflow;
}
bool widthChanged = mWidth != aOther.mWidth ||
@ -1634,22 +1632,22 @@ nsStylePosition::CalcDifference(const nsStylePosition& aOther,
// also have percentage bsizes. This is handled via
// nsChangeHint_UpdateComputedBSize which clears intrinsic sizes
// for frames that have such replaced elements.
NS_UpdateHint(hint, nsChangeHint_NeedReflow |
nsChangeHint_UpdateComputedBSize |
nsChangeHint_ReflowChangesSizeOrPosition);
hint |= nsChangeHint_NeedReflow |
nsChangeHint_UpdateComputedBSize |
nsChangeHint_ReflowChangesSizeOrPosition;
}
if (isVertical ? heightChanged : widthChanged) {
// None of our inline-size differences can affect descendant
// intrinsic sizes and none of them need to force children to
// reflow.
NS_UpdateHint(hint, nsChangeHint_AllReflowHints &
~(nsChangeHint_ClearDescendantIntrinsics |
nsChangeHint_NeedDirtyReflow));
hint |= nsChangeHint_AllReflowHints &
~(nsChangeHint_ClearDescendantIntrinsics |
nsChangeHint_NeedDirtyReflow);
}
} else {
if (widthChanged || heightChanged) {
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
hint |= nsChangeHint_NeutralChange;
}
}
@ -1662,10 +1660,10 @@ nsStylePosition::CalcDifference(const nsStylePosition& aOther,
// that's tricky to do and will hardly ever be able to avoid a reflow.
if (mOffset != aOther.mOffset) {
if (IsAutonessEqual(mOffset, aOther.mOffset)) {
NS_UpdateHint(hint, nsChangeHint(nsChangeHint_RecomputePosition |
nsChangeHint_UpdateParentOverflow));
hint |= nsChangeHint_RecomputePosition |
nsChangeHint_UpdateParentOverflow;
} else {
NS_UpdateHint(hint, nsChangeHint_AllReflowHints);
hint |= nsChangeHint_AllReflowHints;
}
}
return hint;
@ -2364,7 +2362,7 @@ nsStyleImageLayers::CalcDifference(const nsStyleImageLayers& aOther) const
mPositionXCount != aOther.mPositionXCount ||
mPositionYCount != aOther.mPositionYCount ||
mSizeCount != aOther.mSizeCount) {
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
hint |= nsChangeHint_NeutralChange;
}
return hint;
@ -2582,11 +2580,11 @@ nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aOthe
{
nsChangeHint hint = nsChangeHint(0);
if (!EqualURIs(mSourceURI, aOther.mSourceURI)) {
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_UpdateEffects |
nsChangeHint_RepaintFrame;
// Mask changes require that we update the PreEffectsBBoxProperty,
// which is done during overflow computation.
NS_UpdateHint(hint, nsChangeHint_UpdateOverflow);
hint |= nsChangeHint_UpdateOverflow;
} else if (mAttachment != aOther.mAttachment ||
mClip != aOther.mClip ||
mOrigin != aOther.mOrigin ||
@ -2945,7 +2943,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|| mScrollSnapDestination != aOther.mScrollSnapDestination
|| mTopLayer != aOther.mTopLayer
|| mResize != aOther.mResize)
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
hint |= nsChangeHint_ReconstructFrame;
/* Note: When mScrollBehavior, mScrollSnapTypeX, mScrollSnapTypeY,
* mScrollSnapPointsX, mScrollSnapPointsY, or mScrollSnapDestination are
@ -2974,15 +2972,15 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
if (mFloats != aOther.mFloats) {
// Changing which side we float on doesn't affect descendants directly
NS_UpdateHint(hint, nsChangeHint_AllReflowHints &
~(nsChangeHint_ClearDescendantIntrinsics |
nsChangeHint_NeedDirtyReflow));
hint |= nsChangeHint_AllReflowHints &
~(nsChangeHint_ClearDescendantIntrinsics |
nsChangeHint_NeedDirtyReflow);
}
if (mVerticalAlign != aOther.mVerticalAlign) {
// XXX Can this just be AllReflowHints + RepaintFrame, and be included in
// the block below?
NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
hint |= NS_STYLE_HINT_REFLOW;
}
// XXX the following is conservative, for now: changing float breaking shouldn't
@ -2994,11 +2992,11 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
|| mAppearance != aOther.mAppearance
|| mOrient != aOther.mOrient
|| mOverflowClipBox != aOther.mOverflowClipBox)
NS_UpdateHint(hint, nsChangeHint_AllReflowHints |
nsChangeHint_RepaintFrame);
hint |= nsChangeHint_AllReflowHints |
nsChangeHint_RepaintFrame;
if (mIsolation != aOther.mIsolation) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
}
/* If we've added or removed the transform property, we need to reconstruct the frame to add
@ -3008,9 +3006,9 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
// We do not need to apply nsChangeHint_UpdateTransformLayer since
// nsChangeHint_RepaintFrame will forcibly invalidate the frame area and
// ensure layers are rebuilt (or removed).
NS_UpdateHint(hint, nsChangeHint_UpdateContainingBlock |
nsChangeHint_UpdateOverflow |
nsChangeHint_RepaintFrame);
hint |= nsChangeHint_UpdateContainingBlock |
nsChangeHint_UpdateOverflow |
nsChangeHint_RepaintFrame;
} else {
/* Otherwise, if we've kept the property lying around and we already had a
* transform, we need to see whether or not we've changed the transform.
@ -3027,13 +3025,13 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
if (!mSpecifiedTransform != !aOther.mSpecifiedTransform ||
(mSpecifiedTransform &&
*mSpecifiedTransform != *aOther.mSpecifiedTransform)) {
NS_UpdateHint(transformHint, nsChangeHint_UpdateTransformLayer);
transformHint |= nsChangeHint_UpdateTransformLayer;
if (mSpecifiedTransform &&
aOther.mSpecifiedTransform) {
NS_UpdateHint(transformHint, nsChangeHint_UpdatePostTransformOverflow);
transformHint |= nsChangeHint_UpdatePostTransformOverflow;
} else {
NS_UpdateHint(transformHint, nsChangeHint_UpdateOverflow);
transformHint |= nsChangeHint_UpdateOverflow;
}
}
@ -3041,35 +3039,35 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
nsChangeHint_UpdateOverflow | nsChangeHint_RepaintFrame;
for (uint8_t index = 0; index < 3; ++index)
if (mTransformOrigin[index] != aOther.mTransformOrigin[index]) {
NS_UpdateHint(transformHint, nsChangeHint_UpdateTransformLayer |
nsChangeHint_UpdatePostTransformOverflow);
transformHint |= nsChangeHint_UpdateTransformLayer |
nsChangeHint_UpdatePostTransformOverflow;
break;
}
for (uint8_t index = 0; index < 2; ++index)
if (mPerspectiveOrigin[index] != aOther.mPerspectiveOrigin[index]) {
NS_UpdateHint(transformHint, kUpdateOverflowAndRepaintHint);
transformHint |= kUpdateOverflowAndRepaintHint;
break;
}
if (HasPerspectiveStyle() != aOther.HasPerspectiveStyle()) {
// A change from/to being a containing block for position:fixed.
NS_UpdateHint(hint, nsChangeHint_UpdateContainingBlock);
hint |= nsChangeHint_UpdateContainingBlock;
}
if (mChildPerspective != aOther.mChildPerspective ||
mTransformStyle != aOther.mTransformStyle ||
mTransformBox != aOther.mTransformBox)
NS_UpdateHint(transformHint, kUpdateOverflowAndRepaintHint);
transformHint |= kUpdateOverflowAndRepaintHint;
if (mBackfaceVisibility != aOther.mBackfaceVisibility)
NS_UpdateHint(transformHint, nsChangeHint_RepaintFrame);
transformHint |= nsChangeHint_RepaintFrame;
if (transformHint) {
if (HasTransformStyle()) {
NS_UpdateHint(hint, transformHint);
hint |= transformHint;
} else {
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
hint |= nsChangeHint_NeutralChange;
}
}
}
@ -3084,11 +3082,11 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
if (willChangeBitsChanged & (NS_STYLE_WILL_CHANGE_STACKING_CONTEXT |
NS_STYLE_WILL_CHANGE_SCROLL |
NS_STYLE_WILL_CHANGE_OPACITY)) {
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_RepaintFrame;
}
if (willChangeBitsChanged & NS_STYLE_WILL_CHANGE_FIXPOS_CB) {
NS_UpdateHint(hint, nsChangeHint_UpdateContainingBlock);
hint |= nsChangeHint_UpdateContainingBlock;
}
// Note: Our current behavior for handling changes to the
@ -3127,7 +3125,7 @@ nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
mAnimationPlayStateCount != aOther.mAnimationPlayStateCount ||
mAnimationIterationCountCount != aOther.mAnimationIterationCountCount ||
mScrollSnapCoordinate != aOther.mScrollSnapCoordinate)) {
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
hint |= nsChangeHint_NeutralChange;
}
return hint;
@ -3170,29 +3168,29 @@ nsChangeHint nsStyleVisibility::CalcDifference(const nsStyleVisibility& aOther)
// It's important that a change in mWritingMode results in frame
// reconstruction, because it may affect intrinsic size (see
// nsSubDocumentFrame::GetIntrinsicISize/BSize).
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
hint |= nsChangeHint_ReconstructFrame;
} else {
if ((mImageOrientation != aOther.mImageOrientation)) {
NS_UpdateHint(hint, nsChangeHint_AllReflowHints);
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_AllReflowHints |
nsChangeHint_RepaintFrame;
}
if (mVisible != aOther.mVisible) {
if ((NS_STYLE_VISIBILITY_COLLAPSE == mVisible) ||
(NS_STYLE_VISIBILITY_COLLAPSE == aOther.mVisible)) {
NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
hint |= NS_STYLE_HINT_REFLOW;
} else {
NS_UpdateHint(hint, NS_STYLE_HINT_VISUAL);
hint |= NS_STYLE_HINT_VISUAL;
}
}
if (mTextOrientation != aOther.mTextOrientation) {
NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
hint |= NS_STYLE_HINT_REFLOW;
}
if (mImageRendering != aOther.mImageRendering) {
hint |= nsChangeHint_RepaintFrame;
}
if (mColorAdjust != aOther.mColorAdjust) {
// color-adjust only affects media where dynamic changes can't happen.
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
hint |= nsChangeHint_NeutralChange;
}
}
return hint;
@ -3680,8 +3678,8 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aOther) const
mWebkitTextFillColor != aOther.mWebkitTextFillColor ||
mWebkitTextStrokeColorForeground != aOther.mWebkitTextStrokeColorForeground ||
mWebkitTextStrokeColor != aOther.mWebkitTextStrokeColor) {
NS_UpdateHint(hint, nsChangeHint_SchedulePaint);
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
hint |= nsChangeHint_SchedulePaint |
nsChangeHint_RepaintFrame;
}
if (hint) {
@ -3783,12 +3781,12 @@ nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aO
{
nsChangeHint hint = nsChangeHint(0);
if (mCursor != aOther.mCursor)
NS_UpdateHint(hint, nsChangeHint_UpdateCursor);
hint |= nsChangeHint_UpdateCursor;
// We could do better. But it wouldn't be worth it, URL-specified cursors are
// rare.
if (mCursorArrayLength > 0 || aOther.mCursorArrayLength > 0)
NS_UpdateHint(hint, nsChangeHint_UpdateCursor);
hint |= nsChangeHint_UpdateCursor;
if (mPointerEvents != aOther.mPointerEvents) {
// nsSVGPathGeometryFrame's mRect depends on stroke _and_ on the value
@ -3799,19 +3797,19 @@ nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aO
}
if (mUserModify != aOther.mUserModify)
NS_UpdateHint(hint, NS_STYLE_HINT_VISUAL);
hint |= NS_STYLE_HINT_VISUAL;
if (mUserInput != aOther.mUserInput) {
if (NS_STYLE_USER_INPUT_NONE == mUserInput ||
NS_STYLE_USER_INPUT_NONE == aOther.mUserInput) {
NS_UpdateHint(hint, NS_STYLE_HINT_FRAMECHANGE);
hint |= NS_STYLE_HINT_FRAMECHANGE;
} else {
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
hint |= nsChangeHint_NeutralChange;
}
}
if (mUserFocus != aOther.mUserFocus) {
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
hint |= nsChangeHint_NeutralChange;
}
return hint;

Просмотреть файл

@ -326,12 +326,12 @@ nsSVGFilterProperty::DoUpdate()
if (frame && frame->IsFrameOfType(nsIFrame::eSVG)) {
// Changes should propagate out to things that might be observing
// the referencing frame or its ancestors.
NS_UpdateHint(changeHint, nsChangeHint_InvalidateRenderingObservers);
changeHint |= nsChangeHint_InvalidateRenderingObservers;
}
// Don't need to request UpdateOverflow if we're being reflowed.
if (!(frame->GetStateBits() & NS_FRAME_IN_REFLOW)) {
NS_UpdateHint(changeHint, nsChangeHint_UpdateOverflow);
changeHint |= nsChangeHint_UpdateOverflow;
}
frame->PresContext()->RestyleManager()->PostRestyleEvent(
frame->GetContent()->AsElement(), nsRestyleHint(0), changeHint);
@ -354,7 +354,7 @@ nsSVGMarkerProperty::DoUpdate()
// Don't need to request ReflowFrame if we're being reflowed.
if (!(frame->GetStateBits() & NS_FRAME_IN_REFLOW)) {
NS_UpdateHint(changeHint, nsChangeHint_InvalidateRenderingObservers);
changeHint |= nsChangeHint_InvalidateRenderingObservers;
// XXXjwatt: We need to unify SVG into standard reflow so we can just use
// nsChangeHint_NeedReflow | nsChangeHint_NeedDirtyReflow here.
// XXXSDL KILL THIS!!!