[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 08:18:12 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c37838d9ef4854921a93473fed345b200d21cd0d
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 11 19:39:28 2003 +0000

    	Fix for 3507164, scrolling really slow on hixie's web forms spec page.  Hixie has 12 little transparent layers
            at various points on this page, and beginning/ending transparency on only those 12 layers as you scroll
            is enough to kill scrolling performance.
    
    	This patch works around the issue by lazily beginning transparency layers only when we determine that
    	we're actually painting a descendant layer of a transparent ancestor or a transparent layer.
    
    	Also fixing QColor's comparison operator.  It was broken and not comparing the "valid" bit, so invalid and
    	valid colors were being assumed to be the same.
    
    	Also fixed the render dumper to not dump transparent and invalid background colors and fixed it do dump the
    	alpha for colors with an alpha < 0xFF.
    
    	Reviewed by mjs (opacity changes), darin (color changes) and john (render tree dumper changes)
    
            * ChangeLog:
            * khtml/rendering/render_layer.cpp:
            (RenderLayer::RenderLayer):
            (RenderLayer::beginTransparencyLayers):
            (RenderLayer::paint):
            (RenderLayer::paintLayer):
            * khtml/rendering/render_layer.h:
            * kwq/KWQColor.h:
            (operator==):
            (operator!=):
            * kwq/KWQColor.mm:
            (QColor::name):
            * kwq/KWQRenderTreeDebug.cpp:
            (operator<<):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5764 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 6eacab4..933c59b 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,56 @@
+2003-12-11  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3507164, scrolling really slow on hixie's web forms spec page.  Hixie has 12 little transparent layers
+        at various points on this page, and beginning/ending transparency on only those 12 layers as you scroll
+        is enough to kill scrolling performance.
+
+	This patch works around the issue by lazily beginning transparency layers only when we determine that
+	we're actually painting a descendant layer of a transparent ancestor or a transparent layer.
+
+	Also fixing QColor's comparison operator.  It was broken and not comparing the "valid" bit, so invalid and
+	valid colors were being assumed to be the same.
+
+	Also fixed the render dumper to not dump transparent and invalid background colors and fixed it do dump the
+	alpha for colors with an alpha < 0xFF.
+	
+	Reviewed by mjs (opacity changes), darin (color changes) and john (render tree dumper changes)
+
+        * ChangeLog:
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::RenderLayer):
+        (RenderLayer::beginTransparencyLayers):
+        (RenderLayer::paint):
+        (RenderLayer::paintLayer):
+        * khtml/rendering/render_layer.h:
+        * kwq/KWQColor.h:
+        (operator==):
+        (operator!=):
+        * kwq/KWQColor.mm:
+        (QColor::name):
+        * kwq/KWQRenderTreeDebug.cpp:
+        (operator<<):
+
+2003-12-11  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3507164, scrolling really slow on hixie's web forms spec page.  Hixie has 12 little transparent layers
+	at various points on this page, and beginning/ending transparency on only those 12 layers as you scroll
+	is enough to kill scrolling performance.
+
+	This patch works around the issue by lazily beginning transparency layers only when we determine that
+	we're actually painting a descendant layer of a transparent ancestor or a transparent layer.
+
+	Also fixing QColor's comparison operator.  It was broken and not comparing the "valid" bit, so invalid and
+	valid colors were being assumed to be the same.
+	
+        Reviewed by mjs (opacity changes) and darin (color changes)
+
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::RenderLayer):
+        (RenderLayer::beginTransparencyLayers):
+        (RenderLayer::paint):
+        (RenderLayer::paintLayer):
+        * khtml/rendering/render_layer.h:
+
 2003-12-11  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by me
diff --git a/WebCore/khtml/rendering/render_layer.cpp b/WebCore/khtml/rendering/render_layer.cpp
index 213963f..295fb49 100644
--- a/WebCore/khtml/rendering/render_layer.cpp
+++ b/WebCore/khtml/rendering/render_layer.cpp
@@ -90,13 +90,14 @@ m_scrollX( 0 ),
 m_scrollY( 0 ),
 m_scrollWidth( 0 ),
 m_scrollHeight( 0 ),
