[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/khtml
From:       Germain Garand <germain () ebooksfrance ! com>
Date:       2006-06-28 20:15:19
Message-ID: 1151525719.815954.25564.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 555957 by ggarand:

make updating of addRule/removeRule/insertRule work
cf. http://www.quirksmode.org/dom/w3c_css.html#change

BUG: 57159



 M  +12 -0     ChangeLog  
 M  +4 -0      css/css_stylesheetimpl.cpp  
 M  +10 -2     xml/dom_docimpl.cpp  
 M  +5 -1      xml/dom_docimpl.h  


--- branches/KDE/3.5/kdelibs/khtml/ChangeLog #555956:555957
@@ -1,3 +1,15 @@
+2006-06-28  Germain Garand  <germain@ebooksfrance.org>
+
+        make updating of addRule/removeRule/insertRule work
+        cf. http://www.quirksmode.org/dom/w3c_css.html#change
+
+        * css/css_stylesheetimpl.cpp 
+            (insertRule/deleteRule): shallow update of styleselector.
+        * xml/dom_docimpl.{h,cpp} 
+            (updateStyleSelector): new boolean argument for shallow recalculation, \
when all sheets are known. +            (DocumentImpl::recalcStyleSelector): split.
+            (DocumentImpl::rebuildStyleSelector): new from split. Recreate \
styleselector with known sheets. +
 2006-06-27  Germain Garand  <germain@ebooksfrance.org>
 
         . Correct drawing of borders on iframes and objects (#118277/#56109)
--- branches/KDE/3.5/kdelibs/khtml/css/css_stylesheetimpl.cpp #555956:555957
@@ -194,6 +194,8 @@
     // HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the specified \
                index e.g. if an
     //@import rule is inserted after a standard rule set or other at-rule.
     m_lstChildren->insert(index, r);
+    if (m_doc) 
+        m_doc->updateStyleSelector(true /*shallow*/);
     return index;
 }
 
@@ -211,6 +213,8 @@
         return;
     }
     b->deref();
+    if (m_doc)
+        m_doc->updateStyleSelector(true /*shallow*/);
 }
 
 void CSSStyleSheetImpl::addNamespace(CSSParser* p, const DOM::DOMString& prefix, \
                const DOM::DOMString& uri)
--- branches/KDE/3.5/kdelibs/khtml/xml/dom_docimpl.cpp #555956:555957
@@ -1976,7 +1976,7 @@
     if (exceptioncode) *exceptioncode = excode;
 }
 
-void DocumentImpl::updateStyleSelector()
+void DocumentImpl::updateStyleSelector(bool shallow)
 {
 //    kdDebug() << "PENDING " << m_pendingStylesheets << endl;
 
@@ -1984,7 +1984,10 @@
     if (m_pendingStylesheets > 0)
         return;
 
-    recalcStyleSelector();
+    if (shallow)
+        rebuildStyleSelector();
+    else
+        recalcStyleSelector();
     recalcStyle(Force);
 #if 0
 
@@ -2134,6 +2137,11 @@
     for (; it.current(); ++it)
 	it.current()->deref();
 
+    rebuildStyleSelector();
+}
+
+void DocumentImpl::rebuildStyleSelector()
+{
     // Create a new style selector
     delete m_styleSelector;
     QString usersheet = m_usersheet;
--- branches/KDE/3.5/kdelibs/khtml/xml/dom_docimpl.h #555956:555957
@@ -258,10 +258,14 @@
      * <LINK>, <STYLE> or <BODY> elements, as well as processing instructions (XML \
                documents only). A list is
      * constructed from these which is used to create the a new style selector which \
                collates all of the stylesheets
      * found and is used to calculate the derived styles for all rendering objects.
+     *
+     * @param shallow If the stylesheet list for the document is unchanged, with \
only added or removed rules  +     * in existing sheets, then set this argument to \
                true for efficiency.
      */
-    void updateStyleSelector();
+    void updateStyleSelector(bool shallow=false);
 
     void recalcStyleSelector();
+    void rebuildStyleSelector();
 
     QString nextState();
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic