| 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 495 } |
| 496 | 496 |
| 497 LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWi
dth, LayoutUnit availableWidth, RenderBlock* cb, RenderRegion* region, LayoutUni
t offsetFromLogicalTopOfFirstPage) const | 497 LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWi
dth, LayoutUnit availableWidth, RenderBlock* cb, RenderRegion* region, LayoutUni
t offsetFromLogicalTopOfFirstPage) const |
| 498 { | 498 { |
| 499 RenderStyle* styleToUse = style(); | 499 RenderStyle* styleToUse = style(); |
| 500 if (!styleToUse->logicalMaxWidth().isUndefined()) | 500 if (!styleToUse->logicalMaxWidth().isUndefined()) |
| 501 logicalWidth = min(logicalWidth, computeLogicalWidthInRegionUsing(MaxSiz
e, styleToUse->logicalMaxWidth(), availableWidth, cb, region, offsetFromLogicalT
opOfFirstPage)); | 501 logicalWidth = min(logicalWidth, computeLogicalWidthInRegionUsing(MaxSiz
e, styleToUse->logicalMaxWidth(), availableWidth, cb, region, offsetFromLogicalT
opOfFirstPage)); |
| 502 return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, styleToUs
e->logicalMinWidth(), availableWidth, cb, region, offsetFromLogicalTopOfFirstPag
e)); | 502 return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, styleToUs
e->logicalMinWidth(), availableWidth, cb, region, offsetFromLogicalTopOfFirstPag
e)); |
| 503 } | 503 } |
| 504 | 504 |
| 505 LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight) c
onst | 505 LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L
ayoutUnit intrinsicContentHeight) const |
| 506 { | 506 { |
| 507 RenderStyle* styleToUse = style(); | 507 RenderStyle* styleToUse = style(); |
| 508 if (!styleToUse->logicalMaxHeight().isUndefined()) { | 508 if (!styleToUse->logicalMaxHeight().isUndefined()) { |
| 509 LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight
()); | 509 LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight
(), intrinsicContentHeight); |
| 510 if (maxH != -1) | 510 if (maxH != -1) |
| 511 logicalHeight = min(logicalHeight, maxH); | 511 logicalHeight = min(logicalHeight, maxH); |
| 512 } | 512 } |
| 513 return max(logicalHeight, computeLogicalHeightUsing(styleToUse->logicalMinHe
ight())); | 513 return max(logicalHeight, computeLogicalHeightUsing(styleToUse->logicalMinHe
ight(), intrinsicContentHeight)); |
| 514 } | 514 } |
| 515 | 515 |
| 516 LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica
lHeight) const | 516 LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica
lHeight, LayoutUnit intrinsicContentHeight) const |
| 517 { | 517 { |
| 518 RenderStyle* styleToUse = style(); | 518 RenderStyle* styleToUse = style(); |
| 519 if (!styleToUse->logicalMaxHeight().isUndefined()) { | 519 if (!styleToUse->logicalMaxHeight().isUndefined()) { |
| 520 LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeig
ht()); | 520 LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeig
ht(), intrinsicContentHeight); |
| 521 if (maxH != -1) | 521 if (maxH != -1) |
| 522 logicalHeight = min(logicalHeight, maxH); | 522 logicalHeight = min(logicalHeight, maxH); |
| 523 } | 523 } |
| 524 return max(logicalHeight, computeContentLogicalHeight(styleToUse->logicalMin
Height())); | 524 return max(logicalHeight, computeContentLogicalHeight(styleToUse->logicalMin
Height(), intrinsicContentHeight)); |
| 525 } | 525 } |
| 526 | 526 |
| 527 IntRect RenderBox::absoluteContentBox() const | 527 IntRect RenderBox::absoluteContentBox() const |
| 528 { | 528 { |
| 529 // This is wrong with transforms and flipped writing modes. | 529 // This is wrong with transforms and flipped writing modes. |
| 530 IntRect rect = pixelSnappedIntRect(contentBoxRect()); | 530 IntRect rect = pixelSnappedIntRect(contentBoxRect()); |
| 531 FloatPoint absPos = localToAbsolute(); | 531 FloatPoint absPos = localToAbsolute(); |
| 532 rect.move(absPos.x(), absPos.y()); | 532 rect.move(absPos.x(), absPos.y()); |
| 533 return rect; | 533 return rect; |
| 534 } | 534 } |
| (...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2462 // FIXME: Account for block-flow in flexible boxes. | 2462 // FIXME: Account for block-flow in flexible boxes. |
| 2463 // https://bugs.webkit.org/show_bug.cgi?id=46418 | 2463 // https://bugs.webkit.org/show_bug.cgi?id=46418 |
| 2464 if (h.isAuto() && parent()->isDeprecatedFlexibleBox() && parent()->style
()->boxOrient() == HORIZONTAL | 2464 if (h.isAuto() && parent()->isDeprecatedFlexibleBox() && parent()->style
()->boxOrient() == HORIZONTAL |
| 2465 && parent()->isStretchingChildren()) { | 2465 && parent()->isStretchingChildren()) { |
| 2466 h = Length(parentBox()->contentLogicalHeight() - marginBefore() - ma
rginAfter() - borderAndPaddingLogicalHeight(), Fixed); | 2466 h = Length(parentBox()->contentLogicalHeight() - marginBefore() - ma
rginAfter() - borderAndPaddingLogicalHeight(), Fixed); |
| 2467 checkMinMaxHeight = false; | 2467 checkMinMaxHeight = false; |
| 2468 } | 2468 } |
| 2469 | 2469 |
| 2470 LayoutUnit heightResult; | 2470 LayoutUnit heightResult; |
| 2471 if (checkMinMaxHeight) { | 2471 if (checkMinMaxHeight) { |
| 2472 heightResult = computeLogicalHeightUsing(style()->logicalHeight()); | 2472 heightResult = computeLogicalHeightUsing(style()->logicalHeight(), c
omputedValues.m_extent - borderAndPaddingLogicalHeight()); |
| 2473 if (heightResult == -1) | 2473 if (heightResult == -1) |
| 2474 heightResult = computedValues.m_extent; | 2474 heightResult = computedValues.m_extent; |
| 2475 heightResult = constrainLogicalHeightByMinMax(heightResult); | 2475 heightResult = constrainLogicalHeightByMinMax(heightResult, computed
Values.m_extent - borderAndPaddingLogicalHeight()); |
| 2476 } else { | 2476 } else { |
| 2477 // The only times we don't check min/max height are when a fixed len
gth has | 2477 // The only times we don't check min/max height are when a fixed len
gth has |
| 2478 // been given as an override. Just use that. The value has already
been adjusted | 2478 // been given as an override. Just use that. The value has already
been adjusted |
| 2479 // for box-sizing. | 2479 // for box-sizing. |
| 2480 ASSERT(h.isFixed()); |
| 2480 heightResult = h.value() + borderAndPaddingLogicalHeight(); | 2481 heightResult = h.value() + borderAndPaddingLogicalHeight(); |
| 2481 } | 2482 } |
| 2482 | 2483 |
| 2483 computedValues.m_extent = heightResult; | 2484 computedValues.m_extent = heightResult; |
| 2484 | 2485 |
| 2485 if (hasPerpendicularContainingBlock) { | 2486 if (hasPerpendicularContainingBlock) { |
| 2486 bool shouldFlipBeforeAfter = shouldFlipBeforeAfterMargins(cb->style(
), style()); | 2487 bool shouldFlipBeforeAfter = shouldFlipBeforeAfterMargins(cb->style(
), style()); |
| 2487 computeInlineDirectionMargins(cb, containingBlockLogicalWidthForCont
ent(), heightResult, | 2488 computeInlineDirectionMargins(cb, containingBlockLogicalWidthForCont
ent(), heightResult, |
| 2488 shouldFlipBeforeAfter ? computedValues.m_margins.m_after : c
omputedValues.m_margins.m_before, | 2489 shouldFlipBeforeAfter ? computedValues.m_margins.m_after : c
omputedValues.m_margins.m_before, |
| 2489 shouldFlipBeforeAfter ? computedValues.m_margins.m_before :
computedValues.m_margins.m_after); | 2490 shouldFlipBeforeAfter ? computedValues.m_margins.m_before :
computedValues.m_margins.m_after); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2509 } | 2510 } |
| 2510 } | 2511 } |
| 2511 | 2512 |
| 2512 LayoutUnit RenderBox::viewLogicalHeightForPercentages() const | 2513 LayoutUnit RenderBox::viewLogicalHeightForPercentages() const |
| 2513 { | 2514 { |
| 2514 if (document()->printing()) | 2515 if (document()->printing()) |
| 2515 return static_cast<LayoutUnit>(view()->pageLogicalHeight()); | 2516 return static_cast<LayoutUnit>(view()->pageLogicalHeight()); |
| 2516 return view()->viewLogicalHeight(); | 2517 return view()->viewLogicalHeight(); |
| 2517 } | 2518 } |
| 2518 | 2519 |
| 2519 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height) const | 2520 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit
intrinsicContentHeight) const |
| 2520 { | 2521 { |
| 2521 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig
ht); | 2522 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig
ht, intrinsicContentHeight); |
| 2522 if (logicalHeight != -1) | 2523 if (logicalHeight != -1) |
| 2523 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); | 2524 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); |
| 2524 return logicalHeight; | 2525 return logicalHeight; |
| 2525 } | 2526 } |
| 2526 | 2527 |
| 2527 LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height) const | 2528 LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height, LayoutUn
it intrinsicContentHeight) const |
| 2528 { | 2529 { |
| 2529 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(height); | 2530 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(height, intrinsicContentHeight); |
| 2530 if (heightIncludingScrollbar == -1) | 2531 if (heightIncludingScrollbar == -1) |
| 2531 return -1; | 2532 return -1; |
| 2532 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(hei
ghtIncludingScrollbar) - scrollbarLogicalHeight()); | 2533 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(hei
ghtIncludingScrollbar) - scrollbarLogicalHeight()); |
| 2533 } | 2534 } |
| 2534 | 2535 |
| 2535 LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length&
height) const | 2536 LayoutUnit RenderBox::computeIntrinsicLogicalContentHeightUsing(Length logicalHe
ightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) cons
t |
| 2536 { | 2537 { |
| 2538 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. |
| 2539 // If that happens, this code will have to change. |
| 2540 if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent()
|| logicalHeightLength.isFitContent()) |
| 2541 return intrinsicContentHeight; |
| 2542 if (logicalHeightLength.isFillAvailable()) |
| 2543 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd
ing) - borderAndPadding; |
| 2544 ASSERT_NOT_REACHED(); |
| 2545 return 0; |
| 2546 } |
| 2547 |
| 2548 LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length&
height, LayoutUnit intrinsicContentHeight) const |
| 2549 { |
| 2550 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. |
| 2551 // If that happens, this code will have to change. |
| 2552 if (height.isIntrinsic()) |
| 2553 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten
tHeight, borderAndPaddingLogicalHeight()); |
| 2537 if (height.isFixed()) | 2554 if (height.isFixed()) |
| 2538 return height.value(); | 2555 return height.value(); |
| 2539 if (height.isPercent()) | 2556 if (height.isPercent()) |
| 2540 return computePercentageLogicalHeight(height); | 2557 return computePercentageLogicalHeight(height); |
| 2541 if (height.isViewportPercentage()) | 2558 if (height.isViewportPercentage()) |
| 2542 return valueForLength(height, 0, view()); | 2559 return valueForLength(height, 0, view()); |
| 2543 return -1; | 2560 return -1; |
| 2544 } | 2561 } |
| 2545 | 2562 |
| 2546 bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox*
containingBlock) const | 2563 bool RenderBox::skipContainingBlockForPercentHeightCalculation(const RenderBox*
containingBlock) const |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2597 RenderTableCell* cell = toRenderTableCell(cb); | 2614 RenderTableCell* cell = toRenderTableCell(cb); |
| 2598 if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAut
o() || !cell->table()->style()->logicalHeight().isAuto())) | 2615 if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAut
o() || !cell->table()->style()->logicalHeight().isAuto())) |
| 2599 return 0; | 2616 return 0; |
| 2600 return -1; | 2617 return -1; |
| 2601 } | 2618 } |
| 2602 availableHeight = cb->overrideLogicalContentHeight(); | 2619 availableHeight = cb->overrideLogicalContentHeight(); |
| 2603 includeBorderPadding = true; | 2620 includeBorderPadding = true; |
| 2604 } | 2621 } |
| 2605 } else if (cbstyle->logicalHeight().isFixed()) { | 2622 } else if (cbstyle->logicalHeight().isFixed()) { |
| 2606 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz
ing(cbstyle->logicalHeight().value()); | 2623 LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSiz
ing(cbstyle->logicalHeight().value()); |
| 2607 availableHeight = max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeigh
tByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight())); | 2624 availableHeight = max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeigh
tByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1)); |
| 2608 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit
hSpecifiedHeight) { | 2625 } else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWit
hSpecifiedHeight) { |
| 2609 // We need to recur and compute the percentage height for our containing
block. | 2626 // We need to recur and compute the percentage height for our containing
block. |
| 2610 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst
yle->logicalHeight()); | 2627 LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbst
yle->logicalHeight()); |
| 2611 if (heightWithScrollbar != -1) { | 2628 if (heightWithScrollbar != -1) { |
| 2612 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic
alHeightForBoxSizing(heightWithScrollbar); | 2629 LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogic
alHeightForBoxSizing(heightWithScrollbar); |
| 2613 // We need to adjust for min/max height because this method does not | 2630 // We need to adjust for min/max height because this method does not |
| 2614 // handle the min/max of the current block, its caller does. So the | 2631 // handle the min/max of the current block, its caller does. So the |
| 2615 // return value from the recursive call will not have been adjusted | 2632 // return value from the recursive call will not have been adjusted |
| 2616 // yet. | 2633 // yet. |
| 2617 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy
MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); | 2634 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy
MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1); |
| 2618 availableHeight = max<LayoutUnit>(0, contentBoxHeight); | 2635 availableHeight = max<LayoutUnit>(0, contentBoxHeight); |
| 2619 } | 2636 } |
| 2620 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { | 2637 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { |
| 2621 // Don't allow this to affect the block' height() member variable, since
this | 2638 // Don't allow this to affect the block' height() member variable, since
this |
| 2622 // can get called while the block is still laying out its kids. | 2639 // can get called while the block is still laying out its kids. |
| 2623 LogicalExtentComputedValues computedValues; | 2640 LogicalExtentComputedValues computedValues; |
| 2624 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); | 2641 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); |
| 2625 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH
eight() - cb->scrollbarLogicalHeight(); | 2642 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH
eight() - cb->scrollbarLogicalHeight(); |
| 2626 } else if (cb->isRenderView()) | 2643 } else if (cb->isRenderView()) |
| 2627 availableHeight = viewLogicalHeightForPercentages(); | 2644 availableHeight = viewLogicalHeightForPercentages(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2762 cb = cb->containingBlock(); | 2779 cb = cb->containingBlock(); |
| 2763 } | 2780 } |
| 2764 } | 2781 } |
| 2765 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logi
calHeight, availableHeight)); | 2782 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logi
calHeight, availableHeight)); |
| 2766 } | 2783 } |
| 2767 case ViewportPercentageWidth: | 2784 case ViewportPercentageWidth: |
| 2768 case ViewportPercentageHeight: | 2785 case ViewportPercentageHeight: |
| 2769 case ViewportPercentageMin: | 2786 case ViewportPercentageMin: |
| 2770 case ViewportPercentageMax: | 2787 case ViewportPercentageMax: |
| 2771 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logi
calHeight, 0, view())); | 2788 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logi
calHeight, 0, view())); |
| 2789 case MinContent: |
| 2790 case MaxContent: |
| 2791 case FitContent: |
| 2792 case FillAvailable: |
| 2793 return adjustContentBoxLogicalHeightForBoxSizing(computeIntrinsicLog
icalContentHeightUsing(logicalHeight, intrinsicLogicalHeight(), borderAndPadding
Height())); |
| 2772 default: | 2794 default: |
| 2773 return intrinsicLogicalHeight(); | 2795 return intrinsicLogicalHeight(); |
| 2774 } | 2796 } |
| 2775 } | 2797 } |
| 2776 | 2798 |
| 2777 LayoutUnit RenderBox::availableLogicalHeight(AvailableLogicalHeightType heightTy
pe) const | 2799 LayoutUnit RenderBox::availableLogicalHeight(AvailableLogicalHeightType heightTy
pe) const |
| 2778 { | 2800 { |
| 2779 return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style()->l
ogicalHeight(), heightType)); | 2801 return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style()->l
ogicalHeight(), heightType), -1); |
| 2780 } | 2802 } |
| 2781 | 2803 |
| 2782 LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogi
calHeightType heightType) const | 2804 LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogi
calHeightType heightType) const |
| 2783 { | 2805 { |
| 2784 if (isRenderView()) | 2806 if (isRenderView()) |
| 2785 return isHorizontalWritingMode() ? toRenderView(this)->frameView()->visi
bleHeight() : toRenderView(this)->frameView()->visibleWidth(); | 2807 return isHorizontalWritingMode() ? toRenderView(this)->frameView()->visi
bleHeight() : toRenderView(this)->frameView()->visibleWidth(); |
| 2786 | 2808 |
| 2787 // We need to stop here, since we don't want to increase the height of the t
able | 2809 // We need to stop here, since we don't want to increase the height of the t
able |
| 2788 // artificially. We're going to rely on this cell getting expanded to some
new | 2810 // artificially. We're going to rely on this cell getting expanded to some
new |
| 2789 // height, and then when we lay out again we'll use the calculation below. | 2811 // height, and then when we lay out again we'll use the calculation below. |
| 2790 if (isTableCell() && (h.isAuto() || h.isPercent())) { | 2812 if (isTableCell() && (h.isAuto() || h.isPercent())) { |
| 2791 if (hasOverrideHeight()) | 2813 if (hasOverrideHeight()) |
| 2792 return overrideLogicalContentHeight(); | 2814 return overrideLogicalContentHeight(); |
| 2793 return logicalHeight() - borderAndPaddingLogicalHeight(); | 2815 return logicalHeight() - borderAndPaddingLogicalHeight(); |
| 2794 } | 2816 } |
| 2795 | 2817 |
| 2796 if (h.isPercent() && isOutOfFlowPositioned()) { | 2818 if (h.isPercent() && isOutOfFlowPositioned()) { |
| 2797 // FIXME: This is wrong if the containingBlock has a perpendicular writi
ng mode. | 2819 // FIXME: This is wrong if the containingBlock has a perpendicular writi
ng mode. |
| 2798 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c
ontainingBlock()); | 2820 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c
ontainingBlock()); |
| 2799 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail
ableHeight)); | 2821 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail
ableHeight)); |
| 2800 } | 2822 } |
| 2801 | 2823 |
| 2802 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(h); | 2824 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(h, -1); |
| 2803 if (heightIncludingScrollbar != -1) | 2825 if (heightIncludingScrollbar != -1) |
| 2804 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing
(heightIncludingScrollbar) - scrollbarLogicalHeight()); | 2826 return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing
(heightIncludingScrollbar) - scrollbarLogicalHeight()); |
| 2805 | 2827 |
| 2806 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical w
riting-mode. | 2828 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical w
riting-mode. |
| 2807 // https://bugs.webkit.org/show_bug.cgi?id=46500 | 2829 // https://bugs.webkit.org/show_bug.cgi?id=46500 |
| 2808 if (isRenderBlock() && isOutOfFlowPositioned() && style()->height().isAuto()
&& !(style()->top().isAuto() || style()->bottom().isAuto())) { | 2830 if (isRenderBlock() && isOutOfFlowPositioned() && style()->height().isAuto()
&& !(style()->top().isAuto() || style()->bottom().isAuto())) { |
| 2809 RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this)); | 2831 RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this)); |
| 2810 LogicalExtentComputedValues computedValues; | 2832 LogicalExtentComputedValues computedValues; |
| 2811 block->computeLogicalHeight(block->logicalHeight(), 0, computedValues); | 2833 block->computeLogicalHeight(block->logicalHeight(), 0, computedValues); |
| 2812 LayoutUnit newContentHeight = computedValues.m_extent - block->borderAnd
PaddingLogicalHeight() - block->scrollbarLogicalHeight(); | 2834 LayoutUnit newContentHeight = computedValues.m_extent - block->borderAnd
PaddingLogicalHeight() - block->scrollbarLogicalHeight(); |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3406 | 3428 |
| 3407 if (computedValues.m_extent > maxValues.m_extent) { | 3429 if (computedValues.m_extent > maxValues.m_extent) { |
| 3408 computedValues.m_extent = maxValues.m_extent; | 3430 computedValues.m_extent = maxValues.m_extent; |
| 3409 computedValues.m_position = maxValues.m_position; | 3431 computedValues.m_position = maxValues.m_position; |
| 3410 computedValues.m_margins.m_before = maxValues.m_margins.m_before; | 3432 computedValues.m_margins.m_before = maxValues.m_margins.m_before; |
| 3411 computedValues.m_margins.m_after = maxValues.m_margins.m_after; | 3433 computedValues.m_margins.m_after = maxValues.m_margins.m_after; |
| 3412 } | 3434 } |
| 3413 } | 3435 } |
| 3414 | 3436 |
| 3415 // Calculate constraint equation values for 'min-height' case. | 3437 // Calculate constraint equation values for 'min-height' case. |
| 3416 if (!styleToUse->logicalMinHeight().isZero()) { | 3438 if (!styleToUse->logicalMinHeight().isZero() || styleToUse->logicalMinHeight
().isIntrinsic()) { |
| 3417 LogicalExtentComputedValues minValues; | 3439 LogicalExtentComputedValues minValues; |
| 3418 | 3440 |
| 3419 computePositionedLogicalHeightUsing(styleToUse->logicalMinHeight(), cont
ainerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, | 3441 computePositionedLogicalHeightUsing(styleToUse->logicalMinHeight(), cont
ainerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, |
| 3420 logicalTopLength, logicalBottomLengt
h, marginBefore, marginAfter, | 3442 logicalTopLength, logicalBottomLengt
h, marginBefore, marginAfter, |
| 3421 minValues); | 3443 minValues); |
| 3422 | 3444 |
| 3423 if (computedValues.m_extent < minValues.m_extent) { | 3445 if (computedValues.m_extent < minValues.m_extent) { |
| 3424 computedValues.m_extent = minValues.m_extent; | 3446 computedValues.m_extent = minValues.m_extent; |
| 3425 computedValues.m_position = minValues.m_position; | 3447 computedValues.m_position = minValues.m_position; |
| 3426 computedValues.m_margins.m_before = minValues.m_margins.m_before; | 3448 computedValues.m_margins.m_before = minValues.m_margins.m_before; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3493 bool logicalTopIsAuto = logicalTop.isAuto(); | 3515 bool logicalTopIsAuto = logicalTop.isAuto(); |
| 3494 bool logicalBottomIsAuto = logicalBottom.isAuto(); | 3516 bool logicalBottomIsAuto = logicalBottom.isAuto(); |
| 3495 RenderView* renderView = view(); | 3517 RenderView* renderView = view(); |
| 3496 | 3518 |
| 3497 // Height is never unsolved for tables. | 3519 // Height is never unsolved for tables. |
| 3498 if (isTable()) { | 3520 if (isTable()) { |
| 3499 logicalHeightLength.setValue(Fixed, contentLogicalHeight); | 3521 logicalHeightLength.setValue(Fixed, contentLogicalHeight); |
| 3500 logicalHeightIsAuto = false; | 3522 logicalHeightIsAuto = false; |
| 3501 } | 3523 } |
| 3502 | 3524 |
| 3525 LayoutUnit resolvedLogicalHeight; |
| 3526 if (logicalHeightLength.isIntrinsic()) |
| 3527 resolvedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(logica
lHeightLength, contentLogicalHeight, bordersPlusPadding); |
| 3528 else |
| 3529 resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(valueF
orLength(logicalHeightLength, containerLogicalHeight, renderView)); |
| 3530 |
| 3503 if (!logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { | 3531 if (!logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { |
| 3504 /*----------------------------------------------------------------------
-*\ | 3532 /*----------------------------------------------------------------------
-*\ |
| 3505 * If none of the three are 'auto': If both 'margin-top' and 'margin- | 3533 * If none of the three are 'auto': If both 'margin-top' and 'margin- |
| 3506 * bottom' are 'auto', solve the equation under the extra constraint tha
t | 3534 * bottom' are 'auto', solve the equation under the extra constraint tha
t |
| 3507 * the two margins get equal values. If one of 'margin-top' or 'margin- | 3535 * the two margins get equal values. If one of 'margin-top' or 'margin- |
| 3508 * bottom' is 'auto', solve the equation for that value. If the values | 3536 * bottom' is 'auto', solve the equation for that value. If the values |
| 3509 * are over-constrained, ignore the value for 'bottom' and solve for tha
t | 3537 * are over-constrained, ignore the value for 'bottom' and solve for tha
t |
| 3510 * value. | 3538 * value. |
| 3511 \*----------------------------------------------------------------------
-*/ | 3539 \*----------------------------------------------------------------------
-*/ |
| 3512 // NOTE: It is not necessary to solve for 'bottom' in the over constrai
ned | 3540 // NOTE: It is not necessary to solve for 'bottom' in the over constrai
ned |
| 3513 // case because the value is not used for any further calculations. | 3541 // case because the value is not used for any further calculations. |
| 3514 | 3542 |
| 3515 logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForL
ength(logicalHeightLength, containerLogicalHeight, renderView)); | 3543 logicalHeightValue = resolvedLogicalHeight; |
| 3516 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, ren
derView); | 3544 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, ren
derView); |
| 3517 | 3545 |
| 3518 const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopVa
lue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight,
renderView) + bordersPlusPadding); | 3546 const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopVa
lue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight,
renderView) + bordersPlusPadding); |
| 3519 | 3547 |
| 3520 // Margins are now the only unknown | 3548 // Margins are now the only unknown |
| 3521 if (marginBefore.isAuto() && marginAfter.isAuto()) { | 3549 if (marginBefore.isAuto() && marginAfter.isAuto()) { |
| 3522 // Both margins auto, solve for equality | 3550 // Both margins auto, solve for equality |
| 3523 // NOTE: This may result in negative values. | 3551 // NOTE: This may result in negative values. |
| 3524 computedValues.m_margins.m_before = availableSpace / 2; // split the
difference | 3552 computedValues.m_margins.m_before = availableSpace / 2; // split the
difference |
| 3525 computedValues.m_margins.m_after = availableSpace - computedValues.m
_margins.m_before; // account for odd valued differences | 3553 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... |
| 3572 if (logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { | 3600 if (logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { |
| 3573 // RULE 1: (height is content based, solve of top) | 3601 // RULE 1: (height is content based, solve of top) |
| 3574 logicalHeightValue = contentLogicalHeight; | 3602 logicalHeightValue = contentLogicalHeight; |
| 3575 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen
gth(logicalBottom, containerLogicalHeight, renderView)); | 3603 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen
gth(logicalBottom, containerLogicalHeight, renderView)); |
| 3576 } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAu
to) { | 3604 } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAu
to) { |
| 3577 // RULE 3: (height is content based, no need solve of bottom) | 3605 // RULE 3: (height is content based, no need solve of bottom) |
| 3578 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight,
renderView); | 3606 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight,
renderView); |
| 3579 logicalHeightValue = contentLogicalHeight; | 3607 logicalHeightValue = contentLogicalHeight; |
| 3580 } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsA
uto) { | 3608 } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsA
uto) { |
| 3581 // RULE 4: (solve of top) | 3609 // RULE 4: (solve of top) |
| 3582 logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(value
ForLength(logicalHeightLength, containerLogicalHeight, renderView)); | 3610 logicalHeightValue = resolvedLogicalHeight; |
| 3583 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen
gth(logicalBottom, containerLogicalHeight, renderView)); | 3611 logicalTopValue = availableSpace - (logicalHeightValue + valueForLen
gth(logicalBottom, containerLogicalHeight, renderView)); |
| 3584 } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsA
uto) { | 3612 } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsA
uto) { |
| 3585 // RULE 5: (solve of height) | 3613 // RULE 5: (solve of height) |
| 3586 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight,
renderView); | 3614 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight,
renderView); |
| 3587 logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTop
Value + valueForLength(logicalBottom, containerLogicalHeight, renderView))); | 3615 logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTop
Value + valueForLength(logicalBottom, containerLogicalHeight, renderView))); |
| 3588 } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsA
uto) { | 3616 } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsA
uto) { |
| 3589 // RULE 6: (no need solve of bottom) | 3617 // RULE 6: (no need solve of bottom) |
| 3590 logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(value
ForLength(logicalHeightLength, containerLogicalHeight, renderView)); | 3618 logicalHeightValue = resolvedLogicalHeight; |
| 3591 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight,
renderView); | 3619 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight,
renderView); |
| 3592 } | 3620 } |
| 3593 } | 3621 } |
| 3594 computedValues.m_extent = logicalHeightValue; | 3622 computedValues.m_extent = logicalHeightValue; |
| 3595 | 3623 |
| 3596 // Use computed values to calculate the vertical position. | 3624 // Use computed values to calculate the vertical position. |
| 3597 computedValues.m_position = logicalTopValue + computedValues.m_margins.m_bef
ore; | 3625 computedValues.m_position = logicalTopValue + computedValues.m_margins.m_bef
ore; |
| 3598 computeLogicalTopPositionedOffset(computedValues.m_position, this, logicalHe
ightValue, containerBlock, containerLogicalHeight); | 3626 computeLogicalTopPositionedOffset(computedValues.m_position, this, logicalHe
ightValue, containerBlock, containerLogicalHeight); |
| 3599 } | 3627 } |
| 3600 | 3628 |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4557 | 4585 |
| 4558 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst
rumentation) | 4586 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst
rumentation) |
| 4559 { | 4587 { |
| 4560 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes:
:RenderingStructures); | 4588 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes:
:RenderingStructures); |
| 4561 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes::
RenderingStructures); | 4589 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes::
RenderingStructures); |
| 4562 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa
p, WebCoreMemoryTypes::RenderingStructures); | 4590 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa
p, WebCoreMemoryTypes::RenderingStructures); |
| 4563 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap
, WebCoreMemoryTypes::RenderingStructures); | 4591 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap
, WebCoreMemoryTypes::RenderingStructures); |
| 4564 } | 4592 } |
| 4565 | 4593 |
| 4566 } // namespace WebCore | 4594 } // namespace WebCore |
| OLD | NEW |