Revert three changesets (Bug 1451576) for causing bug 1467964 and since it's not generally sound. r=me
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 12 Jun 2018 16:51:02 -0700
changeset 479117 194ef402a7b1d9f5177c326992269cd6e0f1b35b
parent 479116 4c8d9e274e956a95e59f888eb89b9af38559d170
child 479118 3427339d05e830d41682d9ca28e4b6b6073839af
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1451576, 1467964
milestone62.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
Revert three changesets (Bug 1451576) for causing bug 1467964 and since it's not generally sound. r=me MozReview-Commit-ID: CZaLUNlGkX8
dom/base/DirectionalityUtils.cpp
layout/forms/nsFileControlFrame.cpp
layout/reftests/forms/input/file/rtl-ref.xul
toolkit/content/widgets/videocontrols.xml
--- a/dom/base/DirectionalityUtils.cpp
+++ b/dom/base/DirectionalityUtils.cpp
@@ -236,31 +236,30 @@ using mozilla::dom::Element;
 static bool
 DoesNotParticipateInAutoDirection(const Element* aElement)
 {
   mozilla::dom::NodeInfo* nodeInfo = aElement->NodeInfo();
   return (!aElement->IsHTMLElement() ||
           nodeInfo->Equals(nsGkAtoms::script) ||
           nodeInfo->Equals(nsGkAtoms::style) ||
           nodeInfo->Equals(nsGkAtoms::textarea) ||
-          (aElement->IsInAnonymousSubtree() && !aElement->HasDirAuto()));
+          aElement->IsInAnonymousSubtree());
 }
 
 /**
  * Returns true if aElement is one of the element whose text content should not
  * affect the direction of ancestors with dir=auto (though it may affect its own
  * direction, e.g. <bdi>)
  */
 static bool
 DoesNotAffectDirectionOfAncestors(const Element* aElement)
 {
   return (DoesNotParticipateInAutoDirection(aElement) ||
           aElement->IsHTMLElement(nsGkAtoms::bdi) ||
-          aElement->HasFixedDir() ||
-          aElement->IsInAnonymousSubtree());
+          aElement->HasFixedDir());
 }
 
 /**
  * Returns the directionality of a Unicode character
  */
 static Directionality
 GetDirectionFromChar(uint32_t ch)
 {
@@ -276,24 +275,20 @@ GetDirectionFromChar(uint32_t ch)
       return eDir_NotSet;
   }
 }
 
 inline static bool
 NodeAffectsDirAutoAncestor(nsINode* aTextNode)
 {
   Element* parent = aTextNode->GetParentElement();
-  // In the anonymous content, we limit our implementation to only
-  // allow the children text node of the direct dir=auto parent in
-  // the same anonymous subtree to affact the direction.
   return (parent &&
           !DoesNotParticipateInAutoDirection(parent) &&
           parent->NodeOrAncestorHasDirAuto() &&
-          (!aTextNode->IsInAnonymousSubtree() ||
-            parent->HasDirAuto()));
+          !aTextNode->IsInAnonymousSubtree());
 }
 
 Directionality
 GetDirectionFromText(const char16_t* aText, const uint32_t aLength,
                      uint32_t* aFirstStrong)
 {
   const char16_t* start = aText;
   const char16_t* end = aText + aLength;
@@ -918,29 +913,24 @@ SetDirectionFromNewTextNode(nsTextNode* 
   if (dir != eDir_NotSet) {
     SetAncestorDirectionIfAuto(aTextNode, dir);
   }
 }
 
 void
 ResetDirectionSetByTextNode(nsTextNode* aTextNode)
 {
-  // We used to check NodeAffectsDirAutoAncestor() in this function, but
-  // stopped doing that since calling IsInAnonymousSubtree()
-  // too late (during nsTextNode::UnbindFromTree) is impossible and this
-  // function was no-op when there's no directionality map.
-  if (!aTextNode->HasTextNodeDirectionalityMap()) {
+  if (!NodeAffectsDirAutoAncestor(aTextNode)) {
+    nsTextNodeDirectionalityMap::EnsureMapIsClearFor(aTextNode);
     return;
   }
 
   Directionality dir = GetDirectionFromText(aTextNode->GetText());
-  if (dir != eDir_NotSet) {
+  if (dir != eDir_NotSet && aTextNode->HasTextNodeDirectionalityMap()) {
     nsTextNodeDirectionalityMap::ResetTextNodeDirection(aTextNode, aTextNode);
-  } else {
-    nsTextNodeDirectionalityMap::EnsureMapIsClearFor(aTextNode);
   }
 }
 
 void
 SetDirectionalityFromValue(Element* aElement, const nsAString& value,
                            bool aNotify)
 {
   Directionality dir = GetDirectionFromText(PromiseFlatString(value).get(),
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -82,18 +82,16 @@ MakeAnonButton(nsIDocument* aDoc, const 
                const nsAString& aAccessKey)
 {
   RefPtr<Element> button = aDoc->CreateHTMLElement(nsGkAtoms::button);
   // NOTE: SetIsNativeAnonymousRoot() has to be called before setting any
   // attribute.
   button->SetIsNativeAnonymousRoot();
   button->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
                   NS_LITERAL_STRING("button"), false);
-  button->SetAttr(kNameSpaceID_None, nsGkAtoms::dir,
-                  NS_LITERAL_STRING("auto"), false);
 
   // Set the file picking button text depending on the current locale.
   nsAutoString buttonTxt;
   nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                      labelKey, buttonTxt);
 
   // Set the browse button text. It's a bit of a pain to do because we want to
   // make sure we are not notifying.
--- a/layout/reftests/forms/input/file/rtl-ref.xul
+++ b/layout/reftests/forms/input/file/rtl-ref.xul
@@ -5,13 +5,13 @@
   <vbox>
     <html:style>
       vbox {
        margin-right: 8px;
       }
     </html:style>
     <html:div dir='rtl'>
       <html:div class='file' dir='rtl'>
-        <html:button dir='ltr'>Browse&#8230;</html:button><label value="No file selected."/>
+        <html:button>Browse&#8230;</html:button><label value="No file selected."/>
       </html:div>
     </html:div>
   </vbox>
 </window>
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -1651,17 +1651,16 @@
         tt.index = this.textTracksCount++;
 
         const label = tt.label || "";
         const ttText = document.createTextNode(label);
         const ttBtn = document.createElement("button");
 
         ttBtn.classList.add("textTrackItem");
         ttBtn.setAttribute("index", tt.index);
-        ttBtn.setAttribute("dir", "auto");
         ttBtn.appendChild(ttText);
 
         this.textTrackList.appendChild(ttBtn);
 
         if (tt.mode === "showing" && tt.index) {
           this.changeTextTrack(tt.index);
         }
       },