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

List:       kde-commits
Subject:    branches/KDE/4.1/kdelibs/khtml/css
From:       Harri Porten <porten () kde ! org>
Date:       2008-08-24 23:40:20
Message-ID: 1219621220.053210.11952.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 851943 by porten:

Merged revision 851942:
Omit calculation of return value in internal removeProperty()
calls where it's not needed.

Speeds up the repeated backgroundColor setting in
http://www.hixie.ch/tests/adhoc/perf/video/001.html by about 8%.

 M  +1 -2      css_renderstyledeclarationimpl.cpp  
 M  +1 -1      css_renderstyledeclarationimpl.h  
 M  +10 -8     css_valueimpl.cpp  
 M  +1 -1      css_valueimpl.h  


--- branches/KDE/4.1/kdelibs/khtml/css/css_renderstyledeclarationimpl.cpp \
#851942:851943 @@ -1133,10 +1133,9 @@
     return false;
 }
 
-DOM::DOMString RenderStyleDeclarationImpl::removeProperty( int )
+void RenderStyleDeclarationImpl::removeProperty(int, DOM::DOMString*)
 {
     // ### emit error since we're read-only
-    return DOMString();
 }
 
 void RenderStyleDeclarationImpl::removePropertiesInSet(const int* set, \
                unsigned length)
--- branches/KDE/4.1/kdelibs/khtml/css/css_renderstyledeclarationimpl.h \
#851942:851943 @@ -51,7 +51,7 @@
     bool getPropertyPriority( int propertyID ) const;
     unsigned long length() const;
 
-    DOM::DOMString removeProperty( int propertyID );
+    virtual void removeProperty(int propertyID, DOM::DOMString* old = 0);
     virtual void removePropertiesInSet(const int* set, unsigned length);
     bool setProperty ( int propertyId, const DOM::DOMString &value, bool \
                important, int &ec );
     bool setProperty ( int propertyId, const DOM::DOMString &value, bool \
                important = false );
--- branches/KDE/4.1/kdelibs/khtml/css/css_valueimpl.cpp #851942:851943
@@ -159,7 +159,9 @@
     int propID = propertyID(propertyName);
     if (!propID)
         return DOMString();
-    return removeProperty(propID);
+    DOMString old;
+    removeProperty(propID, &old);
+    return old;
 }
 
 DOMString CSSStyleDeclarationImpl::getPropertyValue( int propertyID ) \
const @@ -534,10 +536,11 @@
 
 // -------------------------------------------
 
-DOMString CSSStyleDeclarationImpl::removeProperty( int propertyID)
+void CSSStyleDeclarationImpl::removeProperty(int propertyID,
+                                             DOM::DOMString* old)
 {
-    if(!m_lstValues) return DOMString();
-    DOMString value;
+    if(!m_lstValues)
+        return;
 
     static QHash<int, PropertyLonghand> shorthandMap;
     if (shorthandMap.isEmpty())
@@ -547,7 +550,7 @@
     if (longhand.length()) {
         removePropertiesInSet(longhand.properties(), longhand.length());
         // FIXME: Return an equivalent shorthand when possible.
-        return DOMString();
+        return;
     }
 
     QMutableListIterator<CSSProperty*> lstValuesIt(*m_lstValues);
@@ -556,15 +559,14 @@
     while ( lstValuesIt.hasPrevious() ) {
         current = lstValuesIt.previous();
         if (current->m_id == propertyID) {
-            value = current->value()->cssText();
+            if (old)
+                *old = current->value()->cssText();
             delete lstValuesIt.value();
             lstValuesIt.remove();
             setChanged();
             break;
         }
      }
-
-    return value;
 }
 
 void CSSStyleDeclarationImpl::removePropertiesInSet(const int* set, \
                unsigned length)
--- branches/KDE/4.1/kdelibs/khtml/css/css_valueimpl.h #851942:851943
@@ -56,7 +56,7 @@
 
     virtual unsigned long length() const;
     CSSRuleImpl *parentRule() const;
-    virtual DOM::DOMString removeProperty( int propertyID);
+    virtual void removeProperty(int propertyID, DOM::DOMString* old = 0);
     virtual void removePropertiesInSet(const int* set, unsigned length);
     virtual bool setProperty ( int propertyId, const DOM::DOMString \
                &value, bool important, int &ec);
     virtual bool setProperty ( int propertyId, const DOM::DOMString \
&value, bool important = false);


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

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