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 5817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5828 return View()->PageLogicalHeight(); | 5828 return View()->PageLogicalHeight(); |
5829 } | 5829 } |
5830 | 5830 |
5831 LayoutUnit LayoutBox::PageRemainingLogicalHeightForOffset( | 5831 LayoutUnit LayoutBox::PageRemainingLogicalHeightForOffset( |
5832 LayoutUnit offset, | 5832 LayoutUnit offset, |
5833 PageBoundaryRule page_boundary_rule) const { | 5833 PageBoundaryRule page_boundary_rule) const { |
5834 DCHECK(IsPageLogicalHeightKnown()); | 5834 DCHECK(IsPageLogicalHeightKnown()); |
5835 LayoutView* layout_view = View(); | 5835 LayoutView* layout_view = View(); |
5836 offset += OffsetFromLogicalTopOfFirstPage(); | 5836 offset += OffsetFromLogicalTopOfFirstPage(); |
5837 | 5837 |
| 5838 LayoutUnit footer_height = |
| 5839 View()->GetLayoutState()->HeightOffsetForTableFooters(); |
5838 LayoutFlowThread* flow_thread = FlowThreadContainingBlock(); | 5840 LayoutFlowThread* flow_thread = FlowThreadContainingBlock(); |
| 5841 LayoutUnit remaining_height; |
5839 if (!flow_thread) { | 5842 if (!flow_thread) { |
5840 LayoutUnit page_logical_height = layout_view->PageLogicalHeight(); | 5843 LayoutUnit page_logical_height = layout_view->PageLogicalHeight(); |
5841 LayoutUnit remaining_height = | 5844 remaining_height = |
5842 page_logical_height - IntMod(offset, page_logical_height); | 5845 page_logical_height - IntMod(offset, page_logical_height); |
5843 if (page_boundary_rule == kAssociateWithFormerPage) { | 5846 if (page_boundary_rule == kAssociateWithFormerPage) { |
5844 // An offset exactly at a page boundary will act as being part of the | 5847 // An offset exactly at a page boundary will act as being part of the |
5845 // former page in question (i.e. no remaining space), rather than being | 5848 // former page in question (i.e. no remaining space), rather than being |
5846 // part of the latter (i.e. one whole page length of remaining space). | 5849 // part of the latter (i.e. one whole page length of remaining space). |
5847 remaining_height = IntMod(remaining_height, page_logical_height); | 5850 remaining_height = IntMod(remaining_height, page_logical_height); |
5848 } | 5851 } |
5849 return remaining_height; | 5852 } else { |
| 5853 remaining_height = flow_thread->PageRemainingLogicalHeightForOffset( |
| 5854 offset, page_boundary_rule); |
5850 } | 5855 } |
5851 | 5856 return remaining_height - footer_height; |
5852 return flow_thread->PageRemainingLogicalHeightForOffset(offset, | |
5853 page_boundary_rule); | |
5854 } | 5857 } |
5855 | 5858 |
5856 bool LayoutBox::CrossesPageBoundary(LayoutUnit offset, | 5859 bool LayoutBox::CrossesPageBoundary(LayoutUnit offset, |
5857 LayoutUnit logical_height) const { | 5860 LayoutUnit logical_height) const { |
5858 if (!IsPageLogicalHeightKnown()) | 5861 if (!IsPageLogicalHeightKnown()) |
5859 return false; | 5862 return false; |
5860 return PageRemainingLogicalHeightForOffset(offset, kAssociateWithLatterPage) < | 5863 return PageRemainingLogicalHeightForOffset(offset, kAssociateWithLatterPage) < |
5861 logical_height; | 5864 logical_height; |
5862 } | 5865 } |
5863 | 5866 |
5864 LayoutUnit LayoutBox::CalculatePaginationStrutToFitContent( | 5867 LayoutUnit LayoutBox::CalculatePaginationStrutToFitContent( |
5865 LayoutUnit offset, | 5868 LayoutUnit offset, |
5866 LayoutUnit content_logical_height) const { | 5869 LayoutUnit content_logical_height) const { |
5867 LayoutUnit strut_to_next_page = | 5870 LayoutUnit strut_to_next_page = |
5868 PageRemainingLogicalHeightForOffset(offset, kAssociateWithLatterPage); | 5871 PageRemainingLogicalHeightForOffset(offset, kAssociateWithLatterPage); |
5869 | 5872 |
| 5873 LayoutState* layout_state = View()->GetLayoutState(); |
| 5874 strut_to_next_page += layout_state->HeightOffsetForTableFooters(); |
5870 // If we're inside a cell in a row that straddles a page then avoid the | 5875 // If we're inside a cell in a row that straddles a page then avoid the |
5871 // repeating header group if necessary. If we're a table section we're | 5876 // repeating header group if necessary. If we're a table section we're |
5872 // already accounting for it. | 5877 // already accounting for it. |
5873 if (!IsTableSection()) { | 5878 if (!IsTableSection()) { |
5874 LayoutState* layout_state = View()->GetLayoutState(); | |
5875 strut_to_next_page += layout_state->HeightOffsetForTableHeaders(); | 5879 strut_to_next_page += layout_state->HeightOffsetForTableHeaders(); |
5876 } | 5880 } |
5877 | 5881 |
5878 LayoutUnit next_page_logical_top = offset + strut_to_next_page; | 5882 LayoutUnit next_page_logical_top = offset + strut_to_next_page; |
5879 if (PageLogicalHeightForOffset(next_page_logical_top) >= | 5883 if (PageLogicalHeightForOffset(next_page_logical_top) >= |
5880 content_logical_height) | 5884 content_logical_height) |
5881 return strut_to_next_page; // Content fits just fine in the next page or | 5885 return strut_to_next_page; // Content fits just fine in the next page or |
5882 // column. | 5886 // column. |
5883 | 5887 |
5884 // Moving to the top of the next page or column doesn't result in enough space | 5888 // Moving to the top of the next page or column doesn't result in enough space |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5962 void LayoutBox::MutableForPainting:: | 5966 void LayoutBox::MutableForPainting:: |
5963 SavePreviousContentBoxSizeAndLayoutOverflowRect() { | 5967 SavePreviousContentBoxSizeAndLayoutOverflowRect() { |
5964 auto& rare_data = GetLayoutBox().EnsureRareData(); | 5968 auto& rare_data = GetLayoutBox().EnsureRareData(); |
5965 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; | 5969 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; |
5966 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); | 5970 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); |
5967 rare_data.previous_layout_overflow_rect_ = | 5971 rare_data.previous_layout_overflow_rect_ = |
5968 GetLayoutBox().LayoutOverflowRect(); | 5972 GetLayoutBox().LayoutOverflowRect(); |
5969 } | 5973 } |
5970 | 5974 |
5971 } // namespace blink | 5975 } // namespace blink |
OLD | NEW |