[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

abarth at webkit.org abarth at webkit.org
Thu Feb 4 21:22:53 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 21f33060e8a3397785ce06937913e198fbf0a3a2
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 21 07:22:22 2010 +0000

    2010-01-20  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Darin Adler.
    
            Stylesheet href property shows redirected URL unlike other browsers
            https://bugs.webkit.org/show_bug.cgi?id=33683
    
            Test whether the href property of style sheets contains the original or
            final URL of the redirect chain that lead to the style sheet.
    
            I couldn't figure out how to test the XSLStyleSheet parts of this
            change.  There didn't seem to be DOM bindings for the href property
            here.  If I missed it, please let me know.
    
            * http/tests/security/stylesheet-href-redirect-expected.txt: Added.
            * http/tests/security/stylesheet-href-redirect.html: Added.
    2010-01-20  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Darin Adler.
    
            Stylesheet href property shows redirected URL unlike other browsers
            https://bugs.webkit.org/show_bug.cgi?id=33683
    
            Teach StyleSheet the difference between original and final URLs in
            redirect chains.  Unfortunately, StyleSheet needs to know both of these
            URLs.  The original URL is needed for the href property and the final
            URL is needed as the baseURL.
    
            This change required touching a lot of lines of code because we need to
            plumb this information to the StyleSheet object.  I audited all
            existing clients of href() and setHref() to see whether they wanted the
            original or final URLs.  I then updated the clients (except the JS
            bindings themselves) to use the correct accessor.
    
            Test: http/tests/security/stylesheet-href-redirect.html
    
            * css/CSSImportRule.cpp:
            (WebCore::CSSImportRule::setCSSStyleSheet):
            (WebCore::CSSImportRule::insertedIntoParent):
            * css/CSSImportRule.h:
            * css/CSSStyleSheet.cpp:
            (WebCore::CSSStyleSheet::CSSStyleSheet):
            * css/CSSStyleSheet.h:
            (WebCore::CSSStyleSheet::create):
            (WebCore::CSSStyleSheet::createInline): Added a new constructor to deal
            with "inline" style sheets that don't have a distinct original and
            final URL.
            * css/StyleBase.cpp:
            (WebCore::StyleBase::baseURL): This code wants to use the final URL,
            not the original URL.  Updated it to grab the baseURL directly.
            * css/StyleSheet.cpp:
            (WebCore::StyleSheet::StyleSheet):
            * css/StyleSheet.h:
            (WebCore::StyleSheet::href):
            (WebCore::StyleSheet::setBaseURL): This function really just updates
            the base URL of the style sheet, so I made it more explicit.
            (WebCore::StyleSheet::putativeBaseURL): We need an accessor for the
            base URL, but baseURL is already taken.
            * dom/Document.cpp:
            (WebCore::Document::updateBaseURL):
            (WebCore::Document::pageUserSheet):
            (WebCore::Document::pageGroupUserSheets):
            (WebCore::Document::elementSheet):
            (WebCore::Document::mappedElementSheet):
            * dom/ProcessingInstruction.cpp:
            (WebCore::ProcessingInstruction::checkStyleSheet):
            (WebCore::ProcessingInstruction::setCSSStyleSheet):
            (WebCore::ProcessingInstruction::setXSLStyleSheet):
            * dom/ProcessingInstruction.h:
            * dom/StyleElement.cpp:
            (WebCore::StyleElement::createSheet):
            * html/HTMLLinkElement.cpp:
            (WebCore::HTMLLinkElement::setCSSStyleSheet):
            * html/HTMLLinkElement.h:
            * loader/CachedCSSStyleSheet.cpp:
            (WebCore::CachedCSSStyleSheet::didAddClient):
            (WebCore::CachedCSSStyleSheet::checkNotify): This code now passes both
            the original and final URL into setCSSStyleSheet so that the style
            sheet can have both.
            * loader/CachedResourceClient.h:
            (WebCore::CachedResourceClient::setCSSStyleSheet):
            (WebCore::CachedResourceClient::setXSLStyleSheet):
            * loader/CachedXSLStyleSheet.cpp:
            (WebCore::CachedXSLStyleSheet::didAddClient):
            (WebCore::CachedXSLStyleSheet::checkNotify): I don't have any direct
            evidence that we need to change the XSLStyleSheet behavior, which is
            why I wasn't able to add a test for the behavior.  However, the objects
            are parallel enough that it seemed like the right thing to do.
            * xml/XSLImportRule.cpp:
            (WebCore::XSLImportRule::setXSLStyleSheet):
            (WebCore::XSLImportRule::loadSheet):
            * xml/XSLImportRule.h:
            * xml/XSLStyleSheet.h:
            (WebCore::XSLStyleSheet::create):
            (WebCore::XSLStyleSheet::createEmbedded):
            * xml/XSLStyleSheetLibxslt.cpp:
            (WebCore::XSLStyleSheet::XSLStyleSheet):
            (WebCore::XSLStyleSheet::parseString):
            (WebCore::XSLStyleSheet::loadChildSheets):
            * xml/XSLStyleSheetQt.cpp:
            (WebCore::XSLStyleSheet::XSLStyleSheet):
            * xml/XSLTProcessorLibxslt.cpp:
            (WebCore::xsltStylesheetPointer):
            * xml/XSLTProcessorQt.cpp:
            (WebCore::XSLTProcessor::transformToString):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53607 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 65835c3..27eaab7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-01-20  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        Stylesheet href property shows redirected URL unlike other browsers
+        https://bugs.webkit.org/show_bug.cgi?id=33683
+
+        Test whether the href property of style sheets contains the original or
+        final URL of the redirect chain that lead to the style sheet.
+
+        I couldn't figure out how to test the XSLStyleSheet parts of this
+        change.  There didn't seem to be DOM bindings for the href property
+        here.  If I missed it, please let me know.
+
+        * http/tests/security/stylesheet-href-redirect-expected.txt: Added.
+        * http/tests/security/stylesheet-href-redirect.html: Added.
+
 2010-01-21  Kent Tamura  <tkent at chromium.org>
 
         Unreviewed. Fix a FAIL test by a wrong input.
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b2d6e7d..8a2b227 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,93 @@
+2010-01-20  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        Stylesheet href property shows redirected URL unlike other browsers
+        https://bugs.webkit.org/show_bug.cgi?id=33683
+
+        Teach StyleSheet the difference between original and final URLs in
+        redirect chains.  Unfortunately, StyleSheet needs to know both of these
+        URLs.  The original URL is needed for the href property and the final
+        URL is needed as the baseURL.
+
+        This change required touching a lot of lines of code because we need to
+        plumb this information to the StyleSheet object.  I audited all
+        existing clients of href() and setHref() to see whether they wanted the
+        original or final URLs.  I then updated the clients (except the JS
+        bindings themselves) to use the correct accessor.
+
+        Test: http/tests/security/stylesheet-href-redirect.html
+
+        * css/CSSImportRule.cpp:
+        (WebCore::CSSImportRule::setCSSStyleSheet):
+        (WebCore::CSSImportRule::insertedIntoParent):
+        * css/CSSImportRule.h:
+        * css/CSSStyleSheet.cpp:
+        (WebCore::CSSStyleSheet::CSSStyleSheet):
+        * css/CSSStyleSheet.h:
+        (WebCore::CSSStyleSheet::create): 
+        (WebCore::CSSStyleSheet::createInline): Added a new constructor to deal
+        with "inline" style sheets that don't have a distinct original and
+        final URL.
+        * css/StyleBase.cpp:
+        (WebCore::StyleBase::baseURL): This code wants to use the final URL,
+        not the original URL.  Updated it to grab the baseURL directly.
+        * css/StyleSheet.cpp:
+        (WebCore::StyleSheet::StyleSheet):
+        * css/StyleSheet.h:
+        (WebCore::StyleSheet::href):
+        (WebCore::StyleSheet::setBaseURL): This function really just updates
+        the base URL of the style sheet, so I made it more explicit.
+        (WebCore::StyleSheet::putativeBaseURL): We need an accessor for the
+        base URL, but baseURL is already taken.
+        * dom/Document.cpp:
+        (WebCore::Document::updateBaseURL):
+        (WebCore::Document::pageUserSheet):
+        (WebCore::Document::pageGroupUserSheets):
+        (WebCore::Document::elementSheet):
+        (WebCore::Document::mappedElementSheet):
+        * dom/ProcessingInstruction.cpp:
+        (WebCore::ProcessingInstruction::checkStyleSheet):
+        (WebCore::ProcessingInstruction::setCSSStyleSheet):
+        (WebCore::ProcessingInstruction::setXSLStyleSheet):
+        * dom/ProcessingInstruction.h:
+        * dom/StyleElement.cpp:
+        (WebCore::StyleElement::createSheet):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::setCSSStyleSheet):
+        * html/HTMLLinkElement.h:
+        * loader/CachedCSSStyleSheet.cpp:
+        (WebCore::CachedCSSStyleSheet::didAddClient):
+        (WebCore::CachedCSSStyleSheet::checkNotify): This code now passes both
+        the original and final URL into setCSSStyleSheet so that the style
+        sheet can have both.
+        * loader/CachedResourceClient.h:
+        (WebCore::CachedResourceClient::setCSSStyleSheet):
+        (WebCore::CachedResourceClient::setXSLStyleSheet):
+        * loader/CachedXSLStyleSheet.cpp:
+        (WebCore::CachedXSLStyleSheet::didAddClient):
+        (WebCore::CachedXSLStyleSheet::checkNotify): I don't have any direct
+        evidence that we need to change the XSLStyleSheet behavior, which is
+        why I wasn't able to add a test for the behavior.  However, the objects
+        are parallel enough that it seemed like the right thing to do.
+        * xml/XSLImportRule.cpp:
+        (WebCore::XSLImportRule::setXSLStyleSheet):
+        (WebCore::XSLImportRule::loadSheet):
+        * xml/XSLImportRule.h:
+        * xml/XSLStyleSheet.h:
+        (WebCore::XSLStyleSheet::create):
+        (WebCore::XSLStyleSheet::createEmbedded):
+        * xml/XSLStyleSheetLibxslt.cpp:
+        (WebCore::XSLStyleSheet::XSLStyleSheet):
+        (WebCore::XSLStyleSheet::parseString):
+        (WebCore::XSLStyleSheet::loadChildSheets):
+        * xml/XSLStyleSheetQt.cpp:
+        (WebCore::XSLStyleSheet::XSLStyleSheet):
+        * xml/XSLTProcessorLibxslt.cpp:
+        (WebCore::xsltStylesheetPointer):
+        * xml/XSLTProcessorQt.cpp:
+        (WebCore::XSLTProcessor::transformToString):
+
 2010-01-20  Kwang Yul Seo  <skyul at company100.net>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/WebCore/css/CSSImportRule.cpp b/WebCore/css/CSSImportRule.cpp
