Bug 581536 - Resizer direction doesn't handle dynamic changes correctly; r=bsbarsky a=blocking-betaN+
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 10 Dec 2010 19:25:25 -0500
changeset 61101 f3432e1de08529930142e00a7da7519955ff5e24
parent 61100 f12f55c744f4890f9dd89177288ef9cb6349a1d3
child 61102 80df95979d3af65c8501c29d41dc86d941c5a2e4
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersbsbarsky, blocking-betaN
bugs581536
milestone2.0b10pre
Bug 581536 - Resizer direction doesn't handle dynamic changes correctly; r=bsbarsky a=blocking-betaN+
layout/reftests/forms/reftest.list
layout/reftests/forms/textarea-rtl-dynamic-attr.html
layout/reftests/forms/textarea-rtl-dynamic-style.html
layout/style/nsStyleStruct.cpp
--- a/layout/reftests/forms/reftest.list
+++ b/layout/reftests/forms/reftest.list
@@ -15,16 +15,18 @@ HTTP(..) == text-control-baseline-1.html
 == textarea-resize.html textarea-resize-ref.html
 # an offset seems to apply to the native resizer on windows so skip this test for now
 skip-if(winWidget) == textarea-resize-background.html textarea-resize-background-ref.html
 != textarea-ltr.html textarea-rtl.html
 != textarea-ltr-scrollbar.html textarea-rtl-scrollbar.html
 != textarea-in-ltr-doc-scrollbar.html textarea-in-rtl-doc-scrollbar.html
 != textarea-ltr.html textarea-no-resize.html
 != textarea-rtl.html textarea-no-resize.html
+== textarea-rtl.html textarea-rtl-dynamic-attr.html
+== textarea-rtl.html textarea-rtl-dynamic-style.html
 == textarea-setvalue-framereconstruction-1.html textarea-setvalue-framereconstruction-ref.html
 
 == radio-label-dynamic.html radio-label-dynamic-ref.html
 == out-of-bounds-selectedindex.html out-of-bounds-selectedindex-ref.html # test for bug 471741
 != indeterminate-checked.html indeterminate-checked-notref.html
 != indeterminate-unchecked.html indeterminate-unchecked-notref.html
 != indeterminate-native-checked.html indeterminate-native-checked-notref.html
 != indeterminate-native-unchecked.html indeterminate-native-unchecked-notref.html
copy from layout/reftests/forms/textarea-rtl.html
copy to layout/reftests/forms/textarea-rtl-dynamic-attr.html
--- a/layout/reftests/forms/textarea-rtl.html
+++ b/layout/reftests/forms/textarea-rtl-dynamic-attr.html
@@ -1,10 +1,18 @@
 <!DOCTYPE HTML>
-<html>
+<html class="reftest-wait">
  <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <title></title>
  </head>
  <body>
-  <textarea dir="rtl" cols=20 rows=4></textarea>
+  <textarea cols=20 rows=4></textarea>
+  <script>
+    onload = function() {
+      setTimeout(function() {
+        document.querySelector("textarea").setAttribute("dir", "rtl");
+        document.documentElement.removeAttribute("class");
+      });
+    };
+  </script>
  </body>
 </html>
copy from layout/reftests/forms/textarea-rtl.html
copy to layout/reftests/forms/textarea-rtl-dynamic-style.html
--- a/layout/reftests/forms/textarea-rtl.html
+++ b/layout/reftests/forms/textarea-rtl-dynamic-style.html
@@ -1,10 +1,18 @@
 <!DOCTYPE HTML>
-<html>
+<html class="reftest-wait">
  <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <title></title>
  </head>
  <body>
-  <textarea dir="rtl" cols=20 rows=4></textarea>
+  <textarea cols=20 rows=4></textarea>
+  <script>
+    onload = function() {
+      setTimeout(function() {
+        document.querySelector("textarea").style.direction = "rtl";
+        document.documentElement.removeAttribute("class");
+      });
+    };
+  </script>
  </body>
 </html>
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2154,35 +2154,40 @@ nsStyleVisibility::nsStyleVisibility(con
   mDirection = aSource.mDirection;
   mVisible = aSource.mVisible;
   mLanguage = aSource.mLanguage;
   mPointerEvents = aSource.mPointerEvents;
 } 
 
 nsChangeHint nsStyleVisibility::CalcDifference(const nsStyleVisibility& aOther) const
 {
-  if ((mDirection == aOther.mDirection) &&
-      (mLanguage == aOther.mLanguage)) {
-    if ((mVisible == aOther.mVisible)) {
-      return NS_STYLE_HINT_NONE;
+  nsChangeHint hint = nsChangeHint(0);
+
+  if (mDirection != aOther.mDirection) {
+    NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
+  } else if (mLanguage == aOther.mLanguage) {
+    if (mVisible != aOther.mVisible) {
+      if ((NS_STYLE_VISIBILITY_COLLAPSE == mVisible) ||
+          (NS_STYLE_VISIBILITY_COLLAPSE == aOther.mVisible)) {
+        NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
+      } else {
+        NS_UpdateHint(hint, NS_STYLE_HINT_VISUAL);
+      }
     }
-    if ((NS_STYLE_VISIBILITY_COLLAPSE == mVisible) || 
-        (NS_STYLE_VISIBILITY_COLLAPSE == aOther.mVisible)) {
-      return NS_STYLE_HINT_REFLOW;
-    }
-    return NS_STYLE_HINT_VISUAL;
+  } else {
+    NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
   }
-  return NS_STYLE_HINT_REFLOW;
+  return hint;
 }
 
 #ifdef DEBUG
 /* static */
 nsChangeHint nsStyleVisibility::MaxDifference()
 {
-  return NS_STYLE_HINT_REFLOW;
+  return NS_STYLE_HINT_FRAMECHANGE;
 }
 #endif
 
 nsStyleContentData::~nsStyleContentData()
 {
   NS_ABORT_IF_FALSE(!mImageTracked,
                     "nsStyleContentData being destroyed while still tracking image!");
   if (mType == eStyleContentType_Image) {