Bug 1255997 - Account for scrollbar dimensions when testing the size of the displayport. r=botond a=test-only
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 14 Mar 2016 14:07:16 -0400
changeset 323452 4aaab2bc8e65c5ff2c2e3bd0417fceb1f17ccd23
parent 323451 bbdaba90d893f6fa09fdb287bf3d6227adda3457
child 323453 c3d63e1cfd6ef1d388af123eb3bc99d4703205ca
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond, test-only
bugs1255997
milestone47.0a2
Bug 1255997 - Account for scrollbar dimensions when testing the size of the displayport. r=botond a=test-only MozReview-Commit-ID: 8SrIfA8xuqq
gfx/layers/apz/test/mochitest/helper_bug982141.html
--- a/gfx/layers/apz/test/mochitest/helper_bug982141.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug982141.html
@@ -77,27 +77,32 @@ https://bugzilla.mozilla.org/show_bug.cg
                     "expected scroll frame data for scroll id " + childScrollId);
       SimpleTest.ok("displayport" in correspondingContentPaint[childScrollId],
                     "expected a displayport for scroll id " + childScrollId);
       var childDisplayport = correspondingContentPaint[childScrollId]["displayport"];
       var dpFields = childDisplayport.replace(/[()\s]+/g, '').split(',');
       SimpleTest.is(dpFields.length, 4, "expected displayport string of form (x,y,w,h)");
       var dpWidth = dpFields[2];
       var dpHeight = dpFields[3];
-      SimpleTest.ok(dpWidth >= 50 && dpHeight >= 50,
+      var subframe = document.getElementById('subframe');
+      // The clientWidth and clientHeight may be less than 50 if there are scrollbars showing.
+      // In general they will be (50 - <scrollbarwidth>, 50 - <scrollbarheight>).
+      SimpleTest.ok(subframe.clientWidth > 0, "Expected a non-zero clientWidth, got: " + subframe.clientWidth);
+      SimpleTest.ok(subframe.clientHeight > 0, "Expected a non-zero clientHeight, got: " + subframe.clientHeight);
+      SimpleTest.ok(dpWidth >= subframe.clientWidth && dpHeight >= subframe.clientHeight,
                     "expected a displayport at least as large as the scrollable element, got " + childDisplayport);
 
       window.opener.finishTest();
     }
   </script>
 </head>
 <body style="overflow: hidden;"><!-- This combined with the user-scalable=no ensures the root frame is not scrollable -->
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=982141">Mozilla Bug 982141</a>
   <!-- A scrollable subframe, with enough content to make it have a nonzero scroll range -->
-  <div style="height: 50px; width: 50px; overflow: scroll">
+  <div id="subframe" style="height: 50px; width: 50px; overflow: scroll">
     <div style="width: 100px">
       Wide content so that the vertical scrollbar for the parent div
       doesn't eat into the 50px width and reduce the width of the
       displayport.
     </div>
     Line 1<br>
     Line 2<br>
     Line 3<br>