index be2d3a1..d50ecf7 100644
--- a/WebCore/css/CSSImportRule.cpp
+++ b/WebCore/css/CSSImportRule.cpp
@@ -54,11 +54,11 @@ CSSImportRule::~CSSImportRule()
         m_cachedSheet->removeClient(this);
 }
 
-void CSSImportRule::setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet* sheet)
+void CSSImportRule::setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet)
 {
     if (m_styleSheet)
         m_styleSheet->setParent(0);
-    m_styleSheet = CSSStyleSheet::create(this, url, charset);
+    m_styleSheet = CSSStyleSheet::create(this, href, baseURL, charset);
 
     bool crossOriginCSS = false;
     bool validMIMEType = false;
@@ -70,7 +70,7 @@ void CSSImportRule::setCSSStyleSheet(const String& url, const String& charset, c
 #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD)
     if (enforceMIMEType && needsSiteSpecificQuirks) {
         // Covers both http and https, with or without "www."
-        if (url.contains("mcafee.com/japan/", false))
+        if (baseURL.string().contains("mcafee.com/japan/", false))
             enforceMIMEType = false;
     }
 #endif
@@ -78,17 +78,17 @@ void CSSImportRule::setCSSStyleSheet(const String& url, const String& charset, c
     String sheetText = sheet->sheetText(enforceMIMEType, &validMIMEType);
     m_styleSheet->parseString(sheetText, strict);
 
-    if (!parent || !parent->doc() || !parent->doc()->securityOrigin()->canRequest(KURL(ParsedURLString, url)))
+    if (!parent || !parent->doc() || !parent->doc()->securityOrigin()->canRequest(baseURL))
         crossOriginCSS = true;
 
     if (crossOriginCSS && !validMIMEType && !m_styleSheet->hasSyntacticallyValidCSSHeader())
-        m_styleSheet = CSSStyleSheet::create(this, url, charset);
+        m_styleSheet = CSSStyleSheet::create(this, href, baseURL, charset);
 
     if (strict && needsSiteSpecificQuirks) {
         // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>.
         DEFINE_STATIC_LOCAL(const String, slashKHTMLFixesDotCss, ("/KHTMLFixes.css"));
         DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n"));
-        if (url.endsWith(slashKHTMLFixesDotCss) && sheetText == mediaWikiKHTMLFixesStyleSheet) {
+        if (baseURL.string().endsWith(slashKHTMLFixesDotCss) && sheetText == mediaWikiKHTMLFixesStyleSheet) {
             ASSERT(m_styleSheet->length() == 1);
             ExceptionCode ec;
             m_styleSheet->deleteRule(0, ec);
@@ -117,15 +117,16 @@ void CSSImportRule::insertedIntoParent()
         return;
 
     String absHref = m_strHref;
-    if (!parentSheet->href().isNull())
+    if (!parentSheet->putativeBaseURL().isNull())
         // use parent styleheet's URL as the base URL
-        absHref = KURL(KURL(ParsedURLString, parentSheet->href()), m_strHref).string();
+        absHref = KURL(parentSheet->putativeBaseURL(), m_strHref).string();
 
     // Check for a cycle in our import chain.  If we encounter a stylesheet
     // in our parent chain with the same URL, then just bail.
     StyleBase* root = this;
     for (StyleBase* curr = parent(); curr; curr = curr->parent()) {
-        if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->href())
+        // FIXME: This is wrong if the putativeBaseURL was updated via document::updateBaseURL. 
+        if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->putativeBaseURL().string())
             return;
         root = curr;
     }
diff --git a/WebCore/css/CSSImportRule.h b/WebCore/css/CSSImportRule.h
index f546006..10d3026 100644
--- a/WebCore/css/CSSImportRule.h
+++ b/WebCore/css/CSSImportRule.h
@@ -63,7 +63,7 @@ private:
     virtual unsigned short type() const { return IMPORT_RULE; }
 
     // from CachedResourceClient
-    virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*);
+    virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*);
 
     String m_strHref;
     RefPtr<MediaList> m_lstMedia;
diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp
index 3ce7fb4..9c9aa18 100644
--- a/WebCore/css/CSSStyleSheet.cpp
+++ b/WebCore/css/CSSStyleSheet.cpp
@@ -34,8 +34,8 @@
 
 namespace WebCore {
 
-CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const String& charset)
-    : StyleSheet(parentSheet, href)
+CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset)
+    : StyleSheet(parentSheet, href, baseURL)
     , m_doc(parentSheet ? parentSheet->doc() : 0)
     , m_namespaces(0)
     , m_charset(charset)
@@ -46,8 +46,8 @@ CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, con
 {
 }
 
-CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const String& charset)
-    : StyleSheet(parentNode, href)
+CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, const String& charset)
+    : StyleSheet(parentNode, href, baseURL)
     , m_doc(parentNode->document())
     , m_namespaces(0)
     , m_charset(charset)
