Chromium Code Reviews| 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 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2764 | 2764 |
| 2765 ASSERT_NOT_REACHED(); | 2765 ASSERT_NOT_REACHED(); |
| 2766 return 0; | 2766 return 0; |
| 2767 } | 2767 } |
| 2768 | 2768 |
| 2769 LayoutUnit RenderBox::computeReplacedLogicalHeight() const | 2769 LayoutUnit RenderBox::computeReplacedLogicalHeight() const |
| 2770 { | 2770 { |
| 2771 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLog icalHeightUsing(style()->logicalHeight())); | 2771 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLog icalHeightUsing(style()->logicalHeight())); |
| 2772 } | 2772 } |
| 2773 | 2773 |
| 2774 bool RenderBox::logicalHeightComputesAsNone(SizeType sizeType) const | |
| 2775 { | |
| 2776 ASSERT(sizeType == MinSize || sizeType == MaxSize); | |
| 2777 Length logicalHeightLength = sizeType == MinSize ? style()->logicalMinHeight () : style()->logicalMaxHeight(); | |
| 2778 | |
| 2779 if (logicalHeightLength == (sizeType == MinSize ? RenderStyle::initialMinSiz e() : RenderStyle::initialMaxSize())) | |
| 2780 return true; | |
| 2781 | |
| 2782 if (!logicalHeightLength.isPercent() || isOutOfFlowPositioned() || document( ).inQuirksMode()) | |
|
leviw_travelin_and_unemployed
2014/07/07 18:02:35
Why the Quirks Mode check here? Is this tested any
| |
| 2783 return false; | |
| 2784 | |
| 2785 // Anonymous block boxes are ignored when resolving percentage values that w ould refer to it: | |
| 2786 // the closest non-anonymous ancestor box is used instead. | |
| 2787 RenderBlock* cb = containingBlock(); | |
| 2788 while (cb->isAnonymous()) | |
| 2789 cb = cb->containingBlock(); | |
| 2790 | |
| 2791 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(); | |
| 2792 } | |
| 2793 | |
| 2774 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU nit logicalHeight) const | 2794 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU nit logicalHeight) const |
| 2775 { | 2795 { |
| 2776 LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style()->log icalMinHeight()); | 2796 // 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, |
| 2777 LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? lo gicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); | 2797 // the percentage value is treated as '0' (for 'min-height') or 'none' (for 'max-height'). |
| 2798 LayoutUnit minLogicalHeight = logicalHeightComputesAsNone(MinSize) ? LayoutU nit() : computeReplacedLogicalHeightUsing(style()->logicalMinHeight()); | |
|
esprehn
2014/07/07 18:15:53
computeReplacedLogicalHeightUsing should just know
| |
| 2799 LayoutUnit maxLogicalHeight = logicalHeightComputesAsNone(MaxSize) ? logical Height : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); | |
| 2778 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)) ; | 2800 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)) ; |
| 2779 } | 2801 } |
| 2780 | 2802 |
| 2781 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei ght) const | 2803 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei ght) const |
| 2782 { | 2804 { |
| 2783 switch (logicalHeight.type()) { | 2805 switch (logicalHeight.type()) { |
| 2784 case Fixed: | 2806 case Fixed: |
| 2785 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ()); | 2807 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ()); |
| 2786 case Percent: | 2808 case Percent: |
| 2787 case Calculated: | 2809 case Calculated: |
| (...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4612 return 0; | 4634 return 0; |
| 4613 | 4635 |
| 4614 if (!layoutState && !flowThreadContainingBlock()) | 4636 if (!layoutState && !flowThreadContainingBlock()) |
| 4615 return 0; | 4637 return 0; |
| 4616 | 4638 |
| 4617 RenderBlock* containerBlock = containingBlock(); | 4639 RenderBlock* containerBlock = containingBlock(); |
| 4618 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4640 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
| 4619 } | 4641 } |
| 4620 | 4642 |
| 4621 } // namespace WebCore | 4643 } // namespace WebCore |
| OLD | NEW |