My favorites | Sign in
Project Home Downloads Wiki Issues Code Search
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 2393: Support user stylesheet
111 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  tony@chromium.org
Closed:  Mar 2010
Cc:  a...@chromium.org

Restricted
  • Only users with Commit permission may comment.


Sign in to add a comment
 
Project Member Reported by jshin@chromium.org, Sep 16, 2008
Firefox has options for ignoring the page font and color specification. 
It also has a user stylesheet (there's no UI for that, but a user can edit 
it). Opera UI gives even greater controls to users. 

This is also an A11Y feature ( 
http://www.w3.org/TR/WAI-USERAGENT/guidelines.html#gl-user-control-styles 
).

This has two components, webkit changes and UI changes.  I'll add eseidel 
once he's added to the member list. 







 
Sep 16, 2008
#1 jshin@chromium.org
(No comment was entered for this change.)
Cc: esei...@chromium.org
Sep 16, 2008
#2 macd...@gmail.com
The webkit changes should be tracked as webkit bugs in http://bugs.webkit.org/.  WebKit already supports 
having a user-specified stylesheet applied to all pages.
Sep 16, 2008
#3 ben@chromium.org


Cc: g...@chromium.org br...@chromium.org
Sep 17, 2008
#4 ben@chromium.org
After a brief discussion:

We won't add a UI for this. However, we could support something like userContent.css 
that Firefox does. If present, we could load that and then obviously the style rules 
in that file have the ability to override whatever wherever. If you want to add 
support for this please go ahead (I see the bug is assigned to you).
Sep 17, 2008
#5 jshin@chromium.org
macdome, thanks for the info. If webkit already supports a user stylesheet, we may
get it almost free after a merge.

Ben, thank you for the direction.  
Let's see how it goes after merge. Btw, it appears that if I report a bug and am a
member, it's automatically assigned to me (unless I unassign myself explicitly) :-)
Owner: ---
Cc: js...@chromium.org
Sep 17, 2008
#6 macd...@gmail.com
It already supports user style sheets since *long* before the merge. :)
Sep 17, 2008
#7 jshin@chromium.org
Ok. I begin to feel stupid. Safari has a UI for that (Advanced - Other ... - 
Stylesheet).  

In Chrome, we don't, yet, support user stylesheet because of a sandboxing issue.

See http://src.chromium.org/svn/trunk/src/webkit/tools/layout_tests/test_lists/tests_fixa
ble.txt and look for 'user stylesheet'. 

Or, see http://src.chromium.org/svn/trunk/src/webkit/port/platform/TemporaryLinkStubs.cpp 
(createWithContentsOfFile )







Summary: Support user stylesheet
Cc: ero...@chromium.org
Sep 29, 2008
#8 mal.chromium@gmail.com
(No comment was entered for this change.)
Labels: -area-unknown Area-Misc
Oct 10, 2008
#9 jshin@chromium.org
 issue 3309  was duped to this.
Oct 22, 2008
#10 j...@chromium.org
(No comment was entered for this change.)
Status: Available
Labels: -Area-Misc Area-WebKit Mstone-X
May 10, 2009
#11 patrickb...@gmail.com
Will this be fixed in the foreseeable future or left to the extension apis?
BTW: I think this would also fix  issue 9149  ?!
Aug 12, 2009
#12 mattcu...@gmail.com
Just wondering about the possibility of user stylesheets--any new word?
Aug 12, 2009
#13 klink@chromium.org
I am hacking on a simple extension to provide some simple functionality towards this.
Currently have a very early prototype only being tested by some of our low vision
employees. Will hopefully have something to show soon to a broader audience.
Cc: -sidchatchromium
Nov 8, 2009
#14 darren....@gmail.com
@klink ,  Since several months has passed,I just want to know whether
your extension for this is publicly available now.Where can I find it?
Nov 9, 2009
#15 simo.mel...@gmail.com
I would much welcome this, as well. I've been running Chromium for a couple of weeks 
now and it's snappy and webpages are sandboxed and everything, but text rendering is 
just horrible for my eyes.

