From 812bc7697e6bba8cc570ae08038538728ea471aa Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 7 Nov 2012 12:31:00 +0000 Subject: [PATCH] Backout 99a2125bd365 (bug 779971) for reftest failures --- layout/base/nsCSSFrameConstructor.cpp | 7 ----- layout/base/nsChangeHint.h | 8 +----- layout/svg/crashtests/779971-1.svg | 14 ---------- layout/svg/crashtests/crashtests.list | 1 - layout/svg/nsSVGEffects.cpp | 38 +++++++++++++++++++++++---- 5 files changed, 34 insertions(+), 34 deletions(-) delete mode 100644 layout/svg/crashtests/779971-1.svg diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 0cf2d45ae6c6..2c191a0383fd 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -116,7 +116,6 @@ #include "nsIDOMSVGFilters.h" #include "DOMSVGTests.h" #include "nsSVGEffects.h" -#include "nsSVGTextPathFrame.h" #include "nsSVGUtils.h" #include "nsRefreshDriver.h" @@ -7788,12 +7787,6 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame, needInvalidatingPaint = true; // Invalidate and update our area: nsSVGUtils::InvalidateAndScheduleReflowSVG(aFrame); - } else if (aChange & nsChangeHint_UpdateTextPath) { - NS_ABORT_IF_FALSE(aFrame->GetType() == nsGkAtoms::svgTextPathFrame, - "textPath frame expected"); - needInvalidatingPaint = true; - // Invalidate and update our area: - static_cast(aFrame)->NotifyGlyphMetricsChange(); } else { needInvalidatingPaint = true; // Just invalidate our area: diff --git a/layout/base/nsChangeHint.h b/layout/base/nsChangeHint.h index 977eae84acff..cb055fb1f970 100644 --- a/layout/base/nsChangeHint.h +++ b/layout/base/nsChangeHint.h @@ -111,13 +111,7 @@ enum nsChangeHint { * changes, and it's inherited by a child, that might require a reflow * due to the border-width change on the child. */ - nsChangeHint_BorderStyleNoneChange = 0x8000, - - /** - * SVG textPath needs to be recomputed because the path has changed. - * This means that the glyph positions of the text need to be recomputed. - */ - nsChangeHint_UpdateTextPath = 0x10000 + nsChangeHint_BorderStyleNoneChange = 0x8000 // IMPORTANT NOTE: When adding new hints, consider whether you need to // add them to NS_HintsNotHandledForDescendantsIn() below. diff --git a/layout/svg/crashtests/779971-1.svg b/layout/svg/crashtests/779971-1.svg deleted file mode 100644 index d57065a0ba8a..000000000000 --- a/layout/svg/crashtests/779971-1.svg +++ /dev/null @@ -1,14 +0,0 @@ - -x1 - - diff --git a/layout/svg/crashtests/crashtests.list b/layout/svg/crashtests/crashtests.list index e026a3846231..d01bb92fee52 100644 --- a/layout/svg/crashtests/crashtests.list +++ b/layout/svg/crashtests/crashtests.list @@ -136,7 +136,6 @@ load 767056-1.svg load 768351.svg load 780963-1.html load 757751-1.svg -load 779971-1.svg load 782141-1.svg load 784061-1.svg load 790072.svg diff --git a/layout/svg/nsSVGEffects.cpp b/layout/svg/nsSVGEffects.cpp index 03ae18918119..e307665c6431 100644 --- a/layout/svg/nsSVGEffects.cpp +++ b/layout/svg/nsSVGEffects.cpp @@ -286,6 +286,32 @@ nsSVGMarkerProperty::DoUpdate() mFrame->GetContent()->AsElement(), nsRestyleHint(0), changeHint); } +class nsAsyncNotifyGlyphMetricsChange MOZ_FINAL : public nsIReflowCallback +{ +public: + nsAsyncNotifyGlyphMetricsChange(nsIFrame* aFrame) : mWeakFrame(aFrame) + { + } + + virtual bool ReflowFinished() + { + nsSVGTextPathFrame* frame = + static_cast(mWeakFrame.GetFrame()); + if (frame) { + frame->NotifyGlyphMetricsChange(); + } + delete this; + return true; + } + + virtual void ReflowCallbackCanceled() + { + delete this; + } + + nsWeakFrame mWeakFrame; +}; + void nsSVGTextPathProperty::DoUpdate() { @@ -296,11 +322,13 @@ nsSVGTextPathProperty::DoUpdate() NS_ASSERTION(mFrame->IsFrameOfType(nsIFrame::eSVG), "SVG frame expected"); if (mFrame->GetType() == nsGkAtoms::svgTextPathFrame) { - // Repaint asynchronously in case the path frame is being torn down - nsChangeHint changeHint = - nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_UpdateTextPath); - mFramePresShell->FrameConstructor()->PostRestyleEvent( - mFrame->GetContent()->AsElement(), nsRestyleHint(0), changeHint); + if (mFrame->PresContext()->PresShell()->IsReflowLocked()) { + nsIReflowCallback* cb = new nsAsyncNotifyGlyphMetricsChange(mFrame); + mFrame->PresContext()->PresShell()->PostReflowCallback(cb); + } else { + nsSVGTextPathFrame* textPathFrame = static_cast(mFrame); + textPathFrame->NotifyGlyphMetricsChange(); + } } }