mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 720294 - Refactor style sheet switching code in browser.js. r=gavin
This commit is contained in:
parent
a5b0fa59c8
commit
367115c5e2
@ -6133,24 +6133,26 @@ function charsetLoadListener(event) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Begin Page Style Functions */
|
||||
function getAllStyleSheets(frameset) {
|
||||
|
||||
var gPageStyleMenu = {
|
||||
|
||||
getAllStyleSheets: function (frameset) {
|
||||
var styleSheetsArray = Array.slice(frameset.document.styleSheets);
|
||||
for (let i = 0; i < frameset.frames.length; i++) {
|
||||
let frameSheets = getAllStyleSheets(frameset.frames[i]);
|
||||
let frameSheets = this.getAllStyleSheets(frameset.frames[i]);
|
||||
styleSheetsArray = styleSheetsArray.concat(frameSheets);
|
||||
}
|
||||
return styleSheetsArray;
|
||||
}
|
||||
},
|
||||
|
||||
function stylesheetFillPopup(menuPopup) {
|
||||
stylesheetFillPopup: function (menuPopup) {
|
||||
var noStyle = menuPopup.firstChild;
|
||||
var persistentOnly = noStyle.nextSibling;
|
||||
var sep = persistentOnly.nextSibling;
|
||||
while (sep.nextSibling)
|
||||
menuPopup.removeChild(sep.nextSibling);
|
||||
|
||||
var styleSheets = getAllStyleSheets(window.content);
|
||||
var styleSheets = this.getAllStyleSheets(window.content);
|
||||
var currentStyleSheets = {};
|
||||
var styleDisabled = getMarkupDocumentViewer().authorStyleDisabled;
|
||||
var haveAltSheets = false;
|
||||
@ -6196,14 +6198,14 @@ function stylesheetFillPopup(menuPopup) {
|
||||
persistentOnly.hidden = (window.content.document.preferredStyleSheetSet) ? haveAltSheets : false;
|
||||
sep.hidden = (noStyle.hidden && persistentOnly.hidden) || !haveAltSheets;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
function stylesheetInFrame(frame, title) {
|
||||
stylesheetInFrame: function (frame, title) {
|
||||
return Array.some(frame.document.styleSheets,
|
||||
function (stylesheet) stylesheet.title == title);
|
||||
}
|
||||
},
|
||||
|
||||
function stylesheetSwitchFrame(frame, title) {
|
||||
stylesheetSwitchFrame: function (frame, title) {
|
||||
var docStyleSheets = frame.document.styleSheets;
|
||||
|
||||
for (let i = 0; i < docStyleSheets.length; ++i) {
|
||||
@ -6216,20 +6218,29 @@ function stylesheetSwitchFrame(frame, title) {
|
||||
else if (docStyleSheet.disabled)
|
||||
docStyleSheet.disabled = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
function stylesheetSwitchAll(frameset, title) {
|
||||
if (!title || title == "_nostyle" || stylesheetInFrame(frameset, title))
|
||||
stylesheetSwitchFrame(frameset, title);
|
||||
stylesheetSwitchAll: function (frameset, title) {
|
||||
if (!title || title == "_nostyle" || this.stylesheetInFrame(frameset, title))
|
||||
this.stylesheetSwitchFrame(frameset, title);
|
||||
|
||||
for (let i = 0; i < frameset.frames.length; i++)
|
||||
stylesheetSwitchAll(frameset.frames[i], title);
|
||||
}
|
||||
this.stylesheetSwitchAll(frameset.frames[i], title);
|
||||
},
|
||||
|
||||
function setStyleDisabled(disabled) {
|
||||
setStyleDisabled: function (disabled) {
|
||||
getMarkupDocumentViewer().authorStyleDisabled = disabled;
|
||||
}
|
||||
/* End of the Page Style functions */
|
||||
},
|
||||
};
|
||||
|
||||
/* 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 BrowserOffline = {
|
||||
_inited: false,
|
||||
|
Loading…
Reference in New Issue
Block a user