<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>118658</bug_id>
          
          <creation_ts>2005-12-19 19:54:28 +0000</creation_ts>
          <short_desc>Incremental-repainting not incremental enough for marquees.</short_desc>
          <delta_ts>2006-09-26 04:05:49 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konqueror</product>
          <component>khtml renderer</component>
          <version>unspecified</version>
          <rep_platform>Fedora RPMs</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="kim Lux">lux</reporter>
          <assigned_to name="Konqueror Bugs">konqueror-bugs-null</assigned_to>
          <cc>jens-bugs.kde.org</cc>
    
    <cc>maksim</cc>
    
    <cc>phobos</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>400033</commentid>
    <comment_count>0</comment_count>
    <who name="kim Lux">lux</who>
    <bug_when>2005-12-19 19:54:28 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.5.0)
Installed from:    Fedora RPMs
OS:                Linux

rpm -q kdebase
kdebase-3.5.0-1.2.fc4.kde

konqueror is Release 3.5.0-2.2.fc4.kde

This website make X go to 90% in Konqueror.  Firefox handles it fine. 

http://www.msnbc.msn.com/id/10532906/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>400122</commentid>
    <comment_count>1</comment_count>
    <who name="Thiago Macieira">thiago</who>
    <bug_when>2005-12-20 01:36:02 +0000</bug_when>
    <thetext>It must be that news ticker they have on that page.

Both Konqueror and Firefox shoot the CPU to 100% here. The difference is that Konqueror is sharing the load with X, whereas Firefox claims 95% all for itself.

Tested Konqueror 3.5 r487700 and Firefox 1.0.4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>400133</commentid>
    <comment_count>2</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2005-12-20 01:51:40 +0000</bug_when>
    <thetext>It&apos;s a renderer/incremental repaint issue. hmm, I had a font patch that may make it slightly more efficient wrt to app&apos;s own load
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>407487</commentid>
    <comment_count>3</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-01-19 19:22:53 +0000</bug_when>
    <thetext>Let&apos;s make this a bit general. This is hardly the only website showing this.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>407493</commentid>
    <comment_count>4</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-01-19 19:29:32 +0000</bug_when>
    <thetext>*** Bug 62313 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417947</commentid>
    <comment_count>5</comment_count>
    <who name="Germain Garand">germain</who>
    <bug_when>2006-02-28 05:16:33 +0000</bug_when>
    <thetext>SVN commit 514357 by ggarand:

Common-case style selection optimisation inspired from WebCore.
Avoids repetitive scanning of the class attribute for a list of classes.

CCBUG: 118658
(not the only issue there)



 M  +10 -0     ChangeLog  
 M  +3 -2      css/css_base.cpp  
 M  +1 -0      css/css_base.h  
 M  +25 -15    css/cssstyleselector.cpp  
 M  +1 -1      css/parser.cpp  
 M  +1 -1      css/parser.y  
 M  +10 -0     html/html_elementimpl.cpp  
 M  +1 -0      xml/dom_elementimpl.cpp  
 M  +8 -2      xml/dom_elementimpl.h  


--- branches/KDE/3.5/kdelibs/khtml/ChangeLog #514356:514357
@@ -1,5 +1,15 @@
 2006-02-28  Germain Garand  &lt;germain@ebooksfrance.org&gt;
+         
+        Common-case style selection optimisation inspired from WebCore.
 
+        * css/css_base.cpp/.h: add &apos;Class&apos; to possible matching modes
+        * css/cssstyleselector.cpp: treat &apos;Class&apos; extra, not anymore as an ordinary List.
+        * css/parser.cpp/y: use &apos;Class&apos; matching mode 
+        * html/html_elementimpl.cpp: when parsing ATTR_CLASS, set a boolean to remember if it is or not a class list.
+        * xml/dom_elementimpl.{cpp,h}: add m_hasClassList boolean + setter/getter
+
+2006-02-28  Germain Garand  &lt;germain@ebooksfrance.org&gt;
+
         * rendering/render_object.cpp (dirtyFormattingContext): be more efficient with inlineflow objects.
         * rendering/render_block.cpp (layoutBlockChildren): be more efficient with regard to positioned objects relayout. 
         Merge WC margin-collapse regression fix (WC/#3508). 
--- branches/KDE/3.5/kdelibs/khtml/css/css_base.cpp #514356:514357
@@ -144,6 +144,7 @@
     case Exact:
     case Set:
     case List:
+    case Class:
     case Hyphen:
     case PseudoClass:
     case PseudoElement:
@@ -317,7 +318,7 @@
         str = &quot;#&quot;;
         str += cs-&gt;value;
     }
