mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 10:08:41 +00:00
Remove maxHint from nsStyleContext::CalcStyleDifference. (Bug 779968, patch 3) r=bzbarsky
This commit is contained in:
parent
4846e76d8e
commit
c596be2ae1
@ -388,8 +388,6 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther)
|
|||||||
|
|
||||||
#define DO_STRUCT_DIFFERENCE(struct_) \
|
#define DO_STRUCT_DIFFERENCE(struct_) \
|
||||||
PR_BEGIN_MACRO \
|
PR_BEGIN_MACRO \
|
||||||
NS_ASSERTION(NS_IsHintSubset(nsStyle##struct_::MaxDifference(), maxHint), \
|
|
||||||
"Struct placed in the wrong maxHint section"); \
|
|
||||||
const nsStyle##struct_* this##struct_ = PeekStyle##struct_(); \
|
const nsStyle##struct_* this##struct_ = PeekStyle##struct_(); \
|
||||||
if (this##struct_) { \
|
if (this##struct_) { \
|
||||||
const nsStyle##struct_* other##struct_ = aOther->GetStyle##struct_(); \
|
const nsStyle##struct_* other##struct_ = aOther->GetStyle##struct_(); \
|
||||||
@ -410,17 +408,12 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther)
|
|||||||
} \
|
} \
|
||||||
PR_END_MACRO
|
PR_END_MACRO
|
||||||
|
|
||||||
// We begin by examining those style structs that are capable of
|
// In general, we want to examine structs starting with those that can
|
||||||
// causing the maximal difference, a FRAMECHANGE.
|
// cause the largest style change, down to those that can cause the
|
||||||
// FRAMECHANGE Structs: Display, XUL, Content, UserInterface,
|
// smallest. This lets us skip later ones if we already have a hint
|
||||||
// Visibility, Outline, TableBorder, Table, Text, UIReset, Quotes
|
// that subsumes their MaxDifference. (As the hints get
|
||||||
nsChangeHint maxHint = nsChangeHint(NS_STYLE_HINT_FRAMECHANGE |
|
// finer-grained, this optimization is becoming less useful, though.)
|
||||||
nsChangeHint_UpdateTransformLayer | nsChangeHint_UpdateOpacityLayer |
|
|
||||||
nsChangeHint_UpdateOverflow | nsChangeHint_AddOrRemoveTransform);
|
|
||||||
DO_STRUCT_DIFFERENCE(Display);
|
DO_STRUCT_DIFFERENCE(Display);
|
||||||
|
|
||||||
maxHint = nsChangeHint(NS_STYLE_HINT_FRAMECHANGE |
|
|
||||||
nsChangeHint_UpdateCursor);
|
|
||||||
DO_STRUCT_DIFFERENCE(XUL);
|
DO_STRUCT_DIFFERENCE(XUL);
|
||||||
DO_STRUCT_DIFFERENCE(Column);
|
DO_STRUCT_DIFFERENCE(Column);
|
||||||
DO_STRUCT_DIFFERENCE(Content);
|
DO_STRUCT_DIFFERENCE(Content);
|
||||||
@ -432,38 +425,16 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther)
|
|||||||
DO_STRUCT_DIFFERENCE(UIReset);
|
DO_STRUCT_DIFFERENCE(UIReset);
|
||||||
DO_STRUCT_DIFFERENCE(Text);
|
DO_STRUCT_DIFFERENCE(Text);
|
||||||
DO_STRUCT_DIFFERENCE(List);
|
DO_STRUCT_DIFFERENCE(List);
|
||||||
// If the quotes implementation is ever going to change we might not need
|
|
||||||
// a framechange here and a reflow should be sufficient. See bug 35768.
|
|
||||||
DO_STRUCT_DIFFERENCE(Quotes);
|
DO_STRUCT_DIFFERENCE(Quotes);
|
||||||
|
|
||||||
maxHint = nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_UpdateEffects);
|
|
||||||
DO_STRUCT_DIFFERENCE(SVGReset);
|
DO_STRUCT_DIFFERENCE(SVGReset);
|
||||||
DO_STRUCT_DIFFERENCE(SVG);
|
DO_STRUCT_DIFFERENCE(SVG);
|
||||||
|
|
||||||
maxHint = nsChangeHint(NS_STYLE_HINT_REFLOW |
|
|
||||||
nsChangeHint_UpdateOverflow | nsChangeHint_RecomputePosition);
|
|
||||||
DO_STRUCT_DIFFERENCE(Position);
|
DO_STRUCT_DIFFERENCE(Position);
|
||||||
|
|
||||||
// At this point, we know that the worst kind of damage we could do is
|
|
||||||
// a reflow.
|
|
||||||
maxHint = NS_STYLE_HINT_REFLOW;
|
|
||||||
|
|
||||||
// The following structs cause (as their maximal difference) a reflow
|
|
||||||
// to occur. REFLOW Structs: Font, Margin, Padding, Border, List,
|
|
||||||
// Position, Text, TextReset
|
|
||||||
DO_STRUCT_DIFFERENCE(Font);
|
DO_STRUCT_DIFFERENCE(Font);
|
||||||
DO_STRUCT_DIFFERENCE(Margin);
|
DO_STRUCT_DIFFERENCE(Margin);
|
||||||
DO_STRUCT_DIFFERENCE(Padding);
|
DO_STRUCT_DIFFERENCE(Padding);
|
||||||
DO_STRUCT_DIFFERENCE(Border);
|
DO_STRUCT_DIFFERENCE(Border);
|
||||||
DO_STRUCT_DIFFERENCE(TextReset);
|
DO_STRUCT_DIFFERENCE(TextReset);
|
||||||
|
|
||||||
// Most backgrounds only require a re-render (i.e., a VISUAL change), but
|
|
||||||
// backgrounds using -moz-element need to reset SVG effects, too.
|
|
||||||
maxHint = nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_UpdateEffects);
|
|
||||||
DO_STRUCT_DIFFERENCE(Background);
|
DO_STRUCT_DIFFERENCE(Background);
|
||||||
|
|
||||||
// Color only needs a repaint.
|
|
||||||
maxHint = NS_STYLE_HINT_VISUAL;
|
|
||||||
DO_STRUCT_DIFFERENCE(Color);
|
DO_STRUCT_DIFFERENCE(Color);
|
||||||
|
|
||||||
#undef DO_STRUCT_DIFFERENCE
|
#undef DO_STRUCT_DIFFERENCE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user