[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:36:55 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit fae2b2fcad1fb6c7029f0ca99ec849f12dfd8a96
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Apr 26 06:38:10 2004 +0000

    	Fix for 3258403, implement support for min-height and max-height on normal flow elements.  With this patch the
    	only min-height/max-height work that remains to be done is for table cells and positioned elements.
    
            Reviewed by darin
    
            * khtml/rendering/render_box.cpp:
            (RenderBox::calcHeight):
            (RenderBox::calcHeightUsing):
            (RenderBox::calcPercentageHeight):
            * khtml/rendering/render_box.h:
            * layout-tests/fast/block/basic/minheight-expected.txt: Added.
            * layout-tests/fast/block/basic/minheight.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6482 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/fast/block/basic/minheight-expected.txt b/LayoutTests/fast/block/basic/minheight-expected.txt
new file mode 100644
index 0000000..00fae35
--- /dev/null
+++ b/LayoutTests/fast/block/basic/minheight-expected.txt
@@ -0,0 +1,26 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock (relative positioned) {DIV} at (0,0) size 800x600
+    RenderBlock {DIV} at (0,0) size 800x220 [bgcolor=#6CAAD9]
+      RenderBlock {H1} at (10,10) size 780x30
+        RenderText {TEXT} at (0,1) size 53x18
+          text run at (0,1) width 53: "Content"
+      RenderBlock {P} at (10,40) size 780x30
+        RenderText {TEXT} at (0,1) size 464x18
+          text run at (0,1) width 464: "Please resize the browser window to see how your 100% CSS footer behaves."
+      RenderBlock {P} at (10,70) size 780x102
+        RenderText {TEXT} at (0,1) size 770x90
+          text run at (0,1) width 769: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras porttitor. Ut nonummy vestibulum arcu. Nulla eros eros, mattis et,"
+          text run at (0,19) width 770: "dictum quis, convallis vel, mauris. Ut sed mauris vel metus pretium pretium. Curabitur tristique sem id justo. Nunc sit amet felis."
+          text run at (0,37) width 732: "Duis luctus pharetra urna. Sed enim arcu, cursus a, posuere sed, sollicitudin in, justo. Pellentesque enim lacus, egestas ut,"
+          text run at (0,55) width 750: "elementum eu, molestie vel, urna. Integer quam. Phasellus tempor. Sed commodo porttitor justo. Vestibulum rhoncus lacinia"
+          text run at (0,73) width 429: "pede. Aliquam lectus velit, auctor a, fermentum a, accumsan et, neque."
+layer at (0,562) size 620x38
+  RenderBlock (positioned) {DIV} at (0,562) size 620x38 [bgcolor=#0066B2]
+    RenderBlock {H1} at (10,10) size 600x18 [color=#FFFFFF]
+      RenderText {TEXT} at (0,1) size 43x18
+        text run at (0,1) width 43: "Footer"
diff --git a/LayoutTests/fast/block/basic/minheight.html b/LayoutTests/fast/block/basic/minheight.html
new file mode 100644
index 0000000..2326788
--- /dev/null
+++ b/LayoutTests/fast/block/basic/minheight.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+	"DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+	<head>
+		<title>Example 2: Position a footer with CSS - step 2</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+		<style type="text/css">
+		<!--
+			html, body {
+				height: 100%;
+			}
+			body {
+				margin: 0;
+				padding: 0;
+				font: 12px/1.5 verdana, arial, helvetica, sans-serif;
+			}
+			#container {
+				position: relative;
+				min-height: 100%;
+			}
+			#content {
+				padding: 10px;
+				background-color: #6caad9;
+				padding-bottom: 48px;
+			}
+			#footer {
+				position: absolute;
+				bottom: 0;
+				padding: 10px;
+				background-color: #0066b2;
+				width: 75%;
+			}
+			#footer h1 {
+				color: #fff;
+				padding-bottom: 0;
+			}
+			h1, p {
+				margin: 0;
+				padding-bottom: 1em;
+			}
+			h1 {
+				font-size: 12px;
+				line-height: 1.5em;
+			}
+		-->
+		</style>
+	</head>
+	<body>
+		<div id="container">
+			<div id="content">
+				<h1>Content</h1>
+				<p>Please resize the browser window to see how your 100% CSS footer behaves.</p>
+				<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras porttitor. Ut nonummy vestibulum arcu. Nulla eros eros, mattis et, dictum quis, convallis vel, mauris. Ut sed mauris vel metus pretium pretium. Curabitur tristique sem id justo. Nunc sit amet felis. Duis luctus pharetra urna. Sed enim arcu, cursus a, posuere sed, sollicitudin in, justo. Pellentesque enim lacus, egestas ut, elementum eu, molestie vel, urna. Integer quam. Phasellus tempor. Sed commodo porttitor justo. Vestibulum rhoncus lacinia pede. Aliquam lectus velit, auctor a, fermentum a, accumsan et, neque.</p>
+			</div>
+			<div id="footer">
+				<h1>Footer</h1>
+			</div>
+		</div>
+	</body>
+</html>
\ No newline at end of file
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index d44b0e5..2c0a43a 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2004-04-23  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3258403, implement support for min-height and max-height on normal flow elements.  With this patch the
+	only min-height/max-height work that remains to be done is for table cells and positioned elements.
+	
+        Reviewed by darin
+
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::calcHeight):
+        (RenderBox::calcHeightUsing):
+        (RenderBox::calcPercentageHeight):
+        * khtml/rendering/render_box.h:
+        * layout-tests/fast/block/basic/minheight-expected.txt: Added.
+        * layout-tests/fast/block/basic/minheight.html: Added.
+
 2004-04-25  Darin Adler  <darin at apple.com>
 
         Reviewed by Dave.
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index 6ec7ce9..15fe96c 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -180,7 +180,7 @@
 	<key>CFBundleExecutable</key>
 	<string>WebCore</string>
 	<key>CFBundleGetInfoString</key>