-    else if ( tag == anyLocalName &amp;&amp; cs-&gt;attr == ATTR_CLASS &amp;&amp; cs-&gt;match == CSSSelector::List )
+    else if ( tag == anyLocalName &amp;&amp; cs-&gt;match == CSSSelector::Class )
     {
         str = &quot;.&quot;;
         str += cs-&gt;value;
@@ -343,7 +344,7 @@
             str += &quot;#&quot;;
             str += cs-&gt;value;
         }
-        else if ( cs-&gt;attr == ATTR_CLASS &amp;&amp; cs-&gt;match == CSSSelector::List )
+        else if ( cs-&gt;match == CSSSelector::Class )
         {
             str += &quot;.&quot;;
             str += cs-&gt;value;
--- branches/KDE/3.5/kdelibs/khtml/css/css_base.h #514356:514357
@@ -107,6 +107,7 @@
 	    Id,
 	    Exact,
 	    Set,
+	    Class,
 	    List,
 	    Hyphen,
 	    PseudoClass,
--- branches/KDE/3.5/kdelibs/khtml/css/cssstyleselector.cpp #514356:514357
@@ -1068,25 +1068,35 @@
             break;
         case CSSSelector::Set:
             break;
+        case CSSSelector::Class:
+            if (!e-&gt;hasClassList()) {
+                if( (strictParsing &amp;&amp; strcmp(sel-&gt;value, value) ) ||
+                    (!strictParsing &amp;&amp; strcasecmp(sel-&gt;value, value)))
+                    return false;
+               return true;
+            }
+            // no break    
         case CSSSelector::List:
         {
-            const QChar* s = value.unicode();
-            int l = value.length();
-            while( l &amp;&amp; !s-&gt;isSpace() )
-              l--,s++;
-	    if (!l) {
-		// There is no list, just a single item.  We can avoid
-		// allocing QStrings and just treat this as an exact
-		// match check.
-		if( (strictParsing &amp;&amp; strcmp(sel-&gt;value, value) ) ||
-		    (!strictParsing &amp;&amp; strcasecmp(sel-&gt;value, value)))
-		    return false;
-		break;
-	    }
+            if (sel-&gt;match != CSSSelector::Class) {
+                const QChar* s = value.unicode();
+                int l = value.length();
+                while( l &amp;&amp; !s-&gt;isSpace() )
+                    l--,s++;
+                if (!l) {
+		    // There is no list, just a single item.  We can avoid
+		    // allocing QStrings and just treat this as an exact
+		    // match check.
+		    if( (strictParsing &amp;&amp; strcmp(sel-&gt;value, value) ) ||
+		        (!strictParsing &amp;&amp; strcasecmp(sel-&gt;value, value)))
+		        return false;
+		    break;
+	        }
+            }
 
             // The selector&apos;s value can&apos;t contain a space, or it&apos;s totally bogus.
-            l = sel-&gt;value.find(&apos; &apos;);
-            if (l != -1)
+            // ### check if this can still happen
+            if (sel-&gt;value.find(&apos; &apos;) != -1)
                 return false;
 
             QString str = value.string();
--- branches/KDE/3.5/kdelibs/khtml/css/parser.cpp #514356:514357
@@ -2072,7 +2072,7 @@
 
     {
 	yyval.selector = new CSSSelector();
-	yyval.selector-&gt;match = CSSSelector::List;
+	yyval.selector-&gt;match = CSSSelector::Class;
 	yyval.selector-&gt;attr = ATTR_CLASS;
 	yyval.selector-&gt;value = domString(yyvsp[0].string);
     ;}
--- branches/KDE/3.5/kdelibs/khtml/css/parser.y #514356:514357
@@ -691,7 +691,7 @@
 class:
     &apos;.&apos; IDENT {
 	$$ = new CSSSelector();
-	$$-&gt;match = CSSSelector::List;
+	$$-&gt;match = CSSSelector::Class;
 	$$-&gt;attr = ATTR_CLASS;
 	$$-&gt;value = domString($2);
     }
--- branches/KDE/3.5/kdelibs/khtml/html/html_elementimpl.cpp #514356:514357
@@ -175,6 +175,16 @@
         getDocument()-&gt;incDOMTreeVersion();
         break;
     case ATTR_CLASS:
+        if (attr-&gt;val()) {
+          DOMString v = attr-&gt;value();
+          const QChar* s = v.unicode();
+          int l = v.length();
+          while( l &amp;&amp; !s-&gt;isSpace() )
+            l--,s++;
+          setHasClassList(l);
+        } else
+          setHasClassList(false);                 
+    // no break                                         
     case ATTR_NAME:
         setChanged(); // in case of a CSS selector on class/name
         getDocument()-&gt;incDOMTreeVersion();
--- branches/KDE/3.5/kdelibs/khtml/xml/dom_elementimpl.cpp #514356:514357
@@ -308,6 +308,7 @@
     m_restyleLate = false;
     m_restyleSelfLate = false;
     m_restyleChildrenLate = false;
+    m_hasClassList = false;
 }
 
 ElementImpl::~ElementImpl()
--- branches/KDE/3.5/kdelibs/khtml/xml/dom_elementimpl.h #514356:514357
@@ -141,7 +141,7 @@
 public:
     ElementImpl(DocumentPtr *doc);
     ~ElementImpl();
-
+    
     DOMString getAttribute( NodeImpl::Id id, bool nsAware = 0, const DOMString&amp; qName = DOMString() ) const;
     void setAttribute( NodeImpl::Id id, const DOMString &amp;value, const DOMString &amp;qName,
                        int &amp;exceptioncode );
@@ -224,16 +224,21 @@
      */
     DOMString openTagStartToString(bool expandurls = false) const;
     
-    bool restyleLate() { return m_restyleLate; };
+    bool restyleLate() const { return m_restyleLate; };
     void setRestyleLate(bool b=true) { m_restyleLate = b; };
     void setRestyleSelfLate() { m_restyleSelfLate = true; };
     void setRestyleChildrenLate() { m_restyleChildrenLate = true; };
 
+    // for style selection performance: whether the element matches several CSS Classes
+    bool hasClassList() const { return m_hasClassList; }
+    void setHasClassList(bool b) { m_hasClassList = b; }
+
     void updateId(DOMStringImpl* oldId, DOMStringImpl* newId);
     //Called when mapping from id to this node in document should be removed
     virtual void removeId(const QString&amp; id);
     //Called when mapping from id to this node in document should be added
     virtual void addId   (const QString&amp; id);
+
 protected:
     void createAttributeMap() const;
     void createDecl();
@@ -253,6 +258,7 @@
     bool m_restyleLate;
     bool m_restyleSelfLate;
     bool m_restyleChildrenLate;
+    bool m_hasClassList;
 };
 
 
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>418379</commentid>
    <comment_count>6</comment_count>
    <who name="Tommi Tervo">tommi.tervo</who>
    <bug_when>2006-03-01 19:28:44 +0000</bug_when>
    <thetext>*** Bug 107457 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466725</commentid>
    <comment_count>7</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-09-05 00:45:57 +0000</bug_when>
    <thetext>*** Bug 121543 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>470842</commentid>
    <comment_count>8</comment_count>
    <who name="Germain Garand">germain</who>
    <bug_when>2006-09-18 14:40:37 +0000</bug_when>
    <thetext>Mandriva wiki has some nasty moving rel pos of the same vein
