How can I apply a CSS stylesheet to all page views in XULRunner

230 views Asked by At

I am trying to develop a display device (expected to be installed in public transports) which is able to show a (more or less fixed) web page in a chromeless embedded browser on a Linux platform (I am currently using Archlinux).

After a lot of tries with Mozilla Firefox, I am now focusing on the use of a small XULRunner application using the following very simple xul document:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="EPL Browser" width="1920" height="1080" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 <browser type="content" src="http://www.example.org//" flex="1"/>
</window>

This works nearly as expected, but now I also want to apply to this page (whatever web page I choose) a CSS rule for removing unwanted scrollbars, like the following:

body {
    overflow: hidden;
}

When I was using Mozilla Firefox, this was very simple, I just needed to put it in a chrome/userContent.css file inside the Firefox profile.

But now I would like to know:

  • Is there any mean to include my userContent.css file in my xul document in order to have it working the same way as in Firefox?
  • If not, is there another way to apply this same CSS rule (and possibly others) to the page that I defined in the xul "browser" tag? For example by some other tags directly included in the xul document?

Any help would be welcome.

1

There are 1 answers

2
erikvold On

Use of the userContent.css file is in the nsLayoutStyleSheetCache.cpp file https://dxr.mozilla.org/mozilla-central/source/layout/style/nsLayoutStylesheetCache.cpp#314-341

Which looks like it is not Firefox specific, the app needs to not be safe mode, and there needs to be a profile used, otherwise I think you should be able to use this files.