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

List:       kde-commits
Subject:    branches/KDE/4.0/kdelibs/khtml/rendering
From:       Germain Garand <germain () ebooksfrance ! org>
Date:       2008-03-22 20:52:54
Message-ID: 1206219174.908942.31681.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 788925 by ggarand:

automatically merged revision 788919:
fix some possible regressions after scroll optimisation work

.do a stricter tracking of fixed content objects
 (code could get confused by dynamic insertion/removal of objects)
.get a better rectangle for inlineFlows
.count the outline in

 M  +11 -5     render_canvas.cpp  
 M  +1 -0      render_canvas.h  
 M  +15 -0     render_container.cpp  
 M  +16 -6     render_object.cpp  


--- branches/KDE/4.0/kdelibs/khtml/rendering/render_canvas.cpp #788924:788925
@@ -303,8 +303,10 @@
        QListIterator<RenderObject*> it(*m_positionedObjects);
         while (it.hasNext()) {
             obj = it.next();
-            if (obj->style()->position() == FIXED && obj->layer())
+            if (obj->style()->position() == FIXED && obj->layer()) {
                 ret += obj->layer()->paintedRegion(layer());
+                assert( m_fixedPosition.contains(obj) );
+            }
         }
    }
 
@@ -485,16 +487,20 @@
 
 void RenderCanvas::addStaticObject( RenderObject*o, bool pos)
 { 
-    if (!pos && o && o->isBox()) 
-        m_fixedBackground.insert(o);
+    QSet<RenderObject*>& set = pos ? m_fixedPosition : m_fixedBackground;
+    if (!o || !o->isBox() || set.contains(o))
+        return;
+    set.insert(o);
     if (view())
         view()->addStaticObject(pos);
 }
 
 void RenderCanvas::removeStaticObject( RenderObject*o, bool pos)
 {
-    if (!pos && o && o->isBox())
-        m_fixedBackground.remove(o); 
+    QSet<RenderObject*>& set = pos ? m_fixedPosition : m_fixedBackground;
+    if (!o || !o->isBox() || !set.contains(o))
+        return;
+    set.remove(o); 
     if (view())
         view()->removeStaticObject(pos);
 }
--- branches/KDE/4.0/kdelibs/khtml/rendering/render_canvas.h #788924:788925
@@ -186,6 +186,7 @@
     int m_maximalOutlineSize; // Used to apply a fudge factor to dirty-rect checks \
on blocks/tables.  QList<RenderObject*> m_dirtyChildren;
     QSet<RenderObject*>m_fixedBackground;
+    QSet<RenderObject*>m_fixedPosition;
 };
 
 inline RenderCanvas* RenderObject::canvas() const
--- branches/KDE/4.0/kdelibs/khtml/rendering/render_container.cpp #788924:788925
@@ -491,6 +491,13 @@
     if (newChild->firstChild() || newChild->layer()) {
         layer = enclosingLayer();
         newChild->addLayers(layer, newChild);
+        // keep our fixed object lists updated.
+        if (newChild->style()&& (newChild->style()->hasFixedBackgroundImage() || \
newChild->style()->position() == FIXED)) { +            if \
(newChild->style()->hasFixedBackgroundImage()) +                \
canvas()->addStaticObject( newChild ); +            if (newChild->style()->position() \
== FIXED) +                canvas()->addStaticObject( newChild, true );
+        }
     }
 
     // if the new child is visible but this object was not, tell the layer it has \
some visible content @@ -544,6 +551,14 @@
     if (child->firstChild() || child->layer()) {
         layer = enclosingLayer();
         child->addLayers(layer, child);
+        // keep our fixed object lists updated.
+        if (child->style() && (child->style()->hasFixedBackgroundImage() || \
child->style()->position() == FIXED)) { +            if \
(child->style()->hasFixedBackgroundImage()) +                \
canvas()->addStaticObject( child ); +            if (child->style()->position() == \
FIXED) +                canvas()->addStaticObject( child, true );
+        }
+
     }
 
     // if the new child is visible but this object was not, tell the layer it has \
                some visible content
--- branches/KDE/4.0/kdelibs/khtml/rendering/render_object.cpp #788924:788925
@@ -1359,7 +1359,7 @@
     if (style->hasAutoZIndex() && (isRoot() || style->opacity() < 1.0f))
         style->setZIndex( 0 );
 
-    if ( d > RenderStyle::Position && 
+    if ( d > RenderStyle::Position &&
          (style->hasFixedBackgroundImage() != (m_style && \
                m_style->hasFixedBackgroundImage())
             || (style->position() == FIXED) != (m_style && (m_style->position() == \
FIXED)))  && canvas() && canvas()->view() ) {
@@ -2353,16 +2353,26 @@
 QRegion RenderObject::visibleFlowRegion(int x, int y) const
 {
     QRegion r;
+    bool done = false;
     for (RenderObject* ro=firstChild();ro;ro=ro->nextSibling()) {
-        if( !ro->layer() && !ro->isInlineFlow() && !ro->isFloating() && \
ro->style()->visibility() == VISIBLE) { +        if( !ro->layer() && \
!ro->isFloating() && ro->style()->visibility() == VISIBLE) {  // ### fix horizontal \
float extent  const RenderStyle *s = ro->style();
+            int ow = s ? s->outlineSize() : 0;
             if (ro->isRelPositioned())
                 static_cast<const RenderBox*>(ro)->relativePositionOffset(x,y);
-            if ( s->backgroundImage() || s->backgroundColor().isValid() || \
                s->hasBorder() )
-                r += QRect(x + ro->effectiveXPos(),y + ro->effectiveYPos(), \
                ro->effectiveWidth(), ro->effectiveHeight());
-            else
-                r += ro->visibleFlowRegion(x+ro->xPos(), y+ro->yPos());
+            if ( s->backgroundImage() || s->backgroundColor().isValid() || \
s->hasBorder() || ro->isInline() ) { +                while( ro->isInlineFlow() ) {
+                    ro = ro->parent();
+                    done = true;
+                }
+                r += QRect(x -ow +ro->effectiveXPos(),y -ow + ro->effectiveYPos(), 
+                                  ro->effectiveWidth()+ow*2, \
ro->effectiveHeight()+ow*2); +            } else {
+                QRegion tmp = ro->visibleFlowRegion(x+ro->xPos(), y+ro->yPos());
+                r += tmp;
+            }
+            if (done) break;
         }
     }
     return r;


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

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