[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:20 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit fe02632106bd6cc2e4801ddab59f6666771cb411
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jul 22 22:30:34 2002 +0000

    	This checkin adds support for querying the selected style set,
    	for querying the preferred style set, and for changing the
    	selected style set dynamically.  With this checkin, a Web page
    	in Alexander now has the capability to present its own alternate
    	stylesheet UI in the page and to toggle between sets using script.
    
            * khtml/dom/css_stylesheet.cpp:
            (DocumentStyle::preferredStylesheetSet):
            (DocumentStyle::setSelectedStylesheetSet):
            (DocumentStyle::selectedStylesheetSet):
            * khtml/dom/css_stylesheet.h:
    	Added new methods to the DocumentStyle interface as per Hixie's
    	proposed spec.
    
            * khtml/dom/dom_doc.cpp:
            * khtml/dom/dom_doc.h:
            * khtml/ecma/kjs_dom.cpp:
            (DOMDocument::getValueProperty):
            (DOMDocument::tryPut):
            (DOMDocument::putValue):
            * khtml/ecma/kjs_dom.h:
    	Implement the JS binding glue for the new properties.
    
            * khtml/xml/dom_docimpl.cpp:
            (DocumentImpl::processHttpEquiv):
            (DocumentImpl::preferredStylesheetSet):
            (DocumentImpl::selectedStylesheetSet):
            (DocumentImpl::setSelectedStylesheetSet):
            (DocumentImpl::recalcStyleSelector):
            * khtml/xml/dom_docimpl.h:
    	The implementation of the new properties.  Also fixed a bug
    	caused by the 3.02 merge in the stylesheet filtering code in
    	recalcStyleSelector.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1630 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 9a9fdd9..38d6f22 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,39 @@
+2002-07-22  David Hyatt  <hyatt at apple.com>
+
+	This checkin adds support for querying the selected style set,
+	for querying the preferred style set, and for changing the
+	selected style set dynamically.  With this checkin, a Web page
+	in Alexander now has the capability to present its own alternate
+	stylesheet UI in the page and to toggle between sets using script.
+	
+        * khtml/dom/css_stylesheet.cpp:
+        (DocumentStyle::preferredStylesheetSet):
+        (DocumentStyle::setSelectedStylesheetSet):
+        (DocumentStyle::selectedStylesheetSet):
+        * khtml/dom/css_stylesheet.h:
+	Added new methods to the DocumentStyle interface as per Hixie's
+	proposed spec.
+	
+        * khtml/dom/dom_doc.cpp:
+        * khtml/dom/dom_doc.h:
+        * khtml/ecma/kjs_dom.cpp:
+        (DOMDocument::getValueProperty):
+        (DOMDocument::tryPut):
+        (DOMDocument::putValue):
+        * khtml/ecma/kjs_dom.h:
+	Implement the JS binding glue for the new properties.
+	
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::processHttpEquiv):
+        (DocumentImpl::preferredStylesheetSet):
+        (DocumentImpl::selectedStylesheetSet):
+        (DocumentImpl::setSelectedStylesheetSet):
+        (DocumentImpl::recalcStyleSelector):
+        * khtml/xml/dom_docimpl.h:
+	The implementation of the new properties.  Also fixed a bug
+	caused by the 3.02 merge in the stylesheet filtering code in
+	recalcStyleSelector.
+	
 2002-07-22  Maciej Stachowiak  <mjs at apple.com>
 
         Merged WebCoreBridge and WebCoreFrameBridge.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 9a9fdd9..38d6f22 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,39 @@
+2002-07-22  David Hyatt  <hyatt at apple.com>
+
+	This checkin adds support for querying the selected style set,
+	for querying the preferred style set, and for changing the
+	selected style set dynamically.  With this checkin, a Web page
+	in Alexander now has the capability to present its own alternate
+	stylesheet UI in the page and to toggle between sets using script.
+	
+        * khtml/dom/css_stylesheet.cpp:
+        (DocumentStyle::preferredStylesheetSet):
+        (DocumentStyle::setSelectedStylesheetSet):
+        (DocumentStyle::selectedStylesheetSet):
+        * khtml/dom/css_stylesheet.h:
+	Added new methods to the DocumentStyle interface as per Hixie's
+	proposed spec.
+	
+        * khtml/dom/dom_doc.cpp:
+        * khtml/dom/dom_doc.h:
+        * khtml/ecma/kjs_dom.cpp:
+        (DOMDocument::getValueProperty):
+        (DOMDocument::tryPut):
+        (DOMDocument::putValue):
+        * khtml/ecma/kjs_dom.h:
+	Implement the JS binding glue for the new properties.
+	
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::processHttpEquiv):
+        (DocumentImpl::preferredStylesheetSet):
+        (DocumentImpl::selectedStylesheetSet):
+        (DocumentImpl::setSelectedStylesheetSet):
+        (DocumentImpl::recalcStyleSelector):
+        * khtml/xml/dom_docimpl.h:
+	The implementation of the new properties.  Also fixed a bug
+	caused by the 3.02 merge in the stylesheet filtering code in
+	recalcStyleSelector.
+	
 2002-07-22  Maciej Stachowiak  <mjs at apple.com>
 
         Merged WebCoreBridge and WebCoreFrameBridge.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 9a9fdd9..38d6f22 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,39 @@
