calcAbsoluteVertical question

Dirk Mueller mueller@kde.org
Thu, 9 Jan 2003 08:18:42 +0100


On Mit, 08 Jan 2003, David Hyatt wrote:

> I'm in the process of addressing diveintomark.org's issues with Safari. 

Ups, some links missing, indeed. 

>  At #3 is an issue with positioning using "bottom".  I noticed you made 
> some fixes to calcAbsoluteVertical (as have I), so I merged that 
> function in with your trunk.  It looks to me, though, like the 
> following line on the current trunk:
> 
> if(!style()->bottom().isVariable())
>         b = style()->bottom().width(ch) - cb->borderBottom();
> 
> should actually be
> 
> if(!style()->bottom().isVariable())
>         b = style()->bottom().width(ch) + cb->borderBottom();
> 
> It seems like you are determining a value for bottom, and that means 
> you want to translate up and not down?

yes, but b is relative to padding border. 

I believe this could be the correct fix. Not at all tested, it should 
compile though: 

Index: render_box.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_box.cpp,v
retrieving revision 1.188
diff -u -5 -d -p -r1.188 render_box.cpp
--- render_box.cpp	8 Jan 2003 19:10:43 -0000	1.188
+++ render_box.cpp	9 Jan 2003 07:14:44 -0000
@@ -818,16 +818,15 @@ void RenderBox::calcAbsoluteVertical()
     int pab = borderTop()+borderBottom()+paddingTop()+paddingBottom();
     RenderObject* cb = containingBlock();
 
     Length hl = cb->style()->height();
     if (hl.isFixed())
-        ch = hl.value + cb->paddingTop()
-             + cb->paddingBottom();
+        ch = hl.value + cb->paddingTop() + cb->paddingBottom();
     else if (cb->isHtml())
-        ch = cb->availableHeight();
+        ch = cb->availableHeight() + cb->paddingTop() + cb->paddingBottom();
     else
-        ch = cb->height();
+        ch = cb->height() - cb->borderBottom() - cb->borderTop();
 
     if(!style()->top().isVariable())
         t = style()->top().width(ch) + cb->borderTop();
     if(!style()->bottom().isVariable())
         b = style()->bottom().width(ch) - cb->borderBottom();


would be great if you could give me feedback upon this. 


-- 
Dirk (received 274 mails today)