--- /dev/null
+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"
--- /dev/null
+<!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
+2004-04-23 David Hyatt <hyatt@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@apple.com>
Reviewed by Dave.
<key>CFBundleExecutable</key>
<string>WebCore</string>
<key>CFBundleGetInfoString</key>
- <string>1.3, Copyright 2004 Apple Computer, Inc.; Copyright 1997 Martin Jones <mjones@kde.org>; Copyright 1998, 1999 Torben Weis <weis@kde.org>; Copyright 1998, 1999, 2002 Waldo Bastian <bastian@kde.org>; Copyright 1998-2000 Lars Knoll <knoll@kde.org>; Copyright 1999, 2001 Antti Koivisto <koivisto@kde.org>; Copyright 1999-2001 Harri Porten <porten@kde.org>; Copyright 2000 Simon Hausmann <hausmann@kde.org>; Copyright 2000, 2001 Dirk Mueller <mueller@kde.org>; Copyright 2000, 2001 Peter Kelly <pmk@post.com>; Copyright 2000 Daniel Molkentin <molkentin@kde.org>; Copyright 2000 Stefan Schimanski <schimmi@kde.org>; Copyright 1998-2000 Netscape Communications Corporation.</string>
+ <string>1.3, Copyright 2004 Apple Computer, Inc.; Copyright 1997 Martin Jones <mjones@kde.org>; Copyright 1998, 1999 Torben Weis <weis@kde.org>; Copyright 1998, 1999, 2002 Waldo Bastian <bastian@kde.org>; Copyright 1998-2000 Lars Knoll <knoll@kde.org>; Copyright 1999, 2001 Antti Koivisto <koivisto@kde.org>; Copyright 1999-2001 Harri Porten <porten@kde.org>; Copyright 2000 Simon Hausmann <hausmann@kde.org>; Copyright 2000, 2001 Dirk Mueller <mueller@kde.org>; Copyright 2000, 2001 Peter Kelly <pmk@post.com>; Copyright 2000 Daniel Molkentin <molkentin@kde.org>; Copyright 2000 Stefan Schimanski <schimmi@kde.org>; 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>
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.
&& 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.
}
}
-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();
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.
cb->setHeight(oldHeight);
}
if (result != -1)
- result = style()->height().width(result);
+ result = height.width(result);
return result;
}
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;