Set AncestorHasDirAuto on the descendants of a <bdi> having its dir attribute removed or set to an invalid value. Bug 849732, r=ehsan
authorSimon Montagu <smontagu@smontagu.org>
Sun, 24 Mar 2013 11:27:03 +0200
changeset 126054 426bf346fe1d96e8322c9846f124a2db05085b57
parent 126053 74847b983bc8b3f2f01278e28517a8112e172d6c
child 126055 c656d41192f65397aff67d74b1472443b47f23cc
push id24469
push userphilringnalda@gmail.com
push dateMon, 25 Mar 2013 00:58:18 +0000
treeherdermozilla-central@fadbd3c36f80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs849732
milestone22.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
Set AncestorHasDirAuto on the descendants of a <bdi> having its dir attribute removed or set to an invalid value. Bug 849732, r=ehsan
content/base/src/DirectionalityUtils.cpp
--- a/content/base/src/DirectionalityUtils.cpp
+++ b/content/base/src/DirectionalityUtils.cpp
@@ -658,18 +658,23 @@ WalkDescendantsResetAutoDirection(Elemen
     }
     child = child->GetNextNode(aElement);
   }
 }
 
 void
 WalkDescendantsSetDirAuto(Element* aElement, bool aNotify)
 {
-  if (!DoesNotParticipateInAutoDirection(aElement) &&
-      !IsBdiWithoutDirAuto(aElement)) {
+  // Only test for DoesNotParticipateInAutoDirection -- in other words, if
+  // aElement is a <bdi> which is having its dir attribute set to auto (or
+  // removed or set to an invalid value, which are equivalent to dir=auto for
+  // <bdi>, we *do* want to set AncestorHasDirAuto on its descendants, unlike
+  // in SetDirOnBind where we don't propagate AncestorHasDirAuto to a <bdi>
+  // being bound to an existing node with dir=auto.
+  if (!DoesNotParticipateInAutoDirection(aElement)) {
 
     bool setAncestorDirAutoFlag =
 #ifdef DEBUG
       true;
 #else
       !aElement->AncestorHasDirAuto();
 #endif
 
@@ -680,17 +685,17 @@ WalkDescendantsSetDirAuto(Element* aElem
             DoesNotAffectDirectionOfAncestors(child->AsElement())) {
           child = child->GetNextNonChildNode(aElement);
           continue;
         }
 
         MOZ_ASSERT(!aElement->AncestorHasDirAuto() ||
                    child->AncestorHasDirAuto(),
                    "AncestorHasDirAuto set on node but not its children");
-        child->SetHasDirAuto();
+        child->SetAncestorHasDirAuto();
         child = child->GetNextNode(aElement);
       }
     }
   }
 
   nsINode* textNode = WalkDescendantsSetDirectionFromText(aElement, aNotify);
   if (textNode) {
     nsTextNodeDirectionalityMap::AddEntryToMap(textNode, aElement);