[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 07:24:47 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit a4a4cce870339f03d4cc7c77944fa24e7d88b815
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Feb 17 20:25:58 2003 +0000

    	Fix for 3% improvement on cached cvs-base.  Make cells share the
    	declarations set up by the table (add these decls to the table
    	once instead of to every cell).
    
            Reviewed by darin
    
            * khtml/css/cssstyleselector.cpp:
            * khtml/css/cssstyleselector.h:
            * khtml/html/html_tableimpl.cpp:
            (HTMLTableElementImpl::HTMLTableElementImpl):
            (HTMLTableElementImpl::~HTMLTableElementImpl):
            (HTMLTableElementImpl::createSharedCellDecls):
            (HTMLTableCellElementImpl::getAdditionalStyleDecls):
            (HTMLTableCellElementImpl::attach):
            * khtml/html/html_tableimpl.h:
            * khtml/xml/dom_elementimpl.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3657 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 12fdf44..9061a5b 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,22 @@
+2003-02-17  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3% improvement on cached cvs-base.  Make cells share the
+	declarations set up by the table (add these decls to the table
+	once instead of to every cell).
+	
+        Reviewed by darin
+
+        * khtml/css/cssstyleselector.cpp:
+        * khtml/css/cssstyleselector.h:
+        * khtml/html/html_tableimpl.cpp:
+        (HTMLTableElementImpl::HTMLTableElementImpl):
+        (HTMLTableElementImpl::~HTMLTableElementImpl):
+        (HTMLTableElementImpl::createSharedCellDecls):
+        (HTMLTableCellElementImpl::getAdditionalStyleDecls):
+        (HTMLTableCellElementImpl::attach):
+        * khtml/html/html_tableimpl.h:
+        * khtml/xml/dom_elementimpl.h:
+
 2003-02-17  Trey Matteson  <trey at apple.com>
 
 	2938062 Mouse cursor does not change to link cursor over non-button form submission controls
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 12fdf44..9061a5b 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,22 @@
+2003-02-17  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3% improvement on cached cvs-base.  Make cells share the
+	declarations set up by the table (add these decls to the table
+	once instead of to every cell).
+	
+        Reviewed by darin
+
+        * khtml/css/cssstyleselector.cpp:
+        * khtml/css/cssstyleselector.h:
+        * khtml/html/html_tableimpl.cpp:
+        (HTMLTableElementImpl::HTMLTableElementImpl):
+        (HTMLTableElementImpl::~HTMLTableElementImpl):
+        (HTMLTableElementImpl::createSharedCellDecls):
+        (HTMLTableCellElementImpl::getAdditionalStyleDecls):
+        (HTMLTableCellElementImpl::attach):
+        * khtml/html/html_tableimpl.h:
+        * khtml/xml/dom_elementimpl.h:
+
 2003-02-17  Trey Matteson  <trey at apple.com>
 
 	2938062 Mouse cursor does not change to link cursor over non-button form submission controls
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index 6271882..426ab50 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -377,9 +377,8 @@ RenderStyle *CSSStyleSelector::styleForElement(ElementImpl *e)
 
     // inline style declarations, after all others. non css hints
     // count as author rules, and come before all other style sheets, see hack in append()
-    if(e->m_styleDecls)
-	numPropsToApply = addInlineDeclarations( e->m_styleDecls, numPropsToApply );
-
+    numPropsToApply = addInlineDeclarations( e, e->m_styleDecls, numPropsToApply );
+            
     bubbleSort( propsToApply, propsToApply+numPropsToApply-1 );
     bubbleSort( pseudoProps, pseudoProps+numPseudoProps-1 );
 
@@ -459,23 +458,39 @@ RenderStyle *CSSStyleSelector::styleForElement(ElementImpl *e)
     return style;
 }
 
