Right now when style changes etc. cause FrameNeedsReflow() to be called on descendants of non-display SVG, the dirty marking up the ancestor chain continues out of the non-display frames into the displayed frames, resulting in needless reflow work happening. For example, when the font-size changes on a <tspan> in <text> in a <pattern>, nsStyleFont::CalcFontDifference is called under ReResolveStyleContext causing a restyle with the NS_STYLE_HINT_REFLOW hint. We end up in nsCSSFrameConstructor::ProcessRestyledFrames where StyleChangeReflow() is called for the tspan frame, which calls FrameNeedsReflow passing NS_FRAME_IS_DIRTY. That sets NS_FRAME_IS_DIRTY on the tspan and NS_FRAME_HAS_DIRTY_CHILDREN on its ancestors, most likely all the way up to the root frame. We should stop FrameNeedsReflow from doing this.
We could solve this with a bit flag on nsSVGPatternFrame etc. which would make FrameNeedsReflow halt. Note that this would be slightly different to the NS_FRAME_REFLOW_ROOT flag, since we wouldn't actually want to add anything to PresShell::mDirtyRoots.
Is this kind of like what I have currently in nsSVGTextFrame2::ScheduleReflowSVGNonDisplayText?
You need to log in before you can comment on or make changes to this bug.