Bug 733339 - part 3: make the content window passed to gPageStyleMenu.switchStyleSheet optional. r=dolske

This commit is contained in:
Dão Gottwald 2012-03-11 05:25:02 +01:00
parent 1a317a9cc9
commit 20bb7944b3
3 changed files with 7 additions and 5 deletions

View File

@ -292,7 +292,7 @@
<menu id="pageStyleMenu" label="&pageStyleMenu.label;"
accesskey="&pageStyleMenu.accesskey;" observes="isImage">
<menupopup onpopupshowing="gPageStyleMenu.fillPopup(this);"
oncommand="gPageStyleMenu.switchStyleSheet(window.content, event.target.getAttribute('data'));">
oncommand="gPageStyleMenu.switchStyleSheet(event.target.getAttribute('data'));">
<menuitem id="menu_pageStyleNoStyle"
label="&pageStyleNoStyle.label;"
accesskey="&pageStyleNoStyle.accesskey;"

View File

@ -6175,9 +6175,9 @@ var gPageStyleMenu = {
this._stylesheetSwitchAll(frameset.frames[i], title);
},
switchStyleSheet: function (contentWindow, title) {
switchStyleSheet: function (title, contentWindow) {
getMarkupDocumentViewer().authorStyleDisabled = false;
this._stylesheetSwitchAll(contentWindow, title);
this._stylesheetSwitchAll(contentWindow || content, title);
},
disableStyle: function () {
@ -6188,7 +6188,9 @@ var gPageStyleMenu = {
/* Legacy global page-style functions */
var getAllStyleSheets = gPageStyleMenu.getAllStyleSheets.bind(gPageStyleMenu);
var stylesheetFillPopup = gPageStyleMenu.fillPopup.bind(gPageStyleMenu);
var stylesheetSwitchAll = gPageStyleMenu.switchStyleSheet.bind(gPageStyleMenu);
function stylesheetSwitchAll(contentWindow, title) {
gPageStyleMenu.switchStyleSheet(title, contentWindow);
}
function setStyleDisabled(disabled) {
if (disabled)
gPageStyleMenu.disableStyle();

View File

@ -50,7 +50,7 @@ function test() {
Array.forEach(tab.linkedBrowser.contentDocument.styleSheets, function(aSS, aIx) {
pendingCount++;
let ssTitle = aSS.title;
gPageStyleMenu.switchStyleSheet(tab.linkedBrowser.contentWindow, ssTitle);
gPageStyleMenu.switchStyleSheet(ssTitle, tab.linkedBrowser.contentWindow);
let newTab = gBrowser.duplicateTab(tab);
newTab.linkedBrowser.addEventListener("load", function(aEvent) {