Bug 246599

Summary: Webkit (in Konqueror) ignores custom css files.
Product: [Frameworks and Libraries] kwebkitpart Reporter: Peter Lewis <pete>
Component: generalAssignee: webkit-devel
Status: RESOLVED FIXED    
Severity: wishlist CC: adawit, dap78, davidpjames
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 1.4 (kwebkitpart)
Attachments: Testcase for custom CSS Webkit

Description Peter Lewis 2010-08-03 12:38:27 UTC
Version:           unspecified (using KDE 4.4.95) 
OS:                Linux

KHTML allows the user to place custom CSS in .kde/share/apps/khtml/css/htm4.css. This was useful.

IMO, kwebkitpart should either
a) honour the same settings, or
b) provide its own file to serve the same purpose.

Thanks.

Reproducible: Always

Steps to Reproduce:
Load a page in konqueror, using webkit.

Actual Results:  
Style file is ignored - no (obvious) way to add custom CSS.

Expected Results:  
There should be a way to add custom CSS.
Comment 1 Dawit Alemayehu 2010-08-03 18:38:53 UTC
SVN commit 1158765 by adawit:

Use the user-defined style sheet if present.

CCBUG: 246599


 M  +8 -3      webkitsettings.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1158765
Comment 2 Dawit Alemayehu 2010-08-03 18:43:55 UTC
The above commit should allow you to specify your own custom (user-defined) CSS file under Konqueror's settings dialog (Web Browsing->Appearance->Stylesheets). 

It is important to note that the stylesheet you use for khtml rendering engine might not necessarily produce the desired result for webkit and vise-versa. That is the reason why we do not use the default khtml CSS file (html4.css) in kwebkitpart.

Let us know if the above fix works fine for you.
Comment 3 Peter Lewis 2010-08-04 11:00:27 UTC
Thanks Dawit.

Yes, that works fine if I define a user-defined stylesheet in Konqueror's settings (which is probably the best way, as you point out). Thanks :-)

A question though - if I select "use user defined stylesheet" rather than "use default stylesheet", am I missing some useful style information which I might want to copy from the default to my user defined one? Or will my user defined stylesheet just provide overrides? It might be helpful to clarify this in the GUI.

Thanks again!
Comment 4 Dawit Alemayehu 2010-08-13 17:40:37 UTC
(In reply to comment #3)
> Thanks Dawit.
> 
> Yes, that works fine if I define a user-defined stylesheet in Konqueror's
> settings (which is probably the best way, as you point out). Thanks :-)
> 
> A question though - if I select "use user defined stylesheet" rather than "use
> default stylesheet", am I missing some useful style information which I might
> want to copy from the default to my user defined one? Or will my user defined
> stylesheet just provide overrides? It might be helpful to clarify this in the
> GUI.

Good question. Not sure because the code that handles it is upstream in qtwebkit. It needs to be investigated. I believe it simply uses its own internal version and overrides those values that are defined in the custom stylesheet. IOW, it does not simply ignore its own internal version, but that needs to be validated ofcourse...
Comment 5 Dawit Alemayehu 2012-05-12 22:52:19 UTC
This has been completely addressed in the current development branch. In KDE 4.9.0 even the CSS config dialog in Konqueror will correctly start using the browser engine defined that was defined as the default.
Comment 6 Roland Pallai 2013-02-13 15:27:25 UTC
I'm using 4.9.5 (Fedora 18) and the custom CSS selected under settings->web browsing->appearance is ignored by WebKit (works with KHTML). The built in "accessiblity stylesheet" works with both engine.
Comment 7 Dawit Alemayehu 2013-02-14 03:02:44 UTC
Are the changes reflected in the provided view when you change the style sheet ? Can you provide the custom stylesheet you are using ?
Comment 8 Roland Pallai 2013-02-14 11:04:20 UTC
I'm not sure what do you mean by "provided view";
The radio button and the text input field in settings dialog reflects my selection, but the current html page does not. (With KHTML the changes apply instantly when I select custom css file. Changes to the css file reflected on page reload.)

My css file is very simple, just for testing:
 body { background-color: blue !important; }
 label { color: red !important; }
Comment 9 Dawit Alemayehu 2013-02-17 02:36:57 UTC
Git commit 7e5ab58ceb0849c38592ebdde7389ffbed33f6d1 by Dawit Alemayehu.
Committed on 17/02/2013 at 03:32.
Pushed by adawit into branch 'master'.

Make user defined custom style sheet work.
FIXED-IN: 1.4 (kwebkitpart)

M  +1    -1    src/settings/webkitsettings.cpp

http://commits.kde.org/kwebkitpart/7e5ab58ceb0849c38592ebdde7389ffbed33f6d1
Comment 10 Dawit Alemayehu 2013-02-17 02:53:38 UTC
Git commit 292f32fda933b2ead5a61ff1ec457f839fad5c85 by Dawit Alemayehu.
Committed on 17/02/2013 at 03:32.
Pushed by adawit into branch '1.3'.

Make user defined custom style sheet work.
FIXED-IN: 1.4 (kwebkitpart)
(cherry picked from commit 7e5ab58ceb0849c38592ebdde7389ffbed33f6d1)

M  +1    -1    src/settings/webkitsettings.cpp

http://commits.kde.org/kwebkitpart/292f32fda933b2ead5a61ff1ec457f839fad5c85
Comment 11 David P James 2015-02-24 18:58:28 UTC
Created attachment 91276 [details]
Testcase for custom CSS Webkit

This bug appears to have reappeared, and is present in both Konqueror(Webkit) and Rekonq. I've attached a testcase that demonstrates how to make the bug appear.