[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

hyatt at apple.com hyatt at apple.com
Thu Oct 29 20:34:30 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 1cfc800e1ae520f8b0c51cd351ac7953f6abfa29
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 25 22:24:45 2009 +0000

    https://bugs.webkit.org/show_bug.cgi?id=24399
    Make @import work in user stylesheets.  The first bug was that the URL wasn't being set on the
    user sheets themselves, so relative @import URLs couldn't resolve properly.  The second bug
    was that the loads would be denied.  This is fixed by using the requestUserCSSStyleSheet method
    instead of the normal request method.  In order to know when to do this, CSSStyleSheets now have
    a propagated boolean, m_isUserStyleSheet, that lets them know if they are user stylesheets or not.
    
    Reviewed by Anders Carlsson.
    
    * css/CSSImportRule.cpp:
    (WebCore::CSSImportRule::insertedIntoParent):
    * css/CSSStyleSheet.cpp:
    (WebCore::CSSStyleSheet::CSSStyleSheet):
    * css/CSSStyleSheet.h:
    (WebCore::CSSStyleSheet::setIsUserStyleSheet):
    (WebCore::CSSStyleSheet::isUserStyleSheet):
    * dom/Document.cpp:
    (WebCore::Document::pageUserSheet):
    (WebCore::Document::pageGroupUserSheets):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48773 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 407cc6b..e82f7b3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2009-09-25  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        https://bugs.webkit.org/show_bug.cgi?id=24399
+        Make @import work in user stylesheets.  The first bug was that the URL wasn't being set on the
+        user sheets themselves, so relative @import URLs couldn't resolve properly.  The second bug
+        was that the loads would be denied.  This is fixed by using the requestUserCSSStyleSheet method
+        instead of the normal request method.  In order to know when to do this, CSSStyleSheets now have
+        a propagated boolean, m_isUserStyleSheet, that lets them know if they are user stylesheets or not.
+
+        * css/CSSImportRule.cpp:
+        (WebCore::CSSImportRule::insertedIntoParent):
+        * css/CSSStyleSheet.cpp:
+        (WebCore::CSSStyleSheet::CSSStyleSheet):
+        * css/CSSStyleSheet.h:
+        (WebCore::CSSStyleSheet::setIsUserStyleSheet):
+        (WebCore::CSSStyleSheet::isUserStyleSheet):
+        * dom/Document.cpp:
+        (WebCore::Document::pageUserSheet):
+        (WebCore::Document::pageGroupUserSheets):
+
 2009-09-25  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/css/CSSImportRule.cpp b/WebCore/css/CSSImportRule.cpp
index 9dafba9..6e62f6d 100644
--- a/WebCore/css/CSSImportRule.cpp
+++ b/WebCore/css/CSSImportRule.cpp
@@ -111,7 +111,10 @@ void CSSImportRule::insertedIntoParent()
         root = curr;
     }
 
-    m_cachedSheet = docLoader->requestCSSStyleSheet(absHref, parentSheet->charset());
+    if (parentSheet->isUserStyleSheet())
+        m_cachedSheet = docLoader->requestUserCSSStyleSheet(absHref, parentSheet->charset());
+    else
+        m_cachedSheet = docLoader->requestCSSStyleSheet(absHref, parentSheet->charset());
     if (m_cachedSheet) {
         // if the import rule is issued dynamically, the sheet may be
         // removed from the pending sheet count, so let the doc know
diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp
index ce50af6..1579999 100644
--- a/WebCore/css/CSSStyleSheet.cpp
+++ b/WebCore/css/CSSStyleSheet.cpp
@@ -40,20 +40,22 @@ CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, con
     , m_charset(charset)
     , m_loadCompleted(false)
     , m_strictParsing(!parentSheet || parentSheet->useStrictParsing())
+    , m_isUserStyleSheet(parentSheet ? parentSheet->isUserStyleSheet() : false)
 {
 }
 
-CSSStyleSheet::CSSStyleSheet(Node *parentNode, const String& href, const String& charset)
+CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const String& charset)
     : StyleSheet(parentNode, href)
     , m_doc(parentNode->document())
     , m_namespaces(0)
     , m_charset(charset)
     , m_loadCompleted(false)
     , m_strictParsing(false)
+    , m_isUserStyleSheet(false)
 {
 }
 
-CSSStyleSheet::CSSStyleSheet(CSSRule *ownerRule, const String& href, const String& charset)
+CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const String& charset)
     : StyleSheet(ownerRule, href)
     , m_namespaces(0)
     , m_charset(charset)
@@ -62,6 +64,7 @@ CSSStyleSheet::CSSStyleSheet(CSSRule *ownerRule, const String& href, const Strin
 {
     CSSStyleSheet* parentSheet = ownerRule ? ownerRule->parentStyleSheet() : 0;
     m_doc = parentSheet ? parentSheet->doc() : 0;
+    m_isUserStyleSheet = parentSheet ? parentSheet->isUserStyleSheet() : false;
 }
 
 CSSStyleSheet::~CSSStyleSheet()
diff --git a/WebCore/css/CSSStyleSheet.h b/WebCore/css/CSSStyleSheet.h
index 8646ee9..f534104 100644
--- a/WebCore/css/CSSStyleSheet.h
+++ b/WebCore/css/CSSStyleSheet.h
@@ -93,6 +93,9 @@ public:
     void setStrictParsing(bool b) { m_strictParsing = b; }
     bool useStrictParsing() const { return m_strictParsing; }
 
+    void setIsUserStyleSheet(bool b) { m_isUserStyleSheet = b; }
+    bool isUserStyleSheet() const { return m_isUserStyleSheet; }
+
 private:
     CSSStyleSheet(Node* ownerNode, const String& href, const String& charset);
     CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const String& charset);
@@ -106,6 +109,7 @@ private:
     String m_charset;
     bool m_loadCompleted : 1;
     bool m_strictParsing : 1;
+    bool m_isUserStyleSheet : 1;
 };
 
 } // namespace
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 40132b8..174c0ee 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -1941,7 +1941,8 @@ CSSStyleSheet* Document::pageUserSheet()
         return 0;
     
     // Parse the sheet and cache it.
-    m_pageUserSheet = CSSStyleSheet::create(this);
+    m_pageUserSheet = CSSStyleSheet::create(this, settings()->userStyleSheetLocation());
+    m_pageUserSheet->setIsUserStyleSheet(true);
     m_pageUserSheet->parseString(userSheetText, !inCompatMode());
     return m_pageUserSheet.get();
 }
@@ -1973,7 +1974,8 @@ const Vector<RefPtr<CSSStyleSheet> >* Document::pageGroupUserSheets() const
         const UserStyleSheetVector* sheets = it->second;
         for (unsigned i = 0; i < sheets->size(); ++i) {
             const UserStyleSheet* sheet = sheets->at(i).get();
-            RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::create(const_cast<Document*>(this));
+            RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::create(const_cast<Document*>(this), sheet->url());
+            parsedSheet->setIsUserStyleSheet(true);
             parsedSheet->parseString(sheet->source(), !inCompatMode());
             if (!m_pageGroupUserSheets)
                 m_pageGroupUserSheets.set(new Vector<RefPtr<CSSStyleSheet> >);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list