I'm not particularly comfortable with the various tiny fonts and the hippy typefaces 
that web pages use these days so I've been living with my own user stylesheet for 
years. Lack of that capability is holding me back to Firefox for any serious 
reading/browsing for now; if I had that, I wouldn't look back.
Nov 15, 2009
#16 dhw@chromium.org
(No comment was entered for this change.)
Labels: Accessibility
Dec 9, 2009
#18 ciryus...@gmail.com
I would have to agree with this. User defined CSS is very much needed and is holding me 
back to Firefox too. It would be nice to have the equivalent of userContent.css but 
also userChrome.css to tweak the font used in the UI.
Dec 9, 2009
#19 lubomir....@gmail.com
As I initially noted in the Chromium Google Groups, the ability to force a particular
font for displaying pages is not so much about me liking it but rather an
accessibility issue because my sight is damaged and my eyes start hurting pretty
fast, I get a headache when I have to switch between different fonts and then I'm
just forced to switch to Firefox to be able to work. Anyway, I just wanted to express
my support for having some way of forcing a font regardless of whether it's achived
in the UI as in Firefox and its "Allow pages to choose their own fonts, instead of my
selection above" checkbox or it's some generic, under-the-hood custom CSS styling.
Dec 12, 2009
#20 zane.t...@gmail.com
The lack of this accessibility feature is also holding me back from using Chrome 
instead of Firefox. It seems like most other major browsers (IE, Firefox, Safari) have 
an option to force fonts.
Dec 14, 2009
#22 decklin@red-bean.com
That one seems to do quite a bit more than this request. There is also

https://chrome.google.com/extensions/detail/pabfempgigicdjjlccdgnbmeggkbjdhd

which I like, and I wrote

http://www.chromeextensions.org/other/usr-local-styles/

but haven't published it in the official gallery (and might not ever) because it's 
decidedly less user-friendly.
Dec 25, 2009
#23 jplebreton
I've been unable to get the functionality specified in the original request using the extension linked above, so it would 
seem that the request is still valid - notwithstanding the debate over whether or not this should be built-in browser 
functionality.
Dec 29, 2009
#24 zridl...@gmail.com
Although the "Personalized Web" extension can accomplish this, Chrome really needs a simple style sheet or 'force fonts' option. Otherwise, most people will stick with power and flexibility that 
Firefox customizations provide. I actually like Chrome-Linux better despite its rough edges, but the little things go a LONG way in making a better browser. It doesn't take much. Without font choice, 
the web is unreadable, as are search results! Along with assigning "1" and "2" to tab navigation, this is a no-brainer.
Jan 1, 2010
#25 decklin@red-bean.com
Ok, for the sake of... argument? I'm not really arguing with anyone, but: I have hacked 
this quick little thing up to demonstrate the simplest possible way to do a singular 
user stylesheet with an extension:

https://chrome.google.com/extensions/detail/bpbpmpkbnfajbeogbmhndhijpgkchaab

Given that this is possible to write, I don't see any overwhelming reason to make user 
stylesheets a built-in feature. (And it might actually be useful for a few people 
following this thread, I hope?)

What *would* be nice is a way to get something like @-moz-document in stylesheets (I've 
taken a look at WebKit's CSS parser and there's nothing that could trivially be turned 
into an equivalent), so that one textbox would be all I'd need. The other extension of 
mine above is basically some ugly contortions to get around this.
Jan 1, 2010
#26 Simetrical
The CSS standard requires support for user stylesheets, so that's probably a good 
enough reason to have it as a core browser feature (given that someone spends the time 
to implement it) unless there are strong arguments to the contrary.

