Bug 1342951 - Revert landing of wrong patch. r=me
authorJonathan Watt <jwatt@jwatt.org>
Mon, 14 Aug 2017 16:01:48 +0100
changeset 429099 3a540f01983eeaa8d93e8eed0f8b4b644a63d412
parent 429098 ff8a16b5ebfabffcde11c7cfede5e35cb82f5647
child 429100 545efe0fed92454e52c94e146295a69f8b8e02ef
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1342951
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1342951 - Revert landing of wrong patch. r=me
dom/svg/SVGTextContentElement.cpp
layout/svg/SVGTextFrame.cpp
layout/svg/nsSVGContainerFrame.cpp
--- a/dom/svg/SVGTextContentElement.cpp
+++ b/dom/svg/SVGTextContentElement.cpp
@@ -140,17 +140,17 @@ SVGTextContentElement::SelectSubString(u
     return;
 
   rv = textFrame->SelectSubString(this, charnum, nchars);
 }
 
 float
 SVGTextContentElement::GetSubStringLength(uint32_t charnum, uint32_t nchars, ErrorResult& rv)
 {
-  SVGTextFrame* textFrame = GetSVGTextFrameForNonLayoutDependentQuery();
+  SVGTextFrame* textFrame = GetSVGTextFrame();
   if (!textFrame)
     return 0.0f;
 
   float length = 0.0f;
   rv = textFrame->GetSubStringLength(this, charnum, nchars, &length);
   return length;
 }
 
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -3248,16 +3248,19 @@ SVGTextFrame::DidSetStyleContext(nsStyle
     // know it needs to be repainted.
     ScheduleReflowSVGNonDisplayText(nsIPresShell::eStyleChange);
   }
 }
 
 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");
 
   // We had a style change, so we mark this frame as dirty so that the next
   // time it is painted, we reflow the anonymous block frame.
   AddStateBits(NS_FRAME_IS_DIRTY);
 
@@ -3757,16 +3760,19 @@ SVGTextFrame::GetFrameForPoint(const gfx
     }
   }
   return hit;
 }
 
 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");
 
   if (!nsSVGUtils::NeedsReflowSVG(this)) {
     NS_ASSERTION(!(mState & NS_STATE_SVG_POSITIONING_DIRTY), "How did this happen?");
     return;
   }
 
@@ -4049,23 +4055,17 @@ SVGTextFrame::SelectSubString(nsIContent
  * Implements the SVG DOM GetSubStringLength method for the specified
  * text content element.
  */
 nsresult
 SVGTextFrame::GetSubStringLength(nsIContent* aContent,
                                  uint32_t charnum, uint32_t nchars,
                                  float* aResult)
 {
-  // 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();
-  }
+  UpdateGlyphPositioning();
 
   // Convert charnum/nchars from addressable characters relative to
   // aContent to global character indices.
   CharIterator chit(this, CharIterator::eAddressable, aContent);
   if (!chit.AdvanceToSubtree() ||
       !chit.Next(charnum) ||
       chit.IsAfterSubtree()) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
@@ -5246,16 +5246,18 @@ SVGTextFrame::MaybeReflowAnonymousBlockC
   if (NS_SUBTREE_DIRTY(this)) {
     if (mState & NS_FRAME_IS_DIRTY) {
       // If we require a full reflow, ensure our kid is marked fully dirty.
       // (Note that our anonymous nsBlockFrame is not an nsSVGDisplayableFrame, so
       // even when we are called via our ReflowSVG this will not be done for us
       // by nsSVGDisplayContainerFrame::ReflowSVG.)
       kid->AddStateBits(NS_FRAME_IS_DIRTY);
     }
+    MOZ_ASSERT(nsSVGUtils::AnyOuterSVGIsCallingReflowSVG(this),
+               "should be under ReflowSVG");
     nsPresContext::InterruptPreventer noInterrupts(PresContext());
     DoReflow();
   }
 }
 
 void
 SVGTextFrame::DoReflow()
 {
--- a/layout/svg/nsSVGContainerFrame.cpp
+++ b/layout/svg/nsSVGContainerFrame.cpp
@@ -304,16 +304,19 @@ nsSVGDisplayContainerFrame::GetFrameForP
                "If display lists are enabled, only hit-testing of a "
                "clipPath's contents should take this code path");
   return nsSVGUtils::HitTestChildren(this, 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");
 
   MOZ_ASSERT(!IsSVGOuterSVGFrame(), "Do not call on outer-<svg>");
 
   if (!nsSVGUtils::NeedsReflowSVG(this)) {
     return;
   }