Summary: | User defined stylesheet doesn't work | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Malte S. Stretz <mss> |
Component: | khtml | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | bert, raabe, tero_p, web |
Priority: | NOR | ||
Version: | 4.0 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Testcase which demonstrates the problem |
Description
Malte S. Stretz
2003-12-06 01:54:15 UTC
*** Bug 74030 has been marked as a duplicate of this bug. *** Created attachment 4779 [details]
Testcase which demonstrates the problem
This testcase demonstrates the problem; the background is set to red, my custom
stylesheet just contains "body { background-color: blue }".
I noticed that everything works expected (the page has a blue background, my
custom stylesheet overrides the page stylesheet) if the page stylesheet is
declared "inline". If exactly the same stylesheet is moved to an extra file,
and then referenced using <link rel="stylesheet" ...>, the background becomes
red.
Also, overriding the page stylesheet with the custom stylesheet only seems to
fail in case the page stylesheet defines the same propery (e.g.
body::background-color) as the custom stylesheet. If I change the custom
stylesheet to affect some other property (like, body::color), the two
stylesheets get merged nicely (no matter whether the page stylesheet is
declared inline or not).
CVS commit by raabe: - In DocLoader::requestStyleSheet, don't check whether a redirection from http: to file: is ok in case we are loading the user-defined stylesheet. The user-defined sheet may be stored on the local disk and that check would always make DocLoader::requestStyleSheet refuse to load the stylesheet. CCMAIL:69697-done@bugs.kde.org M +2 -1 khtml_part.cpp 1.969 M +6 -6 misc/loader.cpp 1.171 M +1 -1 misc/loader.h 1.66 --- kdelibs/khtml/khtml_part.cpp #1.968:1.969 @@ -121,5 +121,6 @@ namespace khtml { { m_part = part; - m_cachedSheet = dl->requestStyleSheet(url, QString::null ); + m_cachedSheet = dl->requestStyleSheet(url, QString::null, "text/css", + true /* "user sheet" */); if (m_cachedSheet) m_cachedSheet->ref( this ); --- kdelibs/khtml/misc/loader.cpp #1.170:1.171 @@ -925,14 +925,14 @@ bool DocLoader::needReload(const KURL &f } -#define DOCLOADER_SECCHECK \ +#define DOCLOADER_SECCHECK(doRedirectCheck) \ KURL fullURL (m_doc->completeURL( url.string() )); \ if ( !fullURL.isValid() || \ ( m_part && m_part->onlyLocalReferences() && fullURL.protocol() != "file" && fullURL.protocol() != "data") || \ - ( kapp && m_doc && !kapp->authorizeURLAction("redirect", m_doc->URL(), fullURL))) \ + doRedirectCheck && ( kapp && m_doc && !kapp->authorizeURLAction("redirect", m_doc->URL(), fullURL))) \ return 0L; CachedImage *DocLoader::requestImage( const DOM::DOMString &url) { - DOCLOADER_SECCHECK; + DOCLOADER_SECCHECK(true); CachedImage* i = Cache::requestObject<CachedImage, CachedObject::Image>( this, fullURL, 0); @@ -945,7 +945,7 @@ CachedImage *DocLoader::requestImage( co CachedCSSStyleSheet *DocLoader::requestStyleSheet( const DOM::DOMString &url, const QString& charset, - const char *accept ) + const char *accept, bool userSheet ) { - DOCLOADER_SECCHECK; + DOCLOADER_SECCHECK(!userSheet); CachedCSSStyleSheet* s = Cache::requestObject<CachedCSSStyleSheet, CachedObject::CSSStyleSheet>( this, fullURL, accept ); @@ -958,5 +958,5 @@ CachedCSSStyleSheet *DocLoader::requestS CachedScript *DocLoader::requestScript( const DOM::DOMString &url, const QString& charset) { - DOCLOADER_SECCHECK; + DOCLOADER_SECCHECK(true); CachedScript* s = Cache::requestObject<CachedScript, CachedObject::Script>( this, fullURL, 0 ); --- kdelibs/khtml/misc/loader.h #1.65:1.66 @@ -322,5 +322,5 @@ namespace khtml CachedImage *requestImage( const DOM::DOMString &url); CachedCSSStyleSheet *requestStyleSheet( const DOM::DOMString &url, const QString& charset, - const char *accept = "text/css"); + const char *accept = "text/css", bool userSheet = false ); CachedScript *requestScript( const DOM::DOMString &url, const QString& charset); *** Bug 75519 has been marked as a duplicate of this bug. *** |