[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:26:30 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 84d4035d01f0e1018e5435f9a8deb0ef45abf2f8
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jul 23 17:54:47 2002 +0000

    	The STYLE element was ignoring both the media and type
    	attributes (unlike its cousin, the LINK element).  This
    	patch implements support for media and type and further
    	stops us from loading stylesheets that we should have no
    	business parsing.
    
            * khtml/html/html_headimpl.cpp:
            (HTMLLinkElementImpl::process):
            (HTMLStyleElementImpl::parseAttribute):
            (HTMLStyleElementImpl::insertedIntoDocument):
            (HTMLStyleElementImpl::removedFromDocument):
            (HTMLStyleElementImpl::childrenChanged):
            (HTMLStyleElementImpl::sheetLoaded):
            * khtml/html/html_headimpl.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1637 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 6cc8617..a0aef11 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,20 @@
+2002-07-23  David Hyatt  <hyatt at apple.com>
+
+	The STYLE element was ignoring both the media and type
+	attributes (unlike its cousin, the LINK element).  This
+	patch implements support for media and type and further
+	stops us from loading stylesheets that we should have no
+	business parsing.
+	
+        * khtml/html/html_headimpl.cpp:
+        (HTMLLinkElementImpl::process):
+        (HTMLStyleElementImpl::parseAttribute):
+        (HTMLStyleElementImpl::insertedIntoDocument):
+        (HTMLStyleElementImpl::removedFromDocument):
+        (HTMLStyleElementImpl::childrenChanged):
+        (HTMLStyleElementImpl::sheetLoaded):
+        * khtml/html/html_headimpl.h:
+
 === Alexander-14 ===
 
 2002-07-23  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 6cc8617..a0aef11 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,20 @@
+2002-07-23  David Hyatt  <hyatt at apple.com>
+
+	The STYLE element was ignoring both the media and type
+	attributes (unlike its cousin, the LINK element).  This
+	patch implements support for media and type and further
+	stops us from loading stylesheets that we should have no
+	business parsing.
+	
+        * khtml/html/html_headimpl.cpp:
+        (HTMLLinkElementImpl::process):
+        (HTMLStyleElementImpl::parseAttribute):
+        (HTMLStyleElementImpl::insertedIntoDocument):
+        (HTMLStyleElementImpl::removedFromDocument):
+        (HTMLStyleElementImpl::childrenChanged):
+        (HTMLStyleElementImpl::sheetLoaded):
+        * khtml/html/html_headimpl.h:
+
 === Alexander-14 ===
 
 2002-07-23  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 6cc8617..a0aef11 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2002-07-23  David Hyatt  <hyatt at apple.com>
+
+	The STYLE element was ignoring both the media and type
+	attributes (unlike its cousin, the LINK element).  This
+	patch implements support for media and type and further
+	stops us from loading stylesheets that we should have no
+	business parsing.
+	
+        * khtml/html/html_headimpl.cpp:
+        (HTMLLinkElementImpl::process):
+        (HTMLStyleElementImpl::parseAttribute):
+        (HTMLStyleElementImpl::insertedIntoDocument):
+        (HTMLStyleElementImpl::removedFromDocument):
+        (HTMLStyleElementImpl::childrenChanged):
+        (HTMLStyleElementImpl::sheetLoaded):
+        * khtml/html/html_headimpl.h:
+
 === Alexander-14 ===
 
 2002-07-23  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/khtml/html/html_headimpl.cpp b/WebCore/khtml/html/html_headimpl.cpp
index 58e359d..8e73449 100644
--- a/WebCore/khtml/html/html_headimpl.cpp
+++ b/WebCore/khtml/html/html_headimpl.cpp
@@ -180,7 +180,7 @@ void HTMLLinkElementImpl::process()
 #endif
 
     // Stylesheet
-    // This was buggy and would incorrectly match <link rel="alternate">, which has a different specified meaning.
+    // This was buggy and would incorrectly match <link rel="alternate">, which has a different specified meaning. -dwh
     if(type.contains("text/css") || rel == "stylesheet" || (rel.contains("alternate") && rel.contains("stylesheet"))) {
         // no need to load style sheets which aren't for the screen output
         // ### there may be in some situations e.g. for an editor or script to manipulate
@@ -347,8 +347,11 @@ void HTMLStyleElementImpl::parseAttribute(AttributeImpl *attr)
     switch (attr->id())
     {
     case ATTR_TYPE:
+        m_type = attr->value();
+        break;
     case ATTR_MEDIA:
-	break;
+        m_media = attr->value().string().lower();
+        break;
     default:
         HTMLElementImpl::parseAttribute(attr);
     }
@@ -357,13 +360,15 @@ void HTMLStyleElementImpl::parseAttribute(AttributeImpl *attr)
 void HTMLStyleElementImpl::insertedIntoDocument()
 {
     HTMLElementImpl::insertedIntoDocument();
-    getDocument()->updateStyleSelector();
+    if (m_sheet)
+        getDocument()->updateStyleSelector();
 }
 
 void HTMLStyleElementImpl::removedFromDocument()
 {
     HTMLElementImpl::removedFromDocument();
-    getDocument()->updateStyleSelector();
+    if (m_sheet)
+        getDocument()->updateStyleSelector();
 }
 
 void HTMLStyleElementImpl::childrenChanged()
@@ -377,11 +382,18 @@ void HTMLStyleElementImpl::childrenChanged()
 	    text += c->nodeValue();
     }
 
-    if(m_sheet)
-	m_sheet->deref();
-    m_sheet = new CSSStyleSheetImpl(this);
-    m_sheet->ref();
-    m_sheet->parseString( text, (getDocument()->parseMode() == DocumentImpl::Strict) );
+    if (m_sheet) {
+        m_sheet->deref();
+        m_sheet = 0;
+    }
+    
+    if ((m_type.isEmpty() || m_type == "text/css") // Type must be empty or CSS
+         && (m_media.isNull() || m_media.contains("screen") || m_media.contains("all") || m_media.contains("print"))) {
+        m_sheet = new CSSStyleSheetImpl(this);
+        m_sheet->ref();
+        m_sheet->parseString( text, (getDocument()->parseMode() == DocumentImpl::Strict) );
+    }
+    
     getDocument()->updateStyleSelector();
 }
 
@@ -393,7 +405,8 @@ bool HTMLStyleElementImpl::isLoading() const
 
 void HTMLStyleElementImpl::sheetLoaded()
 {
-  getDocument()->updateStyleSelector();
+    if (m_sheet)
+        getDocument()->updateStyleSelector();
 }
 
 // -------------------------------------------------------------------------
diff --git a/WebCore/khtml/html/html_headimpl.h b/WebCore/khtml/html/html_headimpl.h
index 94c07ce..6281e16 100644
--- a/WebCore/khtml/html/html_headimpl.h
+++ b/WebCore/khtml/html/html_headimpl.h
@@ -156,6 +156,8 @@ public:
 
 protected:
     StyleSheetImpl *m_sheet;
+    DOMString m_type;
+    QString m_media;
 };
 
 // -------------------------------------------------------------------------

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list