-	<string>1.3, Copyright 2004 Apple Computer, Inc.; Copyright 1997 Martin Jones &lt;mjones at kde.org&gt;; Copyright 1998, 1999 Torben Weis &lt;weis at kde.org&gt;; Copyright 1998, 1999, 2002 Waldo Bastian &lt;bastian at kde.org&gt;; Copyright 1998-2000 Lars Knoll &lt;knoll at kde.org&gt;; Copyright 1999, 2001 Antti Koivisto &lt;koivisto at kde.org&gt;; Copyright 1999-2001 Harri Porten &lt;porten at kde.org&gt;; Copyright 2000 Simon Hausmann &lt;hausmann at kde.org&gt;; Copyright 2000, 2001 Dirk Mueller &lt;mueller at kde.org&gt;; Copyright 2000, 2001 Peter Kelly &lt;pmk at post.com&gt;; Copyright 2000 Daniel Molkentin &lt;molkentin at kde.org&gt;; Copyright 2000 Stefan Schimanski &lt;schimmi at kde.org&gt;; Copyright 1998-2000 Netscape Communications Corporation.</string>
+	<string>1.3, Copyright 2004 Apple Computer, Inc.; Copyright 1997 Martin Jones &lt;mjones at kde.org&gt;; Copyright 1998, 1999 Torben Weis &lt;weis at kde.org&gt;; Copyright 1998, 1999, 2002 Waldo Bastian &lt;bastian at kde.org&gt;; Copyright 1998-2000 Lars Knoll &lt;knoll at kde.org&gt;; Copyright 1999, 2001 Antti Koivisto &lt;koivisto at kde.org&gt;; Copyright 1999-2001 Harri Porten &lt;porten at kde.org&gt;; Copyright 2000 Simon Hausmann &lt;hausmann at kde.org&gt;; Copyright 2000, 2001 Dirk Mueller &lt;mueller at kde.org&gt;; Copyright 2000, 2001 Peter Kelly &lt;pmk at post.com&gt;; Copyright 2000 Daniel Molkentin &lt;molkentin at kde.org&gt;; Copyright 2000 Stefan Schimanski &lt;schimmi at kde.org&gt;; Copyright 1998-2000 Netscape Communications Corporation; Copyright 1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark Cooper; Copyright 2001, 2002 Expat maintainers.</string>
 	<key>CFBundleIdentifier</key>
 	<string>com.apple.WebCore</string>
 	<key>CFBundleInfoDictionaryVersion</key>
diff --git a/WebCore/khtml/rendering/render_box.cpp b/WebCore/khtml/rendering/render_box.cpp
index bb83c5d..12663b9 100644
--- a/WebCore/khtml/rendering/render_box.cpp
+++ b/WebCore/khtml/rendering/render_box.cpp
@@ -879,17 +879,25 @@ void RenderBox::calcHeight()
     kdDebug( 6040 ) << "RenderBox::calcHeight()" << endl;
 #endif
 
-    //cell height is managed by table, inline elements do not have a height property.
-    if ( isTableCell() || (isInline() && !isReplaced()) )
+    // Cell height is managed by the table and inline non-replaced elements do not support a height property.
+    if (isTableCell() || (isInline() && !isReplaced()))
         return;
 
     if (isPositioned())
         calcAbsoluteVertical();
     else
     {
+        calcVerticalMargins();
+        
+        // For tables, calculate margins only
+        if (isTable())
+            return;
+        
         Length h;
         bool inHorizontalBox = parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL;
         bool stretching = parent()->style()->boxAlign() == BSTRETCH;
+        bool treatAsReplaced = isReplaced() && !isInlineBlockOrInlineTable() && (!inHorizontalBox || !stretching);
+        bool checkMinMaxHeight = false;
         
         // The parent box is flexing us, so it has increased or decreased our height.  We have to
         // grab our cached flexible height.
@@ -897,45 +905,36 @@ void RenderBox::calcHeight()
             && parent()->isFlexingChildren() && style()->boxFlexedHeight() != -1)
             h = Length(style()->boxFlexedHeight() - borderTop() - borderBottom() -
                        paddingTop() - paddingBottom(), Fixed);