-m_scrollDimensionsDirty( true ),
 m_hBar( 0 ),
 m_vBar( 0 ),
 m_scrollMediator( 0 ),
 m_posZOrderList( 0 ),
 m_negZOrderList( 0 ),
+m_scrollDimensionsDirty( true ),
 m_zOrderListsDirty( true ),
+m_usedTransparency( false ),
 m_marquee( 0 )
 {
 }
@@ -251,6 +252,22 @@ RenderLayer::transparentAncestor()
     for ( ; curr && curr->m_object->style()->opacity() == 1.0f; curr = curr->parent());
     return curr;
 }
+
+void RenderLayer::beginTransparencyLayers(QPainter* p)
+{
+    if (isTransparent() && m_usedTransparency)
+        return;
+    
+    RenderLayer* ancestor = transparentAncestor();
+    if (ancestor)
+        ancestor->beginTransparencyLayers(p);
+    
+    if (isTransparent()) {
+        m_usedTransparency = true;
+        p->beginTransparencyLayer(renderer()->style()->opacity());
+    }
+}
+
 #endif
 
 void* RenderLayer::operator new(size_t sz, RenderArena* renderArena) throw()
@@ -695,7 +712,7 @@ RenderLayer::paintScrollbars(QPainter* p, const QRect& damageRect)
 void
 RenderLayer::paint(QPainter *p, const QRect& damageRect, bool selectionOnly)
 {
-    paintLayer(this, p, damageRect, selectionOnly);
+    paintLayer(this, p, damageRect, false, selectionOnly);
 }
 
 static void setClip(QPainter* p, const QRect& paintDirtyRect, const QRect& clipRect)
