1447 int oldHeight = block->height(); |
1447 int oldHeight = block->height(); |
1448 block->calcHeight(); |
1448 block->calcHeight(); |
1449 int newHeight = block->calcContentBoxHeight(block->contentHeight()); |
1449 int newHeight = block->calcContentBoxHeight(block->contentHeight()); |
1450 block->setHeight(oldHeight); |
1450 block->setHeight(oldHeight); |
1451 return calcContentBoxHeight(height.calcValue(newHeight)); |
1451 return calcContentBoxHeight(height.calcValue(newHeight)); |
|
1452 } |
|
1453 // As per CSS2, percentage based height computes to 'auto', if the height of the containing block |
|
1454 // is not specified explicitly, and this element is not absolutely positioned. |
|
1455 // In standard mode, we try to follow this rule. |
|
1456 if (!style()->htmlHacks() && cb->style()->height().isAuto() && !isPositioned() && !cb->isRenderView() && !cb->isTableCell()) { |
|
1457 IntSize size = intrinsicSize(); |
|
1458 // Try to keep aspect ratio. |
|
1459 int h = size.width() ? calcReplacedWidth() * size.height() / size.width() : size.height(); |
|
1460 if (h > 0) |
|
1461 return calcContentBoxHeight(h); |
1452 } |
1462 } |
1453 |
1463 |
1454 int availableHeight = isPositioned() ? containingBlockHeightForPositioned(cb) : cb->availableHeight(); |
1464 int availableHeight = isPositioned() ? containingBlockHeightForPositioned(cb) : cb->availableHeight(); |
1455 |
1465 |
1456 // It is necessary to use the border-box to match WinIE's broken |
1466 // It is necessary to use the border-box to match WinIE's broken |
1457 // box model. This is essential for sizing inside |
1467 // box model. This is essential for sizing inside |
1458 // table cells using percentage heights. |
1468 // table cells using percentage heights. |