-        else if ( isReplaced() && !isInlineBlockOrInlineTable() &&
-                  (!inHorizontalBox || !stretching )) {
-            h = Length( calcReplacedHeight(), Fixed );
-        }
-        else
+        else if (treatAsReplaced)
+            h = Length(calcReplacedHeight(), Fixed);
+        else {
             h = style()->height();
-
-        calcVerticalMargins();
-
-        // for tables, calculate margins only
-        if (isTable())
-            return;
-
-        // The parent box is flexing us, so it has increased or decreased our height.  We have to
-        // grab our cached flexible height.
-        if (parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL
-            && parent()->isFlexingChildren() && style()->boxFlexedHeight() != -1)
-            h = Length(style()->boxFlexedHeight() - borderTop() - borderBottom() -
-                       paddingTop() - paddingBottom(), Fixed);
+            checkMinMaxHeight = true;
+        }
         
         // Block children of horizontal flexible boxes fill the height of the box.
         if (h.isVariable() && parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL
-            && parent()->isStretchingChildren())
+            && parent()->isStretchingChildren()) {
             h = Length(parent()->contentHeight() - marginTop() - marginBottom() -
                        borderTop() - paddingTop() - borderBottom() - paddingBottom(), Fixed);
+            checkMinMaxHeight = false;
+        }
 
-        if (!h.isVariable()) {
-            int fh = -1;
-            if (h.isFixed())
-                fh = h.value;
-            else if (h.isPercent())
-                fh = calcPercentageHeight();
-            if (fh != -1) {
-                fh += borderTop() + paddingTop() + borderBottom() + paddingBottom();
-                if (fh < m_height && !overhangingContents() && style()->overflow() == OVISIBLE)
-                    setOverhangingContents();
-                m_height = fh;
-            }
+        int height;
+        if (checkMinMaxHeight) {
+            height = calcHeightUsing(style()->height());
+            int minH = calcHeightUsing(style()->minHeight());
+            int maxH = style()->maxHeight().value == UNDEFINED ? height : calcHeightUsing(style()->maxHeight());
+            height = kMin(maxH, height);
+            height = kMax(minH, height);
+            if (height < m_height && !overhangingContents() && style()->overflow() == OVISIBLE)
+                setOverhangingContents();
         }
+        else
+            // The only times we don't check min/max height are when a fixed length has 
+            // been given as an override.  Just use that.
+            height = h.value + borderTop() + paddingTop() + borderBottom() + paddingBottom(); 
+        m_height = height;
     }
     
     // Unfurling marquees override with the furled height.
@@ -946,7 +945,23 @@ void RenderBox::calcHeight()
     }
 }
 
-int RenderBox::calcPercentageHeight()
+int RenderBox::calcHeightUsing(const Length& h)
+{
+    if (!h.isVariable()) {
+        int height = -1;
+        if (h.isFixed())
+            height = h.value;
+        else if (h.isPercent())
+            height = calcPercentageHeight(h);
+        if (height != -1) {
+            height += borderTop() + paddingTop() + borderBottom() + paddingBottom();
+            return height;
+        }
+    }
+    return m_height;
+}
+
+int RenderBox::calcPercentageHeight(const Length& height)
 {
     int result = -1;
     RenderBlock* cb = containingBlock();
@@ -962,7 +977,7 @@ int RenderBox::calcPercentageHeight()
         result = cb->style()->height().value;
     else if (cb->style()->height().isPercent())
         // We need to recur and compute the percentage height for our containing block.
-        result = cb->calcPercentageHeight();
+        result = cb->calcPercentageHeight(cb->style()->height());
     else if (cb->isCanvas()) {
         // Don't allow this to affect the block' m_height member variable, since this
         // can get called while the block is still laying out its kids.
@@ -972,7 +987,7 @@ int RenderBox::calcPercentageHeight()
         cb->setHeight(oldHeight);
     }
     if (result != -1)
-        result = style()->height().width(result);
+        result = height.width(result);
     return result;
 }
 
diff --git a/WebCore/khtml/rendering/render_box.h b/WebCore/khtml/rendering/render_box.h
index 2934dee..ad12e56 100644
--- a/WebCore/khtml/rendering/render_box.h
+++ b/WebCore/khtml/rendering/render_box.h
@@ -107,13 +107,14 @@ public:
     virtual void calcHeight();
 
     int calcWidthUsing(WidthType widthType, int cw, LengthType& lengthType);
+    int calcHeightUsing(const Length& height);
     int calcReplacedWidthUsing(WidthType widthType) const;
     int calcReplacedHeightUsing(HeightType heightType) const;
     
     virtual int calcReplacedWidth() const;
-    virtual int   calcReplacedHeight() const;
+    virtual int calcReplacedHeight() const;
 
-    int calcPercentageHeight();
+    int calcPercentageHeight(const Length& height);
 
     virtual int availableHeight() const;
     int availableHeightUsing(const Length& h) const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list