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

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

Issue 1602773005: Respect break-inside:avoid on table rows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 7 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. 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 4739 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 } 4750 }
4751 4751
4752 void LayoutBox::clearPercentHeightDescendants() 4752 void LayoutBox::clearPercentHeightDescendants()
4753 { 4753 {
4754 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4754 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4755 if (curr->isBox()) 4755 if (curr->isBox())
4756 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4756 toLayoutBox(curr)->removeFromPercentHeightContainer();
4757 } 4757 }
4758 } 4758 }
4759 4759
4760 LayoutUnit LayoutBox::pageLogicalHeightForOffset(LayoutUnit offset) const
4761 {
4762 LayoutView* layoutView = view();
4763 LayoutFlowThread* flowThread = flowThreadContainingBlock();
4764 if (!flowThread)
4765 return layoutView->layoutState()->pageLogicalHeight();
4766 return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopO fFirstPage());
4767 }
4768
4769 LayoutUnit LayoutBox::pageRemainingLogicalHeightForOffset(LayoutUnit offset, Pag eBoundaryRule pageBoundaryRule) const
4770 {
4771 LayoutView* layoutView = view();
4772 offset += offsetFromLogicalTopOfFirstPage();
4773
4774 LayoutFlowThread* flowThread = flowThreadContainingBlock();
4775 if (!flowThread) {
4776 LayoutUnit pageLogicalHeight = layoutView->layoutState()->pageLogicalHei ght();
4777 LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogi calHeight);
4778 if (pageBoundaryRule == AssociateWithFormerPage) {
4779 // An offset exactly at a page boundary will act as being part of th e former page in
4780 // question (i.e. no remaining space), rather than being part of the latter (i.e. one
4781 // whole page length of remaining space).
4782 remainingHeight = intMod(remainingHeight, pageLogicalHeight);
4783 }
4784 return remainingHeight;
4785 }
4786
4787 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR ule);
4788 }
4789
4790 LayoutUnit LayoutBox::calculatePaginationStrutToFitContent(LayoutUnit offset, La youtUnit strutToNextPage, LayoutUnit contentLogicalHeight) const
4791 {
4792 ASSERT(strutToNextPage == pageRemainingLogicalHeightForOffset(offset, Associ ateWithLatterPage));
4793 LayoutUnit nextPageLogicalTop = offset + strutToNextPage;
4794 if (pageLogicalHeightForOffset(nextPageLogicalTop) >= contentLogicalHeight)
4795 return strutToNextPage; // Content fits just fine in the next page or co lumn.
4796
4797 // Moving to the top of the next page or column doesn't result in enough spa ce for the content
4798 // that we're trying to fit. If we're in a nested fragmentation context, we may find enough
4799 // space if we move to a column further ahead, by effectively breaking to th e next outer
4800 // fragmentainer.
4801 LayoutFlowThread* flowThread = flowThreadContainingBlock();
4802 if (!flowThread) {
4803 // If there's no flow thread, we're not nested. All pages have the same height. Give up.
4804 return strutToNextPage;
4805 }
4806 // Start searching for a suitable offset at the top of the next page or colu mn.
4807 LayoutUnit flowThreadOffset = offsetFromLogicalTopOfFirstPage() + nextPageLo gicalTop;
4808 return strutToNextPage + flowThread->nextLogicalTopForUnbreakableContent(flo wThreadOffset, contentLogicalHeight) - flowThreadOffset;
4809 }
4810
4760 } // namespace blink 4811 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698