Bug 1400035 - Propagate RepaintFrame change hint instead of UpdateOpacityLayer for SVG geometry frames. r?jwatt
We do return RepaintFrame change hint from nsStyleEffects::CalcDifference for
the case where we optimize 0.99 over opacity values. We also need RepaintFrame
change hint for the opacity optimization in SVG, but we can't return the change
hint from CalcDifference() since we have no way to know whether we are
calculating change hint for the optimized frame, so we fix it up in
ProcessRestyledFrames() instead.
MozReview-Commit-ID: 5GUaN9ecfoC
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1563,16 +1563,28 @@ RestyleManager::ProcessRestyledFrames(ns
!(frame->GetStateBits() & NS_STATE_IS_OUTER_SVG))) {
SVGObserverUtils::InvalidateRenderingObservers(frame);
}
if (hint & nsChangeHint_NeedReflow) {
StyleChangeReflow(frame, hint);
didReflowThisFrame = true;
}
+ // Here we need to propagate repaint frame change hint instead of update
+ // opacity layer change hint when we do opacity optimization for SVG.
+ // We can't do it in nsStyleEffects::CalcDifference() just like we do
+ // for the optimization for 0.99 over opacity values since we have no way
+ // to call nsSVGUtils::CanOptimizeOpacity() there.
+ if ((hint & nsChangeHint_UpdateOpacityLayer) &&
+ nsSVGUtils::CanOptimizeOpacity(frame) &&
+ frame->IsFrameOfType(nsIFrame::eSVGGeometry)) {
+ hint &= ~nsChangeHint_UpdateOpacityLayer;
+ hint |= nsChangeHint_RepaintFrame;
+ }
+
if ((hint & nsChangeHint_UpdateUsesOpacity) &&
frame->IsFrameOfType(nsIFrame::eTablePart)) {
NS_ASSERTION(hint & nsChangeHint_UpdateOpacityLayer,
"should only return UpdateUsesOpacity hint "
"when also returning UpdateOpacityLayer hint");
// When an internal table part (including cells) changes between
// having opacity 1 and non-1, it changes whether its
// backgrounds (and those of table parts inside of it) are