Skip to content

Commit 6c7b47c

Browse files
committed
Fix empty space on the right side due to scrollbar placeholder when body height at 100%. Closes cburgmer#95
1 parent b4f1e83 commit 6c7b47c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/browser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ var browser = (function (util, proxies, ayepromise, theWindow) {
8080
iframe.style.left = (-10000 - width) + "px";
8181
// Don't execute JS, all we need from sandboxing is access to the iframe's document
8282
iframe.sandbox = 'allow-same-origin';
83+
// Don't include a scrollbar on Linux
84+
iframe.scrolling = 'no';
8385
return iframe;
8486
};
8587

test/specs/BrowserSpec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,20 @@ describe("Browser functions", function () {
386386
});
387387
});
388388

389+
it("should not include a scrollbar in calculations on Unix systems", function (done) {
390+
setHtml('<style>' +
391+
'html, body { height: 100%; }' +
392+
'</style>');
393+
394+
// For Firefox width and height seem to be important, too small will not trigger the error
395+
browser.calculateDocumentContentSize(doc, {width: 600, height: 200}).then(function (size) {
396+
expect(size.width).toBe(600);
397+
expect(size.viewportWidth).toBe(600);
398+
399+
done();
400+
});
401+
});
402+
389403
describe("zooming", function () {
390404
it("should report half the viewport size for a zoom of 2", function (done) {
391405
setElementWithSize({});

0 commit comments

Comments
 (0)