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

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 4666 matching lines...) Expand 10 before | Expand all | Expand 10 after
4677 } 4677 }
4678 } 4678 }
4679 4679
4680 void LayoutBox::IntrinsicSizingInfo::transpose() 4680 void LayoutBox::IntrinsicSizingInfo::transpose()
4681 { 4681 {
4682 size = size.transposedSize(); 4682 size = size.transposedSize();
4683 aspectRatio = aspectRatio.transposedSize(); 4683 aspectRatio = aspectRatio.transposedSize();
4684 std::swap(hasWidth, hasHeight); 4684 std::swap(hasWidth, hasHeight);
4685 } 4685 }
4686 4686
4687 LayoutUnit LayoutBox::pageLogicalHeightForOffset(LayoutUnit offset) const
4688 {
4689 LayoutView* layoutView = view();
4690 LayoutFlowThread* flowThread = flowThreadContainingBlock();
4691 if (!flowThread)
4692 return layoutView->layoutState()->pageLogicalHeight();
4693 return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopO fFirstPage());
4694 }
4695
4696 LayoutUnit LayoutBox::pageRemainingLogicalHeightForOffset(LayoutUnit offset, Pag eBoundaryRule pageBoundaryRule) const
4697 {
4698 LayoutView* layoutView = view();
4699 offset += offsetFromLogicalTopOfFirstPage();
4700
4701 LayoutFlowThread* flowThread = flowThreadContainingBlock();
4702 if (!flowThread) {
4703 LayoutUnit pageLogicalHeight = layoutView->layoutState()->pageLogicalHei ght();
4704 LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogi calHeight);
4705 if (pageBoundaryRule == AssociateWithFormerPage) {
4706 // An offset exactly at a page boundary will act as being part of th e former page in
4707 // question (i.e. no remaining space), rather than being part of the latter (i.e. one
4708 // whole page length of remaining space).
4709 remainingHeight = intMod(remainingHeight, pageLogicalHeight);
4710 }
4711 return remainingHeight;
4712 }
4713
4714 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR ule);
4715 }
4716
4717 LayoutUnit LayoutBox::calculatePaginationStrutToFitContent(LayoutUnit offset, La youtUnit strutToNextPage, LayoutUnit contentLogicalHeight) const
4718 {
4719 ASSERT(strutToNextPage == pageRemainingLogicalHeightForOffset(offset, Associ ateWithLatterPage));
4720 LayoutUnit nextPageLogicalTop = offset + strutToNextPage;
4721 if (pageLogicalHeightForOffset(nextPageLogicalTop) >= contentLogicalHeight)
4722 return strutToNextPage; // Content fits just fine in the next page or co lumn.
4723
4724 // Moving to the top of the next page or column doesn't result in enough spa ce for the content
4725 // that we're trying to fit. If we're in a nested fragmentation context, we may find enough
4726 // space if we move to a column further ahead, by effectively breaking to th e next outer
4727 // fragmentainer.
4728 LayoutFlowThread* flowThread = flowThreadContainingBlock();
4729 if (!flowThread) {
4730 // If there's no flow thread, we're not nested. All pages have the same height. Give up.
4731 return strutToNextPage;
4732 }
4733 // Start searching for a suitable offset at the top of the next page or colu mn.
4734 LayoutUnit flowThreadOffset = offsetFromLogicalTopOfFirstPage() + nextPageLo gicalTop;
4735 return strutToNextPage + flowThread->nextLogicalTopForUnbreakableContent(flo wThreadOffset, contentLogicalHeight) - flowThreadOffset;
4736 }
4737
4687 } // namespace blink 4738 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698