Bug 1322096 - Don't special-case rp in innerText. r=smaug
authorSimon Pieters <zcorpan@gmail.com>
Wed, 03 Oct 2018 12:20:32 +0000
changeset 487722 fc316e011bb6647781db75fb01e2845410ca9e3a
parent 487721 f062d23be1811dce1fc21ef72f3772f9acdc5cdf
child 487723 6bca826c27cf5f951069fe64617dc1e1e58a82ab
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewerssmaug
bugs1322096
milestone64.0a1
Bug 1322096 - Don't special-case rp in innerText. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D7420
dom/base/nsRange.cpp
testing/web-platform/meta/html/dom/elements/the-innertext-idl-attribute/getter.html.ini
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -3452,27 +3452,16 @@ IsVisibleAndNotInReplacedElement(nsIFram
         !f->GetContent()->IsHTMLElement(nsGkAtoms::button) &&
         !f->GetContent()->IsHTMLElement(nsGkAtoms::select)) {
       return false;
     }
   }
   return true;
 }
 
-static bool
-ElementIsVisibleNoFlush(Element* aElement)
-{
-  if (!aElement) {
-    return false;
-  }
-  RefPtr<ComputedStyle> sc =
-    nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
-  return sc && sc->StyleVisibility()->IsVisible();
-}
-
 static void
 AppendTransformedText(InnerTextAccumulator& aResult, nsIContent* aContainer)
 {
   auto textNode = static_cast<CharacterData*>(aContainer);
 
   nsIFrame* frame = textNode->GetPrimaryFrame();
   if (!IsVisibleAndNotInReplacedElement(frame)) {
     return;
@@ -3578,22 +3567,17 @@ nsRange::GetInnerTextNoFlush(DOMString& 
     currentState = AT_NODE;
   }
 
   while (currentNode != endNode || currentState != endState) {
     nsIFrame* f = currentNode->GetPrimaryFrame();
     bool isVisibleAndNotReplaced = IsVisibleAndNotInReplacedElement(f);
     if (currentState == AT_NODE) {
       bool isText = currentNode->IsText();
-      if (isText && currentNode->GetParent()->IsHTMLElement(nsGkAtoms::rp) &&
-          ElementIsVisibleNoFlush(currentNode->GetParent()->AsElement())) {
-        nsAutoString str;
-        currentNode->GetTextContent(str, aError);
-        result.Append(str);
-      } else if (isVisibleAndNotReplaced) {
+      if (isVisibleAndNotReplaced) {
         result.AddRequiredLineBreakCount(GetRequiredInnerTextLineBreakCount(f));
         if (isText) {
           nsIFrame::RenderedText text = f->GetRenderedText();
           result.Append(text.mString);
         }
       }
       nsIContent* child = currentNode->GetFirstChild();
       if (child) {
--- a/testing/web-platform/meta/html/dom/elements/the-innertext-idl-attribute/getter.html.ini
+++ b/testing/web-platform/meta/html/dom/elements/the-innertext-idl-attribute/getter.html.ini
@@ -1,16 +1,4 @@
 [getter.html]
   [<canvas><div id='target'> contents ok for element not being rendered ("<canvas><div id='target'>abc")]
     expected: FAIL
 
-  [<rp> ("<div><ruby>abc<rp>(</rp><rt>def</rt><rp>)</rp></ruby>")]
-    expected: FAIL
-
-  [Lone <rp> ("<div><rp>abc</rp>")]
-    expected: FAIL
-
-  [display:block <rp> with whitespace ("<div><rp style='display:block'> abc </rp>def")]
-    expected: FAIL
-
-  [<rp> in a <select> ("<div><select class='poke-rp'></select>")]
-    expected: FAIL
-