e.g:
http://qa.mandriva.com/twiki/bin/view/Main/MandrivaLinux2007Sunna</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>472831</commentid>
    <comment_count>9</comment_count>
    <who name="Germain Garand">germain</who>
    <bug_when>2006-09-26 04:05:48 +0000</bug_when>
    <thetext>SVN commit 588455 by ggarand:

Heavy DHTML optimizations.
Basically avoid to do any layouting work when the style difference only implies 
the translation of a layer and nothing more, which is very common.
Makes KHTML fly on a lot of dynamical pages!

Introduce some priority levels when repainting, so we can have rapid repaints
when needed.

Don&apos;t use anymore the overflow properties for storing the layers scroll overflows
as that was terminally boken for any nestig level. 
Admittedly leftmost/rightmost and friends can be a tad more 
expensive at times, but they do provide correct results which is very much valuable. 
Rebutals welcome.

BUG: 118658




 M  +44 -14    render_block.cpp  
 M  +4 -0      render_block.h  
 M  +2 -2      render_body.cpp  
 M  +1 -1      render_body.h  
 M  +11 -15    render_box.cpp  
 M  +3 -2      render_box.h  
 M  +71 -34    render_canvas.cpp  
 M  +15 -3     render_canvas.h  
 M  +44 -5     render_flow.cpp  
 M  +2 -1      render_flow.h  
 M  +11 -6     render_layer.cpp  
 M  +1 -1      render_layer.h  
 M  +70 -13    render_object.cpp  
 M  +12 -3     render_object.h  
 M  +13 -1     render_style.cpp  
 M  +22 -5     render_table.cpp  
 M  +2 -1      render_table.h  
 M  +2 -2      render_text.cpp  
 M  +1 -1      render_text.h  
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>