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 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 const ComputedStyle& styleToUse = styleRef(); | 581 const ComputedStyle& styleToUse = styleRef(); |
582 if (!styleToUse.logicalMaxWidth().isMaxSizeNone()) | 582 if (!styleToUse.logicalMaxWidth().isMaxSizeNone()) |
583 logicalWidth = std::min(logicalWidth, computeLogicalWidthUsing(MaxSize,
styleToUse.logicalMaxWidth(), availableWidth, cb)); | 583 logicalWidth = std::min(logicalWidth, computeLogicalWidthUsing(MaxSize,
styleToUse.logicalMaxWidth(), availableWidth, cb)); |
584 return std::max(logicalWidth, computeLogicalWidthUsing(MinSize, styleToUse.l
ogicalMinWidth(), availableWidth, cb)); | 584 return std::max(logicalWidth, computeLogicalWidthUsing(MinSize, styleToUse.l
ogicalMinWidth(), availableWidth, cb)); |
585 } | 585 } |
586 | 586 |
587 LayoutUnit LayoutBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L
ayoutUnit intrinsicContentHeight) const | 587 LayoutUnit LayoutBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L
ayoutUnit intrinsicContentHeight) const |
588 { | 588 { |
589 const ComputedStyle& styleToUse = styleRef(); | 589 const ComputedStyle& styleToUse = styleRef(); |
590 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) { | 590 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) { |
591 LayoutUnit maxH = computeLogicalHeightUsing(styleToUse.logicalMaxHeight(
), intrinsicContentHeight); | 591 LayoutUnit maxH = computeLogicalHeightUsing(MaxSize, styleToUse.logicalM
axHeight(), intrinsicContentHeight); |
592 if (maxH != -1) | 592 if (maxH != -1) |
593 logicalHeight = std::min(logicalHeight, maxH); | 593 logicalHeight = std::min(logicalHeight, maxH); |
594 } | 594 } |
595 return std::max(logicalHeight, computeLogicalHeightUsing(styleToUse.logicalM
inHeight(), intrinsicContentHeight)); | 595 return std::max(logicalHeight, computeLogicalHeightUsing(MinSize, styleToUse
.logicalMinHeight(), intrinsicContentHeight)); |
596 } | 596 } |
597 | 597 |
598 LayoutUnit LayoutBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica
lHeight, LayoutUnit intrinsicContentHeight) const | 598 LayoutUnit LayoutBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica
lHeight, LayoutUnit intrinsicContentHeight) const |
599 { | 599 { |
600 const ComputedStyle& styleToUse = styleRef(); | 600 const ComputedStyle& styleToUse = styleRef(); |
601 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) { | 601 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) { |
602 LayoutUnit maxH = computeContentLogicalHeight(styleToUse.logicalMaxHeigh
t(), intrinsicContentHeight); | 602 LayoutUnit maxH = computeContentLogicalHeight(MaxSize, styleToUse.logica
lMaxHeight(), intrinsicContentHeight); |
603 if (maxH != -1) | 603 if (maxH != -1) |
604 logicalHeight = std::min(logicalHeight, maxH); | 604 logicalHeight = std::min(logicalHeight, maxH); |
605 } | 605 } |
606 return std::max(logicalHeight, computeContentLogicalHeight(styleToUse.logica
lMinHeight(), intrinsicContentHeight)); | 606 return std::max(logicalHeight, computeContentLogicalHeight(MinSize, styleToU
se.logicalMinHeight(), intrinsicContentHeight)); |
607 } | 607 } |
608 | 608 |
609 void LayoutBox::setLocationAndUpdateOverflowControlsIfNeeded(const LayoutPoint&
location) | 609 void LayoutBox::setLocationAndUpdateOverflowControlsIfNeeded(const LayoutPoint&
location) |
610 { | 610 { |
611 if (hasOverflowClip()) { | 611 if (hasOverflowClip()) { |
612 IntSize oldPixelSnappedBorderRectSize = pixelSnappedBorderBoxRect().size
(); | 612 IntSize oldPixelSnappedBorderRectSize = pixelSnappedBorderBoxRect().size
(); |
613 setLocation(location); | 613 setLocation(location); |
614 if (pixelSnappedBorderBoxRect().size() != oldPixelSnappedBorderRectSize) | 614 if (pixelSnappedBorderBoxRect().size() != oldPixelSnappedBorderRectSize) |
615 scrollableArea()->updateAfterLayout(); | 615 scrollableArea()->updateAfterLayout(); |
616 return; | 616 return; |
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2073 maxLogicalWidth += borderAndPadding; | 2073 maxLogicalWidth += borderAndPadding; |
2074 return std::max(minLogicalWidth, std::min(maxLogicalWidth, fillAvailable
Measure(availableLogicalWidth))); | 2074 return std::max(minLogicalWidth, std::min(maxLogicalWidth, fillAvailable
Measure(availableLogicalWidth))); |
2075 } | 2075 } |
2076 | 2076 |
2077 ASSERT_NOT_REACHED(); | 2077 ASSERT_NOT_REACHED(); |
2078 return 0; | 2078 return 0; |
2079 } | 2079 } |
2080 | 2080 |
2081 LayoutUnit LayoutBox::computeLogicalWidthUsing(SizeType widthType, const Length&
logicalWidth, LayoutUnit availableLogicalWidth, const LayoutBlock* cb) const | 2081 LayoutUnit LayoutBox::computeLogicalWidthUsing(SizeType widthType, const Length&
logicalWidth, LayoutUnit availableLogicalWidth, const LayoutBlock* cb) const |
2082 { | 2082 { |
| 2083 ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalW
idth.isAuto()); |
| 2084 if (widthType == MinSize && logicalWidth.isAuto()) |
| 2085 return adjustBorderBoxLogicalWidthForBoxSizing(0); |
| 2086 |
2083 if (!logicalWidth.isIntrinsicOrAuto()) { | 2087 if (!logicalWidth.isIntrinsicOrAuto()) { |
2084 // FIXME: If the containing block flow is perpendicular to our direction
we need to use the available logical height instead. | 2088 // FIXME: If the containing block flow is perpendicular to our direction
we need to use the available logical height instead. |
2085 return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWid
th, availableLogicalWidth)); | 2089 return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWid
th, availableLogicalWidth)); |
2086 } | 2090 } |
2087 | 2091 |
2088 if (logicalWidth.isIntrinsic()) | 2092 if (logicalWidth.isIntrinsic()) |
2089 return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalW
idth, borderAndPaddingLogicalWidth()); | 2093 return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalW
idth, borderAndPaddingLogicalWidth()); |
2090 | 2094 |
2091 LayoutUnit marginStart = 0; | 2095 LayoutUnit marginStart = 0; |
2092 LayoutUnit marginEnd = 0; | 2096 LayoutUnit marginEnd = 0; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 // Block children of horizontal flexible boxes fill the height of the bo
x. | 2327 // Block children of horizontal flexible boxes fill the height of the bo
x. |
2324 // FIXME: Account for writing-mode in flexible boxes. | 2328 // FIXME: Account for writing-mode in flexible boxes. |
2325 // https://bugs.webkit.org/show_bug.cgi?id=46418 | 2329 // https://bugs.webkit.org/show_bug.cgi?id=46418 |
2326 if (h.isAuto() && inHorizontalBox && toLayoutDeprecatedFlexibleBox(paren
t())->isStretchingChildren()) { | 2330 if (h.isAuto() && inHorizontalBox && toLayoutDeprecatedFlexibleBox(paren
t())->isStretchingChildren()) { |
2327 h = Length(parentBox()->contentLogicalHeight() - marginBefore() - ma
rginAfter() - borderAndPaddingLogicalHeight(), Fixed); | 2331 h = Length(parentBox()->contentLogicalHeight() - marginBefore() - ma
rginAfter() - borderAndPaddingLogicalHeight(), Fixed); |
2328 checkMinMaxHeight = false; | 2332 checkMinMaxHeight = false; |
2329 } | 2333 } |
2330 | 2334 |
2331 LayoutUnit heightResult; | 2335 LayoutUnit heightResult; |
2332 if (checkMinMaxHeight) { | 2336 if (checkMinMaxHeight) { |
2333 heightResult = computeLogicalHeightUsing(style()->logicalHeight(), c
omputedValues.m_extent - borderAndPaddingLogicalHeight()); | 2337 heightResult = computeLogicalHeightUsing(MainOrPreferredSize, style(
)->logicalHeight(), computedValues.m_extent - borderAndPaddingLogicalHeight()); |
2334 if (heightResult == -1) | 2338 if (heightResult == -1) |
2335 heightResult = computedValues.m_extent; | 2339 heightResult = computedValues.m_extent; |
2336 heightResult = constrainLogicalHeightByMinMax(heightResult, computed
Values.m_extent - borderAndPaddingLogicalHeight()); | 2340 heightResult = constrainLogicalHeightByMinMax(heightResult, computed
Values.m_extent - borderAndPaddingLogicalHeight()); |
2337 } else { | 2341 } else { |
2338 // The only times we don't check min/max height are when a fixed len
gth has | 2342 // The only times we don't check min/max height are when a fixed len
gth has |
2339 // been given as an override. Just use that. The value has already
been adjusted | 2343 // been given as an override. Just use that. The value has already
been adjusted |
2340 // for box-sizing. | 2344 // for box-sizing. |
2341 ASSERT(h.isFixed()); | 2345 ASSERT(h.isFixed()); |
2342 heightResult = h.value() + borderAndPaddingLogicalHeight(); | 2346 heightResult = h.value() + borderAndPaddingLogicalHeight(); |
2343 } | 2347 } |
(...skipping 15 matching lines...) Expand all Loading... |
2359 LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages(); | 2363 LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages(); |
2360 if (isDocumentElement()) { | 2364 if (isDocumentElement()) { |
2361 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - margins); | 2365 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - margins); |
2362 } else { | 2366 } else { |
2363 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo
re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight()
; | 2367 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo
re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight()
; |
2364 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - marginsBordersPadding); | 2368 computedValues.m_extent = std::max(computedValues.m_extent, visibleH
eight - marginsBordersPadding); |
2365 } | 2369 } |
2366 } | 2370 } |
2367 } | 2371 } |
2368 | 2372 |
2369 LayoutUnit LayoutBox::computeLogicalHeightUsing(const Length& height, LayoutUnit
intrinsicContentHeight) const | 2373 LayoutUnit LayoutBox::computeLogicalHeightUsing(SizeType heightType, const Lengt
h& height, LayoutUnit intrinsicContentHeight) const |
2370 { | 2374 { |
2371 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig
ht, intrinsicContentHeight); | 2375 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig
htType, height, intrinsicContentHeight); |
2372 if (logicalHeight != -1) | 2376 if (logicalHeight != -1) |
2373 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); | 2377 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); |
2374 return logicalHeight; | 2378 return logicalHeight; |
2375 } | 2379 } |
2376 | 2380 |
2377 LayoutUnit LayoutBox::computeContentLogicalHeight(const Length& height, LayoutUn
it intrinsicContentHeight) const | 2381 LayoutUnit LayoutBox::computeContentLogicalHeight(SizeType heightType, const Len
gth& height, LayoutUnit intrinsicContentHeight) const |
2378 { | 2382 { |
2379 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(height, intrinsicContentHeight); | 2383 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(heightType, height, intrinsicContentHeight); |
2380 if (heightIncludingScrollbar == -1) | 2384 if (heightIncludingScrollbar == -1) |
2381 return -1; | 2385 return -1; |
2382 return std::max(LayoutUnit(), adjustContentBoxLogicalHeightForBoxSizing(heig
htIncludingScrollbar) - scrollbarLogicalHeight()); | 2386 return std::max(LayoutUnit(), adjustContentBoxLogicalHeightForBoxSizing(heig
htIncludingScrollbar) - scrollbarLogicalHeight()); |
2383 } | 2387 } |
2384 | 2388 |
2385 LayoutUnit LayoutBox::computeIntrinsicLogicalContentHeightUsing(const Length& lo
gicalHeightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPaddin
g) const | 2389 LayoutUnit LayoutBox::computeIntrinsicLogicalContentHeightUsing(const Length& lo
gicalHeightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPaddin
g) const |
2386 { | 2390 { |
2387 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. | 2391 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. |
2388 // If that happens, this code will have to change. | 2392 // If that happens, this code will have to change. |
2389 if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent()
|| logicalHeightLength.isFitContent()) { | 2393 if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent()
|| logicalHeightLength.isFitContent()) { |
2390 if (isReplaced()) | 2394 if (isReplaced()) |
2391 return intrinsicSize().height(); | 2395 return intrinsicSize().height(); |
2392 if (m_intrinsicContentLogicalHeight != -1) | 2396 if (m_intrinsicContentLogicalHeight != -1) |
2393 return m_intrinsicContentLogicalHeight; | 2397 return m_intrinsicContentLogicalHeight; |
2394 return intrinsicContentHeight; | 2398 return intrinsicContentHeight; |
2395 } | 2399 } |
2396 if (logicalHeightLength.isFillAvailable()) | 2400 if (logicalHeightLength.isFillAvailable()) |
2397 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd
ing) - borderAndPadding; | 2401 return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadd
ing) - borderAndPadding; |
2398 ASSERT_NOT_REACHED(); | 2402 ASSERT_NOT_REACHED(); |
2399 return 0; | 2403 return 0; |
2400 } | 2404 } |
2401 | 2405 |
2402 LayoutUnit LayoutBox::computeContentAndScrollbarLogicalHeightUsing(const Length&
height, LayoutUnit intrinsicContentHeight) const | 2406 LayoutUnit LayoutBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heig
htType, const Length& height, LayoutUnit intrinsicContentHeight) const |
2403 { | 2407 { |
| 2408 if (height.isAuto()) |
| 2409 return heightType == MinSize ? 0 : -1; |
2404 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. | 2410 // FIXME(cbiesinger): The css-sizing spec is considering changing what min-c
ontent/max-content should resolve to. |
2405 // If that happens, this code will have to change. | 2411 // If that happens, this code will have to change. |
2406 if (height.isIntrinsic()) { | 2412 if (height.isIntrinsic()) { |
2407 if (intrinsicContentHeight == -1) | 2413 if (intrinsicContentHeight == -1) |
2408 return -1; // Intrinsic height isn't available. | 2414 return -1; // Intrinsic height isn't available. |
2409 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten
tHeight, borderAndPaddingLogicalHeight()); | 2415 return computeIntrinsicLogicalContentHeightUsing(height, intrinsicConten
tHeight, borderAndPaddingLogicalHeight()); |
2410 } | 2416 } |
2411 if (height.isFixed()) | 2417 if (height.isFixed()) |
2412 return height.value(); | 2418 return height.value(); |
2413 if (height.isPercent()) | 2419 if (height.isPercent()) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2525 // box model. This is essential for sizing inside | 2531 // box model. This is essential for sizing inside |
2526 // table cells using percentage heights. | 2532 // table cells using percentage heights. |
2527 result -= borderAndPaddingLogicalHeight(); | 2533 result -= borderAndPaddingLogicalHeight(); |
2528 return std::max(LayoutUnit(), result); | 2534 return std::max(LayoutUnit(), result); |
2529 } | 2535 } |
2530 return result; | 2536 return result; |
2531 } | 2537 } |
2532 | 2538 |
2533 LayoutUnit LayoutBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC
omputePreferred) const | 2539 LayoutUnit LayoutBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldC
omputePreferred) const |
2534 { | 2540 { |
2535 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogic
alWidthUsing(style()->logicalWidth()), shouldComputePreferred); | 2541 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogic
alWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePreferr
ed); |
2536 } | 2542 } |
2537 | 2543 |
2538 LayoutUnit LayoutBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUni
t logicalWidth, ShouldComputePreferred shouldComputePreferred) const | 2544 LayoutUnit LayoutBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUni
t logicalWidth, ShouldComputePreferred shouldComputePreferred) const |
2539 { | 2545 { |
2540 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMinWidth().isPercent()) || style()->logicalMinWidth().isMaxSizeN
one() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMinWidth
()); | 2546 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMinWidth().isPercent()) || style()->logicalMinWidth().isMaxSizeN
one() ? logicalWidth : computeReplacedLogicalWidthUsing(MinSize, style()->logica
lMinWidth()); |
2541 LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMaxWidth().isPercent()) || style()->logicalMaxWidth().isMaxSizeN
one() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth
()); | 2547 LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred &&
style()->logicalMaxWidth().isPercent()) || style()->logicalMaxWidth().isMaxSizeN
one() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style()->logica
lMaxWidth()); |
2542 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth)); | 2548 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth)); |
2543 } | 2549 } |
2544 | 2550 |
2545 LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing(const Length& logicalWidt
h) const | 2551 LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing(SizeType sizeType, const
Length& logicalWidth) const |
2546 { | 2552 { |
| 2553 ASSERT(sizeType == MinSize || sizeType == MainOrPreferredSize || !logicalWid
th.isAuto()); |
| 2554 if (sizeType == MinSize && logicalWidth.isAuto()) |
| 2555 return adjustContentBoxLogicalWidthForBoxSizing(0); |
| 2556 |
2547 switch (logicalWidth.type()) { | 2557 switch (logicalWidth.type()) { |
2548 case Fixed: | 2558 case Fixed: |
2549 return adjustContentBoxLogicalWidthForBoxSizing(logicalWidth.value()); | 2559 return adjustContentBoxLogicalWidthForBoxSizing(logicalWidth.value()); |
2550 case MinContent: | 2560 case MinContent: |
2551 case MaxContent: { | 2561 case MaxContent: { |
2552 // MinContent/MaxContent don't need the availableLogicalWidth argument. | 2562 // MinContent/MaxContent don't need the availableLogicalWidth argument. |
2553 LayoutUnit availableLogicalWidth = 0; | 2563 LayoutUnit availableLogicalWidth = 0; |
2554 return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalW
idth, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth(); | 2564 return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalW
idth, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth(); |
2555 } | 2565 } |
2556 case FitContent: | 2566 case FitContent: |
(...skipping 23 matching lines...) Expand all Loading... |
2580 case DeviceHeight: | 2590 case DeviceHeight: |
2581 break; | 2591 break; |
2582 } | 2592 } |
2583 | 2593 |
2584 ASSERT_NOT_REACHED(); | 2594 ASSERT_NOT_REACHED(); |
2585 return 0; | 2595 return 0; |
2586 } | 2596 } |
2587 | 2597 |
2588 LayoutUnit LayoutBox::computeReplacedLogicalHeight() const | 2598 LayoutUnit LayoutBox::computeReplacedLogicalHeight() const |
2589 { | 2599 { |
2590 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLog
icalHeightUsing(style()->logicalHeight())); | 2600 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLog
icalHeightUsing(MainOrPreferredSize, style()->logicalHeight())); |
2591 } | 2601 } |
2592 | 2602 |
2593 bool LayoutBox::logicalHeightComputesAsNone(SizeType sizeType) const | 2603 bool LayoutBox::logicalHeightComputesAsNone(SizeType sizeType) const |
2594 { | 2604 { |
2595 ASSERT(sizeType == MinSize || sizeType == MaxSize); | 2605 ASSERT(sizeType == MinSize || sizeType == MaxSize); |
2596 Length logicalHeight = sizeType == MinSize ? style()->logicalMinHeight() : s
tyle()->logicalMaxHeight(); | 2606 Length logicalHeight = sizeType == MinSize ? style()->logicalMinHeight() : s
tyle()->logicalMaxHeight(); |
2597 Length initialLogicalHeight = sizeType == MinSize ? ComputedStyle::initialMi
nSize() : ComputedStyle::initialMaxSize(); | 2607 Length initialLogicalHeight = sizeType == MinSize ? ComputedStyle::initialMi
nSize() : ComputedStyle::initialMaxSize(); |
2598 | 2608 |
2599 if (logicalHeight == initialLogicalHeight) | 2609 if (logicalHeight == initialLogicalHeight) |
2600 return true; | 2610 return true; |
2601 | 2611 |
2602 if (LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeight)) | 2612 if (LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeight)) |
2603 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(); | 2613 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(); |
2604 return false; | 2614 return false; |
2605 } | 2615 } |
2606 | 2616 |
2607 LayoutUnit LayoutBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU
nit logicalHeight) const | 2617 LayoutUnit LayoutBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU
nit logicalHeight) const |
2608 { | 2618 { |
2609 // If the height of the containing block is not specified explicitly (i.e.,
it depends on content height), and this element is not absolutely positioned, | 2619 // If the height of the containing block is not specified explicitly (i.e.,
it depends on content height), and this element is not absolutely positioned, |
2610 // the percentage value is treated as '0' (for 'min-height') or 'none' (for
'max-height'). | 2620 // the percentage value is treated as '0' (for 'min-height') or 'none' (for
'max-height'). |
2611 LayoutUnit minLogicalHeight; | 2621 LayoutUnit minLogicalHeight; |
2612 if (!logicalHeightComputesAsNone(MinSize)) | 2622 if (!logicalHeightComputesAsNone(MinSize)) |
2613 minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMin
Height()); | 2623 minLogicalHeight = computeReplacedLogicalHeightUsing(MinSize, style()->l
ogicalMinHeight()); |
2614 LayoutUnit maxLogicalHeight = logicalHeight; | 2624 LayoutUnit maxLogicalHeight = logicalHeight; |
2615 if (!logicalHeightComputesAsNone(MaxSize)) | 2625 if (!logicalHeightComputesAsNone(MaxSize)) |
2616 maxLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMa
xHeight()); | 2626 maxLogicalHeight = computeReplacedLogicalHeightUsing(MaxSize, style()->
logicalMaxHeight()); |
2617 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight))
; | 2627 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight))
; |
2618 } | 2628 } |
2619 | 2629 |
2620 LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing(const Length& logicalHei
ght) const | 2630 LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing(SizeType sizeType, const
Length& logicalHeight) const |
2621 { | 2631 { |
| 2632 ASSERT(sizeType == MinSize || sizeType == MainOrPreferredSize || !logicalHei
ght.isAuto()); |
| 2633 if (sizeType == MinSize && logicalHeight.isAuto()) |
| 2634 return adjustContentBoxLogicalHeightForBoxSizing(0); |
| 2635 |
2622 switch (logicalHeight.type()) { | 2636 switch (logicalHeight.type()) { |
2623 case Fixed: | 2637 case Fixed: |
2624 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value()); | 2638 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value()); |
2625 case Percent: | 2639 case Percent: |
2626 case Calculated: | 2640 case Calculated: |
2627 { | 2641 { |
2628 LayoutObject* cb = isOutOfFlowPositioned() ? container() : containingBlo
ck(); | 2642 LayoutObject* cb = isOutOfFlowPositioned() ? container() : containingBlo
ck(); |
2629 while (cb->isAnonymous()) | 2643 while (cb->isAnonymous()) |
2630 cb = cb->containingBlock(); | 2644 cb = cb->containingBlock(); |
2631 if (cb->isLayoutBlock()) | 2645 if (cb->isLayoutBlock()) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2696 return overrideLogicalContentHeight(); | 2710 return overrideLogicalContentHeight(); |
2697 return logicalHeight() - borderAndPaddingLogicalHeight(); | 2711 return logicalHeight() - borderAndPaddingLogicalHeight(); |
2698 } | 2712 } |
2699 | 2713 |
2700 if (h.isPercent() && isOutOfFlowPositioned()) { | 2714 if (h.isPercent() && isOutOfFlowPositioned()) { |
2701 // FIXME: This is wrong if the containingBlock has a perpendicular writi
ng mode. | 2715 // FIXME: This is wrong if the containingBlock has a perpendicular writi
ng mode. |
2702 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c
ontainingBlock()); | 2716 LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(c
ontainingBlock()); |
2703 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail
ableHeight)); | 2717 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, avail
ableHeight)); |
2704 } | 2718 } |
2705 | 2719 |
2706 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(h, -1); | 2720 LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeigh
tUsing(MainOrPreferredSize, h, -1); |
2707 if (heightIncludingScrollbar != -1) | 2721 if (heightIncludingScrollbar != -1) |
2708 return std::max(LayoutUnit(), adjustContentBoxLogicalHeightForBoxSizing(
heightIncludingScrollbar) - scrollbarLogicalHeight()); | 2722 return std::max(LayoutUnit(), adjustContentBoxLogicalHeightForBoxSizing(
heightIncludingScrollbar) - scrollbarLogicalHeight()); |
2709 | 2723 |
2710 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical w
riting-mode. | 2724 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical w
riting-mode. |
2711 // https://bugs.webkit.org/show_bug.cgi?id=46500 | 2725 // https://bugs.webkit.org/show_bug.cgi?id=46500 |
2712 if (isLayoutBlock() && isOutOfFlowPositioned() && style()->height().isAuto()
&& !(style()->top().isAuto() || style()->bottom().isAuto())) { | 2726 if (isLayoutBlock() && isOutOfFlowPositioned() && style()->height().isAuto()
&& !(style()->top().isAuto() || style()->bottom().isAuto())) { |
2713 LayoutBlock* block = const_cast<LayoutBlock*>(toLayoutBlock(this)); | 2727 LayoutBlock* block = const_cast<LayoutBlock*>(toLayoutBlock(this)); |
2714 LogicalExtentComputedValues computedValues; | 2728 LogicalExtentComputedValues computedValues; |
2715 block->computeLogicalHeight(block->logicalHeight(), 0, computedValues); | 2729 block->computeLogicalHeight(block->logicalHeight(), 0, computedValues); |
2716 LayoutUnit newContentHeight = computedValues.m_extent - block->borderAnd
PaddingLogicalHeight() - block->scrollbarLogicalHeight(); | 2730 LayoutUnit newContentHeight = computedValues.m_extent - block->borderAnd
PaddingLogicalHeight() - block->scrollbarLogicalHeight(); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2939 * fixed positioned elements is the initial containing block instead of the | 2953 * fixed positioned elements is the initial containing block instead of the |
2940 * viewport, and all scrollable boxes should be assumed to be scrolled to th
eir | 2954 * viewport, and all scrollable boxes should be assumed to be scrolled to th
eir |
2941 * origin. | 2955 * origin. |
2942 \*--------------------------------------------------------------------------
-*/ | 2956 \*--------------------------------------------------------------------------
-*/ |
2943 | 2957 |
2944 // see FIXME 1 | 2958 // see FIXME 1 |
2945 // Calculate the static distance if needed. | 2959 // Calculate the static distance if needed. |
2946 computeInlineStaticDistance(logicalLeftLength, logicalRightLength, this, con
tainerBlock, containerLogicalWidth); | 2960 computeInlineStaticDistance(logicalLeftLength, logicalRightLength, this, con
tainerBlock, containerLogicalWidth); |
2947 | 2961 |
2948 // Calculate constraint equation values for 'width' case. | 2962 // Calculate constraint equation values for 'width' case. |
2949 computePositionedLogicalWidthUsing(style()->logicalWidth(), containerBlock,
containerDirection, | 2963 computePositionedLogicalWidthUsing(MainOrPreferredSize, style()->logicalWidt
h(), containerBlock, containerDirection, |
2950 containerLogicalWidth, bordersPlusPadding, | 2964 containerLogicalWidth, bordersPlusPadding, |
2951 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalR
ight, | 2965 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalR
ight, |
2952 computedValues); | 2966 computedValues); |
2953 | 2967 |
2954 // Calculate constraint equation values for 'max-width' case. | 2968 // Calculate constraint equation values for 'max-width' case. |
2955 if (!style()->logicalMaxWidth().isMaxSizeNone()) { | 2969 if (!style()->logicalMaxWidth().isMaxSizeNone()) { |
2956 LogicalExtentComputedValues maxValues; | 2970 LogicalExtentComputedValues maxValues; |
2957 | 2971 |
2958 computePositionedLogicalWidthUsing(style()->logicalMaxWidth(), container
Block, containerDirection, | 2972 computePositionedLogicalWidthUsing(MaxSize, style()->logicalMaxWidth(),
containerBlock, containerDirection, |
2959 containerLogicalWidth, bordersPlusPadding, | 2973 containerLogicalWidth, bordersPlusPadding, |
2960 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogi
calRight, | 2974 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogi
calRight, |
2961 maxValues); | 2975 maxValues); |
2962 | 2976 |
2963 if (computedValues.m_extent > maxValues.m_extent) { | 2977 if (computedValues.m_extent > maxValues.m_extent) { |
2964 computedValues.m_extent = maxValues.m_extent; | 2978 computedValues.m_extent = maxValues.m_extent; |
2965 computedValues.m_position = maxValues.m_position; | 2979 computedValues.m_position = maxValues.m_position; |
2966 computedValues.m_margins.m_start = maxValues.m_margins.m_start; | 2980 computedValues.m_margins.m_start = maxValues.m_margins.m_start; |
2967 computedValues.m_margins.m_end = maxValues.m_margins.m_end; | 2981 computedValues.m_margins.m_end = maxValues.m_margins.m_end; |
2968 } | 2982 } |
2969 } | 2983 } |
2970 | 2984 |
2971 // Calculate constraint equation values for 'min-width' case. | 2985 // Calculate constraint equation values for 'min-width' case. |
2972 if (!style()->logicalMinWidth().isZero() || style()->logicalMinWidth().isInt
rinsic()) { | 2986 if (!style()->logicalMinWidth().isZero() || style()->logicalMinWidth().isInt
rinsic()) { |
2973 LogicalExtentComputedValues minValues; | 2987 LogicalExtentComputedValues minValues; |
2974 | 2988 |
2975 computePositionedLogicalWidthUsing(style()->logicalMinWidth(), container
Block, containerDirection, | 2989 computePositionedLogicalWidthUsing(MinSize, style()->logicalMinWidth(),
containerBlock, containerDirection, |
2976 containerLogicalWidth, bordersPlusPadding, | 2990 containerLogicalWidth, bordersPlusPadding, |
2977 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogi
calRight, | 2991 logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogi
calRight, |
2978 minValues); | 2992 minValues); |
2979 | 2993 |
2980 if (computedValues.m_extent < minValues.m_extent) { | 2994 if (computedValues.m_extent < minValues.m_extent) { |
2981 computedValues.m_extent = minValues.m_extent; | 2995 computedValues.m_extent = minValues.m_extent; |
2982 computedValues.m_position = minValues.m_position; | 2996 computedValues.m_position = minValues.m_position; |
2983 computedValues.m_margins.m_start = minValues.m_margins.m_start; | 2997 computedValues.m_margins.m_start = minValues.m_margins.m_start; |
2984 computedValues.m_margins.m_end = minValues.m_margins.m_end; | 2998 computedValues.m_margins.m_end = minValues.m_margins.m_end; |
2985 } | 2999 } |
(...skipping 17 matching lines...) Expand all Loading... |
3003 } | 3017 } |
3004 } | 3018 } |
3005 | 3019 |
3006 LayoutUnit LayoutBox::shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth,
LayoutUnit bordersPlusPadding) const | 3020 LayoutUnit LayoutBox::shrinkToFitLogicalWidth(LayoutUnit availableLogicalWidth,
LayoutUnit bordersPlusPadding) const |
3007 { | 3021 { |
3008 LayoutUnit preferredLogicalWidth = maxPreferredLogicalWidth() - bordersPlusP
adding; | 3022 LayoutUnit preferredLogicalWidth = maxPreferredLogicalWidth() - bordersPlusP
adding; |
3009 LayoutUnit preferredMinLogicalWidth = minPreferredLogicalWidth() - bordersPl
usPadding; | 3023 LayoutUnit preferredMinLogicalWidth = minPreferredLogicalWidth() - bordersPl
usPadding; |
3010 return std::min(std::max(preferredMinLogicalWidth, availableLogicalWidth), p
referredLogicalWidth); | 3024 return std::min(std::max(preferredMinLogicalWidth, availableLogicalWidth), p
referredLogicalWidth); |
3011 } | 3025 } |
3012 | 3026 |
3013 void LayoutBox::computePositionedLogicalWidthUsing(Length logicalWidth, const La
youtBoxModelObject* containerBlock, TextDirection containerDirection, | 3027 void LayoutBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt
h logicalWidth, const LayoutBoxModelObject* containerBlock, TextDirection contai
nerDirection, |
3014 LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding, | 3028 LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding, |
3015 const Length& logicalLeft, const Length& logicalRight, const Length& marginL
ogicalLeft, | 3029 const Length& logicalLeft, const Length& logicalRight, const Length& marginL
ogicalLeft, |
3016 const Length& marginLogicalRight, LogicalExtentComputedValues& computedValue
s) const | 3030 const Length& marginLogicalRight, LogicalExtentComputedValues& computedValue
s) const |
3017 { | 3031 { |
3018 if (logicalWidth.isIntrinsic()) | 3032 ASSERT(widthSizeType == MinSize || widthSizeType == MainOrPreferredSize || !
logicalWidth.isAuto()); |
| 3033 if (widthSizeType == MinSize && logicalWidth.isAuto()) |
| 3034 logicalWidth = Length(0, Fixed); |
| 3035 else if (logicalWidth.isIntrinsic()) |
3019 logicalWidth = Length(computeIntrinsicLogicalWidthUsing(logicalWidth, co
ntainerLogicalWidth, bordersPlusPadding) - bordersPlusPadding, Fixed); | 3036 logicalWidth = Length(computeIntrinsicLogicalWidthUsing(logicalWidth, co
ntainerLogicalWidth, bordersPlusPadding) - bordersPlusPadding, Fixed); |
3020 | 3037 |
3021 // 'left' and 'right' cannot both be 'auto' because one would of been | 3038 // 'left' and 'right' cannot both be 'auto' because one would of been |
3022 // converted to the static position already | 3039 // converted to the static position already |
3023 ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto())); | 3040 ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto())); |
3024 | 3041 |
3025 // minimumValueForLength will convert 'auto' to 0 so that it doesn't impact
the available space computation below. | 3042 // minimumValueForLength will convert 'auto' to 0 so that it doesn't impact
the available space computation below. |
3026 LayoutUnit logicalLeftValue = minimumValueForLength(logicalLeft, containerLo
gicalWidth); | 3043 LayoutUnit logicalLeftValue = minimumValueForLength(logicalLeft, containerLo
gicalWidth); |
3027 LayoutUnit logicalRightValue = minimumValueForLength(logicalRight, container
LogicalWidth); | 3044 LayoutUnit logicalRightValue = minimumValueForLength(logicalRight, container
LogicalWidth); |
3028 | 3045 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3241 * of fixed positioned elements is the initial containing block instead of | 3258 * of fixed positioned elements is the initial containing block instead of |
3242 * the viewport. | 3259 * the viewport. |
3243 \*--------------------------------------------------------------------------
-*/ | 3260 \*--------------------------------------------------------------------------
-*/ |
3244 | 3261 |
3245 // see FIXME 1 | 3262 // see FIXME 1 |
3246 // Calculate the static distance if needed. | 3263 // Calculate the static distance if needed. |
3247 computeBlockStaticDistance(logicalTopLength, logicalBottomLength, this, cont
ainerBlock); | 3264 computeBlockStaticDistance(logicalTopLength, logicalBottomLength, this, cont
ainerBlock); |
3248 | 3265 |
3249 // Calculate constraint equation values for 'height' case. | 3266 // Calculate constraint equation values for 'height' case. |
3250 LayoutUnit logicalHeight = computedValues.m_extent; | 3267 LayoutUnit logicalHeight = computedValues.m_extent; |
3251 computePositionedLogicalHeightUsing(styleToUse.logicalHeight(), containerBlo
ck, containerLogicalHeight, bordersPlusPadding, logicalHeight, | 3268 computePositionedLogicalHeightUsing(MainOrPreferredSize, styleToUse.logicalH
eight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeig
ht, |
3252 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, | 3269 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, |
3253 computedValues); | 3270 computedValues); |
3254 | 3271 |
3255 // Avoid doing any work in the common case (where the values of min-height a
nd max-height are their defaults). | 3272 // Avoid doing any work in the common case (where the values of min-height a
nd max-height are their defaults). |
3256 // see FIXME 2 | 3273 // see FIXME 2 |
3257 | 3274 |
3258 // Calculate constraint equation values for 'max-height' case. | 3275 // Calculate constraint equation values for 'max-height' case. |
3259 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) { | 3276 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) { |
3260 LogicalExtentComputedValues maxValues; | 3277 LogicalExtentComputedValues maxValues; |
3261 | 3278 |
3262 computePositionedLogicalHeightUsing(styleToUse.logicalMaxHeight(), conta
inerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, | 3279 computePositionedLogicalHeightUsing(MaxSize, styleToUse.logicalMaxHeight
(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, |
3263 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, | 3280 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, |
3264 maxValues); | 3281 maxValues); |
3265 | 3282 |
3266 if (computedValues.m_extent > maxValues.m_extent) { | 3283 if (computedValues.m_extent > maxValues.m_extent) { |
3267 computedValues.m_extent = maxValues.m_extent; | 3284 computedValues.m_extent = maxValues.m_extent; |
3268 computedValues.m_position = maxValues.m_position; | 3285 computedValues.m_position = maxValues.m_position; |
3269 computedValues.m_margins.m_before = maxValues.m_margins.m_before; | 3286 computedValues.m_margins.m_before = maxValues.m_margins.m_before; |
3270 computedValues.m_margins.m_after = maxValues.m_margins.m_after; | 3287 computedValues.m_margins.m_after = maxValues.m_margins.m_after; |
3271 } | 3288 } |
3272 } | 3289 } |
3273 | 3290 |
3274 // Calculate constraint equation values for 'min-height' case. | 3291 // Calculate constraint equation values for 'min-height' case. |
3275 if (!styleToUse.logicalMinHeight().isZero() || styleToUse.logicalMinHeight()
.isIntrinsic()) { | 3292 if (!styleToUse.logicalMinHeight().isZero() || styleToUse.logicalMinHeight()
.isIntrinsic()) { |
3276 LogicalExtentComputedValues minValues; | 3293 LogicalExtentComputedValues minValues; |
3277 | 3294 |
3278 computePositionedLogicalHeightUsing(styleToUse.logicalMinHeight(), conta
inerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, | 3295 computePositionedLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight
(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, |
3279 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, | 3296 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, |
3280 minValues); | 3297 minValues); |
3281 | 3298 |
3282 if (computedValues.m_extent < minValues.m_extent) { | 3299 if (computedValues.m_extent < minValues.m_extent) { |
3283 computedValues.m_extent = minValues.m_extent; | 3300 computedValues.m_extent = minValues.m_extent; |
3284 computedValues.m_position = minValues.m_position; | 3301 computedValues.m_position = minValues.m_position; |
3285 computedValues.m_margins.m_before = minValues.m_margins.m_before; | 3302 computedValues.m_margins.m_before = minValues.m_margins.m_before; |
3286 computedValues.m_margins.m_after = minValues.m_margins.m_after; | 3303 computedValues.m_margins.m_after = minValues.m_margins.m_after; |
3287 } | 3304 } |
3288 } | 3305 } |
(...skipping 20 matching lines...) Expand all Loading... |
3309 else | 3326 else |
3310 logicalTopPos += containerBlock->borderRight(); | 3327 logicalTopPos += containerBlock->borderRight(); |
3311 } else { | 3328 } else { |
3312 if (child->isHorizontalWritingMode()) | 3329 if (child->isHorizontalWritingMode()) |
3313 logicalTopPos += containerBlock->borderTop(); | 3330 logicalTopPos += containerBlock->borderTop(); |
3314 else | 3331 else |
3315 logicalTopPos += containerBlock->borderLeft(); | 3332 logicalTopPos += containerBlock->borderLeft(); |
3316 } | 3333 } |
3317 } | 3334 } |
3318 | 3335 |
3319 void LayoutBox::computePositionedLogicalHeightUsing(Length logicalHeightLength,
const LayoutBoxModelObject* containerBlock, | 3336 void LayoutBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len
gth logicalHeightLength, const LayoutBoxModelObject* containerBlock, |
3320 LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit
logicalHeight, | 3337 LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit
logicalHeight, |
3321 const Length& logicalTop, const Length& logicalBottom, const Length& marginB
efore, | 3338 const Length& logicalTop, const Length& logicalBottom, const Length& marginB
efore, |
3322 const Length& marginAfter, LogicalExtentComputedValues& computedValues) cons
t | 3339 const Length& marginAfter, LogicalExtentComputedValues& computedValues) cons
t |
3323 { | 3340 { |
| 3341 ASSERT(heightSizeType == MinSize || heightSizeType == MainOrPreferredSize ||
!logicalHeightLength.isAuto()); |
| 3342 if (heightSizeType == MinSize && logicalHeightLength.isAuto()) |
| 3343 logicalHeightLength = Length(0, Fixed); |
| 3344 |
3324 // 'top' and 'bottom' cannot both be 'auto' because 'top would of been | 3345 // 'top' and 'bottom' cannot both be 'auto' because 'top would of been |
3325 // converted to the static position in computePositionedLogicalHeight() | 3346 // converted to the static position in computePositionedLogicalHeight() |
3326 ASSERT(!(logicalTop.isAuto() && logicalBottom.isAuto())); | 3347 ASSERT(!(logicalTop.isAuto() && logicalBottom.isAuto())); |
3327 | 3348 |
3328 LayoutUnit logicalHeightValue; | 3349 LayoutUnit logicalHeightValue; |
3329 LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding; | 3350 LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding; |
3330 | 3351 |
3331 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidth
ForPositioned(containerBlock, false); | 3352 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidth
ForPositioned(containerBlock, false); |
3332 | 3353 |
3333 LayoutUnit logicalTopValue = 0; | 3354 LayoutUnit logicalTopValue = 0; |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4644 computedValues.m_margins.m_end = marginEnd(); | 4665 computedValues.m_margins.m_end = marginEnd(); |
4645 | 4666 |
4646 setLogicalTop(oldLogicalTop); | 4667 setLogicalTop(oldLogicalTop); |
4647 setLogicalWidth(oldLogicalWidth); | 4668 setLogicalWidth(oldLogicalWidth); |
4648 setLogicalLeft(oldLogicalLeft); | 4669 setLogicalLeft(oldLogicalLeft); |
4649 setMarginLeft(oldMarginLeft); | 4670 setMarginLeft(oldMarginLeft); |
4650 setMarginRight(oldMarginRight); | 4671 setMarginRight(oldMarginRight); |
4651 } | 4672 } |
4652 | 4673 |
4653 } // namespace blink | 4674 } // namespace blink |
OLD | NEW |