Bug 1342951 - Limit SVGTextFrame::GetSubStringLength sync reflows to the SVGTextFrame. r=heycam

This commit is contained in:
Jonathan Watt 2017-08-14 16:00:33 +01:00
Родитель d8964297e9
Коммит 3808c49bb5
3 изменённых файлов: 8 добавлений и 13 удалений

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

@ -145,7 +145,7 @@ SVGTextContentElement::SelectSubString(uint32_t charnum, uint32_t nchars, ErrorR
float
SVGTextContentElement::GetSubStringLength(uint32_t charnum, uint32_t nchars, ErrorResult& rv)
{
SVGTextFrame* textFrame = GetSVGTextFrame();
SVGTextFrame* textFrame = GetSVGTextFrameForNonLayoutDependentQuery();
if (!textFrame)
return 0.0f;

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

@ -3253,9 +3253,6 @@ SVGTextFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
void
SVGTextFrame::ReflowSVGNonDisplayText()
{
MOZ_ASSERT(nsSVGUtils::AnyOuterSVGIsCallingReflowSVG(this),
"only call ReflowSVGNonDisplayText when an outer SVG frame is "
"under ReflowSVG");
MOZ_ASSERT(mState & NS_FRAME_IS_NONDISPLAY,
"only call ReflowSVGNonDisplayText if the frame is "
"NS_FRAME_IS_NONDISPLAY");
@ -3765,9 +3762,6 @@ SVGTextFrame::GetFrameForPoint(const gfxPoint& aPoint)
void
SVGTextFrame::ReflowSVG()
{
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probaby a wasteful mistake");
MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY),
"ReflowSVG mechanism not designed for this");
@ -4060,7 +4054,13 @@ SVGTextFrame::GetSubStringLength(nsIContent* aContent,
uint32_t charnum, uint32_t nchars,
float* aResult)
{
UpdateGlyphPositioning();
// XXX perf: We only care about glyph advances here, so we really shouldn't
// be reflowing.
if (mState & NS_FRAME_IS_NONDISPLAY) {
ReflowSVGNonDisplayText();
} else {
ReflowSVG();
}
// Convert charnum/nchars from addressable characters relative to
// aContent to global character indices.
@ -5251,8 +5251,6 @@ SVGTextFrame::MaybeReflowAnonymousBlockChild()
// by nsSVGDisplayContainerFrame::ReflowSVG.)
kid->AddStateBits(NS_FRAME_IS_DIRTY);
}
MOZ_ASSERT(nsSVGUtils::AnyOuterSVGIsCallingReflowSVG(this),
"should be under ReflowSVG");
nsPresContext::InterruptPreventer noInterrupts(PresContext());
DoReflow();
}

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

@ -309,9 +309,6 @@ nsSVGDisplayContainerFrame::GetFrameForPoint(const gfxPoint& aPoint)
void
nsSVGDisplayContainerFrame::ReflowSVG()
{
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY),
"ReflowSVG mechanism not designed for this");