зеркало из https://github.com/mozilla/gecko-dev.git
bug 877402 fix social panel sizing and fix tests, r=markh
This commit is contained in:
Родитель
443c507139
Коммит
da9fef97ff
|
@ -407,7 +407,11 @@ function sizeSocialPanelToContent(panel, iframe) {
|
|||
let height = Math.max(computedHeight, PANEL_MIN_HEIGHT);
|
||||
let computedWidth = parseInt(cs.marginLeft) + body.offsetWidth + parseInt(cs.marginRight);
|
||||
let width = Math.max(computedWidth, PANEL_MIN_WIDTH);
|
||||
panel.sizeTo(width, height);
|
||||
iframe.style.width = width + "px";
|
||||
iframe.style.height = height + "px";
|
||||
// since we do not use panel.sizeTo, we need to adjust the arrow ourselves
|
||||
if (panel.state == "open")
|
||||
panel.adjustArrowPosition();
|
||||
}
|
||||
|
||||
function DynamicResizeWatcher() {
|
||||
|
|
|
@ -58,14 +58,26 @@ var tests = {
|
|||
port.postMessage({topic: "test-flyout-open"});
|
||||
break;
|
||||
case "got-flyout-visibility":
|
||||
// The width of the flyout should be 250px
|
||||
if (e.data.result != "shown")
|
||||
return;
|
||||
// The width of the flyout should be 400px initially
|
||||
let iframe = panel.firstChild;
|
||||
let cs = iframe.contentWindow.getComputedStyle(iframe.contentDocument.body);
|
||||
is(cs.width, "250px", "should be 250px wide");
|
||||
iframe.contentDocument.addEventListener("SocialTest-DoneMakeWider", function _doneHandler() {
|
||||
iframe.contentDocument.removeEventListener("SocialTest-DoneMakeWider", _doneHandler, false);
|
||||
cs = iframe.contentWindow.getComputedStyle(iframe.contentDocument.body);
|
||||
let body = iframe.contentDocument.body;
|
||||
let cs = iframe.contentWindow.getComputedStyle(body);
|
||||
|
||||
is(cs.width, "400px", "should be 400px wide");
|
||||
is(iframe.boxObject.width, 400, "iframe should now be 400px wide");
|
||||
is(cs.height, "400px", "should be 400px high");
|
||||
is(iframe.boxObject.height, 400, "iframe should now be 400px high");
|
||||
|
||||
iframe.contentWindow.addEventListener("resize", function _doneHandler() {
|
||||
iframe.contentWindow.removeEventListener("resize", _doneHandler, false);
|
||||
cs = iframe.contentWindow.getComputedStyle(body);
|
||||
|
||||
is(cs.width, "500px", "should now be 500px wide");
|
||||
is(iframe.boxObject.width, 500, "iframe should now be 500px wide");
|
||||
is(cs.height, "500px", "should now be 500px high");
|
||||
is(iframe.boxObject.height, 500, "iframe should now be 500px high");
|
||||
panel.hidePopup();
|
||||
port.close();
|
||||
next();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
port.postMessage({topic: "flyout-visibility", result: "hidden"});
|
||||
}, false);
|
||||
window.addEventListener("socialTest-MakeWider", function(e) {
|
||||
document.body.setAttribute("style", "width: 500px;");
|
||||
document.body.setAttribute("style", "width: 500px; height: 500px; margin: 0; overflow: hidden;");
|
||||
document.body.offsetWidth; // force a layout flush
|
||||
var evt = document.createEvent("CustomEvent");
|
||||
evt.initCustomEvent("SocialTest-DoneMakeWider", true, true, {});
|
||||
|
@ -29,7 +29,7 @@
|
|||
}, false);
|
||||
</script>
|
||||
</head>
|
||||
<body style="max-width: 250px;" onload="pingWorker();">
|
||||
<body style="width: 400px; height: 400px; margin: 0; overflow: hidden;" onload="pingWorker();">
|
||||
<p>This is a test social flyout panel.</p>
|
||||
<a id="traversal" href="http://mochi.test">test link</a>
|
||||
</body>
|
||||
|
|
Загрузка…
Ссылка в новой задаче