Menu

#7 relative paths in CSS do not work

open
None
5
2007-07-11
2007-07-09
No

CSS @import statements can point to files relative to their own location.

wxWebkit does not appear to handle this correctly. Included is a zipped directory showing this.

The directory has the following structure:

relpathbug/
test.html
res/
main.css
samedir.css
includedlater.css

1) test.html has an @import 'res/main.css';
2) main.css has an @import 'samedir.css';
2) main.css also has an @import '../includedlater.css';

The "finished" page should have white text on a red background, and does so in Firefox and Safari. But in wxWebkit res/samedir.css and includedlater.css do not get loaded, as is noted in the console.

Run "relpathbug.py" for an example window showing the problem, but don't forget to change the URL of the file to wherever you unzip relpathbug.zip.

Discussion

  • Kevin Watters

    Kevin Watters - 2007-07-09

    CSS relative path bug test

     
  • Kevin Watters

    Kevin Watters - 2007-07-09

    Logged In: YES
    user_id=1731802
    Originator: YES

    SourceForge's formatter removed the spaces from the path tree above...please ignore it and just see the directory in the ZIP file :)

     
  • Kevin Ollivier

    Kevin Ollivier - 2007-07-11

    Logged In: YES
    user_id=248468
    Originator: NO

    I've confirmed this problem happens for me too, although I'm not sure what is causing it. I'm working to debug it, but it might be a little while before I can track this down. In the meantime, is it acceptable to workaround it by not loading css in subdirs?

     
  • Kevin Ollivier

    Kevin Ollivier - 2007-07-11
    • assigned_to: nobody --> kollivier
     
  • Kevin Watters

    Kevin Watters - 2007-07-11

    Logged In: YES
    user_id=1731802
    Originator: YES

    Actually, relative CSS paths are used everywhere in the "pages" we're loading with WebKit, the structure of which is already defined, so this is definitely a bug I'll be poking through the code for as well.

     
  • Kevin Ollivier

    Kevin Ollivier - 2007-07-17

    Logged In: YES
    user_id=248468
    Originator: NO

    I've found a hack that fixes this, but it is not the correct solution. In CachedCSSStyleSheet::checkNotify(), in WebCore/loader/CachedCSSStyleSheet.cpp, change "m_response.url().url()" in line 90 to read just "url()". This isn't the correct fix, because it works around the problem that m_resource is not properly set, but it will be enough to get things running until a proper fix is in place.

     

Log in to post a comment.

MongoDB Logo MongoDB