+2002-07-22  David Hyatt  <hyatt at apple.com>
+
+	This checkin adds support for querying the selected style set,
+	for querying the preferred style set, and for changing the
+	selected style set dynamically.  With this checkin, a Web page
+	in Alexander now has the capability to present its own alternate
+	stylesheet UI in the page and to toggle between sets using script.
+	
+        * khtml/dom/css_stylesheet.cpp:
+        (DocumentStyle::preferredStylesheetSet):
+        (DocumentStyle::setSelectedStylesheetSet):
+        (DocumentStyle::selectedStylesheetSet):
+        * khtml/dom/css_stylesheet.h:
+	Added new methods to the DocumentStyle interface as per Hixie's
+	proposed spec.
+	
+        * khtml/dom/dom_doc.cpp:
+        * khtml/dom/dom_doc.h:
+        * khtml/ecma/kjs_dom.cpp:
+        (DOMDocument::getValueProperty):
+        (DOMDocument::tryPut):
+        (DOMDocument::putValue):
+        * khtml/ecma/kjs_dom.h:
+	Implement the JS binding glue for the new properties.
+	
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::processHttpEquiv):
+        (DocumentImpl::preferredStylesheetSet):
+        (DocumentImpl::selectedStylesheetSet):
+        (DocumentImpl::setSelectedStylesheetSet):
+        (DocumentImpl::recalcStyleSelector):
+        * khtml/xml/dom_docimpl.h:
+	The implementation of the new properties.  Also fixed a bug
+	caused by the 3.02 merge in the stylesheet filtering code in
+	recalcStyleSelector.
+	
 2002-07-22  Maciej Stachowiak  <mjs at apple.com>
 
         Merged WebCoreBridge and WebCoreFrameBridge.
diff --git a/WebCore/khtml/dom/css_stylesheet.cpp b/WebCore/khtml/dom/css_stylesheet.cpp
index 48d7a9b..fa1c1b5 100644
--- a/WebCore/khtml/dom/css_stylesheet.cpp
+++ b/WebCore/khtml/dom/css_stylesheet.cpp
@@ -446,6 +446,21 @@ StyleSheetList DocumentStyle::styleSheets()
     return doc->styleSheets();
 }
 
+DOMString DocumentStyle::preferredStylesheetSet()
+{
+    return doc->preferredStylesheetSet();
+}
+
+void DocumentStyle::setSelectedStylesheetSet(const DOMString& aStr)
+{
+    return doc->setSelectedStylesheetSet(aStr);
+}
+
+DOMString DocumentStyle::selectedStylesheetSet()
+{
+    return doc->selectedStylesheetSet();
+}
+
 bool DocumentStyle::isNull() const
 {
     return (doc == 0);
diff --git a/WebCore/khtml/dom/css_stylesheet.h b/WebCore/khtml/dom/css_stylesheet.h
index 25f731c..e64f8a5 100644
--- a/WebCore/khtml/dom/css_stylesheet.h
+++ b/WebCore/khtml/dom/css_stylesheet.h
@@ -479,6 +479,10 @@ public:
 
     StyleSheetList styleSheets();
 
+    DOMString preferredStylesheetSet();
+    DOMString selectedStylesheetSet();
+    void setSelectedStylesheetSet(const DOMString& aString);
+
     bool isNull() const;
 
 protected:
diff --git a/WebCore/khtml/dom/dom_doc.cpp b/WebCore/khtml/dom/dom_doc.cpp
index 9ea71dc..2667811 100644
--- a/WebCore/khtml/dom/dom_doc.cpp
+++ b/WebCore/khtml/dom/dom_doc.cpp
@@ -398,6 +398,29 @@ StyleSheetList Document::styleSheets() const
     return ((DocumentImpl *)impl)->styleSheets();
 }
 