@@ -727,7 +744,7 @@ static void restoreClip(QPainter* p, const QRect& paintDirtyRect, const QRect& c
 
 void
 RenderLayer::paintLayer(RenderLayer* rootLayer, QPainter *p,
-                        const QRect& paintDirtyRect, bool selectionOnly)
+                        const QRect& paintDirtyRect, bool haveTransparency, bool selectionOnly)
 {
     // Calculate the clip rects we should use.
     QRect layerBounds, damageRect, clipRectToApply;
@@ -739,39 +756,42 @@ RenderLayer::paintLayer(RenderLayer* rootLayer, QPainter *p,
     updateZOrderLists();
 
 #if APPLE_CHANGES
-    // Set our transparency if we need to.
     if (isTransparent())
-        p->beginTransparencyLayer(renderer()->style()->opacity());
+        haveTransparency = true;
 #endif
-    
+
     // We want to paint our layer, but only if we intersect the damage rect.
     bool shouldPaint = intersectsDamageRect(layerBounds, damageRect);
-    if (shouldPaint && !selectionOnly) {
+    if (shouldPaint && !selectionOnly && !damageRect.isEmpty()) {
+#if APPLE_CHANGES
+        // Begin transparency layers lazily now that we know we have to paint something.
+        if (haveTransparency)
+            beginTransparencyLayers(p);
+#endif
+        
         // Paint our background first, before painting any child layers.
-        if (!damageRect.isEmpty()) {
-            // Establish the clip used to paint our background.
-            setClip(p, paintDirtyRect, damageRect);
+        // Establish the clip used to paint our background.
+        setClip(p, paintDirtyRect, damageRect);
 
-            // Paint the background.
-            renderer()->paint(p, damageRect.x(), damageRect.y(),
-                              damageRect.width(), damageRect.height(),
-                              x - renderer()->xPos(), y - renderer()->yPos(),
-                              PaintActionElementBackground);
+        // Paint the background.
+        renderer()->paint(p, damageRect.x(), damageRect.y(),
+                            damageRect.width(), damageRect.height(),
+                            x - renderer()->xPos(), y - renderer()->yPos(),
+                            PaintActionElementBackground);
 
 #ifndef INCREMENTAL_REPAINTING
-            // Position our scrollbars.
-            positionScrollbars(layerBounds);
+        // Position our scrollbars.
+        positionScrollbars(layerBounds);
 #endif
-            
+        
 #if APPLE_CHANGES
-            // Our scrollbar widgets paint exactly when we tell them to, so that they work properly with
-            // z-index.  We paint after we painted the background/border, so that the scrollbars will
-            // sit above the background/border.
-            paintScrollbars(p, damageRect);
+        // Our scrollbar widgets paint exactly when we tell them to, so that they work properly with
+        // z-index.  We paint after we painted the background/border, so that the scrollbars will
+        // sit above the background/border.
+        paintScrollbars(p, damageRect);
 #endif
-            // Restore the clip.
-            restoreClip(p, paintDirtyRect, damageRect);
-        }
+        // Restore the clip.
+        restoreClip(p, paintDirtyRect, damageRect);
     }
 
     // Now walk the sorted list of children with negative z-indices.
@@ -779,12 +799,18 @@ RenderLayer::paintLayer(RenderLayer* rootLayer, QPainter *p,
         uint count = m_negZOrderList->count();
         for (uint i = 0; i < count; i++) {
             RenderLayer* child = m_negZOrderList->at(i);
-            child->paintLayer(rootLayer, p, paintDirtyRect, selectionOnly);
+            child->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, selectionOnly);
         }
     }
     
     // Now establish the appropriate clip and paint our child RenderObjects.
     if (shouldPaint && !clipRectToApply.isEmpty()) {
+#if APPLE_CHANGES
+        // Begin transparency layers lazily now that we know we have to paint something.
+        if (haveTransparency)
+            beginTransparencyLayers(p);
+#endif
+
         // Set up the clip used when painting our children.
         setClip(p, paintDirtyRect, clipRectToApply);
 
@@ -816,14 +842,16 @@ RenderLayer::paintLayer(RenderLayer* rootLayer, QPainter *p,
         uint count = m_posZOrderList->count();
         for (uint i = 0; i < count; i++) {
             RenderLayer* child = m_posZOrderList->at(i);
-            child->paintLayer(rootLayer, p, paintDirtyRect, selectionOnly);
+            child->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, selectionOnly);
         }
     }
     
 #if APPLE_CHANGES
     // End our transparency layer
-    if (isTransparent())
+    if (isTransparent() && m_usedTransparency) {
         p->endTransparencyLayer();
+        m_usedTransparency = false;
+    }
 #endif
 }
 
diff --git a/WebCore/khtml/rendering/render_layer.h b/WebCore/khtml/rendering/render_layer.h
index 8f2f660..c8a1a2e 100644
--- a/WebCore/khtml/rendering/render_layer.h
+++ b/WebCore/khtml/rendering/render_layer.h
@@ -155,6 +155,7 @@ public:
 #if APPLE_CHANGES
     bool isTransparent();
     RenderLayer* transparentAncestor();
+    void beginTransparencyLayers(QPainter* p);
 #endif
     
     RenderLayer* root() {
@@ -274,7 +275,8 @@ private:
 
     void collectLayers(QPtrVector<RenderLayer>*&, QPtrVector<RenderLayer>*&);
 
-    void paintLayer(RenderLayer* rootLayer, QPainter *p, const QRect& paintDirtyRect, bool selectionOnly=false);
+    void paintLayer(RenderLayer* rootLayer, QPainter *p, const QRect& paintDirtyRect, 
+                    bool haveTransparency=false, bool selectionOnly=false);
     RenderLayer* nodeAtPointForLayer(RenderLayer* rootLayer, RenderObject::NodeInfo& info,
                                      int x, int y, const QRect& hitTestRect);
 
@@ -314,7 +316,6 @@ protected:
     // The width/height of our scrolled area.
     short m_scrollWidth;
     int m_scrollHeight;
-    bool m_scrollDimensionsDirty;
     
     // For layers with overflow, we have a pair of scrollbars.
     QScrollBar* m_hBar;
@@ -327,8 +328,15 @@ protected:
     // z-indices.
     QPtrVector<RenderLayer>* m_posZOrderList;
     QPtrVector<RenderLayer>* m_negZOrderList;
-    bool m_zOrderListsDirty;
     
+    bool m_scrollDimensionsDirty : 1;
+    bool m_zOrderListsDirty : 1;
+#if APPLE_CHANGES
+    bool m_usedTransparency : 1; // Tracks whether we need to close a transparent layer, i.e., whether
+                                 // we ended up painting this layer or any descendants (and therefore need to
+                                 // blend).
+#endif
+
     Marquee* m_marquee; // Used by layers with overflow:marquee
 };
 
diff --git a/WebCore/kwq/KWQColor.h b/WebCore/kwq/KWQColor.h
index c32274b..d914720 100644
--- a/WebCore/kwq/KWQColor.h
+++ b/WebCore/kwq/KWQColor.h
@@ -77,12 +77,12 @@ private:
 
 inline bool operator==(const QColor &a, const QColor &b)
 {
-    return a.color == b.color;
+    return a.color == b.color && a.valid == b.valid;
 }
 
 inline bool operator!=(const QColor &a, const QColor &b)
 {
-    return a.color != b.color;
+    return a.color != b.color || a.valid != b.valid;
 }
 
 #endif
diff --git a/WebCore/kwq/KWQColor.mm b/WebCore/kwq/KWQColor.mm
index baff496..e190d1a 100644
--- a/WebCore/kwq/KWQColor.mm
+++ b/WebCore/kwq/KWQColor.mm
@@ -70,7 +70,10 @@ QColor::QColor(const char *name)
 QString QColor::name() const
 {
     QString name;
-    name.sprintf("#%02X%02X%02X", red(), green(), blue());
+    if (qAlpha(color) < 0xFF)
+        name.sprintf("#%02X%02X%02X%02X", red(), green(), blue(), qAlpha(color));
+    else
+        name.sprintf("#%02X%02X%02X", red(), green(), blue());
     return name;
 }
 
diff --git a/WebCore/kwq/KWQRenderTreeDebug.cpp b/WebCore/kwq/KWQRenderTreeDebug.cpp
index 4b32686..fd1eaa5 100644
--- a/WebCore/kwq/KWQRenderTreeDebug.cpp
+++ b/WebCore/kwq/KWQRenderTreeDebug.cpp
@@ -45,6 +45,7 @@ using khtml::InlineTextBox;
 using khtml::InlineTextBoxArray;
 using khtml::BorderValue;
 using khtml::EBorderStyle;
+using khtml::transparentColor;
 
 static void writeLayers(QTextStream &ts, const RenderLayer* rootLayer, RenderLayer* l,
                         const QRect& paintDirtyRect, int indent=0);
@@ -120,7 +121,10 @@ static QTextStream &operator<<(QTextStream &ts, const RenderObject &o)
     if (!o.isText()) {
         if (o.parent() && (o.parent()->style()->color() != o.style()->color()))
             ts << " [color=" << o.style()->color().name() << "]";
-        if (o.parent() && (o.parent()->style()->backgroundColor() != o.style()->backgroundColor()))
+        if (o.parent() && (o.parent()->style()->backgroundColor() != o.style()->backgroundColor()) &&
+            o.style()->backgroundColor().isValid() && 
+	    o.style()->backgroundColor().rgb() != khtml::transparentColor)
+	    // Do not dump invalid or transparent backgrounds, since that is the default.
             ts << " [bgcolor=" << o.style()->backgroundColor().name() << "]";
     
         if (o.borderTop() || o.borderRight() || o.borderBottom() || o.borderLeft()) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list