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

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, 9 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 4692 matching lines...) Expand 10 before | Expand all | Expand 10 after
4703 } 4703 }
4704 4704
4705 void LayoutBox::clearPercentHeightDescendants() 4705 void LayoutBox::clearPercentHeightDescendants()
4706 { 4706 {
4707 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4707 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4708 if (curr->isBox()) 4708 if (curr->isBox())
4709 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4709 toLayoutBox(curr)->removeFromPercentHeightContainer();
4710 } 4710 }
4711 } 4711 }
4712 4712
4713 LayoutUnit LayoutBox::pageLogicalHeightForOffset(LayoutUnit offset) const
4714 {
4715 LayoutView* layoutView = view();
4716 LayoutFlowThread* flowThread = flowThreadContainingBlock();
4717 if (!flowThread)
4718 return layoutView->layoutState()->pageLogicalHeight();
4719 return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopO fFirstPage());
4720 }
4721
4722 LayoutUnit LayoutBox::pageRemainingLogicalHeightForOffset(LayoutUnit offset, Pag eBoundaryRule pageBoundaryRule) const
4723 {
4724 LayoutView* layoutView = view();
4725 offset += offsetFromLogicalTopOfFirstPage();
4726
4727 LayoutFlowThread* flowThread = flowThreadContainingBlock();
4728 if (!flowThread) {
4729 LayoutUnit pageLogicalHeight = layoutView->layoutState()->pageLogicalHei ght();
4730 LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogi calHeight);
4731 if (pageBoundaryRule == AssociateWithFormerPage) {
4732 // An offset exactly at a page boundary will act as being part of th e former page in
4733 // question (i.e. no remaining space), rather than being part of the latter (i.e. one
4734 // whole page length of remaining space).
4735 remainingHeight = intMod(remainingHeight, pageLogicalHeight);
4736 }
4737 return remainingHeight;
4738 }
4739
4740 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR ule);
4741 }
4742
4743 LayoutUnit LayoutBox::calculatePaginationStrutToFitContent(LayoutUnit offset, La youtUnit strutToNextPage, LayoutUnit contentLogicalHeight) const
4744 {
4745 ASSERT(strutToNextPage == pageRemainingLogicalHeightForOffset(offset, Associ ateWithLatterPage));
4746 LayoutUnit nextPageLogicalTop = offset + strutToNextPage;
4747 if (pageLogicalHeightForOffset(nextPageLogicalTop) >= contentLogicalHeight)
4748 return strutToNextPage; // Content fits just fine in the next page or co lumn.
4749
4750 // Moving to the top of the next page or column doesn't result in enough spa ce for the content
4751 // that we're trying to fit. If we're in a nested fragmentation context, we may find enough
4752 // space if we move to a column further ahead, by effectively breaking to th e next outer
4753 // fragmentainer.
4754 LayoutFlowThread* flowThread = flowThreadContainingBlock();
4755 if (!flowThread) {
4756 // If there's no flow thread, we're not nested. All pages have the same height. Give up.
4757 return strutToNextPage;
4758 }
4759 // Start searching for a suitable offset at the top of the next page or colu mn.
4760 LayoutUnit flowThreadOffset = offsetFromLogicalTopOfFirstPage() + nextPageLo gicalTop;
4761 return strutToNextPage + flowThread->nextLogicalTopForUnbreakableContent(flo wThreadOffset, contentLogicalHeight) - flowThreadOffset;
4762 }
4763
4713 } // namespace blink 4764 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698