@@ -58,8 +58,8 @@ CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const String&
 {
 }
 
-CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const String& charset)
-    : StyleSheet(ownerRule, href)
+CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)
+    : StyleSheet(ownerRule, href, baseURL)
     , m_namespaces(0)
     , m_charset(charset)
     , m_loadCompleted(false)
diff --git a/WebCore/css/CSSStyleSheet.h b/WebCore/css/CSSStyleSheet.h
index d4b353a..2d8a912 100644
--- a/WebCore/css/CSSStyleSheet.h
+++ b/WebCore/css/CSSStyleSheet.h
@@ -38,27 +38,31 @@ class CSSStyleSheet : public StyleSheet {
 public:
     static PassRefPtr<CSSStyleSheet> create()
     {
-        return adoptRef(new CSSStyleSheet(static_cast<CSSStyleSheet*>(0), String(), String()));
+        return adoptRef(new CSSStyleSheet(static_cast<CSSStyleSheet*>(0), String(), KURL(), String()));
     }
     static PassRefPtr<CSSStyleSheet> create(Node* ownerNode)
     {
-        return adoptRef(new CSSStyleSheet(ownerNode, String(), String()));
+        return adoptRef(new CSSStyleSheet(ownerNode, String(), KURL(), String()));
     }
-    static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href)
+    static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const KURL& baseURL)
     {
-        return adoptRef(new CSSStyleSheet(ownerNode, href, String()));
+        return adoptRef(new CSSStyleSheet(ownerNode, href, baseURL, String()));
     }
