Bug 541382. Buttons with non-visible overflow should clip their contents. r=roc
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 25 Jan 2010 11:03:43 -0500
changeset 37482 b5a9cb0708ac2822002fa0ac46df0a6031329e5b
parent 37481 0235fc257969646a5bcc3dbdc227103b40d9f090
child 37483 fc6c823b524ae77fc56bc0dd447d86d4cf063310
push id11327
push userbzbarsky@mozilla.com
push dateMon, 25 Jan 2010 16:04:30 +0000
treeherdermozilla-central@fc6c823b524a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs541382
milestone1.9.3a1pre
Bug 541382. Buttons with non-visible overflow should clip their contents. r=roc
layout/forms/nsHTMLButtonControlFrame.cpp
layout/reftests/bugs/541382-1-ref.html
layout/reftests/bugs/541382-1.html
layout/reftests/bugs/reftest.list
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -174,18 +174,19 @@ nsHTMLButtonControlFrame::BuildDisplayLi
                                DISPLAY_CHILD_FORCE_PSEUDO_STACKING_CONTEXT);
     NS_ENSURE_SUCCESS(rv, rv);
     // That should put the display items in set.Content()
   }
   
   // Put the foreground outline and focus rects on top of the children
   set.Content()->AppendToTop(&onTop);
 
-  // clips to our padding box for <input>s but not <button>s.
-  if (IsInput()) {
+  // clips to our padding box for <input>s but not <button>s, unless
+  // they have non-visible overflow..
+  if (IsInput() || GetStyleDisplay()->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE) {
     nsMargin border = GetStyleBorder()->GetActualBorder();
     nsRect rect(aBuilder->ToReferenceFrame(this), GetSize());
     rect.Deflate(border);
   
     nsresult rv = OverflowClip(aBuilder, set, aLists, rect);
     NS_ENSURE_SUCCESS(rv, rv);
   } else {
     set.MoveTo(aLists);
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/541382-1-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <button style="height: 20px; overflow: hidden; text-indent: 300px; width: 200px;">a</button><br>
+    <button style="height: 20px; overflow: scroll; text-indent: 300px; width: 200px;">b</button><br>
+    <button style="height: 20px; overflow: auto; text-indent: 300px; width: 200px;">c</button>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/541382-1.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <button style="height: 20px; overflow: hidden; text-indent: 300px; width: 200px;">text</button><br>
+    <button style="height: 20px; overflow: scroll; text-indent: 300px; width: 200px;">text</button><br>
+    <button style="height: 20px; overflow: auto; text-indent: 300px; width: 200px;">text</button>
+  </body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1374,8 +1374,9 @@ fails HTTP(..) == 518172-2b.html 518172-
 == 531371-1.html 531371-1-ref.html
 == 534808-1.html 534808-1-ref.html
 == 534808-2.html 534808-2-ref.html
 == 534919-1.html 534919-1-ref.html
 == 537507-1.xul 537507-1-ref.xul
 == 537507-2.html 537507-2-ref.html
 == 537471-1.html 537471-1-ref.html
 == 539226-1.html about:blank
+== 541382-1.html 541382-1-ref.html