Bug 1289868 - Part 1: stylo: Add an outparam to Gecko_CalcStyleDifference that returns whether any style data changed. r=emilio
MozReview-Commit-ID: 2Pk2x9JME0
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -327,30 +327,28 @@ Gecko_GetStyleContext(RawGeckoElementBor
CSSPseudoElementType
Gecko_GetImplementedPseudo(RawGeckoElementBorrowed aElement)
{
return aElement->GetPseudoElementType();
}
nsChangeHint
Gecko_CalcStyleDifference(nsStyleContext* aOldStyleContext,
- ServoComputedValuesBorrowed aComputedValues)
+ ServoComputedValuesBorrowed aComputedValues,
+ bool* aAnyStyleChanged)
{
MOZ_ASSERT(aOldStyleContext);
MOZ_ASSERT(aComputedValues);
- // Eventually, we should compute things out of these flags like
- // ElementRestyler::RestyleSelf does and pass the result to the caller to
- // potentially halt traversal. See bug 1289868.
uint32_t equalStructs, samePointerStructs;
nsChangeHint result =
aOldStyleContext->CalcStyleDifference(aComputedValues,
&equalStructs,
&samePointerStructs);
-
+ *aAnyStyleChanged = equalStructs != NS_STYLE_INHERIT_MASK;
return result;
}
nsChangeHint
Gecko_HintsHandledForDescendants(nsChangeHint aHint)
{
return aHint & ~NS_HintsNotHandledForDescendantsIn(aHint);
}
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -317,17 +317,18 @@ void Gecko_SetOwnerDocumentNeedsStyleFlu
// Incremental restyle.
// Also, we might want a ComputedValues to ComputedValues API for animations?
// Not if we do them in Gecko...
nsStyleContext* Gecko_GetStyleContext(RawGeckoElementBorrowed element,
nsIAtom* aPseudoTagOrNull);
mozilla::CSSPseudoElementType Gecko_GetImplementedPseudo(RawGeckoElementBorrowed element);
nsChangeHint Gecko_CalcStyleDifference(nsStyleContext* oldstyle,
- ServoComputedValuesBorrowed newstyle);
+ ServoComputedValuesBorrowed newstyle,
+ bool* any_style_changed);
nsChangeHint Gecko_HintsHandledForDescendants(nsChangeHint aHint);
// Get an element snapshot for a given element from the table.
const ServoElementSnapshot*
Gecko_GetElementSnapshot(const mozilla::ServoElementSnapshotTable* table,
RawGeckoElementBorrowed element);
void Gecko_DropElementSnapshot(ServoElementSnapshotOwned snapshot);