Bug 1288938: Allow passing different reasons to dirty a non display SVG text frame. r=heycam

Otherwise, when a glyph changes, we might end up doing too much work, destroying
the text-run and the observer that dirtied the frame, causing an assertion when
trying to delete it from the observer set.

MozReview-Commit-ID: LMQVr6pYFVM
This commit is contained in:
Emilio Cobos Álvarez 2016-07-31 17:08:56 -07:00
Родитель e1e6b574d9
Коммит ff065c3a99
4 изменённых файлов: 12 добавлений и 11 удалений

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

@ -843,7 +843,7 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
if (anonBlock && !(anonBlock->GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
(svgTextFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY) &&
!(svgTextFrame->GetStateBits() & NS_STATE_SVG_TEXT_IN_REFLOW)) {
svgTextFrame->ScheduleReflowSVGNonDisplayText();
svgTextFrame->ScheduleReflowSVGNonDisplayText(nsIPresShell::eStyleChange);
}
}

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

@ -655,7 +655,7 @@ InvalidateFrameDueToGlyphsChanged(nsIFrame* aFrame)
auto svgTextFrame = static_cast<SVGTextFrame*>(
nsLayoutUtils::GetClosestFrameOfType(f,
nsGkAtoms::svgTextFrame));
svgTextFrame->ScheduleReflowSVGNonDisplayText();
svgTextFrame->ScheduleReflowSVGNonDisplayText(nsIPresShell::eResize);
} else {
// Theoretically we could just update overflow areas, perhaps using
// OverflowChangedTracker, but that would do a bunch of work eagerly that

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

@ -3322,7 +3322,7 @@ SVGTextFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
// child to be reflowed when it is next painted, and (b) not cause the
// <text> to be repainted anyway since the user of the <mask> would not
// know it needs to be repainted.
ScheduleReflowSVGNonDisplayText();
ScheduleReflowSVGNonDisplayText(nsIPresShell::eStyleChange);
}
}
@ -3356,7 +3356,7 @@ SVGTextFrame::ReflowSVGNonDisplayText()
}
void
SVGTextFrame::ScheduleReflowSVGNonDisplayText()
SVGTextFrame::ScheduleReflowSVGNonDisplayText(nsIPresShell::IntrinsicDirty aReason)
{
MOZ_ASSERT(!nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
"do not call ScheduleReflowSVGNonDisplayText when the outer SVG "
@ -3394,8 +3394,7 @@ SVGTextFrame::ScheduleReflowSVGNonDisplayText()
MOZ_ASSERT(f, "should have found an ancestor frame to reflow");
PresContext()->PresShell()->FrameNeedsReflow(
f, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
PresContext()->PresShell()->FrameNeedsReflow(f, aReason, NS_FRAME_IS_DIRTY);
}
NS_IMPL_ISUPPORTS(SVGTextFrame::MutationObserver, nsIMutationObserver)
@ -5296,7 +5295,7 @@ void
SVGTextFrame::ScheduleReflowSVG()
{
if (mState & NS_FRAME_IS_NONDISPLAY) {
ScheduleReflowSVGNonDisplayText();
ScheduleReflowSVGNonDisplayText(nsIPresShell::eStyleChange);
} else {
nsSVGUtils::ScheduleReflowSVG(this);
}

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

@ -399,11 +399,13 @@ public:
* nsSVGDisplayContainerFrame::ReflowSVG will call ReflowSVGNonDisplayText on
* it.
*
* The only case where we have to do this is in response to a style change on
* a non-display <text>. It is done in response to glyphs changes on
* non-display <text> (i.e., animated SVG-in-OpenType glyphs).
* We have to do this in two cases: in response to a style change on a
* non-display <text>, where aReason will be eStyleChange (the common case),
* and also in response to glyphs changes on non-display <text> (i.e.,
* animated SVG-in-OpenType glyphs), in which case aReason will be eResize,
* since layout doesn't need to be recomputed.
*/
void ScheduleReflowSVGNonDisplayText();
void ScheduleReflowSVGNonDisplayText(nsIPresShell::IntrinsicDirty aReason);
/**
* Updates the mFontSizeScaleFactor value by looking at the range of