mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 733339 - part 1: remove unneeded legacy style sheet switching functions and bind remaining ones to gPageStyleMenu. r=dolske
This commit is contained in:
parent
b0ca471a79
commit
f721bff622
@ -291,12 +291,13 @@
|
||||
</menu>
|
||||
<menu id="pageStyleMenu" label="&pageStyleMenu.label;"
|
||||
accesskey="&pageStyleMenu.accesskey;" observes="isImage">
|
||||
<menupopup onpopupshowing="stylesheetFillPopup(this);"
|
||||
oncommand="stylesheetSwitchAll(window.content, event.target.getAttribute('data')); setStyleDisabled(false);">
|
||||
<menupopup onpopupshowing="gPageStyleMenu.fillPopup(this);"
|
||||
oncommand="gPageStyleMenu.switchStyleSheet(window.content, event.target.getAttribute('data'));
|
||||
gPageStyleMenu.setStyleDisabled(false);">
|
||||
<menuitem id="menu_pageStyleNoStyle"
|
||||
label="&pageStyleNoStyle.label;"
|
||||
accesskey="&pageStyleNoStyle.accesskey;"
|
||||
oncommand="setStyleDisabled(true); event.stopPropagation();"
|
||||
oncommand="gPageStyleMenu.setStyleDisabled(true); event.stopPropagation();"
|
||||
type="radio"/>
|
||||
<menuitem id="menu_pageStylePersistentOnly"
|
||||
label="&pageStylePersistentOnly.label;"
|
||||
|
@ -6092,7 +6092,7 @@ var gPageStyleMenu = {
|
||||
return styleSheetsArray;
|
||||
},
|
||||
|
||||
stylesheetFillPopup: function (menuPopup) {
|
||||
fillPopup: function (menuPopup) {
|
||||
var noStyle = menuPopup.firstChild;
|
||||
var persistentOnly = noStyle.nextSibling;
|
||||
var sep = persistentOnly.nextSibling;
|
||||
@ -6147,12 +6147,12 @@ var gPageStyleMenu = {
|
||||
return true;
|
||||
},
|
||||
|
||||
stylesheetInFrame: function (frame, title) {
|
||||
_stylesheetInFrame: function (frame, title) {
|
||||
return Array.some(frame.document.styleSheets,
|
||||
function (stylesheet) stylesheet.title == title);
|
||||
},
|
||||
|
||||
stylesheetSwitchFrame: function (frame, title) {
|
||||
_stylesheetSwitchFrame: function (frame, title) {
|
||||
var docStyleSheets = frame.document.styleSheets;
|
||||
|
||||
for (let i = 0; i < docStyleSheets.length; ++i) {
|
||||
@ -6167,12 +6167,12 @@ var gPageStyleMenu = {
|
||||
}
|
||||
},
|
||||
|
||||
stylesheetSwitchAll: function (frameset, title) {
|
||||
if (!title || title == "_nostyle" || this.stylesheetInFrame(frameset, title))
|
||||
this.stylesheetSwitchFrame(frameset, title);
|
||||
switchStyleSheet: function (frameset, title) {
|
||||
if (!title || title == "_nostyle" || this._stylesheetInFrame(frameset, title))
|
||||
this._stylesheetSwitchFrame(frameset, title);
|
||||
|
||||
for (let i = 0; i < frameset.frames.length; i++)
|
||||
this.stylesheetSwitchAll(frameset.frames[i], title);
|
||||
this.switchStyleSheet(frameset.frames[i], title);
|
||||
},
|
||||
|
||||
setStyleDisabled: function (disabled) {
|
||||
@ -6181,12 +6181,10 @@ var gPageStyleMenu = {
|
||||
};
|
||||
|
||||
/* Legacy global page-style functions */
|
||||
var getAllStyleSheets = gPageStyleMenu.getAllStyleSheets;
|
||||
var stylesheetFillPopup = gPageStyleMenu.stylesheetFillPopup;
|
||||
var stylesheetInFrame = gPageStyleMenu.stylesheetInFrame;
|
||||
var stylesheetSwitchFrame = gPageStyleMenu.stylesheetSwitchFrame;
|
||||
var stylesheetSwitchAll = gPageStyleMenu.stylesheetSwitchAll;
|
||||
var setStyleDisabled = gPageStyleMenu.setStyleDisabled;
|
||||
var getAllStyleSheets = gPageStyleMenu.getAllStyleSheets.bind(gPageStyleMenu);
|
||||
var stylesheetFillPopup = gPageStyleMenu.fillPopup.bind(gPageStyleMenu);
|
||||
var stylesheetSwitchAll = gPageStyleMenu.switchStyleSheet.bind(gPageStyleMenu);
|
||||
var setStyleDisabled = gPageStyleMenu.setStyleDisabled.bind(gPageStyleMenu);
|
||||
|
||||
|
||||
var BrowserOffline = {
|
||||
|
@ -14,7 +14,7 @@ function test() {
|
||||
function checkPageStyleMenu() {
|
||||
var menupopup = document.getElementById("pageStyleMenu")
|
||||
.getElementsByTagName("menupopup")[0];
|
||||
stylesheetFillPopup(menupopup);
|
||||
gPageStyleMenu.fillPopup(menupopup);
|
||||
|
||||
var items = [];
|
||||
var current = menupopup.getElementsByTagName("menuseparator")[0];
|
||||
|
@ -50,7 +50,7 @@ function test() {
|
||||
Array.forEach(tab.linkedBrowser.contentDocument.styleSheets, function(aSS, aIx) {
|
||||
pendingCount++;
|
||||
let ssTitle = aSS.title;
|
||||
stylesheetSwitchAll(tab.linkedBrowser.contentWindow, ssTitle);
|
||||
gPageStyleMenu.switchStyleSheet(tab.linkedBrowser.contentWindow, ssTitle);
|
||||
|
||||
let newTab = gBrowser.duplicateTab(tab);
|
||||
newTab.linkedBrowser.addEventListener("load", function(aEvent) {
|
||||
|
Loading…
Reference in New Issue
Block a user