mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 972237 - Fix missing plugin overlay with some zoom levels and add test. r=mikedeboer
This commit is contained in:
parent
cb9ef142f0
commit
7e1bb7be75
@ -106,8 +106,8 @@ var gPluginHandler = {
|
||||
let pluginRect = plugin.getBoundingClientRect();
|
||||
// XXX bug 446693. The text-shadow on the submitted-report text at
|
||||
// the bottom causes scrollHeight to be larger than it should be.
|
||||
let overflows = (overlay.scrollWidth > pluginRect.width) ||
|
||||
(overlay.scrollHeight - 5 > pluginRect.height);
|
||||
let overflows = (overlay.scrollWidth > Math.ceil(pluginRect.width)) ||
|
||||
(overlay.scrollHeight - 5 > Math.ceil(pluginRect.height));
|
||||
if (overflows) {
|
||||
return false;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ support-files =
|
||||
plugin_two_types.html
|
||||
plugin_unknown.html
|
||||
plugin_crashCommentAndURL.html
|
||||
plugin_zoom.html
|
||||
|
||||
[browser_bug743421.js]
|
||||
[browser_bug744745.js]
|
||||
@ -62,6 +63,7 @@ run-if = crashreporter
|
||||
[browser_CTP_notificationBar.js]
|
||||
[browser_CTP_outsideScrollArea.js]
|
||||
[browser_CTP_resize.js]
|
||||
[browser_CTP_zoom.js]
|
||||
[browser_globalplugin_crashinfobar.js]
|
||||
[browser_pageInfo_plugins.js]
|
||||
[browser_pluginnotification.js]
|
||||
|
77
browser/base/content/test/plugins/browser_CTP_zoom.js
Normal file
77
browser/base/content/test/plugins/browser_CTP_zoom.js
Normal file
@ -0,0 +1,77 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
let rootDir = getRootDirectory(gTestPath);
|
||||
const gTestRoot = rootDir;
|
||||
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/",
|
||||
"http://127.0.0.1:8888/");
|
||||
|
||||
let gTestBrowser = null;
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
registerCleanupFunction(() => {
|
||||
FullZoom.reset();
|
||||
clearAllPluginPermissions();
|
||||
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
|
||||
});
|
||||
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
|
||||
|
||||
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
||||
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
|
||||
|
||||
let newTab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = newTab;
|
||||
gTestBrowser = gBrowser.selectedBrowser;
|
||||
gTestBrowser.addEventListener("load", pageLoad, true);
|
||||
gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_zoom.html"
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
clearAllPluginPermissions();
|
||||
gTestBrowser.removeEventListener("load", pageLoad, true);
|
||||
gBrowser.removeCurrentTab();
|
||||
window.focus();
|
||||
finish();
|
||||
}
|
||||
|
||||
function pageLoad() {
|
||||
// Due to layout being async, "PluginBindAttached" may trigger later.
|
||||
// This wraps a function to force a layout flush, thus triggering it,
|
||||
// and schedules the function execution so they're definitely executed
|
||||
// afterwards.
|
||||
let doc = gTestBrowser.contentDocument;
|
||||
let elems = doc.getElementsByTagName('embed');
|
||||
if (elems.length < 1) {
|
||||
elems = doc.getElementsByTagName('object');
|
||||
}
|
||||
elems[0].clientTop;
|
||||
executeSoon(testOverlay);
|
||||
}
|
||||
|
||||
let enlargeCount = 4;
|
||||
|
||||
// Enlarges the zoom level |enlargeCount| times and tests that the overlay is
|
||||
// visible after each enlargement.
|
||||
function testOverlay() {
|
||||
let plugin = gTestBrowser.contentDocument.getElementById("test");
|
||||
let doc = gTestBrowser.contentDocument;
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
ok(overlay, "Overlay should exist");
|
||||
ok(overlay.classList.contains("visible"), "Overlay should be visible");
|
||||
|
||||
if (enlargeCount > 0) {
|
||||
--enlargeCount;
|
||||
FullZoom.enlarge();
|
||||
gTestBrowser.contentWindow.location.reload();
|
||||
} else {
|
||||
FullZoom.reset();
|
||||
clearAllPluginPermissions();
|
||||
finishTest();
|
||||
}
|
||||
}
|
10
browser/base/content/test/plugins/plugin_zoom.html
Normal file
10
browser/base/content/test/plugins/plugin_zoom.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<!-- The odd width and height are here to trigger bug 972237. -->
|
||||
<embed id="test" style="width: 99.789%; height: 99.123%" type="application/x-test">
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user