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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 m_frameRect.height().toFloat()); | 699 m_frameRect.height().toFloat()); |
700 } | 700 } |
701 | 701 |
702 void LayoutBox::updateLayerTransformAfterLayout() { | 702 void LayoutBox::updateLayerTransformAfterLayout() { |
703 // Transform-origin depends on box size, so we need to update the layer | 703 // Transform-origin depends on box size, so we need to update the layer |
704 // transform after layout. | 704 // transform after layout. |
705 if (hasLayer()) | 705 if (hasLayer()) |
706 layer()->updateTransformationMatrix(); | 706 layer()->updateTransformationMatrix(); |
707 } | 707 } |
708 | 708 |
709 LayoutUnit LayoutBox::logicalHeightWithVisibleOverflow() const { | 709 LayoutUnit LayoutBox::logicalHeightIncludingOverflow() const { |
710 if (!m_overflow || hasOverflowClip()) | 710 if (!m_overflow) |
711 return logicalHeight(); | 711 return logicalHeight(); |
712 LayoutRect overflow = layoutOverflowRect(); | 712 LayoutRect overflow = layoutOverflowRect(); |
713 if (style()->isHorizontalWritingMode()) | 713 if (style()->isHorizontalWritingMode()) |
714 return overflow.maxY(); | 714 return overflow.maxY(); |
715 return overflow.maxX(); | 715 return overflow.maxX(); |
716 } | 716 } |
717 | 717 |
718 LayoutUnit LayoutBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, | 718 LayoutUnit LayoutBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, |
719 LayoutUnit availableWidth, | 719 LayoutUnit availableWidth, |
720 LayoutBlock* cb) const { | 720 LayoutBlock* cb) const { |
(...skipping 3984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4705 } | 4705 } |
4706 | 4706 |
4707 void LayoutBox::updateFragmentationInfoForChild(LayoutBox& child) { | 4707 void LayoutBox::updateFragmentationInfoForChild(LayoutBox& child) { |
4708 LayoutState* layoutState = view()->layoutState(); | 4708 LayoutState* layoutState = view()->layoutState(); |
4709 DCHECK(layoutState->isPaginated()); | 4709 DCHECK(layoutState->isPaginated()); |
4710 child.setOffsetToNextPage(LayoutUnit()); | 4710 child.setOffsetToNextPage(LayoutUnit()); |
4711 if (!pageLogicalHeightForOffset(child.logicalTop())) | 4711 if (!pageLogicalHeightForOffset(child.logicalTop())) |
4712 return; | 4712 return; |
4713 | 4713 |
4714 LayoutUnit logicalTop = child.logicalTop(); | 4714 LayoutUnit logicalTop = child.logicalTop(); |
4715 LayoutUnit logicalHeight = child.logicalHeightWithVisibleOverflow(); | 4715 LayoutUnit logicalHeight = child.logicalHeightIncludingOverflow(); |
4716 LayoutUnit spaceLeft = | 4716 LayoutUnit spaceLeft = |
4717 pageRemainingLogicalHeightForOffset(logicalTop, AssociateWithLatterPage); | 4717 pageRemainingLogicalHeightForOffset(logicalTop, AssociateWithLatterPage); |
4718 if (spaceLeft < logicalHeight) | 4718 if (spaceLeft < logicalHeight) |
4719 child.setOffsetToNextPage(spaceLeft); | 4719 child.setOffsetToNextPage(spaceLeft); |
4720 } | 4720 } |
4721 | 4721 |
4722 bool LayoutBox::childNeedsRelayoutForPagination(const LayoutBox& child) const { | 4722 bool LayoutBox::childNeedsRelayoutForPagination(const LayoutBox& child) const { |
4723 // TODO(mstensho): Should try to get this to work for floats too, instead of | 4723 // TODO(mstensho): Should try to get this to work for floats too, instead of |
4724 // just marking and bailing here. | 4724 // just marking and bailing here. |
4725 if (child.isFloating()) | 4725 if (child.isFloating()) |
4726 return true; | 4726 return true; |
4727 LayoutUnit logicalTop = child.logicalTop(); | 4727 LayoutUnit logicalTop = child.logicalTop(); |
4728 // Figure out if we really need to force re-layout of the child. We only need | 4728 // Figure out if we really need to force re-layout of the child. We only need |
4729 // to do this if there's a chance that we need to recalculate pagination | 4729 // to do this if there's a chance that we need to recalculate pagination |
4730 // struts inside. | 4730 // struts inside. |
4731 if (LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalTop)) { | 4731 if (LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalTop)) { |
4732 LayoutUnit logicalHeight = child.logicalHeightWithVisibleOverflow(); | 4732 LayoutUnit logicalHeight = child.logicalHeightIncludingOverflow(); |
4733 LayoutUnit remainingSpace = pageRemainingLogicalHeightForOffset( | 4733 LayoutUnit remainingSpace = pageRemainingLogicalHeightForOffset( |
4734 logicalTop, AssociateWithLatterPage); | 4734 logicalTop, AssociateWithLatterPage); |
4735 if (child.offsetToNextPage()) { | 4735 if (child.offsetToNextPage()) { |
4736 // We need to relayout unless we're going to break at the exact same | 4736 // We need to relayout unless we're going to break at the exact same |
4737 // location as before. | 4737 // location as before. |
4738 if (child.offsetToNextPage() != remainingSpace) | 4738 if (child.offsetToNextPage() != remainingSpace) |
4739 return true; | 4739 return true; |
4740 } else if (logicalHeight > remainingSpace) { | 4740 } else if (logicalHeight > remainingSpace) { |
4741 // Last time we laid out this child, we didn't need to break, but now we | 4741 // Last time we laid out this child, we didn't need to break, but now we |
4742 // have to. So we need to relayout. | 4742 // have to. So we need to relayout. |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5638 LayoutRect rect = frameRect(); | 5638 LayoutRect rect = frameRect(); |
5639 | 5639 |
5640 LayoutBlock* block = containingBlock(); | 5640 LayoutBlock* block = containingBlock(); |
5641 if (block) | 5641 if (block) |
5642 block->adjustChildDebugRect(rect); | 5642 block->adjustChildDebugRect(rect); |
5643 | 5643 |
5644 return rect; | 5644 return rect; |
5645 } | 5645 } |
5646 | 5646 |
5647 } // namespace blink | 5647 } // namespace blink |
OLD | NEW |