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 2564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 | 2575 |
2576 // WinIE quirk: The <html> block always fills the entire canvas in quirks mo
de. The <body> always fills the | 2576 // WinIE quirk: The <html> block always fills the entire canvas in quirks mo
de. The <body> always fills the |
2577 // <html> block in quirks mode. Only apply this quirk if the block is norma
l flow and no height | 2577 // <html> block in quirks mode. Only apply this quirk if the block is norma
l flow and no height |
2578 // is specified. When we're printing, we also need this quirk if the body or
root has a percentage | 2578 // is specified. When we're printing, we also need this quirk if the body or
root has a percentage |
2579 // height since we don't set a height in RenderView when we're printing. So
without this quirk, the | 2579 // height since we don't set a height in RenderView when we're printing. So
without this quirk, the |
2580 // height has nothing to be a percentage of, and it ends up being 0. That is
bad. | 2580 // height has nothing to be a percentage of, and it ends up being 0. That is
bad. |
2581 bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercent(
) | 2581 bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercent(
) |
2582 && (isDocumentElement() || (isBody() && document().documentElement()->re
nderer()->style()->logicalHeight().isPercent())) && !isInline(); | 2582 && (isDocumentElement() || (isBody() && document().documentElement()->re
nderer()->style()->logicalHeight().isPercent())) && !isInline(); |
2583 if (stretchesToViewport() || paginatedContentNeedsBaseHeight) { | 2583 if (stretchesToViewport() || paginatedContentNeedsBaseHeight) { |
2584 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter(); | 2584 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter(); |
2585 LayoutUnit visibleHeight = viewLogicalHeightForPercentages(); | 2585 LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages(); |
2586 if (isDocumentElement()) | 2586 if (isDocumentElement()) |
2587 computedValues.m_extent = max(computedValues.m_extent, visibleHeight
- margins); | 2587 computedValues.m_extent = max(computedValues.m_extent, visibleHeight
- margins); |
2588 else { | 2588 else { |
2589 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo
re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight()
; | 2589 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo
re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight()
; |
2590 computedValues.m_extent = max(computedValues.m_extent, visibleHeight
- marginsBordersPadding); | 2590 computedValues.m_extent = max(computedValues.m_extent, visibleHeight
- marginsBordersPadding); |
2591 } | 2591 } |
2592 } | 2592 } |
2593 } | 2593 } |
2594 | 2594 |
2595 LayoutUnit RenderBox::viewLogicalHeightForPercentages() const | |
2596 { | |
2597 if (document().printing()) | |
2598 return static_cast<LayoutUnit>(view()->pageLogicalHeight()); | |
2599 return view()->viewLogicalHeight(); | |
2600 } | |
2601 | |
2602 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit
intrinsicContentHeight) const | 2595 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit
intrinsicContentHeight) const |
2603 { | 2596 { |
2604 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig
ht, intrinsicContentHeight); | 2597 LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(heig
ht, intrinsicContentHeight); |
2605 if (logicalHeight != -1) | 2598 if (logicalHeight != -1) |
2606 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); | 2599 logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); |
2607 return logicalHeight; | 2600 return logicalHeight; |
2608 } | 2601 } |
2609 | 2602 |
2610 LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height, LayoutUn
it intrinsicContentHeight) const | 2603 LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height, LayoutUn
it intrinsicContentHeight) const |
2611 { | 2604 { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy
MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1); | 2720 LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightBy
MinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1); |
2728 availableHeight = max<LayoutUnit>(0, contentBoxHeight); | 2721 availableHeight = max<LayoutUnit>(0, contentBoxHeight); |
2729 } | 2722 } |
2730 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { | 2723 } else if (isOutOfFlowPositionedWithSpecifiedHeight) { |
2731 // Don't allow this to affect the block' height() member variable, since
this | 2724 // Don't allow this to affect the block' height() member variable, since
this |
2732 // can get called while the block is still laying out its kids. | 2725 // can get called while the block is still laying out its kids. |
2733 LogicalExtentComputedValues computedValues; | 2726 LogicalExtentComputedValues computedValues; |
2734 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); | 2727 cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues); |
2735 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH
eight() - cb->scrollbarLogicalHeight(); | 2728 availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalH
eight() - cb->scrollbarLogicalHeight(); |
2736 } else if (cb->isRenderView()) | 2729 } else if (cb->isRenderView()) |
2737 availableHeight = viewLogicalHeightForPercentages(); | 2730 availableHeight = view()->viewLogicalHeightForPercentages(); |
2738 | 2731 |
2739 if (availableHeight == -1) | 2732 if (availableHeight == -1) |
2740 return availableHeight; | 2733 return availableHeight; |
2741 | 2734 |
2742 availableHeight -= rootMarginBorderPaddingHeight; | 2735 availableHeight -= rootMarginBorderPaddingHeight; |
2743 | 2736 |
2744 LayoutUnit result = valueForLength(height, availableHeight); | 2737 LayoutUnit result = valueForLength(height, availableHeight); |
2745 if (includeBorderPadding) { | 2738 if (includeBorderPadding) { |
2746 // FIXME: Table cells should default to box-sizing: border-box so we can
avoid this hack. | 2739 // FIXME: Table cells should default to box-sizing: border-box so we can
avoid this hack. |
2747 // It is necessary to use the border-box to match WinIE's broken | 2740 // It is necessary to use the border-box to match WinIE's broken |
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4678 return 0; | 4671 return 0; |
4679 | 4672 |
4680 if (!layoutState && !flowThreadContainingBlock()) | 4673 if (!layoutState && !flowThreadContainingBlock()) |
4681 return 0; | 4674 return 0; |
4682 | 4675 |
4683 RenderBlock* containerBlock = containingBlock(); | 4676 RenderBlock* containerBlock = containingBlock(); |
4684 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4677 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
4685 } | 4678 } |
4686 | 4679 |
4687 } // namespace WebCore | 4680 } // namespace WebCore |
OLD | NEW |