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

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/khtml/rendering
From:       Germain Garand <germain () ebooksfrance ! com>
Date:       2005-10-03 17:22:31
Message-ID: 1128360151.887402.7397.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 466917 by ggarand:

- use -500000 to flag uninitialised floats. The former -1 is actually a valid value \
                ;(
- make floating objects list initialisation more lazy (cherry picked in WebCore)

BUG: 113744



 M  +14 -14    render_block.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/render_block.cpp #466916:466917
@@ -1731,8 +1731,8 @@
         else
             newObj = new FloatingObject(FloatingObject::FloatRight);
 
-        newObj->startY = -1;
-        newObj->endY = -1;
+        newObj->startY = -500000;
+        newObj->endY = -500000;
         newObj->width = o->width() + o->marginLeft() + o->marginRight();
     }
     else {
@@ -1763,12 +1763,12 @@
 {
     if(!m_floatingObjects) return;
     FloatingObject *f = m_floatingObjects->getLast();
-    if(!f || f->startY != -1) return;
+    if(!f || f->startY != -500000) return;
     FloatingObject *lastFloat;
     while(1)
     {
         lastFloat = m_floatingObjects->prev();
-        if (!lastFloat || lastFloat->startY != -1) {
+        if (!lastFloat || lastFloat->startY != -500000) {
             m_floatingObjects->next();
             break;
         }
@@ -2221,12 +2221,6 @@
     if ( !flow->m_floatingObjects || (child && flow->isRoot()) )
         return;
 
-    // we have overhanging floats
-    if (!m_floatingObjects) {
-        m_floatingObjects = new QPtrList<FloatingObject>;
-        m_floatingObjects->setAutoDelete(true);
-    }
-
     QPtrListIterator<FloatingObject> it(*flow->m_floatingObjects);
     FloatingObject *r;
     for ( ; (r = it.current()); ++it ) {
@@ -2243,10 +2237,12 @@
 
             FloatingObject* f = 0;
             // don't insert it twice!
-            QPtrListIterator<FloatingObject> it(*m_floatingObjects);
-            while ( (f = it.current()) ) {
-                if (f->node == r->node) break;
-                ++it;
+            if (m_floatingObjects) {
+                QPtrListIterator<FloatingObject> it(*m_floatingObjects);
+                while ( (f = it.current()) ) {
+                    if (f->node == r->node) break;
+                    ++it;
+                }
             }
             if ( !f ) {
                 FloatingObject *floatingObj = new FloatingObject(r->type);
@@ -2271,6 +2267,10 @@
 
                 floatingObj->width = r->width;
                 floatingObj->node = r->node;
+                if (!m_floatingObjects) {
+                    m_floatingObjects = new QPtrList<FloatingObject>;
+                    m_floatingObjects->setAutoDelete(true);
+                 }
                 m_floatingObjects->append(floatingObj);
 #ifdef DEBUG_LAYOUT
                 kdDebug( 6040 ) << "addOverHangingFloats x/y= (" << \
floatingObj->left << "/" << floatingObj->startY << "-" << floatingObj->width << "/" \
<< floatingObj->endY - floatingObj->startY << ")" << endl;


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

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