Bug 1255997 - Account for scrollbar dimensions when testing the size of the displayport. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 14 Mar 2016 14:07:16 -0400
changeset 288608 48c0d3800c35628ccae44935ba822c91b15632aa
parent 288607 a8ae52b3b96cb69f6253390aa61f08698c94fabd
child 288609 fbe36b282024d49c78a5699d8e9e2824ef03c85a
push id30087
push usercbook@mozilla.com
push dateTue, 15 Mar 2016 09:43:43 +0000
treeherdermozilla-central@5e14887312d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1255997
milestone48.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
Bug 1255997 - Account for scrollbar dimensions when testing the size of the displayport. r=botond 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>