[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-04-22 14:15:39
Message-ID: 1208873739.946655.12514.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 799846 by ggarand:

automatically merged revision 796959:
.Fix solving of percentage height for positioned elements, in light
 of the nota bene in CSS 2.1-10.5.

.Satisfyingly, the same code path can also be used to solve percentage
 intrinsic height (10.6.2) - (#160371)

.Fix some errors in the implicit height code, that wasn't converting to
 content height.

BUG:160371

 M  +14 -5     render_box.cpp  
 M  +1 -1      render_box.h  


--- branches/KDE/4.0/kdelibs/khtml/rendering/render_box.cpp #799845:799846
@@ -1185,16 +1185,16 @@
     return height;
 }
 
-int RenderBox::calcImplicitHeight() const {
+int RenderBox::calcImplicitContentHeight() const {
     assert(hasImplicitHeight());
 
     RenderBlock* cb = containingBlock();
     // padding-box height
-    int ch = cb->height() - cb->borderTop() + cb->borderBottom();
+    int ch = cb->height() - cb->borderTop() - cb->borderBottom();
     int top = style()->top().width(ch);
     int bottom = style()->bottom().width(ch);
 
-    return ch - top - bottom;
+    return ch - top - bottom - borderTop() - borderBottom() - paddingTop() - \
paddingBottom();;  }
 
 int RenderBox::calcPercentageHeight(const Length& height, bool treatAsReplaced) \
const @@ -1239,12 +1239,21 @@
                               borderTop() + borderBottom() +
                               paddingTop() + paddingBottom());
     }
+    else if (isPositioned()) {
+        // "10.5 - Note that the height of the containing block of an absolutely \
positioned element is independent +        //  of the size of the element itself, and \
thus a percentage height on such an element can always be resolved." +        //
+        // take the used height - at the padding edge since we are positioned (10.1)
+        result = cb->height() - cb->borderTop() - cb->borderBottom();
+    }
     else if (cb->isAnonymousBlock() || treatAsReplaced && style()->htmlHacks()) {
         // IE quirk.
         result = cb->calcPercentageHeight(cb->style()->height(), treatAsReplaced);
+        if (result != -1)
+            result = cb->calcContentHeight(result);
     }
     else if (cb->hasImplicitHeight()) {
-        result = cb->calcImplicitHeight();
+        result = cb->calcImplicitContentHeight();
     }
 
     if (result != -1) {
@@ -1368,7 +1377,7 @@
 
     // Check for implicit height
     if (hasImplicitHeight())
-        return calcImplicitHeight();
+        return calcImplicitContentHeight();
 
     return containingBlock()->availableHeight();
 }
--- branches/KDE/4.0/kdelibs/khtml/rendering/render_box.h #799845:799846
@@ -144,7 +144,7 @@
     int calcPercentageHeight(const Length& height, bool treatAsReplaced = false) \
const;  int availableHeightUsing(const Length& h) const;
     int availableWidthUsing(const Length& w) const;
-    int calcImplicitHeight() const;
+    int calcImplicitContentHeight() const;
     bool hasImplicitHeight() const {
         return isPositioned() && !style()->top().isVariable() && \
!style()->bottom().isVariable();  }


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

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