"UAs must allow users to specify a file that contains the user style sheet. UAs that 
run on devices without any means of writing or specifying files are exempted from this 
requirement."
<http://www.w3.org/TR/CSS2/conform.html#conformance>
Jan 1, 2010
#27 ciryus...@gmail.com
Extensions can NOT achieve what a user stylesheet can do. The reason is pretty
simple: the CSS standard define levels of priority for resolving which rules apply to
an element (http://reference.sitepoint.com/css/cascade).

Having a user stylesheet allows to override ALL definition with the use of
'!important'. This is particularly important if one wants to change font-size of
font-family, and for all other concerns regarding accessibility.

The injection of CSS rules directly in the page, even if done correctly (ie also in
iframes) does not provide a simple way to have an 'overriding' rule that works all
the time. If it just happens that the CSS of the site as a more precise selector for
an element, their choice will override yours.
Maybe it could be done in an other way as an extension and respect priorities, in
which case this would be an acceptable solution.
Jan 1, 2010
#28 decklin@red-bean.com
Sounds like a good reason to me.

(just out of curiosity, does Firefox even implement it that way? I've just been 
liberally applying !important since that's the same thing I assumed I had to do 
there.)
Jan 1, 2010
#29 ciryus...@gmail.com
I don't really know about the internals of Firefox :/

However, I know that the stylish extension on Firefox works in such a way that the styles defined in the 
extension are considered 'user styles' and as such can obtain the highest priority with the use of '!important'. I 
used to have a file 'userChrome.css' and now use stylish instead (easier to manage).

I hope for something similar for Chrome :)
Jan 4, 2010
#30 dglazkov@chromium.org
One way to do this right would be to add plumbing allowing extensions to inject user 
scripts.
Cc: -kl...@chromium.org -b...@chromium.org -esei...@chromium.org -g...@chromium.org -br...@chromium.org -js...@chromium.org -ero...@chromium.org a...@chromium.org
Jan 4, 2010
#31 jason.ba...@gmail.com
Allowing extensions to inject user *scripts* doesn't get it right because they'd
still be injected as author sheets rather than user sheets.

Providing plumbing for extensions to inject user *styles* would get it right, but
you'd probably also want to support something similar to Firefox's -moz-doc rules
(http://lists.w3.org/Archives/Public/www-style/2004Aug/0135), because most people
likely want to create site-specific styles.
Jan 6, 2010
#32 dherber...@gmail.com
@jason.barnabe

But extensions CAN inject user style sheets.
Jan 6, 2010
#33 jason.ba...@gmail.com
"Can" as in currently can, or "can" as in potentially can? If the former, can you
give an example or link to some documentation?
Jan 6, 2010
#34 dherber...@gmail.com
https://code.google.com/chrome/extensions/content_scripts.html

You can create content scripts where the only "script" injected into the page is a CSS 
file. When pages matching the content script are loaded, the CSS will be injected into 
the page, as specified in the documentation.
Jan 6, 2010
#35 jason.ba...@gmail.com
The term "user style sheet" has a specific meaning and behaviour in CSS. User style
sheets are applied at a different order in the cascade than author style sheets.
Creating style sheets in the way you describe would lead Chrome to regard the sheet
as an author style sheet. This is what comment 27 is talking about.

http://www.w3.org/TR/CSS-access#UserControl
http://www.w3.org/TR/CSS21/cascade.html#cascading-order
Jan 7, 2010
#36 simo.mel...@gmail.com
Hear what ciryus432 and jason.barnabe say.

You can't hack user stylesheets together as they don't live in the content domain of 
the document. The support must come natively from the browser so that they can 
reliably override rules in content stylesheet; hence this bug.

However, Firefox, IE, and Safari and other browsers do support them. Further, 
apparently WebKit already has support for them. How much more work would it be, on 
top of merely enabling them as configurable?
Jan 7, 2010
#37 michael....@gmail.com
>> apparently WebKit already has support for them

Yes, WebKitGTK for example has the feature and browsers like Epiphany expose it to the 
user as "[x] Use custom stylesheet   [Edit]"
Jan 9, 2010
#38 dev...@gmail.com
Does anybody know why is it hard to provide a simple configuration preference to force my fonts? Since I don't understand the jargon here, I would like to know why this basic feature is ignored for such a long time.

If someone has a step by step howto, I would love to have get a hold of that.
Jan 10, 2010
#39 tony@chromium.org
Webkit supports user style sheets, but it's disabled in Chrome because we need to add 
some extra plumbing for it to work with the sandbox (since the renderer process can't 
read from disk, we need to pass the user style sheet via IPC).
Jan 18, 2010
#40 luigislugger@gmail.com
There are some extensions that allow you to import your own CSS. They are 
hacked together and sometimes add extra loading time to a page. I will be glad to 
see userstyles get some real support in Chrome/Chromium. Maybe then we can 
get a real extension like Firefox's "Stylish" for Chrome.

Still... kudos for disabling it until you make it work with the sandbox.
Feb 19, 2010
#41 klink@chromium.org
(No comment was entered for this change.)
Labels: Feature-Accessibility
Feb 24, 2010
#42 tony@chromium.org
UI-less version in the works.
Status: Started
Owner: tony.chromium
Mar 8, 2010
#43 bugdroid1@gmail.com
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=40882 

------------------------------------------------------------------------
r40882 | tony@chromium.org | 2010-03-07 21:18:06 -0800 (Sun, 07 Mar 2010) | 17 lines
Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/extension_host.cc?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/profile.cc?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/profile.h?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/tab_contents/render_view_host_delegate_helper.cc?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/tab_contents/render_view_host_delegate_helper.h?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/tab_contents/tab_contents.cc?r1=40882&r2=40881
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/user_style_sheet_watcher.cc
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/user_style_sheet_watcher.h
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/user_style_sheet_watcher_unittest.cc
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/chrome_browser.gypi?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/chrome_tests.gypi?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/chrome_switches.cc?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/chrome_switches.h?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/notification_type.h?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/testing_profile.h?r1=40882&r2=40881
   M http://src.chromium.org/viewvc/chrome/trunk/src/webkit/glue/webpreferences.h?r1=40882&r2=40881

First cut at custom user style sheets.

Enabled with the --enable-user-stylesheet flag which
causes chrome to read
<user-data-dir>/<profile>/User StyleSheet/Custom.css
at startup and set it as the user style sheet.

This version never reloads the user style sheet, I'll
have to bring back FileWatcher for that.  I also put the user
stylesheet in a subdir because the implementation of
FileWatcher will watch the parent dir (this is what the OS
apis give me) and watching the profile dir will cause
lots of activity.

BUG=2393

Review URL: http://codereview.chromium.org/660349
------------------------------------------------------------------------

Mar 14, 2010
#44 bugdroid1@gmail.com
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=41561 

------------------------------------------------------------------------
r41561 | tony@chromium.org | 2010-03-14 20:39:50 -0700 (Sun, 14 Mar 2010) | 7 lines
Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/user_style_sheet_watcher.cc?r1=41561&r2=41560
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/user_style_sheet_watcher.h?r1=41561&r2=41560

Connect UserStyleSheetWatcher to FileWatcher to have changes to
Default/User StyleSheets/Custom.css instantly change layout in
all your tabs.

BUG=2393

Review URL: http://codereview.chromium.org/799005
------------------------------------------------------------------------

Mar 14, 2010
#45 tony@chromium.org
User style sheets should work with --enable-user-stylesheet if you're using a ToT 
build.  There's no UI (as mentioned in comment 4).  We haven't pushed a version to the 
dev channel with this feature yet.

I also filed  issue 38182  for getting rid of the command line flag and  issue 38183  for 
being able to access this from an extension.
Status: Fixed
Mar 14, 2010
#46 simo.mel...@gmail.com
Thanks, this is great! I'll be happy to test this; how long will it take until it gets 
out to the dev channel?
Mar 19, 2010
#47 simon.bo...@gmail.com
Yes, any approximation when it'll hit the Dev or even Beta channel?
Mar 20, 2010
#48 tony@chromium.org
This is in 5.0.356.X that was just released on the dev channel.
http://googlechromereleases.blogspot.com/
Mar 20, 2010
#49 dhw@chromium.org
This is fantastic Tony!

Just to point out a typo between Comment 43 and 44, the directory name to use is:
  Default/User StyleSheets/Custom.css

ie, "User StyleSheets" with an "s" at the end.

But I notice if you start with --enable-user-stylesheet, it automatically creates the 
directory anyway.

This is working great with my testing in Chrome	5.0.356.2 (Official Build 42060) dev
Mar 27, 2010
#50 matte...@gmail.com
Great! thx for this patch. This thing is only reason for using firefox instead of chrome.

But I dont know how can I enable option "Allow pages to choose their own fonts,
instead of my selections above" like in firefox?

I don't know about much about css. But I'm used to terminal, vim and sort of that.
Plz give some hint : )

Thanks for this effort again.
Apr 5, 2010
#51 matte...@gmail.com
Here is my Custom.css for,
"Allow pages to choose their own fonts, instead of my selections above"