-unsigned int CSSStyleSelector::addInlineDeclarations(DOM::CSSStyleDeclarationImpl *decl,
-					    unsigned int numProps )
+unsigned int CSSStyleSelector::addInlineDeclarations(DOM::ElementImpl* e, DOM::CSSStyleDeclarationImpl *decl,
+                                                     unsigned int numProps)
 {
-    QPtrList<CSSProperty> *values = decl->values();
-    if(!values) return numProps;
-    int len = values->count();
+    CSSStyleDeclarationImpl* addDecls = 0;
+    if (e->id() == ID_TD) // For now only TD Implements the virtual function for shared cell rules.
+        addDecls = e->getAdditionalStyleDecls();
+
+    if (!decl && !addDecls)
+        return numProps;
 
-    if ( inlineProps.size() < (uint)len )
-	inlineProps.resize( len+1 );
-    if (numProps + len >= propsToApplySize ) {
+    QPtrList<CSSProperty>* values = decl ? decl->values() : 0;
+    QPtrList<CSSProperty>* addValues = addDecls ? addDecls->values() : 0;
+    if (!values && !addValues)
+        return numProps;
+    
+    int firstLen = values ? values->count() : 0;
+    int secondLen = addValues ? addValues->count() : 0;
+    int totalLen = firstLen + secondLen;
+
+    if (inlineProps.size() < (uint)totalLen)
+        inlineProps.resize(totalLen + 1);
+    
+    if (numProps + totalLen >= propsToApplySize ) {
         propsToApplySize += propsToApplySize;
         propsToApply = (CSSOrderedProperty **)realloc( propsToApply, propsToApplySize*sizeof( CSSOrderedProperty * ) );
     }
 
     CSSOrderedProperty *array = (CSSOrderedProperty *)inlineProps.data();
-    for(int i = 0; i < len; i++)
+    for(int i = 0; i < totalLen; i++)
     {
+        if (i == firstLen)
+            values = addValues;
+        
         CSSProperty *prop = values->at(i);
 	Source source = Inline;
 
@@ -506,7 +521,7 @@ unsigned int CSSStyleSelector::addInlineDeclarations(DOM::CSSStyleDeclarationImp
 	array->prop = prop;
 	array->pseudoId = RenderStyle::NOPSEUDO;
 	array->selector = 0;
-	array->position = i;
+        array->position = i;
 	array->priority = (!first << 30) | (source << 24);
 	propsToApply[numProps++] = array++;
     }
diff --git a/WebCore/khtml/css/cssstyleselector.h b/WebCore/khtml/css/cssstyleselector.h
index 91164e1..1268fe3 100644
--- a/WebCore/khtml/css/cssstyleselector.h
+++ b/WebCore/khtml/css/cssstyleselector.h
@@ -155,8 +155,8 @@ namespace khtml
 	void buildLists();
 	void clearLists();
 
-	unsigned int addInlineDeclarations(DOM::CSSStyleDeclarationImpl *decl,
-				   unsigned int numProps );
+        unsigned int addInlineDeclarations(DOM::ElementImpl* e, DOM::CSSStyleDeclarationImpl *decl,
+				   unsigned int numProps);
 
 	static DOM::CSSStyleSheetImpl *defaultSheet;
 	static CSSStyleSelectorList *defaultStyle;
diff --git a/WebCore/khtml/html/html_tableimpl.cpp b/WebCore/khtml/html/html_tableimpl.cpp
index 52db6d2..ecee30f 100644
--- a/WebCore/khtml/html/html_tableimpl.cpp
+++ b/WebCore/khtml/html/html_tableimpl.cpp
@@ -38,6 +38,8 @@
 #include "css/cssproperties.h"
 #include "css/cssvalues.h"
 #include "css/csshelper.h"
+#include "css_valueimpl.h"
+#include "css/css_stylesheetimpl.h"
 
 #include "rendering/render_table.h"
 
@@ -59,6 +61,9 @@ HTMLTableElementImpl::HTMLTableElementImpl(DocumentPtr *doc)
     rules = None;
     frame = Void;
 #endif
+
+    m_sharedCellDecls = 0;
+    
     padding = 1;
     
     m_noBorder = true;
@@ -67,6 +72,11 @@ HTMLTableElementImpl::HTMLTableElementImpl(DocumentPtr *doc)
 
 HTMLTableElementImpl::~HTMLTableElementImpl()
 {
+    if (m_sharedCellDecls) {
+        m_sharedCellDecls->setNode(0);
+        m_sharedCellDecls->setParent(0);
+        m_sharedCellDecls->deref();
+    }
 }
 
 NodeImpl::Id HTMLTableElementImpl::id() const
@@ -74,6 +84,31 @@ NodeImpl::Id HTMLTableElementImpl::id() const
     return ID_TABLE;
 }
 
+DOM::CSSStyleDeclarationImpl* HTMLTableElementImpl::createSharedCellDecls()
+{
+    if (!m_sharedCellDecls) {
+        m_sharedCellDecls = new CSSStyleDeclarationImpl(0);
+        m_sharedCellDecls->ref();
+        m_sharedCellDecls->setParent(getDocument()->elementSheet());
+        m_sharedCellDecls->setNode(this);
+        m_sharedCellDecls->setStrictParsing( !getDocument()->inQuirksMode() );
+
+        if (m_noBorder)
+            m_sharedCellDecls->setProperty(CSS_PROP_BORDER_WIDTH, "0", false, true);
+        else {
+            m_sharedCellDecls->setProperty(CSS_PROP_BORDER_WIDTH, "1px", false, true);
+            int v = m_solid ? CSS_VAL_SOLID : CSS_VAL_INSET;
+            m_sharedCellDecls->setProperty(CSS_PROP_BORDER_TOP_STYLE, v, false, true);
+            m_sharedCellDecls->setProperty(CSS_PROP_BORDER_BOTTOM_STYLE, v, false, true);
+            m_sharedCellDecls->setProperty(CSS_PROP_BORDER_LEFT_STYLE, v, false, true);
+            m_sharedCellDecls->setProperty(CSS_PROP_BORDER_RIGHT_STYLE, v, false, true);
+            m_sharedCellDecls->setProperty(CSS_PROP_BORDER_COLOR, "inherit", false, true);
+        }
+    }
+    
+    return m_sharedCellDecls;
+}
+
 NodeImpl* HTMLTableElementImpl::setCaption( HTMLTableCaptionElementImpl *c )
 {
     int exceptioncode = 0;
@@ -839,28 +874,30 @@ void HTMLTableCellElementImpl::parseAttribute(AttributeImpl *attr)
     }
 }
 
-void HTMLTableCellElementImpl::attach()
+// used by table cells to share style decls created by the enclosing table.
+DOM::CSSStyleDeclarationImpl* HTMLTableCellElementImpl::getAdditionalStyleDecls()
 {
     HTMLElementImpl* p = static_cast<HTMLElementImpl*>(parentNode());
     while(p && p->id() != ID_TABLE)
         p = static_cast<HTMLElementImpl*>(p->parentNode());
 
-    if(p) {
+    if (p) {
         HTMLTableElementImpl* table = static_cast<HTMLTableElementImpl*>(p);
-        if (table->m_noBorder) {
-            addCSSProperty(CSS_PROP_BORDER_WIDTH, "0");
-        }
-        else {
-            addCSSProperty(CSS_PROP_BORDER_WIDTH, "1px");
-            int v = (table->m_solid || m_solid) ? CSS_VAL_SOLID : CSS_VAL_INSET;
-            addCSSProperty(CSS_PROP_BORDER_TOP_STYLE, v);
-            addCSSProperty(CSS_PROP_BORDER_BOTTOM_STYLE, v);
-            addCSSProperty(CSS_PROP_BORDER_LEFT_STYLE, v);
-            addCSSProperty(CSS_PROP_BORDER_RIGHT_STYLE, v);
+        return table->m_sharedCellDecls;
+    }
 
-            if (!m_solid)
-                addCSSProperty(CSS_PROP_BORDER_COLOR, "inherit");
-        }
+    return 0;
+}
+
+void HTMLTableCellElementImpl::attach()
+{
+    HTMLElementImpl* p = static_cast<HTMLElementImpl*>(parentNode());
+    while(p && p->id() != ID_TABLE)
+        p = static_cast<HTMLElementImpl*>(p->parentNode());
+
+    if (p) {
+        HTMLTableElementImpl* table = static_cast<HTMLTableElementImpl*>(p);
+        table->createSharedCellDecls();
     }
 
     HTMLTablePartElementImpl::attach();
diff --git a/WebCore/khtml/html/html_tableimpl.h b/WebCore/khtml/html/html_tableimpl.h
index 435ce92..b7ff741 100644
--- a/WebCore/khtml/html/html_tableimpl.h
+++ b/WebCore/khtml/html/html_tableimpl.h
@@ -45,6 +45,7 @@ class HTMLTableCaptionElementImpl;
 class HTMLTableCaptionElement;
 class HTMLElement;
 class HTMLCollection;
+class CSSStyleDeclarationImpl;
 
 class HTMLTableElementImpl : public HTMLElementImpl
 {
@@ -99,6 +100,8 @@ public:
     virtual void parseAttribute(AttributeImpl *attr);
     virtual void attach();
 
+    DOM::CSSStyleDeclarationImpl* createSharedCellDecls();
+    
 protected:
     HTMLTableSectionElementImpl *head;
     HTMLTableSectionElementImpl *foot;
@@ -110,6 +113,8 @@ protected:
     Rules rules;
 #endif
 
+    DOM::CSSStyleDeclarationImpl *m_sharedCellDecls;
+    
     bool m_noBorder     : 1;
     bool m_solid        : 1;
     uint unused		: 14;
@@ -197,6 +202,9 @@ public:
     virtual void parseAttribute(AttributeImpl *attr);
     virtual void attach();
 
+    // used by table cells to share style decls created by the enclosing table.
+    virtual DOM::CSSStyleDeclarationImpl* getAdditionalStyleDecls();
+    
 protected:
     int _row;
     int _col;
diff --git a/WebCore/khtml/xml/dom_elementimpl.h b/WebCore/khtml/xml/dom_elementimpl.h
index e74f410..f63b1d4 100644
--- a/WebCore/khtml/xml/dom_elementimpl.h
+++ b/WebCore/khtml/xml/dom_elementimpl.h
@@ -205,7 +205,9 @@ public:
       if (!m_styleDecls) createDecl();
       return m_styleDecls;
     }
-
+    // used by table cells to share style decls created by the enclosing table.
+    virtual DOM::CSSStyleDeclarationImpl* getAdditionalStyleDecls() { return 0; }
+    
     void dispatchAttrRemovalEvent(AttributeImpl *attr);
     void dispatchAttrAdditionEvent(AttributeImpl *attr);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list