<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>69697</bug_id>
          
          <creation_ts>2003-12-06 01:54:14 +0000</creation_ts>
          <short_desc>User defined stylesheet doesn&apos;t work</short_desc>
          <delta_ts>2004-02-28 23:45:50 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konqueror</product>
          <component>khtml</component>
          <version>4.0</version>
          <rep_platform>unspecified</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Malte S. Stretz">mss</reporter>
          <assigned_to name="Konqueror Bugs">konqueror-bugs-null</assigned_to>
          <cc>bert</cc>
    
    <cc>raabe</cc>
    
    <cc>tero_p</cc>
    
    <cc>web</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>183250</commentid>
    <comment_count>0</comment_count>
    <who name="Malte S. Stretz">mss</who>
    <bug_when>2003-12-06 01:54:15 +0000</bug_when>
    <thetext>Version:           4.0 (using KDE 3.1.94 (3.2 Beta 2), Gentoo)
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3, propolice)
OS:          Linux (i686) release 2.4.20-gentoo-r8

To work around bug 59600, I tried to add a user defined stylesheet which just consists of the line
  a { background-image: none; }
This worked neither in KDE 3.2-beta2 nor in 3.1.4.

So I tried to find out if that feature worked at all and put the line
  p { color: red; }
That did work in KDE 3.1.4 but not in KDE 3.2-beta2.

I restarted Konqueror (even whole KDE) to get around bug 39962 but that didn&apos;t help.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>201149</commentid>
    <comment_count>1</comment_count>
    <who name="Stephan Kulow">coolo</who>
    <bug_when>2004-02-02 21:41:13 +0000</bug_when>
    <thetext>*** Bug 74030 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>207571</commentid>
    <comment_count>2</comment_count>
      <attachid>4779</attachid>
    <who name="Frerich Raabe">raabe</who>
    <bug_when>2004-02-19 16:49:29 +0000</bug_when>
    <thetext>Created attachment 4779
Testcase which demonstrates the problem

This testcase demonstrates the problem; the background is set to red, my custom
stylesheet just contains &quot;body { background-color: blue }&quot;.

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 &quot;inline&quot;. If exactly the same stylesheet is moved to an extra file,
and then referenced using &lt;link rel=&quot;stylesheet&quot; ...&gt;, 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).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>207967</commentid>
    <comment_count>3</comment_count>
    <who name="Frerich Raabe">raabe</who>
    <bug_when>2004-02-20 15:05:32 +0000</bug_when>
    <thetext>CVS commit by raabe: 

- In DocLoader::requestStyleSheet, don&apos;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-&gt;requestStyleSheet(url, QString::null );
+            m_cachedSheet = dl-&gt;requestStyleSheet(url, QString::null, &quot;text/css&quot;,
+                                                  true /* &quot;user sheet&quot; */);
             if (m_cachedSheet)
                 m_cachedSheet-&gt;ref( this );

--- kdelibs/khtml/misc/loader.cpp  #1.170:1.171
@@ -925,14 +925,14 @@ bool DocLoader::needReload(const KURL &amp;f
 }
 
-#define DOCLOADER_SECCHECK \
+#define DOCLOADER_SECCHECK(doRedirectCheck) \
     KURL fullURL (m_doc-&gt;completeURL( url.string() )); \
     if ( !fullURL.isValid() || \
          ( m_part &amp;&amp; m_part-&gt;onlyLocalReferences() &amp;&amp; fullURL.protocol() != &quot;file&quot; &amp;&amp; fullURL.protocol() != &quot;data&quot;) || \
-         ( kapp &amp;&amp; m_doc &amp;&amp; !kapp-&gt;authorizeURLAction(&quot;redirect&quot;, m_doc-&gt;URL(), fullURL))) \
+         doRedirectCheck &amp;&amp; ( kapp &amp;&amp; m_doc &amp;&amp; !kapp-&gt;authorizeURLAction(&quot;redirect&quot;, m_doc-&gt;URL(), fullURL))) \
          return 0L;
 
 CachedImage *DocLoader::requestImage( const DOM::DOMString &amp;url)
 {
-    DOCLOADER_SECCHECK;
+    DOCLOADER_SECCHECK(true);
 
     CachedImage* i = Cache::requestObject&lt;CachedImage, CachedObject::Image&gt;( this, fullURL, 0);
@@ -945,7 +945,7 @@ CachedImage *DocLoader::requestImage( co
 
 CachedCSSStyleSheet *DocLoader::requestStyleSheet( const DOM::DOMString &amp;url, const QString&amp; charset,
-                                                   const char *accept )
+                                                   const char *accept, bool userSheet )
 {
-    DOCLOADER_SECCHECK;
+    DOCLOADER_SECCHECK(!userSheet);
 
     CachedCSSStyleSheet* s = Cache::requestObject&lt;CachedCSSStyleSheet, CachedObject::CSSStyleSheet&gt;( this, fullURL, accept );
@@ -958,5 +958,5 @@ CachedCSSStyleSheet *DocLoader::requestS
 CachedScript *DocLoader::requestScript( const DOM::DOMString &amp;url, const QString&amp; charset)
 {
-    DOCLOADER_SECCHECK;
+    DOCLOADER_SECCHECK(true);
 
     CachedScript* s = Cache::requestObject&lt;CachedScript, CachedObject::Script&gt;( this, fullURL, 0 );

--- kdelibs/khtml/misc/loader.h  #1.65:1.66
@@ -322,5 +322,5 @@ namespace khtml
         CachedImage *requestImage( const DOM::DOMString &amp;url);
         CachedCSSStyleSheet *requestStyleSheet( const DOM::DOMString &amp;url, const QString&amp; charset,
-                                                const char *accept = &quot;text/css&quot;);
+                                                const char *accept = &quot;text/css&quot;, bool userSheet = false );
         CachedScript *requestScript( const DOM::DOMString &amp;url, const QString&amp; charset);
 


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>207974</commentid>
    <comment_count>4</comment_count>
    <who name="Stephan Kulow">coolo</who>
    <bug_when>2004-02-20 15:13:43 +0000</bug_when>
    <thetext>*** Bug 75519 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>210794</commentid>
    <comment_count>5</comment_count>
    <who name="Germain Garand">germain</who>
    <bug_when>2004-02-28 23:45:50 +0000</bug_when>
    <thetext>*** Bug 76379 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4779</attachid>
            <date>2004-02-19 16:49:29 +0000</date>
            <delta_ts>2004-02-19 16:49:29 +0000</delta_ts>
            <desc>Testcase which demonstrates the problem</desc>
            <filename>simple.html</filename>
            <type>text/html</type>
            <size>185</size>
            <attacher name="Frerich Raabe">raabe</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9InNpbXBsZS5jc3MiIHR5
cGU9InRleHQvY3NzIiAvPgo8IS0tCjxzdHlsZSB0eXBlPSJjc3MiPgpib2R5IHsgYmFja2dyb3Vu
ZC1jb2xvcjogcmVkIH0KPC9zdHlsZT4KLS0+CjwvaGVhZD4KPGJvZHk+SGVsbG8sIFdvcmxkITwv
Ym9keT4KPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>