-    static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const String& charset)
+    static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const KURL& baseURL, const String& charset)
     {
-        return adoptRef(new CSSStyleSheet(ownerNode, href, charset));
+        return adoptRef(new CSSStyleSheet(ownerNode, href, baseURL, charset));
     }
-    static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& href, const String& charset)
+    static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)
     {
-        return adoptRef(new CSSStyleSheet(ownerRule, href, charset));
+        return adoptRef(new CSSStyleSheet(ownerRule, href, baseURL, charset));
+    }
+    static PassRefPtr<CSSStyleSheet> createInline(Node* ownerNode, const KURL& baseURL)
+    {
+        return adoptRef(new CSSStyleSheet(ownerNode, baseURL.string(), baseURL, String()));
     }
 
     virtual ~CSSStyleSheet();
-    
+
     CSSRule* ownerRule() const;
     PassRefPtr<CSSRuleList> cssRules(bool omitCharsetRules = false);
     unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
@@ -72,7 +76,7 @@ public:
 
     void addNamespace(CSSParser*, const AtomicString& prefix, const AtomicString& uri);
     const AtomicString& determineNamespace(const AtomicString& prefix);
-    
+
     virtual void styleSheetChanged();
 
     virtual bool parseString(const String&, bool strict = true);
@@ -99,10 +103,10 @@ public:
     bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValidCSSHeader; }
 
 private:
-    CSSStyleSheet(Node* ownerNode, const String& href, const String& charset);
-    CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const String& charset);
-    CSSStyleSheet(CSSRule* ownerRule, const String& href, const String& charset);
-    
+    CSSStyleSheet(Node* ownerNode, const String& href, const KURL& baseURL, const String& charset);
+    CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset);
+    CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset);
+
     virtual bool isCSSStyleSheet() const { return true; }
     virtual String type() const { return "text/css"; }
 
diff --git a/WebCore/css/StyleBase.cpp b/WebCore/css/StyleBase.cpp
index 8bfec5e..93bc57d 100644
--- a/WebCore/css/StyleBase.cpp
+++ b/WebCore/css/StyleBase.cpp
@@ -56,9 +56,9 @@ KURL StyleBase::baseURL() const
     StyleSheet* sheet = const_cast<StyleBase*>(this)->stylesheet();
     if (!sheet)
         return KURL();
-    if (!sheet->href().isNull())
-        return KURL(ParsedURLString, sheet->href());
-    if (sheet->parent()) 
+    if (!sheet->putativeBaseURL().isNull())
+        return sheet->putativeBaseURL();
+    if (sheet->parent())
         return sheet->parent()->baseURL();
     if (!sheet->ownerNode()) 
         return KURL();
diff --git a/WebCore/css/StyleSheet.cpp b/WebCore/css/StyleSheet.cpp
index b4fb3b2..15e1c3b 100644
--- a/WebCore/css/StyleSheet.cpp
+++ b/WebCore/css/StyleSheet.cpp
@@ -24,27 +24,30 @@
 
 namespace WebCore {
 
-StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& href)
+StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& baseURL)
     : StyleList(parentSheet)
     , m_parentNode(0)
-    , m_strHref(href)
+    , m_href(href)
+    , m_baseURL(baseURL)
     , m_disabled(false)
 {
 }
 
 
-StyleSheet::StyleSheet(Node* parentNode, const String& href)
+StyleSheet::StyleSheet(Node* parentNode, const String& href, const KURL& baseURL)
     : StyleList(0)
     , m_parentNode(parentNode)
-    , m_strHref(href)
+    , m_href(href)
+    , m_baseURL(baseURL)
     , m_disabled(false)
 {
 }
 
-StyleSheet::StyleSheet(StyleBase* owner, const String& href)
+StyleSheet::StyleSheet(StyleBase* owner, const String& href, const KURL& baseURL)
     : StyleList(owner)
     , m_parentNode(0)
-    , m_strHref(href)
+    , m_href(href)
+    , m_baseURL(baseURL)
     , m_disabled(false)
 {
 }
diff --git a/WebCore/css/StyleSheet.h b/WebCore/css/StyleSheet.h
index 016d50a..5f8ad78 100644
--- a/WebCore/css/StyleSheet.h
+++ b/WebCore/css/StyleSheet.h
@@ -41,8 +41,18 @@ public:
 
     Node* ownerNode() const { return m_parentNode; }
     StyleSheet *parentStyleSheet() const;
-    const String& href() const { return m_strHref; }
-    void setHref(const String& href) { m_strHref = href; }
+
+    // Note that href is the URL that started the redirect chain that led to
+    // this style sheet. This property probably isn't useful for much except
+    // the JavaScript binding (which needs to use this value for security).
+    const String& href() const { return m_href; }
+
+    void setBaseURL(const KURL& baseURL) { m_baseURL = baseURL; }
+
+    // Notice that this object inherits a baseURL function from StyleBase that
+    // crawls the parent() relation looking for a non-0 putativeBaseURL.
+    const KURL& putativeBaseURL() const { return m_baseURL; }
+
     const String& title() const { return m_strTitle; }
     void setTitle(const String& s) { m_strTitle = s; }
     MediaList* media() const { return m_media.get(); }
@@ -58,15 +68,16 @@ public:
     virtual bool parseString(const String&, bool strict = true) = 0;
 
 protected:
