Bug 836890 - Set AncestorHasDirAuto flag when adding a new text node. r=ehsan, a=lsblakk
authorSimon Montagu <smontagu@smontagu.org>
Wed, 06 Feb 2013 00:13:18 -0800
changeset 127512 beb2e598079c2565ee462dd03230cf6584043b4e
parent 127511 0e3b5d954cf11f46cea771571bf946c044f33dfd
child 127513 fcd1d2c9dd8ba11311303ae20ac965609b05e7b6
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, lsblakk
bugs836890
milestone20.0a2
Bug 836890 - Set AncestorHasDirAuto flag when adding a new text node. r=ehsan, a=lsblakk
content/base/crashtests/836890.html
content/base/crashtests/crashtests.list
content/base/src/DirectionalityUtils.cpp
new file mode 100644
--- /dev/null
+++ b/content/base/crashtests/836890.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+
+function boom()
+{
+  var outer = document.createElement("span");
+  var inner = document.createElement("span");
+  outer.dir = "auto";
+  outer.appendChild(inner);
+  inner.appendChild(document.createTextNode("x"));
+  inner.dir = "auto";
+}
+
+</script>
+</head>
+<body onload="boom();"></body>
+</html>
--- a/content/base/crashtests/crashtests.list
+++ b/content/base/crashtests/crashtests.list
@@ -121,8 +121,9 @@ load 815276.html
 load 815477.html
 load 815500.html
 load 816253.html
 load 822691.html
 load 822723.html
 load 827190.html
 load 828054.html
 load 829428.html
+load 836890.html
--- a/content/base/src/DirectionalityUtils.cpp
+++ b/content/base/src/DirectionalityUtils.cpp
@@ -695,16 +695,18 @@ void SetAncestorDirectionIfAuto(nsINode*
              "Must be a text node");
 
   Element* parent = aTextNode->GetElementParent();
   while (parent && parent->NodeOrAncestorHasDirAuto()) {
     if (DoesNotParticipateInAutoDirection(parent) || parent->HasFixedDir()) {
       break;
     }
 
+    aTextNode->SetAncestorHasDirAuto();
+
     if (parent->HasDirAuto()) {
       bool resetDirection = false;
 
       if (!parent->HasDirAutoSet()) {
         // Fast path if parent's direction is not yet set by any descendant
         resetDirection = true;
       } else {
         // If parent's direction is already set, we need to know if