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 2754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2765 | 2765 |
| 2766 ASSERT_NOT_REACHED(); | 2766 ASSERT_NOT_REACHED(); |
| 2767 return 0; | 2767 return 0; |
| 2768 } | 2768 } |
| 2769 | 2769 |
| 2770 LayoutUnit RenderBox::computeReplacedLogicalHeight() const | 2770 LayoutUnit RenderBox::computeReplacedLogicalHeight() const |
| 2771 { | 2771 { |
| 2772 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLog icalHeightUsing(style()->logicalHeight())); | 2772 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLog icalHeightUsing(style()->logicalHeight())); |
| 2773 } | 2773 } |
| 2774 | 2774 |
| 2775 bool RenderBox::logicalHeightComputesAsNone(SizeType sizeType) const | |
| 2776 { | |
| 2777 ASSERT(sizeType == MinSize || sizeType == MaxSize); | |
| 2778 Length logicalHeightLength = sizeType == MinSize ? style()->logicalMinHeight () : style()->logicalMaxHeight(); | |
|
esprehn
2014/07/16 20:43:50
Why suffix with Length?
| |
| 2779 | |
| 2780 if (logicalHeightLength == (sizeType == MinSize ? RenderStyle::initialMinSiz e() : RenderStyle::initialMaxSize())) | |
|
esprehn
2014/07/16 20:43:49
Can we put this in a stack var instead of inside t
| |
| 2781 return true; | |
| 2782 | |
| 2783 if (!logicalHeightLength.isPercent() || isOutOfFlowPositioned()) | |
| 2784 return false; | |
| 2785 | |
| 2786 // Anonymous block boxes are ignored when resolving percentage values that w ould refer to it: | |
| 2787 // the closest non-anonymous ancestor box is used instead. | |
| 2788 RenderBlock* cb = containingBlock(); | |
|
esprehn
2014/07/16 20:43:50
containingBlock = this->containingBlock() ? I'd be
| |
| 2789 while (cb->isAnonymous()) | |
| 2790 cb = cb->containingBlock(); | |
| 2791 | |
| 2792 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(); | |
| 2793 } | |
| 2794 | |
| 2775 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU nit logicalHeight) const | 2795 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU nit logicalHeight) const |
| 2776 { | 2796 { |
| 2777 LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style()->log icalMinHeight()); | 2797 // 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, |
| 2778 LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? lo gicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); | 2798 // the percentage value is treated as '0' (for 'min-height') or 'none' (for 'max-height'). |
| 2799 LayoutUnit minLogicalHeight = logicalHeightComputesAsNone(MinSize) ? LayoutU nit() : computeReplacedLogicalHeightUsing(style()->logicalMinHeight()); | |
|
esprehn
2014/07/16 20:43:49
Instead of using a ternary I might early initializ
| |
| 2800 LayoutUnit maxLogicalHeight = logicalHeightComputesAsNone(MaxSize) ? logical Height : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); | |
| 2779 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)) ; | 2801 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)) ; |
| 2780 } | 2802 } |
| 2781 | 2803 |
| 2782 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei ght) const | 2804 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei ght) const |
| 2783 { | 2805 { |
| 2784 switch (logicalHeight.type()) { | 2806 switch (logicalHeight.type()) { |
| 2785 case Fixed: | 2807 case Fixed: |
| 2786 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ()); | 2808 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value ()); |
| 2787 case Percent: | 2809 case Percent: |
| 2788 case Calculated: | 2810 case Calculated: |
| (...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4685 return 0; | 4707 return 0; |
| 4686 | 4708 |
| 4687 if (!layoutState && !flowThreadContainingBlock()) | 4709 if (!layoutState && !flowThreadContainingBlock()) |
| 4688 return 0; | 4710 return 0; |
| 4689 | 4711 |
| 4690 RenderBlock* containerBlock = containingBlock(); | 4712 RenderBlock* containerBlock = containingBlock(); |
| 4691 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4713 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
| 4692 } | 4714 } |
| 4693 | 4715 |
| 4694 } // namespace WebCore | 4716 } // namespace WebCore |
| OLD | NEW |