-    StyleSheet(Node* ownerNode, const String& href);
-    StyleSheet(StyleSheet* parentSheet, const String& href);
-    StyleSheet(StyleBase* owner, const String& href);
+    StyleSheet(Node* ownerNode, const String& href, const KURL& baseURL);
+    StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& baseURL);
+    StyleSheet(StyleBase* owner, const String& href, const KURL& baseURL);
 
 private:
     virtual bool isStyleSheet() const { return true; }
 
     Node* m_parentNode;
-    String m_strHref;
+    String m_href;
+    KURL m_baseURL;
     String m_strTitle;
     RefPtr<MediaList> m_media;
     bool m_disabled;
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 96b262b..ab37cb7 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -2009,9 +2009,9 @@ void Document::updateBaseURL()
         m_baseURL = KURL();
 
     if (m_elemSheet)
-        m_elemSheet->setHref(m_baseURL.string());
+        m_elemSheet->setBaseURL(m_baseURL);
     if (m_mappedElementSheet)
-        m_mappedElementSheet->setHref(m_baseURL.string());
+        m_mappedElementSheet->setBaseURL(m_baseURL);
 }
 
 String Document::userAgent(const KURL& url) const
@@ -2033,7 +2033,7 @@ CSSStyleSheet* Document::pageUserSheet()
         return 0;
     
     // Parse the sheet and cache it.
-    m_pageUserSheet = CSSStyleSheet::create(this, settings()->userStyleSheetLocation());
+    m_pageUserSheet = CSSStyleSheet::createInline(this, settings()->userStyleSheetLocation());
     m_pageUserSheet->setIsUserStyleSheet(true);
     m_pageUserSheet->parseString(userSheetText, !inCompatMode());
     return m_pageUserSheet.get();
@@ -2068,7 +2068,7 @@ const Vector<RefPtr<CSSStyleSheet> >* Document::pageGroupUserSheets() const
             const UserStyleSheet* sheet = sheets->at(i).get();
             if (!UserContentURLPattern::matchesPatterns(url(), sheet->whitelist(), sheet->blacklist()))
                 continue;
-            RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::create(const_cast<Document*>(this), sheet->url());
+            RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::createInline(const_cast<Document*>(this), sheet->url());
             parsedSheet->setIsUserStyleSheet(true);
             parsedSheet->parseString(sheet->source(), !inCompatMode());
             if (!m_pageGroupUserSheets)
@@ -2090,14 +2090,14 @@ void Document::clearPageGroupUserSheets()
 CSSStyleSheet* Document::elementSheet()
 {
     if (!m_elemSheet)
-        m_elemSheet = CSSStyleSheet::create(this, m_baseURL.string());
+        m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
     return m_elemSheet.get();
 }
 
 CSSStyleSheet* Document::mappedElementSheet()
 {
     if (!m_mappedElementSheet)
-        m_mappedElementSheet = CSSStyleSheet::create(this, m_baseURL.string());
+        m_mappedElementSheet = CSSStyleSheet::createInline(this, m_baseURL);
     return m_mappedElementSheet.get();
 }
 
diff --git a/WebCore/dom/ProcessingInstruction.cpp b/WebCore/dom/ProcessingInstruction.cpp
index e4599dd..bca7c2c 100644
--- a/WebCore/dom/ProcessingInstruction.cpp
+++ b/WebCore/dom/ProcessingInstruction.cpp
@@ -139,7 +139,8 @@ void ProcessingInstruction::checkStyleSheet()
             // We need to make a synthetic XSLStyleSheet that is embedded.  It needs to be able
             // to kick off import/include loads that can hang off some parent sheet.
             if (m_isXSL) {
-                m_sheet = XSLStyleSheet::createEmbedded(this, m_localHref);
+                KURL baseURL = KURL(ParsedURLString, m_localHref);
+                m_sheet = XSLStyleSheet::createEmbedded(this, m_localHref, baseURL);
                 m_loading = false;
             }
 #endif
@@ -197,12 +198,12 @@ bool ProcessingInstruction::sheetLoaded()
     return false;
 }
 
-void ProcessingInstruction::setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet* sheet)
+void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet)
 {
 #if ENABLE(XSLT)
     ASSERT(!m_isXSL);
 #endif
-    RefPtr<CSSStyleSheet> newSheet = CSSStyleSheet::create(this, url, charset);
+    RefPtr<CSSStyleSheet> newSheet = CSSStyleSheet::create(this, href, baseURL, charset);
     m_sheet = newSheet;
     // We don't need the cross-origin security check here because we are
     // getting the sheet text in "strict" mode. This enforces a valid CSS MIME
@@ -214,10 +215,10 @@ void ProcessingInstruction::setCSSStyleSheet(const String& url, const String& ch
 }
 
 #if ENABLE(XSLT)
-void ProcessingInstruction::setXSLStyleSheet(const String& url, const String& sheet)
+void ProcessingInstruction::setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet)
 {
     ASSERT(m_isXSL);
-    m_sheet = XSLStyleSheet::create(this, url);
+    m_sheet = XSLStyleSheet::create(this, href, baseURL);
     parseStyleSheet(sheet);
 }
 #endif
diff --git a/WebCore/dom/ProcessingInstruction.h b/WebCore/dom/ProcessingInstruction.h
index 4b7dc86..fdb0ec9 100644
--- a/WebCore/dom/ProcessingInstruction.h
+++ b/WebCore/dom/ProcessingInstruction.h
@@ -68,9 +68,9 @@ private:
     virtual void removedFromDocument();
 
     void checkStyleSheet();
-    virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*);
+    virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*);
 #if ENABLE(XSLT)
-    virtual void setXSLStyleSheet(const String& url, const String& sheet);
+    virtual void setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet);
 #endif
 
     bool isLoading() const;