+DOMString Document::preferredStylesheetSet()
+{
+    if (!impl)
+        throw DOMException(DOMException::INVALID_STATE_ERR);
+
+    return ((DocumentImpl*)impl)->preferredStylesheetSet();
+}
+
+DOMString Document::selectedStylesheetSet()
+{
+    if (!impl)
+        throw DOMException(DOMException::INVALID_STATE_ERR);
+
+    return ((DocumentImpl*)impl)->selectedStylesheetSet();
+}
+
+void Document::setSelectedStylesheetSet(const DOMString& aString)
+{
+    if (!impl)
+        throw DOMException(DOMException::INVALID_STATE_ERR);
+
+    return ((DocumentImpl*)impl)->setSelectedStylesheetSet(aString);
+}
 
 KHTMLView *Document::view() const
 {
diff --git a/WebCore/khtml/dom/dom_doc.h b/WebCore/khtml/dom/dom_doc.h
index 9742e2e..1407527 100644
--- a/WebCore/khtml/dom/dom_doc.h
+++ b/WebCore/khtml/dom/dom_doc.h
@@ -742,6 +742,14 @@ public:
      */
     StyleSheetList styleSheets() const;
 
+    /* Newly proposed CSS3 mechanism for selecting alternate
+       stylesheets using the DOM. May be subject to change as
+       spec matures. - dwh
+    */
+    DOMString preferredStylesheetSet();
+    DOMString selectedStylesheetSet();
+    void setSelectedStylesheetSet(const DOMString& aString);
+
     /**
      * @return The KHTML view widget of this document.
      */
diff --git a/WebCore/khtml/ecma/kjs_dom.cpp b/WebCore/khtml/ecma/kjs_dom.cpp
index 8de61fd..0a820c8 100644
--- a/WebCore/khtml/ecma/kjs_dom.cpp
+++ b/WebCore/khtml/ecma/kjs_dom.cpp
@@ -679,6 +679,8 @@ const ClassInfo DOMDocument::info = { "Document", &DOMNode::info, &DOMDocumentTa
   implementation  DOMDocument::Implementation                  DontDelete|ReadOnly
   documentElement DOMDocument::DocumentElement                 DontDelete|ReadOnly
   styleSheets     DOMDocument::StyleSheets                     DontDelete|ReadOnly
+  preferredStylesheetSet  DOMDocument::PreferredStylesheetSet  DontDelete|ReadOnly
+  selectedStylesheetSet  DOMDocument::SelectedStylesheetSet    DontDelete
   readyState      DOMDocument::ReadyState                      DontDelete|ReadOnly
 @end
 */
@@ -712,6 +714,10 @@ Value DOMDocument::getValueProperty(ExecState *exec, int token) const
   case StyleSheets:
     //kdDebug() << "DOMDocument::StyleSheets, returning " << doc.styleSheets().length() << " stylesheets" << endl;
     return getDOMStyleSheetList(exec, doc.styleSheets(), doc);
+  case PreferredStylesheetSet:
+    return getString(doc.preferredStylesheetSet());
+  case SelectedStylesheetSet:
+    return getString(doc.selectedStylesheetSet());
   case ReadyState:
     {
     DOM::DocumentImpl* docimpl = node.handle()->getDocument();
@@ -734,6 +740,26 @@ Value DOMDocument::getValueProperty(ExecState *exec, int token) const
   }
 }
 
+void DOMDocument::tryPut(ExecState *exec, const UString& propertyName, const Value& value, int attr)
+{
+#ifdef KJS_VERBOSE
+  kdDebug(6070) << "DOMDocument::tryPut " << propertyName.qstring() << endl;
+#endif
+  DOMObjectLookupPut<DOMDocument,DOMObject>(exec, propertyName, value, attr,
+					    &DOMDocumentTable, this );
+}
+
+void DOMDocument::putValue(ExecState *exec, int token, const Value& value, int /*attr*/)
+{
+  DOM::Document doc = static_cast<DOM::Document>(node);
+  switch (token) {
+    case SelectedStylesheetSet: {
+      doc.setSelectedStylesheetSet(value.toString(exec).string());
+      break;
+    }
+  }
+}
+
 Value DOMDocumentProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
 {
   if (!thisObj.inherits(&KJS::DOMNode::info)) {
diff --git a/WebCore/khtml/ecma/kjs_dom.h b/WebCore/khtml/ecma/kjs_dom.h
index 269d2f3..4fa3b2b 100644
--- a/WebCore/khtml/ecma/kjs_dom.h
+++ b/WebCore/khtml/ecma/kjs_dom.h
@@ -106,6 +106,8 @@ namespace KJS {
     DOMDocument(Object proto, DOM::Document d);
     virtual Value tryGet(ExecState *exec, const UString &propertyName) const;
     Value getValueProperty(ExecState *exec, int token) const;
+    virtual void tryPut(ExecState *exec, const UString &propertyName, const Value& value, int attr = None);
+    void putValue(ExecState *exec, int token, const Value& value, int attr);
     virtual const ClassInfo* classInfo() const { return &info; }
     static const ClassInfo info;
     enum { DocType, Implementation, DocumentElement,
@@ -115,7 +117,8 @@ namespace KJS {
            CreateEntityReference, GetElementsByTagName, ImportNode, CreateElementNS,
            CreateAttributeNS, GetElementsByTagNameNS, GetElementById,
            CreateRange, CreateNodeIterator, CreateTreeWalker, DefaultView,
-           CreateEvent, StyleSheets, GetOverrideStyle, ReadyState };
+           CreateEvent, StyleSheets, PreferredStylesheetSet, 
+           SelectedStylesheetSet, GetOverrideStyle, ReadyState };
   };
 
   class DOMAttr : public DOMNode {
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index 394698e..2454d56 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -1397,6 +1397,7 @@ void DocumentImpl::processHttpEquiv(const DOMString &equiv, const DOMString &con
         // http://www.hixie.ch/tests/evil/css/import/main/preferred.html
         // -dwh
         v->part()->d->m_sheetUsed = content.string();
+        m_preferredStylesheetSet = content;
         updateStyleSelector();
     }
     else if(strcasecmp(equiv, "refresh") == 0 && v->part()->metaRefreshEnabled())
@@ -1744,6 +1745,27 @@ StyleSheetListImpl* DocumentImpl::styleSheets()
     return m_styleSheets;
 }
 
+DOMString 
+DocumentImpl::preferredStylesheetSet()
+{
+  return m_preferredStylesheetSet;
+}
+
+DOMString 
+DocumentImpl::selectedStylesheetSet()
+{
+  return view()->part()->d->m_sheetUsed;
+}
+
+void 
+DocumentImpl::setSelectedStylesheetSet(const DOMString& aString)
+{
+  view()->part()->d->m_sheetUsed = aString.string();
+  updateStyleSelector();
+  if (renderer())
+    renderer()->repaint();
+}
+
 // This method is called whenever a top-level stylesheet has finished loading.
 void DocumentImpl::stylesheetLoaded()
 {
@@ -1838,33 +1860,30 @@ void DocumentImpl::recalcStyleSelector()
                 // <STYLE> element
                 sheet = static_cast<HTMLStyleElementImpl*>(n)->sheet();
 
-
 	    // Check to see if this sheet belongs to a styleset
 	    // (thus making it PREFERRED or ALTERNATE rather than
 	    // PERSISTENT).
             if ( !title.isEmpty() ) {
 	        // Yes, we have a title.
-	        if ( sheetUsed.isEmpty() ) {
+	      if ( sheetUsed.isEmpty() ) {
 		  // No preferred set has been established.  If
 		  // we are NOT an alternate sheet, then establish
 		  // us as the preferred set.  Otherwise, just ignore
 		  // this sheet.
 		  QString rel = e->getAttribute( ATTR_REL ).string();
-		  if (!rel.contains("alternate")) {
+		  if (n->id() == ID_STYLE || !rel.contains("alternate")) {
                       sheetUsed = view()->part()->d->m_sheetUsed = title;
-                      if ( !m_availableSheets.contains( title ) )
-                          m_availableSheets.append( title );
-		  }
-		}
-            }
-            if ( n->id() == ID_LINK ) {
-                if (title.isEmpty() || title == sheetUsed)
-                    sheet = static_cast<HTMLLinkElementImpl*>(n)->sheet();
+                      m_preferredStylesheetSet = sheetUsed;
+                  }
+              }
+                      
+              if ( !m_availableSheets.contains( title ) )
+                  m_availableSheets.append( title );
+		      
+              if (title != sheetUsed)
+                  sheet = 0;
             }
-            else
-                // <STYLE> element
-	        sheet = static_cast<HTMLStyleElementImpl*>(n)->sheet();
-	}
+        }
 	else if (n->id() == ID_BODY) {
             // <BODY> element (doesn't contain styles as such but vlink="..." and friends
             // are treated as style declarations)
diff --git a/WebCore/khtml/xml/dom_docimpl.h b/WebCore/khtml/xml/dom_docimpl.h
index c4faef5..ec556b8 100644
--- a/WebCore/khtml/xml/dom_docimpl.h
+++ b/WebCore/khtml/xml/dom_docimpl.h
@@ -304,6 +304,14 @@ public:
 
     StyleSheetListImpl* styleSheets();
 
+    /* Newly proposed CSS3 mechanism for selecting alternate
+       stylesheets using the DOM. May be subject to change as
+       spec matures. - dwh
+    */
+    DOMString preferredStylesheetSet();
+    DOMString selectedStylesheetSet();
+    void setSelectedStylesheetSet(const DOMString& aString);
+
     QStringList availableStyleSheets() const;
     NodeImpl *focusNode() const { return m_focusNode; }
     void setFocusNode(NodeImpl *newFocusNode);
@@ -443,6 +451,8 @@ protected:
     QPtrList<RegisteredEventListener> m_windowEventListeners;
     QPtrList<NodeImpl> m_maintainsState;
 
+    DOMString m_preferredStylesheetSet;
+
     bool m_loadingSheet;
     bool visuallyOrdered;
     bool m_bParsing;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list