Bug 57159 - Javascript or CSS error in http://www.htmlhelp.com/reference/html40/special/img.html
Summary: Javascript or CSS error in http://www.htmlhelp.com/reference/html40/special/i...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: unspecified
Platform: Mandrake RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-12 13:41 UTC by Albert Astals Cid
Modified: 2006-06-28 22:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Astals Cid 2003-04-12 13:41:12 UTC
Version:            (using KDE KDE 3.1)
Installed from:    Mandrake RPMs
Compiler:          gcc 3.2.2 
OS:          Linux

If i go to http://www.htmlhelp.com/reference/html40/special/img.html and click the "Hide non-strict attributes" nothing happens. 

If you use mozilla you'll see what should happen.

I have quickly "debugged" the Javascript file that is used in that page http://www.htmlhelp.com/reference/html40/hideNonStrict.js placing alerts beetween sentences.

[CODE SNIP]
alert("HOLA");
sheet.addRule(".transitional", "display:none");
alert("HOLA2");
newRules.push(sheet.rules.length - 1);
alert("HOLA3");
sheet.addRule(".transitional", "speak:none");
alert("HOLA4");
[/CODE SNIP]

Using konqueror it reaches HOLA3 but not HOLA4, so i suspect 
sheet.addRule(".transitional", "speak:none");
is the ofending sentence.
Comment 1 Albert Astals Cid 2003-07-01 23:00:07 UTC
Using Konqueror HEAD branch build from 1 July 2003 is even worse, as it doesn't even 
show the hide non-strict attibutes button  
Comment 2 Sashmit Bhaduri 2004-04-01 00:35:03 UTC
page changed layout.. 
Comment 3 Allan Sandfeld 2004-12-27 22:17:28 UTC
Yes, the button doesn't work
Comment 4 Germain Garand 2006-06-28 22:15:52 UTC
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();