diff --git a/WebCore/dom/StyleElement.cpp b/WebCore/dom/StyleElement.cpp
index a21959d..f881179 100644
--- a/WebCore/dom/StyleElement.cpp
+++ b/WebCore/dom/StyleElement.cpp
@@ -103,7 +103,7 @@ void StyleElement::createSheet(Element* e, const String& text)
         if (screenEval.eval(mediaList.get()) || printEval.eval(mediaList.get())) {
             document->addPendingSheet();
             setLoading(true);
-            m_sheet = CSSStyleSheet::create(e, String(), document->inputEncoding());
+            m_sheet = CSSStyleSheet::create(e, String(), KURL(), document->inputEncoding());
             m_sheet->parseString(text, !document->inCompatMode());
             m_sheet->setMedia(mediaList.get());
             m_sheet->setTitle(e->title());
diff --git a/WebCore/html/HTMLLinkElement.cpp b/WebCore/html/HTMLLinkElement.cpp
index c89ddf4..88213d1 100644
--- a/WebCore/html/HTMLLinkElement.cpp
+++ b/WebCore/html/HTMLLinkElement.cpp
@@ -254,9 +254,9 @@ void HTMLLinkElement::finishParsingChildren()
     HTMLElement::finishParsingChildren();
 }
 
-void HTMLLinkElement::setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet* sheet)
+void HTMLLinkElement::setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet)
 {
-    m_sheet = CSSStyleSheet::create(this, url, charset);
+    m_sheet = CSSStyleSheet::create(this, href, baseURL, charset);
 
     bool strictParsing = !document()->inCompatMode();
     bool enforceMIMEType = strictParsing;
@@ -272,7 +272,7 @@ void HTMLLinkElement::setCSSStyleSheet(const String& url, const String& charset,
 #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD)
     if (enforceMIMEType && needsSiteSpecificQuirks) {
         // Covers both http and https, with or without "www."
-        if (url.contains("mcafee.com/japan/", false))
+        if (baseURL.string().contains("mcafee.com/japan/", false))
             enforceMIMEType = false;
     }
 #endif
@@ -285,11 +285,11 @@ void HTMLLinkElement::setCSSStyleSheet(const String& url, const String& charset,
     // valid CSS rule.
     // This prevents an attacker playing games by injecting CSS strings into
     // HTML, XML, JSON, etc. etc.
-    if (!document()->securityOrigin()->canRequest(KURL(ParsedURLString, url)))
+    if (!document()->securityOrigin()->canRequest(baseURL))
         crossOriginCSS = true;
 
     if (crossOriginCSS && !validMIMEType && !m_sheet->hasSyntacticallyValidCSSHeader())
-        m_sheet = CSSStyleSheet::create(this, url, charset);
+        m_sheet = CSSStyleSheet::create(this, href, baseURL, charset);
 
     if (strictParsing && needsSiteSpecificQuirks) {
         // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>.
@@ -297,7 +297,7 @@ void HTMLLinkElement::setCSSStyleSheet(const String& url, const String& charset,
         DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n"));
         // There are two variants of KHTMLFixes.css. One is equal to mediaWikiKHTMLFixesStyleSheet,
         // while the other lacks the second trailing newline.
-        if (url.endsWith(slashKHTMLFixesDotCss) && !sheetText.isNull() && mediaWikiKHTMLFixesStyleSheet.startsWith(sheetText)
+        if (baseURL.string().endsWith(slashKHTMLFixesDotCss) && !sheetText.isNull() && mediaWikiKHTMLFixesStyleSheet.startsWith(sheetText)
                 && sheetText.length() >= mediaWikiKHTMLFixesStyleSheet.length() - 1) {
             ASSERT(m_sheet->length() == 1);
             ExceptionCode ec;
diff --git a/WebCore/html/HTMLLinkElement.h b/WebCore/html/HTMLLinkElement.h
index aacac92..5d4e2dc 100644
--- a/WebCore/html/HTMLLinkElement.h
+++ b/WebCore/html/HTMLLinkElement.h
@@ -79,7 +79,7 @@ public:
     virtual void removedFromDocument();
 
     // from CachedResourceClient
-    virtual void setCSSStyleSheet(const String &url, const String& charset, const CachedCSSStyleSheet* sheet);
+    virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet);
     bool isLoading() const;
     virtual bool sheetLoaded();
 
diff --git a/WebCore/loader/CachedCSSStyleSheet.cpp b/WebCore/loader/CachedCSSStyleSheet.cpp
index 82b3551..b2e03b9 100644
--- a/WebCore/loader/CachedCSSStyleSheet.cpp
+++ b/WebCore/loader/CachedCSSStyleSheet.cpp
@@ -52,9 +52,9 @@ CachedCSSStyleSheet::~CachedCSSStyleSheet()
 void CachedCSSStyleSheet::didAddClient(CachedResourceClient *c)
 {
     if (!m_loading)
-        c->setCSSStyleSheet(m_url, m_decoder->encoding().name(), this);
+        c->setCSSStyleSheet(m_url, m_response.url(), m_decoder->encoding().name(), this);
 }
-    
+
 void CachedCSSStyleSheet::allClientsRemoved()
 {
     if (isSafeToMakePurgeable())
@@ -112,7 +112,7 @@ void CachedCSSStyleSheet::checkNotify()
 
     CachedResourceClientWalker w(m_clients);
     while (CachedResourceClient *c = w.next())
-        c->setCSSStyleSheet(m_response.url().string(), m_decoder->encoding().name(), this);
+        c->setCSSStyleSheet(m_url, m_response.url(), m_decoder->encoding().name(), this);
 }
 
 void CachedCSSStyleSheet::error()
diff --git a/WebCore/loader/CachedResourceClient.h b/WebCore/loader/CachedResourceClient.h
index dd9bb94..be3f87e 100644
--- a/WebCore/loader/CachedResourceClient.h
+++ b/WebCore/loader/CachedResourceClient.h
@@ -42,6 +42,7 @@ namespace WebCore {
     class String;
     class Image;
     class IntRect;
+    class KURL;
 
     /**
      * @internal
@@ -65,8 +66,8 @@ namespace WebCore {
         // e.g., in the b/f cache or in a background tab).
         virtual bool willRenderImage(CachedImage*) { return false; }
 
-        virtual void setCSSStyleSheet(const String& /*URL*/, const String& /*charset*/, const CachedCSSStyleSheet*) { }
-        virtual void setXSLStyleSheet(const String& /*URL*/, const String& /*sheet*/) { }
+        virtual void setCSSStyleSheet(const String& /* href */, const KURL& /* baseURL */, const String& /* charset */, const CachedCSSStyleSheet*) { }
+        virtual void setXSLStyleSheet(const String& /* href */, const KURL& /* baseURL */, const String& /* sheet */) { }
 
         virtual void fontLoaded(CachedFont*) {};
 
diff --git a/WebCore/loader/CachedXSLStyleSheet.cpp b/WebCore/loader/CachedXSLStyleSheet.cpp
index 5da0abf..59c3907 100644
--- a/WebCore/loader/CachedXSLStyleSheet.cpp
+++ b/WebCore/loader/CachedXSLStyleSheet.cpp
@@ -48,7 +48,7 @@ CachedXSLStyleSheet::CachedXSLStyleSheet(const String &url)
 void CachedXSLStyleSheet::didAddClient(CachedResourceClient* c)
 {  
     if (!m_loading)
-        c->setXSLStyleSheet(m_url, m_sheet);
+        c->setXSLStyleSheet(m_url, m_response.url(), m_sheet);
 }
 
 void CachedXSLStyleSheet::setEncoding(const String& chs)
@@ -83,10 +83,9 @@ void CachedXSLStyleSheet::checkNotify()
     
     CachedResourceClientWalker w(m_clients);
     while (CachedResourceClient *c = w.next())
-        c->setXSLStyleSheet(m_url, m_sheet);
+        c->setXSLStyleSheet(m_url, m_response.url(), m_sheet);
 }
 
-
 void CachedXSLStyleSheet::error()
 {
     m_loading = false;
diff --git a/WebCore/xml/XSLImportRule.cpp b/WebCore/xml/XSLImportRule.cpp
index b697c0d..c0f6363 100644
--- a/WebCore/xml/XSLImportRule.cpp
+++ b/WebCore/xml/XSLImportRule.cpp
@@ -52,13 +52,13 @@ XSLStyleSheet* XSLImportRule::parentStyleSheet() const
     return (parent() && parent()->isXSLStyleSheet()) ? static_cast<XSLStyleSheet*>(parent()) : 0;
 }
 
-void XSLImportRule::setXSLStyleSheet(const String& url, const String& sheet)
+void XSLImportRule::setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet)
 {
     if (m_styleSheet)
         m_styleSheet->setParent(0);
-    
-    m_styleSheet = XSLStyleSheet::create(this, url);
-    
+
+    m_styleSheet = XSLStyleSheet::create(this, href, baseURL);
+
     XSLStyleSheet* parent = parentStyleSheet();
     if (parent)
         m_styleSheet->setParentStyleSheet(parent);
@@ -87,14 +87,14 @@ void XSLImportRule::loadSheet()
     
     String absHref = m_strHref;
     XSLStyleSheet* parentSheet = parentStyleSheet();
-    if (!parentSheet->href().isNull())
+    if (!parentSheet->putativeBaseURL().isNull())
         // use parent styleheet's URL as the base URL
-        absHref = KURL(KURL(ParsedURLString, parentSheet->href()), m_strHref).string();
+        absHref = KURL(parentSheet->putativeBaseURL(), m_strHref).string();
     
     // Check for a cycle in our import chain.  If we encounter a stylesheet
     // in our parent chain with the same URL, then just bail.
     for (parent = this->parent(); parent; parent = parent->parent()) {
-        if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)->href())
+        if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)->putativeBaseURL().string())
             return;
     }
     
diff --git a/WebCore/xml/XSLImportRule.h b/WebCore/xml/XSLImportRule.h
index fc7a7f8..f3a9318 100644
--- a/WebCore/xml/XSLImportRule.h
+++ b/WebCore/xml/XSLImportRule.h
@@ -57,7 +57,7 @@ private:
     virtual bool isImportRule() { return true; }
 
     // from CachedResourceClient
-    virtual void setXSLStyleSheet(const String& url, const String& sheet);
+    virtual void setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet);
     
     String m_strHref;
     RefPtr<XSLStyleSheet> m_styleSheet;
diff --git a/WebCore/xml/XSLStyleSheet.h b/WebCore/xml/XSLStyleSheet.h
index c9729bb..b3861a0 100644
--- a/WebCore/xml/XSLStyleSheet.h
+++ b/WebCore/xml/XSLStyleSheet.h
@@ -43,18 +43,18 @@ class XSLImportRule;
 class XSLStyleSheet : public StyleSheet {
 public:
 #if !USE(QXMLQUERY)
-    static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& href)
+    static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& href, const KURL& baseURL)
     {
-        return adoptRef(new XSLStyleSheet(parentImport, href));
+        return adoptRef(new XSLStyleSheet(parentImport, href, baseURL));
     }
 #endif
-    static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& href)
+    static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& href, const KURL& baseURL)
     {
-        return adoptRef(new XSLStyleSheet(parentNode, href, false));
+        return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, false));
     }
-    static PassRefPtr<XSLStyleSheet> createEmbedded(Node* parentNode, const String& href)
+    static PassRefPtr<XSLStyleSheet> createEmbedded(Node* parentNode, const String& href, const KURL& baseURL)
     {
-        return adoptRef(new XSLStyleSheet(parentNode, href, true));
+        return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, true));
     }
 
     virtual ~XSLStyleSheet();
@@ -90,9 +90,9 @@ public:
     bool processed() const { return m_processed; }
 
 private:
-    XSLStyleSheet(Node* parentNode, const String& href, bool embedded);
+    XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded);
 #if !USE(QXMLQUERY)
-    XSLStyleSheet(XSLImportRule* parentImport, const String& href);
+    XSLStyleSheet(XSLImportRule* parentImport, const String& href, const KURL& baseURL);
 #endif
 
     Document* m_ownerDocument;
diff --git a/WebCore/xml/XSLStyleSheetLibxslt.cpp b/WebCore/xml/XSLStyleSheetLibxslt.cpp
index 2ae8b82..4122aa1 100644
--- a/WebCore/xml/XSLStyleSheetLibxslt.cpp
+++ b/WebCore/xml/XSLStyleSheetLibxslt.cpp
@@ -55,8 +55,8 @@ SOFT_LINK(libxslt, xsltLoadStylesheetPI, xsltStylesheetPtr, (xmlDocPtr doc), (do
 
 namespace WebCore {
 
-XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href)
-    : StyleSheet(parentRule, href)
+XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href, const KURL& baseURL)
+    : StyleSheet(parentRule, href, baseURL)
     , m_ownerDocument(0)
     , m_embedded(false)
     , m_processed(false) // Child sheets get marked as processed when the libxslt engine has finally seen them.
@@ -66,8 +66,8 @@ XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href)
 {
 }
 
-XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href,  bool embedded)
-    : StyleSheet(parentNode, href)
+XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL,  bool embedded)
+    : StyleSheet(parentNode, href, baseURL)
     , m_ownerDocument(parentNode->document())
     , m_embedded(embedded)
     , m_processed(true) // The root sheet starts off processed.
@@ -168,7 +168,7 @@ bool XSLStyleSheet::parseString(const String& string, bool)
     }
 
     m_stylesheetDoc = xmlCtxtReadMemory(ctxt, buffer, size,
-        href().utf8().data(),
+        putativeBaseURL().string().utf8().data(),
         BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE",
         XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA);
     xmlFreeParserCtxt(ctxt);
@@ -192,7 +192,7 @@ void XSLStyleSheet::loadChildSheets()
     if (m_embedded) {
         // We have to locate (by ID) the appropriate embedded stylesheet element, so that we can walk the
         // import/include list.
-        xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)(href().utf8().data()));
+        xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)(putativeBaseURL().string().utf8().data()));
         if (!idNode)
             return;
         stylesheetRoot = idNode->parent;
diff --git a/WebCore/xml/XSLStyleSheetQt.cpp b/WebCore/xml/XSLStyleSheetQt.cpp
index 6d27e20..4151be4 100644
--- a/WebCore/xml/XSLStyleSheetQt.cpp
+++ b/WebCore/xml/XSLStyleSheetQt.cpp
@@ -33,8 +33,8 @@
 
 namespace WebCore {
 
-XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href,  bool embedded)
-    : StyleSheet(parentNode, href)
+XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL,  bool embedded)
+    : StyleSheet(parentNode, href, baseURL)
     , m_ownerDocument(parentNode->document())
     , m_embedded(embedded)
 {
diff --git a/WebCore/xml/XSLTProcessorLibxslt.cpp b/WebCore/xml/XSLTProcessorLibxslt.cpp
index 200c56b..ded5c68 100644
--- a/WebCore/xml/XSLTProcessorLibxslt.cpp
+++ b/WebCore/xml/XSLTProcessorLibxslt.cpp
@@ -226,7 +226,8 @@ static xsltStylesheetPtr xsltStylesheetPointer(RefPtr<XSLStyleSheet>& cachedStyl
 {
     if (!cachedStylesheet && stylesheetRootNode) {
         cachedStylesheet = XSLStyleSheet::create(stylesheetRootNode->parent() ? stylesheetRootNode->parent() : stylesheetRootNode,
-            stylesheetRootNode->document()->url().string());
+            stylesheetRootNode->document()->url().string(),
+            stylesheetRootNode->document()->url()); // FIXME: Should we use baseURL here?
         cachedStylesheet->parseString(createMarkup(stylesheetRootNode));
     }
 
diff --git a/WebCore/xml/XSLTProcessorQt.cpp b/WebCore/xml/XSLTProcessorQt.cpp
index 3e05ca0..9ac3f5d 100644
--- a/WebCore/xml/XSLTProcessorQt.cpp
+++ b/WebCore/xml/XSLTProcessorQt.cpp
@@ -120,7 +120,9 @@ bool XSLTProcessor::transformToString(Node* sourceNode, String&, String& resultS
     RefPtr<XSLStyleSheet> stylesheet = m_stylesheet;
     if (!stylesheet && m_stylesheetRootNode) {
         Node* node = m_stylesheetRootNode.get();
-        stylesheet = XSLStyleSheet::create(node->parent() ? node->parent() : node, node->document()->url().string());
+        stylesheet = XSLStyleSheet::create(node->parent() ? node->parent() : node,
+            node->document()->url().string(),
+            node->document()->url()); // FIXME: Should we use baseURL here?
         stylesheet->parseString(createMarkup(node));
     }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list