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

List:       kfm-devel
Subject:    Re: Slashdot
From:       Michael Bedy <mjbedy () mediaone ! net>
Date:       2001-01-13 2:58:28
[Download RAW message or body]

Ok. I will recompile everything then. 

  Thanks for letting me know. Hopefully whatever the problem is here is
just some fluke that will go away on recompile...

  Attached is a new version of my patch with one line changed. percentage
should be initialized to 0, not -1. When I have a sane setup again I will
test it a bit more.

  Thanks!
    - Mike


On Sat, 13 Jan 2001, Tobias Anton wrote:

> On Saturday 13 January 2001 03:25, Michael Bedy wrote:
> >   Here's an example(attached). Instead of the familiar green background
> > and white text, I get plain bold black writing on a white background. It
> > also does not load the little round corner on the left side.
> >
> >   I'm real close to just blowing everything away and recompiling...
> >
> >     - Mike
> >
> > On Sat, 13 Jan 2001, Tobias Anton wrote:
> > > On Saturday 13 January 2001 03:03, Michael Bedy wrote:
> > > >   Can someone tell me if a recent compile of khtml renders slashdot
> > > > correctly?? I thought it was my patch that was screwing it up, but I
> > > > completely reverted my patch and I get the same problem.
> > > >
> > > >   Is something screwed up in my setup?
> > > >
> > > >     - Mike
> > >
> > > i can't see any serious problems with the slashdot page,
> > > so please describe what you see, or - what i should *not* see.
> > >
> > > Cheers,
> > > Tobias
> Hi!
> Your test page renders fine in my installation, with or without your patch - 
> no difference.
> 
> But for the slashdot page, there's a little difference when resizing the view 
> to a value smaller than the minimum width:
> 
> without your patch:
>  the width of the middle column, containing the atricles, is shrinked so much 
>  that the headlines get wrapped onto the next line
> with your patch:
>  minWidth is bigger as without it, the black document border is twice as 
> large, and the articles column is also wider, so that the headlines nearly 
> fit into it. All i can see is that there's one headline with the ")" wrapped 
> into the next line.
> 
> So, i think your patch improves slashdot's rendering rather than breaking it.
> 
> But if all you see is crap, i'd consider recompiling in any case.
> 
> Cheers,
> Tobias
> 

["TableWidthFix.diff" (TEXT/PLAIN)]

Index: render_table.cpp
===================================================================
RCS file: /home/projects/kdecvs/cvsroot/kdelibs/khtml/rendering/render_table.cpp,v
retrieving revision 1.86
diff -u -r1.86 render_table.cpp
--- render_table.cpp	2001/01/05 01:01:23	1.86
+++ render_table.cpp	2001/01/13 02:54:45
@@ -100,12 +100,14 @@
     columnPos.resize( 2 );
     colMaxWidth.resize( 1 );
     colMinWidth.resize( 1 );
+    colFixedPercent.resize( 1 );
     colValue.resize(1);
     colType.resize(1);
     actColWidth.resize(1);
     columnPos.fill( 0 );
     colMaxWidth.fill( 0 );
     colMinWidth.fill( 0 );
+    colFixedPercent.fill( 0 );
     colValue.fill(0);
     colType.fill(Variable);
     actColWidth.fill(0);
@@ -322,6 +324,8 @@
     memset( colMaxWidth.data() + totalCols , 0, num*sizeof(int));
     colMinWidth.resize(newCols);
     memset( colMinWidth.data() + totalCols , 0, num*sizeof(int));
+    colFixedPercent.resize(newCols);
+    memset( colFixedPercent.data() + totalCols , 0, num*sizeof(int));
     colValue.resize(newCols);
     memset( colValue.data() + totalCols , 0, num*sizeof(int));
     colType.resize(newCols);
@@ -454,9 +458,23 @@
     }
     if (_width.type > col->type)
     {
+        // We need to keep track of percentages, to make some
+        // b0rked tables look right.
+        //
+        if (col->type == Percent)
+            col->percentage = col->value;
+
         col->type = _width.type;
         col->value = _width.value;
     }
+    // Make sure we see all percentages..
+    //
+    if (_width.type < col->type &&
+        _width.type == Percent)
+    {
+        col->percentage = _width.value;
+    }
+
     if (_width.type == col->type)
     {
         if (_width.value > col->value)
@@ -696,6 +714,7 @@
         colMaxWidth[c] = smax;
         colValue[c] = col->value;
         colType[c] = col->type;
+        colFixedPercent[c] = col->percentage;
     }
     else
     {
@@ -782,6 +801,7 @@
 
     colMinWidth.fill(0);
     colMaxWidth.fill(0);
+    colFixedPercent.fill(0);
 
     int availableWidth = containingBlockWidth();
 
@@ -845,6 +865,7 @@
     totalRelative=0;
 
     int maxFixed=0;
+    int maxFixedPercent=0;
     int minPercent=0;
     int percentWidest=0;
     int percentWidestPercent=0;
@@ -868,6 +889,7 @@
         {
         case Fixed:
             maxFixed += colMaxWidth[i] + spacing;
+            maxFixedPercent += colFixedPercent[i];
             hasFixed=true;
             break;
         case Percent:
@@ -922,9 +944,18 @@
     else if (hasPercent && hasFixed)
     {
         int tot = QMIN(99,totalPercent);
+
+        // Don't let columns with both fixed and percent constrain the table
+        // size.
+        //
+        int ourPercent = (100 - tot);
+
+        if (maxFixedPercent > 0)
+            ourPercent = maxFixedPercent;
+
 //      kdDebug( 6040 ) << "3 maxFixed=" << maxFixed << "  totalPercent=" << totalPercent << endl;
         m_width = (maxFixed + minVar + minRel) * 100 /
-            (100 - tot);
+            ourPercent;
         m_width = QMIN (m_width, availableWidth);
     }
     else
Index: render_table.h
===================================================================
RCS file: /home/projects/kdecvs/cvsroot/kdelibs/khtml/rendering/render_table.h,v
retrieving revision 1.39
diff -u -r1.39 render_table.h
--- render_table.h	2001/01/03 04:28:17	1.39
+++ render_table.h	2001/01/13 02:54:45
@@ -157,6 +157,7 @@
             value=0;
             minCell=0;
             maxCell=0;
+            percentage=0;
         }
         void update();
 
@@ -215,6 +216,7 @@
     QArray<int> columnPos;
     QArray<int> colMaxWidth;
     QArray<int> colMinWidth;
+    QArray<int> colFixedPercent;
     QArray<khtml::LengthType> colType;
     QArray<int> colValue;
     QArray<int> rowHeights;
@@ -392,7 +394,7 @@
     int _topExtra;
     int _bottomExtra;
     bool nWrap;
-    bool _implicitCell:1; 
+    bool _implicitCell:1;
 
     virtual int borderTopExtra() { return _topExtra; }
     virtual int borderBottomExtra() { return _bottomExtra; }


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

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