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

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

Powered by Google App Engine
This is Rietveld 408576698