Backed out 2 changesets (bug 1343695) for osx chrome mochitest assertions a=backout
authorWes Kocher <wkocher@mozilla.com>
Mon, 13 Mar 2017 16:44:23 -0700
changeset 347402 41c24766c4ce0e2f98ae6a0a3b2a7d294e6a4544
parent 347401 6b1862025a25525ce9ebcd044afa91269d1d4ee5
child 347403 0dcf56cef37d4d44a2342eaee006390dbdb48731
push id31496
push usercbook@mozilla.com
push dateTue, 14 Mar 2017 13:21:57 +0000
treeherdermozilla-central@9a26ed658fdc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1343695
milestone55.0a1
backs oute5db40a036fef8a575630d94c0fcb0d436ca957c
687ffd715113f7eecbff4be3b73914f4e288c34c
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
Backed out 2 changesets (bug 1343695) for osx chrome mochitest assertions a=backout Backed out changeset e5db40a036fe (bug 1343695) Backed out changeset 687ffd715113 (bug 1343695) MozReview-Commit-ID: 2CN1gipg3ia
dom/base/nsRange.cpp
dom/base/test/chrome/test_range_getClientRectsAndTexts.html
layout/base/nsLayoutUtils.cpp
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -2901,16 +2901,23 @@ GetTextFrameForContent(nsIContent* aCont
 static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback,
                                    Sequence<nsString>* aTextList,
                                    nsIContent* aContent, int32_t aStartOffset,
                                    int32_t aEndOffset, bool aClampToEdge,
                                    bool aFlushLayout)
 {
   nsTextFrame* textFrame = GetTextFrameForContent(aContent, aFlushLayout);
   if (textFrame) {
+    // If we'll need it later, collect the full content text now.
+    nsAutoString textContent;
+    if (aTextList) {
+      mozilla::ErrorResult err; // ignored
+      aContent->GetTextContent(textContent, err);
+    }
+
     nsIFrame* relativeTo = nsLayoutUtils::GetContainingBlockForClientRect(textFrame);
     for (nsTextFrame* f = textFrame; f; f = static_cast<nsTextFrame*>(f->GetNextContinuation())) {
       int32_t fstart = f->GetContentOffset(), fend = f->GetContentEnd();
       if (fend <= aStartOffset || fstart >= aEndOffset)
         continue;
 
       // Calculate the text content offsets we'll need if text is requested.
       int32_t textContentStart = fstart;
@@ -2931,23 +2938,21 @@ static nsresult GetPartialTextRect(nsLay
         ExtractRectFromOffset(f, aEndOffset, &r, !rtl, aClampToEdge);
         textContentEnd = aEndOffset;
       }
       r = nsLayoutUtils::TransformFrameRectToAncestor(f, r, relativeTo);
       aCallback->AddRect(r);
 
       // Finally capture the text, if requested.
       if (aTextList) {
-        nsIFrame::RenderedText renderedText = f->GetRenderedText(
-          textContentStart,
-          textContentEnd,
-          nsIFrame::TextOffsetType::OFFSETS_IN_CONTENT_TEXT,
-          nsIFrame::TrailingWhitespace::DONT_TRIM_TRAILING_WHITESPACE);
-
-        aTextList->AppendElement(renderedText.mString, fallible);
+        const nsAString& textSubstring =
+          Substring(textContent,
+                    textContentStart,
+                    (textContentEnd - textContentStart));
+        aTextList->AppendElement(textSubstring, fallible);
       }
     }
   }
   return NS_OK;
 }
 
 /* static */ void
 nsRange::CollectClientRectsAndText(nsLayoutUtils::RectCallback* aCollector,
--- a/dom/base/test/chrome/test_range_getClientRectsAndTexts.html
+++ b/dom/base/test/chrome/test_range_getClientRectsAndTexts.html
@@ -10,27 +10,21 @@ SimpleTest.waitForExplicitFinish();
 
 function runTests()
 {
   let range = document.createRange();
 
   let attempts = [
     {startNode: "one", start:0, endNode:"one", end:0, textList:[], message:"Empty rect"},
     {startNode: "one", start:2, endNode:"one", end:6, textList:["l on"], message:"Single line"},
-    {startNode: "implicit", start:6, endNode:"implicit", end:12, textList:["it bre"], message:"Implicit break"},
+    {startNode: "implicit", start:6, endNode:"implicit", end:12, textList:["it\nbre"], message:"Implicit break"},
     {startNode: "two.a", start:1, endNode:"two.b", end:2, textList:["wo", "", "li"], message:"Two lines"},
     {startNode: "embed.a", start:7, endNode:"embed.b", end:2, textList:["th ", "simple nested", " ", "te"], message:"Simple nested"},
     {startNode: "deep.a", start:2, endNode:"deep.b", end:2, textList:["ne with ", "complex, more deeply nested", " ", "te"], message:"Complex nested"},
     {startNode: "image.a", start:7, endNode:"image.b", end:2, textList:["th inline ", "", " ", "im"], message:"Inline image"},
-    {startNode: "hyphen1", start:0, endNode:"hyphen1", end:3, textList:["a\u00AD", "b"], message:"Shy hyphen (active)"},
-    {startNode: "hyphen2", start:0, endNode:"hyphen2", end:3, textList:["c\u00ADd"], message:"Shy hyphen (inactive)"},
-    {startNode: "hyphen2", start:0, endNode:"hyphen2", end:2, textList:["c\u00AD"], message:"Shy hyphen (inactive, trailing)"},
-    {startNode: "hyphen2", start:1, endNode:"hyphen2", end:3, textList:["\u00ADd"], message:"Shy hyphen (inactive, leading)"},
-    {startNode: "uc", start:0, endNode:"uc", end:2, textList:["EF"], message:"UC transform"},
-    {startNode: "pre", start:0, endNode:"pre", end:3, textList:["g\n", "h"], message:"pre with break"},
   ];
 
   for (let attempt of attempts) {
     range.setStart(document.getElementById(attempt.startNode).childNodes[0], attempt.start);
     range.setEnd(document.getElementById(attempt.endNode).childNodes[0], attempt.end);
 
     let result = range.getClientRectsAndTexts();
 
@@ -57,19 +51,10 @@ break in one line</div>
 ><span id="two.b">lines</span></div>
 
 <div id="embed.a">Line with <span>simple nested</span> <span id="embed.b">text</span></div>
 
 <div id="deep.a">Line with <span>complex, <span>more <span>deeply <span>nested</span></span></span></span> <span id="deep.b">text</span></div>
 
 <div id="image.a">Line with inline <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAG0lEQVR42mP8z0A%2BYKJA76jmUc2jmkc1U0EzACKcASfOgGoMAAAAAElFTkSuQmCC" width="20" height="20"/> <span id="image.b">image</span></div>
 
-<div id="hyphen1" style="width:0">a&shy;b</div>
-
-<div id="hyphen2" style="width:100px">c&shy;d</div>
-
-<div id="uc" style="text-transform:uppercase">ef</div>
-
-<pre id="pre">g
-h</pre>
-
 </body>
 </html>
\ No newline at end of file
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4013,23 +4013,26 @@ struct MOZ_RAII BoxToRectAndText : publi
   static void AccumulateText(nsIFrame* aFrame, nsAString& aResult) {
     MOZ_ASSERT(aFrame);
 
     // Get all the text in aFrame and child frames, while respecting
     // the content offsets in each of the nsTextFrames.
     if (aFrame->GetType() == nsGkAtoms::textFrame) {
       nsTextFrame* textFrame = static_cast<nsTextFrame*>(aFrame);
 
-      nsIFrame::RenderedText renderedText = textFrame->GetRenderedText(
-        textFrame->GetContentOffset(),
-        textFrame->GetContentOffset() + textFrame->GetContentLength(),
-        nsIFrame::TextOffsetType::OFFSETS_IN_CONTENT_TEXT,
-        nsIFrame::TrailingWhitespace::DONT_TRIM_TRAILING_WHITESPACE);
-
-      aResult.Append(renderedText.mString);
+      nsIContent* content = textFrame->GetContent();
+      nsAutoString textContent;
+      mozilla::ErrorResult err; // ignored
+      content->GetTextContent(textContent, err);
+
+      const nsAString& textSubstring =
+        Substring(textContent,
+                  textFrame->GetContentOffset(),
+                  textFrame->GetContentLength());
+      aResult.Append(textSubstring);
     }
 
     for (nsIFrame* child = aFrame->PrincipalChildList().FirstChild();
          child;
          child = child->GetNextSibling()) {
       AccumulateText(child, aResult);
     }
   }