Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2584143003: Repeat footers in paginated context (Closed)
Patch Set: bug 656232 Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5828 matching lines...) Expand 10 before | Expand all | Expand 10 after
5839 if (!flow_thread) { 5839 if (!flow_thread) {
5840 LayoutUnit page_logical_height = layout_view->PageLogicalHeight(); 5840 LayoutUnit page_logical_height = layout_view->PageLogicalHeight();
5841 LayoutUnit remaining_height = 5841 LayoutUnit remaining_height =
5842 page_logical_height - IntMod(offset, page_logical_height); 5842 page_logical_height - IntMod(offset, page_logical_height);
5843 if (page_boundary_rule == kAssociateWithFormerPage) { 5843 if (page_boundary_rule == kAssociateWithFormerPage) {
5844 // An offset exactly at a page boundary will act as being part of the 5844 // 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 5845 // 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). 5846 // part of the latter (i.e. one whole page length of remaining space).
5847 remaining_height = IntMod(remaining_height, page_logical_height); 5847 remaining_height = IntMod(remaining_height, page_logical_height);
5848 } 5848 }
5849 return remaining_height; 5849 return remaining_height;
mstensho (USE GERRIT) 2017/08/01 18:58:18 Need to subtract it here too, I guess, or it's not
5850 } 5850 }
5851 5851
5852 return flow_thread->PageRemainingLogicalHeightForOffset(offset, 5852 return flow_thread->PageRemainingLogicalHeightForOffset(offset,
5853 page_boundary_rule); 5853 page_boundary_rule) -
5854 View()->GetLayoutState()->HeightOffsetForTableFooters();
mstensho (USE GERRIT) 2017/08/01 18:58:18 Should we DCHECK that the result isn't negative?
5854 } 5855 }
5855 5856
5856 bool LayoutBox::CrossesPageBoundary(LayoutUnit offset, 5857 bool LayoutBox::CrossesPageBoundary(LayoutUnit offset,
5857 LayoutUnit logical_height) const { 5858 LayoutUnit logical_height) const {
5858 if (!IsPageLogicalHeightKnown()) 5859 if (!IsPageLogicalHeightKnown())
5859 return false; 5860 return false;
5860 return PageRemainingLogicalHeightForOffset(offset, kAssociateWithLatterPage) < 5861 return PageRemainingLogicalHeightForOffset(offset, kAssociateWithLatterPage) <
5861 logical_height; 5862 logical_height;
5862 } 5863 }
5863 5864
5864 LayoutUnit LayoutBox::CalculatePaginationStrutToFitContent( 5865 LayoutUnit LayoutBox::CalculatePaginationStrutToFitContent(
5865 LayoutUnit offset, 5866 LayoutUnit offset,
5866 LayoutUnit content_logical_height) const { 5867 LayoutUnit content_logical_height) const {
5867 LayoutUnit strut_to_next_page = 5868 LayoutUnit strut_to_next_page =
5868 PageRemainingLogicalHeightForOffset(offset, kAssociateWithLatterPage); 5869 PageRemainingLogicalHeightForOffset(offset, kAssociateWithLatterPage);
5869 5870
5871 LayoutState* layout_state = View()->GetLayoutState();
5872 strut_to_next_page += layout_state->HeightOffsetForTableFooters();
5870 // If we're inside a cell in a row that straddles a page then avoid the 5873 // 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 5874 // repeating header group if necessary. If we're a table section we're
5872 // already accounting for it. 5875 // already accounting for it.
5873 if (!IsTableSection()) { 5876 if (!IsTableSection()) {
5874 LayoutState* layout_state = View()->GetLayoutState();
5875 strut_to_next_page += layout_state->HeightOffsetForTableHeaders(); 5877 strut_to_next_page += layout_state->HeightOffsetForTableHeaders();
5876 } 5878 }
5877 5879
5878 LayoutUnit next_page_logical_top = offset + strut_to_next_page; 5880 LayoutUnit next_page_logical_top = offset + strut_to_next_page;
5879 if (PageLogicalHeightForOffset(next_page_logical_top) >= 5881 if (PageLogicalHeightForOffset(next_page_logical_top) >=
5880 content_logical_height) 5882 content_logical_height)
5881 return strut_to_next_page; // Content fits just fine in the next page or 5883 return strut_to_next_page; // Content fits just fine in the next page or
5882 // column. 5884 // column.
5883 5885
5884 // Moving to the top of the next page or column doesn't result in enough space 5886 // 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
5962 void LayoutBox::MutableForPainting:: 5964 void LayoutBox::MutableForPainting::
5963 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5965 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5964 auto& rare_data = GetLayoutBox().EnsureRareData(); 5966 auto& rare_data = GetLayoutBox().EnsureRareData();
5965 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5967 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5966 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5968 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5967 rare_data.previous_layout_overflow_rect_ = 5969 rare_data.previous_layout_overflow_rect_ =
5968 GetLayoutBox().LayoutOverflowRect(); 5970 GetLayoutBox().LayoutOverflowRect();
5969 } 5971 }
5970 5972
5971 } // namespace blink 5973 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698