* {
    font-family: serif !important;  /* for proportional font
}

/for monospaced font
pre, pre * {
    font-family: monospace !important ;
}

code, code * {
    font-family: monospace !important ;
}

tt, tt * {
    font-family: monospace !important ;
}

Its not perfect. Any hints are welcome : )
May 5, 2010
#52 mkte...@gmail.com
This doesn't seem to be working on my end... I created a Custom.css file in the "User 
StyleSheets" (with an 's') folder in the Default profile folder, then pasted in the 
code for this style:
http://userstyles.org/styles/23032

And saved the file.  But it does not take effect even after I restart the browser 
(with or without --enable-user-stylesheet).  Installing the style as a userscript 
*does* work, so I don't think it's an issue with the style code.

I'm on the latest Beta, 5.0.375.29 (Official Build 46008) beta.
May 9, 2010
#53 tony@chromium.org
@mkterra: If you properly pass --enable-user-stylesheet, when you launch chrome, it will automatically create 
"User StyleSheets\Custom.css" in your profile directory.
May 10, 2010
#54 mkte...@gmail.com
It does generate a blank Custom.css file, but pasting code from userstyles.org into 
it (and saving) doesn't seem to do anything, even after restarting the browser (still 
with --enable-user-stylesheet).  I've tried a couple of styles without seeing any 
effect:
http://userstyles.org/styles/23032
http://userstyles.org/styles/23433

By the way, I thought your changes in  Issue 38182  removed the need for --enable-user-
stylesheet?  Was that reverted later in a different bug?
May 10, 2010
#55 mkte...@gmail.com
Oh wait, I've got it: Chrome doesn't support @-moz-document url-prefix.  (Are there 
plans to add that?)
May 10, 2010
#56 tony@chromium.org
The removal of --enable-user-stylesheet didn't make it into beta, but it is removed in the dev channel builds.

Please file a bug at bugs.webkit.org about supporting @document url-prefix.
May 17, 2010
#57 dhw@chromium.org
If removal of --enable-user-stylesheet didn't make it into beta, does that mean this is 
not a supported feature for Chrome 5, but will be a supported feature for Chrome 6?
May 17, 2010
#58 tony@chromium.org
@dhw: I'm not sure what you mean by "supported".  In Chrome 5, you will be able to enable this feature using the 
command line.
Jun 16, 2010
#59 nikri...@gmail.com
Are there any plans involving adding per-site userContent?
Something along the lines of Mozilla's @moz-document, perhaps?
Jun 16, 2010
#60 a...@chromium.org
When bug 29995 is done, you will be able to do that using an extension.
Dec 16, 2010
#61 mathias%...@gtempaccount.com
Re: comment 56: I filed a bug for @-webkit-document over at https://bugs.webkit.org/show_bug.cgi?id=51172.
Jan 3, 2011
#62 aesouza2008@gmail.com
Although this has been marked fixed, one of the original aims is not accomplished: that of a proper UI.
The Wrench > Options > Under the Hood > Web Content > "Change the default font and language for webpages" is thoroughly misleading to "average" (and unobservant) users coming from Firefox, for example. Misleading because the *default* is a rarity on the 'net. Users make changes there expecting these changes to be visible when they go surfing. Result: irate posts in the help forum.

It is even politically incorrect since font size and color are *accessibility* issues and Google should bend over backward to show it is friendly to the "differently abled" or whatever the phrase is now.
Jul 6, 2011
#64 perdri...@gmail.com
100% agree with comment #62
Aug 21, 2011
#65 sa...@beadlebugs.com
There's **still** no ability to create site-specific css in Chrome? WHAT THE F***!? Epic fail.
Aug 21, 2011
#66 sa...@beadlebugs.com
Implementing user css without the ability to apply custom css only to specific sites is utterly half-assed and makes the whole feature useless.
Aug 21, 2011
#68 mathias@qiwi.be
> Implementing user css without the ability to apply custom css only to specific
> sites is utterly half-assed and makes the whole feature useless.

That’s what https://bugs.webkit.org/show_bug.cgi?id=51172 is all about.
Oct 12, 2012
#69 bugdroid1@chromium.org
This issue has been closed for some time. No one will pay attention to new comments.
If you are seeing this bug or have new data, please click New Issue to start a new bug.
Labels: Restrict-AddIssueComment-Commit
Blocking: -chromium:15639
Mar 10, 2013
#70 bugdroid1@chromium.org
(No comment was entered for this change.)
Labels: -Area-WebKit -Feature-Accessibility Cr-Content Cr-UI-Accessibility
Apr 5, 2013
#71 bugdroid1@chromium.org
(No comment was entered for this change.)
Labels: -Cr-Content Cr-Blink
Sign in to add a comment

Powered by Google Project Hosting