OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
500 } | 500 } |
501 | 501 |
502 LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWi dth, LayoutUnit availableWidth, RenderBlock* cb, RenderRegion* region, LayoutUni t offsetFromLogicalTopOfFirstPage) const | 502 LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWi dth, LayoutUnit availableWidth, RenderBlock* cb, RenderRegion* region, LayoutUni t offsetFromLogicalTopOfFirstPage) const |
503 { | 503 { |
504 RenderStyle* styleToUse = style(); | 504 RenderStyle* styleToUse = style(); |
505 if (!styleToUse->logicalMaxWidth().isUndefined()) | 505 if (!styleToUse->logicalMaxWidth().isUndefined()) |
506 logicalWidth = min(logicalWidth, computeLogicalWidthInRegionUsing(MaxSiz e, styleToUse->logicalMaxWidth(), availableWidth, cb, region, offsetFromLogicalT opOfFirstPage)); | 506 logicalWidth = min(logicalWidth, computeLogicalWidthInRegionUsing(MaxSiz e, styleToUse->logicalMaxWidth(), availableWidth, cb, region, offsetFromLogicalT opOfFirstPage)); |
507 return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, styleToUs e->logicalMinWidth(), availableWidth, cb, region, offsetFromLogicalTopOfFirstPag e)); | 507 return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, styleToUs e->logicalMinWidth(), availableWidth, cb, region, offsetFromLogicalTopOfFirstPag e)); |
508 } | 508 } |
509 | 509 |
510 LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight) c onst | 510 LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L ayoutUnit contentHeight) const |
511 { | 511 { |
512 RenderStyle* styleToUse = style(); | 512 RenderStyle* styleToUse = style(); |
513 if (!styleToUse->logicalMaxHeight().isUndefined()) { | 513 if (!styleToUse->logicalMaxHeight().isUndefined()) { |
514 LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight ()); | 514 LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight (), contentHeight); |
515 if (maxH != -1) | 515 if (maxH != -1) |
516 logicalHeight = min(logicalHeight, maxH); | 516 logicalHeight = min(logicalHeight, maxH); |
517 } | 517 } |
518 return max(logicalHeight, computeLogicalHeightUsing(styleToUse->logicalMinHe ight())); | 518 return max(logicalHeight, computeLogicalHeightUsing(styleToUse->logicalMinHe ight(), contentHeight)); |
519 } | 519 } |
520 | 520 |
521 LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica lHeight) const | 521 LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica lHeight, LayoutUnit contentHeight) const |
522 { | 522 { |
523 RenderStyle* styleToUse = style(); | 523 RenderStyle* styleToUse = style(); |
524 if (!styleToUse->logicalMaxHeight().isUndefined()) { | 524 if (!styleToUse->logicalMaxHeight().isUndefined()) { |
525 LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeig ht()); | 525 LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeig ht(), contentHeight); |
526 if (maxH != -1) | 526 if (maxH != -1) |
527 logicalHeight = min(logicalHeight, maxH); | 527 logicalHeight = min(logicalHeight, maxH); |
528 } | 528 } |
529 return max(logicalHeight, computeContentLogicalHeight(styleToUse->logicalMin Height())); | 529 return max(logicalHeight, computeContentLogicalHeight(styleToUse->logicalMin Height(), contentHeight)); |
530 } | 530 } |
531 | 531 |
532 IntRect RenderBox::absoluteContentBox() const | 532 IntRect RenderBox::absoluteContentBox() const |
533 { | 533 { |
534 // This is wrong with transforms and flipped writing modes. | 534 // This is wrong with transforms and flipped writing modes. |
535 IntRect rect = pixelSnappedIntRect(contentBoxRect()); | 535 IntRect rect = pixelSnappedIntRect(contentBoxRect()); |
536 FloatPoint absPos = localToAbsolute(); | 536 FloatPoint absPos = localToAbsolute(); |
537 rect.move(absPos.x(), absPos.y()); | 537 rect.move(absPos.x(), absPos.y()); |
538 return rect; | 538 return rect; |
539 } | 539 } |
(...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2503 // FIXME: Account for block-flow in flexible boxes. | 2503 // FIXME: Account for block-flow in flexible boxes. |
2504 // https://bugs.webkit.org/show_bug.cgi?id=46418 | 2504 // https://bugs.webkit.org/show_bug.cgi?id=46418 |
2505 if (h.isAuto() && parent()->isDeprecatedFlexibleBox() && parent()->style ()->boxOrient() == HORIZONTAL | 2505 if (h.isAuto() && parent()->isDeprecatedFlexibleBox() && parent()->style ()->boxOrient() == HORIZONTAL |
2506 && parent()->isStretchingChildren()) { | 2506 && parent()->isStretchingChildren()) { |
2507 h = Length(parentBox()->contentLogicalHeight() - marginBefore() - ma rginAfter() - borderAndPaddingLogicalHeight(), Fixed); | 2507 h = Length(parentBox()->contentLogicalHeight() - marginBefore() - ma rginAfter() - borderAndPaddingLogicalHeight(), Fixed); |
2508 checkMinMaxHeight = false; | 2508 checkMinMaxHeight = false; |
2509 } | 2509 } |
2510 | 2510 |
2511 LayoutUnit heightResult; | 2511 LayoutUnit heightResult; |
2512 if (checkMinMaxHeight) { | 2512 if (checkMinMaxHeight) { |
2513 heightResult = computeLogicalHeightUsing(style()->logicalHeight()); | 2513 heightResult = computeLogicalHeightUsing(style()->logicalHeight(), c omputedValues.m_extent - borderAndPaddingLogicalHeight()); |
2514 if (heightResult == -1) | 2514 if (heightResult == -1) |
2515 heightResult = computedValues.m_extent; | 2515 heightResult = computedValues.m_extent; |
2516 heightResult = constrainLogicalHeightByMinMax(heightResult); | 2516 heightResult = constrainLogicalHeightByMinMax(heightResult, computed Values.m_extent - borderAndPaddingLogicalHeight()); |
2517 } else { | 2517 } else { |
2518 // The only times we don't check min/max height are when a fixed len gth has | 2518 // The only times we don't check min/max height are when a fixed len gth has |
2519 // been given as an override. Just use that. The value has already been adjusted | 2519 // been given as an override. Just use that. The value has already been adjusted |
2520 // for box-sizing. | 2520 // for box-sizing. |
2521 ASSERT(h.isFixed()); | |
2521 heightResult = h.value() + borderAndPaddingLogicalHeight(); | 2522 heightResult = h.value() + borderAndPaddingLogicalHeight(); |
2522 } | 2523 } |
2523 | 2524 |
2524 computedValues.m_extent = heightResult; | 2525 computedValues.m_extent = heightResult; |
2525 | 2526 |
2526 if (hasPerpendicularContainingBlock) { | 2527 if (hasPerpendicularContainingBlock) { |
2527 bool shouldFlipBeforeAfter = shouldFlipBeforeAfterMargins(cb->style( ), style()); | 2528 bool shouldFlipBeforeAfter = shouldFlipBeforeAfterMargins(cb->style( ), style()); |
2528 computeInlineDirectionMargins(cb, containingBlockLogicalWidthForCont ent(), heightResult, | 2529 computeInlineDirectionMargins(cb, containingBlockLogicalWidthForCont ent(), heightResult, |
2529 shouldFlipBeforeAfter ? computedValues.m_margins.m_after : c omputedValues.m_margins.m_before, | 2530 shouldFlipBeforeAfter ? computedValues.m_margins.m_after : c omputedValues.m_margins.m_before, |
2530 shouldFlipBeforeAfter ? computedValues.m_margins.m_before : computedValues.m_margins.m_after); | 2531 shouldFlipBeforeAfter ? computedValues.m_margins.m_before : computedValues.m_margins.m_after); |
(...skipping 19 matching lines...) Expand all Loading... | |
2550 } | 2551 } |
2551 } | 2552 } |
2552 | 2553 |
2553 LayoutUnit RenderBox::viewLogicalHeightForPercentages() const | 2554 LayoutUnit RenderBox::viewLogicalHeightForPercentages() const |
2554 { | 2555 { |
2555 if (document()->printing()) | 2556 if (document()->printing()) |
2556 return static_cast<LayoutUnit>(view()->pageLogicalHeight()); | 2557 return static_cast<LayoutUnit>(view()->pageLogicalHeight()); |
2557 return view()->viewLogicalHeight(); | 2558 return view()->viewLogicalHeight(); |
2558 } | 2559 } |
2559 | 2560 |
2560 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height) const | 2561 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit contentHeight) const |
2561 { | 2562 { |
2562 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig ht); | 2563 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig ht, contentHeight); |
2563 if (logicalHeight != -1) | 2564 if (logicalHeight != -1) |
2564 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); | 2565 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); |
2565 return logicalHeight; | 2566 return logicalHeight; |
2566 } | 2567 } |
2567 | 2568 |
2568 LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height) const | 2569 LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height, LayoutUn it contentHeight) const |
2569 { | 2570 { |
2570 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh tUsing(height); | 2571 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh tUsing(height, contentHeight); |
2571 if (heightIncludingScrollbar == -1) | 2572 if (heightIncludingScrollbar == -1) |
2572 return -1; | 2573 return -1; |
2573 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(hei ghtIncludingScrollbar) - scrollbarLogicalHeight()); | 2574 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(hei ghtIncludingScrollbar) - scrollbarLogicalHeight()); |
2574 } | 2575 } |
2575 | 2576 |
2576 LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height) const | 2577 LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height, LayoutUnit contentHeight) const |
2577 { | 2578 { |
2579 if (height.isMinContent() || height.isMaxContent() || height.isFitContent()) | |
ojan
2013/04/11 03:21:46
Maybe include a FIXME that the spec is considering
cbiesinger
2013/04/12 01:17:52
Done.
| |
2580 return contentHeight; | |
2581 if (height.isFillAvailable()) | |
2582 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd ing) - borderAndPaddingLogicalHeight(); | |
2578 if (height.isFixed()) | 2583 if (height.isFixed()) |
2579 return height.value(); | 2584 return height.value(); |
2580 if (height.isPercent()) | 2585 if (height.isPercent()) |
2581 return computePercentageLogicalHeight(height); | 2586 return computePercentageLogicalHeight(height); |
2582 if (height.isViewportPercentage()) | 2587 if (height.isViewportPercentage()) |
2583 return valueForLength(height, 0, view()); | 2588 return valueForLength(height, 0, view()); |
2584 return -1; | 2589 return -1; |
2585 } | 2590 } |
2586 | 2591 |
2587 bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock) const | 2592 bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock) const |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2638 RenderTableCell* cell = toRenderTableCell(cb); | 2643 RenderTableCell* cell = toRenderTableCell(cb); |
2639 if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAut o() || !cell->table()->style()->logicalHeight().isAuto())) | 2644 if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAut o() || !cell->table()->style()->logicalHeight().isAuto())) |
2640 return 0; | 2645 return 0; |
2641 return -1; | 2646 return -1; |
2642 } | 2647 } |
2643 availableHeight = cb->overrideLogicalContentHeight(); | 2648 availableHeight = cb->overrideLogicalContentHeight(); |
2644 includeBorderPadding = true; | 2649 includeBorderPadding = true; |
2645 } | 2650 } |
2646 } else if (cbstyle->logicalHeight().isFixed()) { | 2651 } else if (cbstyle->logicalHeight().isFixed()) { |
2647 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz ing(cbstyle->logicalHeight().value()); | 2652 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz ing(cbstyle->logicalHeight().value()); |
2648 availableHeight = max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeigh tByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight())); | 2653 availableHeight = max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeigh tByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1)); |
2649 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit hSpecifiedHeight) { | 2654 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit hSpecifiedHeight) { |
2650 // We need to recur and compute the percentage height for our containing block. | 2655 // We need to recur and compute the percentage height for our containing block. |
2651 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst yle->logicalHeight()); | 2656 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst yle->logicalHeight()); |
2652 if (heightWithScrollbar != -1) { | 2657 if (heightWithScrollbar != -1) { |
2653 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic alHeightForBoxSizing(heightWithScrollbar); | 2658 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic alHeightForBoxSizing(heightWithScrollbar); |
2654 // We need to adjust for min/max height because this method does not | 2659 // We need to adjust for min/max height because this method does not |
2655 // handle the min/max of the current block, its caller does. So the | 2660 // handle the min/max of the current block, its caller does. So the |
2656 // return value from the recursive call will not have been adjusted | 2661 // return value from the recursive call will not have been adjusted |
2657 // yet. | 2662 // yet. |
2658 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); | 2663 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1); |
2659 availableHeight = max<LayoutUnit>(0, contentBoxHeight); | 2664 availableHeight = max<LayoutUnit>(0, contentBoxHeight); |
2660 } | 2665 } |
2661 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { | 2666 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { |
2662 // Don't allow this to affect the block' height() member variable, since this | 2667 // Don't allow this to affect the block' height() member variable, since this |
2663 // can get called while the block is still laying out its kids. | 2668 // can get called while the block is still laying out its kids. |
2664 LogicalExtentComputedValues computedValues; | 2669 LogicalExtentComputedValues computedValues; |
2665 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); | 2670 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); |
2666 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH eight() - cb->scrollbarLogicalHeight(); | 2671 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH eight() - cb->scrollbarLogicalHeight(); |
2667 } else if (cb->isRenderView()) | 2672 } else if (cb->isRenderView()) |
2668 availableHeight = viewLogicalHeightForPercentages(); | 2673 availableHeight = viewLogicalHeightForPercentages(); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2810 case ViewportPercentageMin: | 2815 case ViewportPercentageMin: |
2811 case ViewportPercentageMax: | 2816 case ViewportPercentageMax: |
2812 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logi calHeight, 0, view())); | 2817 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logi calHeight, 0, view())); |
2813 default: | 2818 default: |
2814 return intrinsicLogicalHeight(); | 2819 return intrinsicLogicalHeight(); |
2815 } | 2820 } |
2816 } | 2821 } |
2817 | 2822 |
2818 LayoutUnit RenderBox::availableLogicalHeight(AvailableLogicalHeightType heightTy pe) const | 2823 LayoutUnit RenderBox::availableLogicalHeight(AvailableLogicalHeightType heightTy pe) const |
2819 { | 2824 { |
2820 return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style()->l ogicalHeight(), heightType)); | 2825 return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style()->l ogicalHeight(), heightType), -1); |
2821 } | 2826 } |
2822 | 2827 |
2823 LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogi calHeightType heightType) const | 2828 LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogi calHeightType heightType) const |
2824 { | 2829 { |
2825 if (isRenderView()) | 2830 if (isRenderView()) |
2826 return isHorizontalWritingMode() ? toRenderView(this)->frameView()->visi bleHeight() : toRenderView(this)->frameView()->visibleWidth(); | 2831 return isHorizontalWritingMode() ? toRenderView(this)->frameView()->visi bleHeight() : toRenderView(this)->frameView()->visibleWidth(); |
2827 | 2832 |
2828 // We need to stop here, since we don't want to increase the height of the t able | 2833 // We need to stop here, since we don't want to increase the height of the t able |
2829 // artificially. We're going to rely on this cell getting expanded to some new | 2834 // artificially. We're going to rely on this cell getting expanded to some new |
2830 // height, and then when we lay out again we'll use the calculation below. | 2835 // height, and then when we lay out again we'll use the calculation below. |
2831 if (isTableCell() && (h.isAuto() || h.isPercent())) { | 2836 if (isTableCell() && (h.isAuto() || h.isPercent())) { |
2832 if (hasOverrideHeight()) | 2837 if (hasOverrideHeight()) |
2833 return overrideLogicalContentHeight(); | 2838 return overrideLogicalContentHeight(); |
2834 return logicalHeight() - borderAndPaddingLogicalHeight(); | 2839 return logicalHeight() - borderAndPaddingLogicalHeight(); |
2835 } | 2840 } |
2836 | 2841 |
2837 if (h.isPercent() && isOutOfFlowPositioned()) { | 2842 if (h.isPercent() && isOutOfFlowPositioned()) { |
2838 // FIXME: This is wrong if the containingBlock has a perpendicular writi ng mode. | 2843 // FIXME: This is wrong if the containingBlock has a perpendicular writi ng mode. |
2839 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c ontainingBlock()); | 2844 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c ontainingBlock()); |
2840 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail ableHeight)); | 2845 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail ableHeight)); |
2841 } | 2846 } |
2842 | 2847 |
2843 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh tUsing(h); | 2848 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh tUsing(h, -1); |
2844 if (heightIncludingScrollbar != -1) | 2849 if (heightIncludingScrollbar != -1) |
2845 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing (heightIncludingScrollbar) - scrollbarLogicalHeight()); | 2850 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing (heightIncludingScrollbar) - scrollbarLogicalHeight()); |
2846 | 2851 |
2847 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical w riting-mode. | 2852 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical w riting-mode. |
2848 // https://bugs.webkit.org/show_bug.cgi?id=46500 | 2853 // https://bugs.webkit.org/show_bug.cgi?id=46500 |
2849 if (isRenderBlock() && isOutOfFlowPositioned() && style()->height().isAuto() && !(style()->top().isAuto() || style()->bottom().isAuto())) { | 2854 if (isRenderBlock() && isOutOfFlowPositioned() && style()->height().isAuto() && !(style()->top().isAuto() || style()->bottom().isAuto())) { |
2850 RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this)); | 2855 RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this)); |
2851 LogicalExtentComputedValues computedValues; | 2856 LogicalExtentComputedValues computedValues; |
2852 block->computeLogicalHeight(block->logicalHeight(), 0, computedValues); | 2857 block->computeLogicalHeight(block->logicalHeight(), 0, computedValues); |
2853 LayoutUnit newContentHeight = computedValues.m_extent - block->borderAnd PaddingLogicalHeight() - block->scrollbarLogicalHeight(); | 2858 LayoutUnit newContentHeight = computedValues.m_extent - block->borderAnd PaddingLogicalHeight() - block->scrollbarLogicalHeight(); |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3447 | 3452 |
3448 if (computedValues.m_extent > maxValues.m_extent) { | 3453 if (computedValues.m_extent > maxValues.m_extent) { |
3449 computedValues.m_extent = maxValues.m_extent; | 3454 computedValues.m_extent = maxValues.m_extent; |
3450 computedValues.m_position = maxValues.m_position; | 3455 computedValues.m_position = maxValues.m_position; |
3451 computedValues.m_margins.m_before = maxValues.m_margins.m_before; | 3456 computedValues.m_margins.m_before = maxValues.m_margins.m_before; |
3452 computedValues.m_margins.m_after = maxValues.m_margins.m_after; | 3457 computedValues.m_margins.m_after = maxValues.m_margins.m_after; |
3453 } | 3458 } |
3454 } | 3459 } |
3455 | 3460 |
3456 // Calculate constraint equation values for 'min-height' case. | 3461 // Calculate constraint equation values for 'min-height' case. |
3457 if (!styleToUse->logicalMinHeight().isZero()) { | 3462 if (!styleToUse->logicalMinHeight().isZero() || styleToUse->logicalMinHeight ().isIntrinsic()) { |
3458 LogicalExtentComputedValues minValues; | 3463 LogicalExtentComputedValues minValues; |
3459 | 3464 |
3460 computePositionedLogicalHeightUsing(styleToUse->logicalMinHeight(), cont ainerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, | 3465 computePositionedLogicalHeightUsing(styleToUse->logicalMinHeight(), cont ainerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, |
3461 logicalTopLength, logicalBottomLengt h, marginBefore, marginAfter, | 3466 logicalTopLength, logicalBottomLengt h, marginBefore, marginAfter, |
3462 minValues); | 3467 minValues); |
3463 | 3468 |
3464 if (computedValues.m_extent < minValues.m_extent) { | 3469 if (computedValues.m_extent < minValues.m_extent) { |
3465 computedValues.m_extent = minValues.m_extent; | 3470 computedValues.m_extent = minValues.m_extent; |
3466 computedValues.m_position = minValues.m_position; | 3471 computedValues.m_position = minValues.m_position; |
3467 computedValues.m_margins.m_before = minValues.m_margins.m_before; | 3472 computedValues.m_margins.m_before = minValues.m_margins.m_before; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3534 bool logicalTopIsAuto = logicalTop.isAuto(); | 3539 bool logicalTopIsAuto = logicalTop.isAuto(); |
3535 bool logicalBottomIsAuto = logicalBottom.isAuto(); | 3540 bool logicalBottomIsAuto = logicalBottom.isAuto(); |
3536 RenderView* renderView = view(); | 3541 RenderView* renderView = view(); |
3537 | 3542 |
3538 // Height is never unsolved for tables. | 3543 // Height is never unsolved for tables. |
3539 if (isTable()) { | 3544 if (isTable()) { |
3540 logicalHeightLength.setValue(Fixed, contentLogicalHeight); | 3545 logicalHeightLength.setValue(Fixed, contentLogicalHeight); |
3541 logicalHeightIsAuto = false; | 3546 logicalHeightIsAuto = false; |
3542 } | 3547 } |
3543 | 3548 |
3549 LayoutUnit resolvedLogicalHeight; | |
3550 if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent() || logicalHeightLength.isFitContent()) | |
ojan
2013/04/11 03:21:46
Can you make a computeIntrinsicLogicalHeightUsing
cbiesinger
2013/04/12 01:17:52
Done (named it computeIntrinsicLogicalContentHeigh
ojan
2013/04/12 04:03:11
SGTM
| |
3551 resolvedLogicalHeight = contentLogicalHeight; | |
3552 else if (logicalHeightLength.isFillAvailable()) | |
3553 resolvedLogicalHeight = containingBlock()->availableLogicalHeight(Exclud eMarginBorderPadding) - bordersPlusPadding; | |
3554 else | |
3555 resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(valueF orLength(logicalHeightLength, containerLogicalHeight, renderView)); | |
3556 | |
3544 if (!logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { | 3557 if (!logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { |
3545 /*---------------------------------------------------------------------- -*\ | 3558 /*---------------------------------------------------------------------- -*\ |
3546 * If none of the three are 'auto': If both 'margin-top' and 'margin- | 3559 * If none of the three are 'auto': If both 'margin-top' and 'margin- |
3547 * bottom' are 'auto', solve the equation under the extra constraint tha t | 3560 * bottom' are 'auto', solve the equation under the extra constraint tha t |
3548 * the two margins get equal values. If one of 'margin-top' or 'margin- | 3561 * the two margins get equal values. If one of 'margin-top' or 'margin- |
3549 * bottom' is 'auto', solve the equation for that value. If the values | 3562 * bottom' is 'auto', solve the equation for that value. If the values |
3550 * are over-constrained, ignore the value for 'bottom' and solve for tha t | 3563 * are over-constrained, ignore the value for 'bottom' and solve for tha t |
3551 * value. | 3564 * value. |
3552 \*---------------------------------------------------------------------- -*/ | 3565 \*---------------------------------------------------------------------- -*/ |
3553 // NOTE: It is not necessary to solve for 'bottom' in the over constrai ned | 3566 // NOTE: It is not necessary to solve for 'bottom' in the over constrai ned |
3554 // case because the value is not used for any further calculations. | 3567 // case because the value is not used for any further calculations. |
3555 | 3568 |
3556 logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForL ength(logicalHeightLength, containerLogicalHeight, renderView)); | 3569 logicalHeightValue = resolvedLogicalHeight; |
3557 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, ren derView); | 3570 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, ren derView); |
3558 | 3571 |
3559 const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopVa lue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView) + bordersPlusPadding); | 3572 const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopVa lue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView) + bordersPlusPadding); |
3560 | 3573 |
3561 // Margins are now the only unknown | 3574 // Margins are now the only unknown |
3562 if (marginBefore.isAuto() && marginAfter.isAuto()) { | 3575 if (marginBefore.isAuto() && marginAfter.isAuto()) { |
3563 // Both margins auto, solve for equality | 3576 // Both margins auto, solve for equality |
3564 // NOTE: This may result in negative values. | 3577 // NOTE: This may result in negative values. |
3565 computedValues.m_margins.m_before = availableSpace / 2; // split the difference | 3578 computedValues.m_margins.m_before = availableSpace / 2; // split the difference |
3566 computedValues.m_margins.m_after = availableSpace - computedValues.m _margins.m_before; // account for odd valued differences | 3579 computedValues.m_margins.m_after = availableSpace - computedValues.m _margins.m_before; // account for odd valued differences |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3613 if (logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { | 3626 if (logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { |
3614 // RULE 1: (height is content based, solve of top) | 3627 // RULE 1: (height is content based, solve of top) |
3615 logicalHeightValue = contentLogicalHeight; | 3628 logicalHeightValue = contentLogicalHeight; |
3616 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen gth(logicalBottom, containerLogicalHeight, renderView)); | 3629 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen gth(logicalBottom, containerLogicalHeight, renderView)); |
3617 } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAu to) { | 3630 } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAu to) { |
3618 // RULE 3: (height is content based, no need solve of bottom) | 3631 // RULE 3: (height is content based, no need solve of bottom) |
3619 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); | 3632 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); |
3620 logicalHeightValue = contentLogicalHeight; | 3633 logicalHeightValue = contentLogicalHeight; |
3621 } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsA uto) { | 3634 } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsA uto) { |
3622 // RULE 4: (solve of top) | 3635 // RULE 4: (solve of top) |
3623 logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(value ForLength(logicalHeightLength, containerLogicalHeight, renderView)); | 3636 logicalHeightValue = resolvedLogicalHeight; |
3624 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen gth(logicalBottom, containerLogicalHeight, renderView)); | 3637 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen gth(logicalBottom, containerLogicalHeight, renderView)); |
3625 } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsA uto) { | 3638 } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsA uto) { |
3626 // RULE 5: (solve of height) | 3639 // RULE 5: (solve of height) |
3627 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); | 3640 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); |
3628 logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTop Value + valueForLength(logicalBottom, containerLogicalHeight, renderView))); | 3641 logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTop Value + valueForLength(logicalBottom, containerLogicalHeight, renderView))); |
3629 } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsA uto) { | 3642 } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsA uto) { |
3630 // RULE 6: (no need solve of bottom) | 3643 // RULE 6: (no need solve of bottom) |
3631 logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(value ForLength(logicalHeightLength, containerLogicalHeight, renderView)); | 3644 logicalHeightValue = resolvedLogicalHeight; |
3632 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); | 3645 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); |
3633 } | 3646 } |
3634 } | 3647 } |
3635 computedValues.m_extent = logicalHeightValue; | 3648 computedValues.m_extent = logicalHeightValue; |
3636 | 3649 |
3637 // Use computed values to calculate the vertical position. | 3650 // Use computed values to calculate the vertical position. |
3638 computedValues.m_position = logicalTopValue + computedValues.m_margins.m_bef ore; | 3651 computedValues.m_position = logicalTopValue + computedValues.m_margins.m_bef ore; |
3639 computeLogicalTopPositionedOffset(computedValues.m_position, this, logicalHe ightValue, containerBlock, containerLogicalHeight); | 3652 computeLogicalTopPositionedOffset(computedValues.m_position, this, logicalHe ightValue, containerBlock, containerLogicalHeight); |
3640 } | 3653 } |
3641 | 3654 |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4598 | 4611 |
4599 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation) | 4612 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation) |
4600 { | 4613 { |
4601 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures); | 4614 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures); |
4602 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures); | 4615 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures); |
4603 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures); | 4616 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures); |
4604 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures); | 4617 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures); |
4605 } | 4618 } |
4606 | 4619 |
4607 } // namespace WebCore | 4620 } // namespace WebCore |
OLD | NEW |