Hi, for quite some while I've been trying to add support for the @import directive in CSS. The problem is that it creates a cyclic dependency between CssParser and DilloHtml: CssParser now calls a_Html_load_stylesheet(). This is extremely ugly and needs to be decoupled somehow. Anyway, attached is what I currently have - cleanup ideas welcome. Note, that we also need to use the URL of the current stylesheet to resolve relative URLs in @import. This is not implemented yet. Cheers, Johannes
Johannes wrote:
for quite some while I've been trying to add support for the @import directive in CSS. The problem is that it creates a cyclic dependency between CssParser and DilloHtml: CssParser now calls a_Html_load_stylesheet().
This is extremely ugly and needs to be decoupled somehow.
Anyway, attached is what I currently have - cleanup ideas welcome.
Note, that we also need to use the URL of the current stylesheet to resolve relative URLs in @import. This is not implemented yet.
Good! - Is strcat safe here? - strcasecmp -> dStrcasecmp - needs a check for prefs.load_stylesheets - Can we get into loops if an imported stylesheet imports itself (directly or indirectly)
On Sat, Apr 04, 2009 at 03:19:06PM +0000, corvid wrote:
Johannes wrote:
for quite some while I've been trying to add support for the @import directive in CSS. The problem is that it creates a cyclic dependency between CssParser and DilloHtml: CssParser now calls a_Html_load_stylesheet().
This is extremely ugly and needs to be decoupled somehow.
Anyway, attached is what I currently have - cleanup ideas welcome.
Note, that we also need to use the URL of the current stylesheet to resolve relative URLs in @import. This is not implemented yet.
Good!
- Is strcat safe here?
Argh, no of course not. And I was wondering why dillo was crashing all the time :-)
- strcasecmp -> dStrcasecmp
Yes.
- needs a check for prefs.load_stylesheets
That should probabely go into a_Html_load_stylesheet().
- Can we get into loops if an imported stylesheet imports itself (directly or indirectly)
Yes, we need to detect such loops. Should be not too hard. But first I'd like to fix the cyclic dependency. Maybe we can move a_Html_load_stylesheet() from html.cc to some other place? Thanks for having a look! Johannes
On Sun, Apr 05, 2009 at 04:49:16PM +0000, corvid wrote:
Johannes wrote:
But first I'd like to fix the cyclic dependency. Maybe we can move a_Html_load_stylesheet() from html.cc to some other place?
Perhaps some code could move to the bw.
Yes, but maybe it isn't as bad as I initially thought anyway... Attached is an improved version of the patch that avoids looping on recursive @import and resolves relative urls properly. Cheers, Johannes
On Sun, Apr 05, 2009 at 04:49:16PM +0000, corvid wrote:
Johannes wrote:
But first I'd like to fix the cyclic dependency. Maybe we can move a_Html_load_stylesheet() from html.cc to some other place?
Perhaps some code could move to the bw.
I've just committed my CSS @import work. It seems to work reliably here. The cyclic dependency is still unsolved. But I came to the conclusion that the whole concept of @import is somewhat cyclic :) Nevertheless I will try to move some code to bw as corvid suggested. Cheers, Johannes PS: Thanks for the reviews, corvid!
participants (2)
-
corvid@lavabit.com
-
Johannes.Hofmann@gmx.de