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

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

Issue 1472053002: Jump to the next outer column when an inner column is too short. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review Created 5 years 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 // question (i.e. no remaining space), rather than being part of the latter (i.e. one 2646 // question (i.e. no remaining space), rather than being part of the latter (i.e. one
2647 // whole page length of remaining space). 2647 // whole page length of remaining space).
2648 remainingHeight = intMod(remainingHeight, pageLogicalHeight); 2648 remainingHeight = intMod(remainingHeight, pageLogicalHeight);
2649 } 2649 }
2650 return remainingHeight; 2650 return remainingHeight;
2651 } 2651 }
2652 2652
2653 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR ule); 2653 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR ule);
2654 } 2654 }
2655 2655
2656 LayoutUnit LayoutBlock::calculatePaginationStrutToFitContent(LayoutUnit offset, LayoutUnit strutToNextPage, LayoutUnit contentLogicalHeight) const
2657 {
2658 ASSERT(strutToNextPage == pageRemainingLogicalHeightForOffset(offset, Associ ateWithLatterPage));
2659 LayoutUnit nextPageLogicalTop = offset + strutToNextPage;
2660 if (pageLogicalHeightForOffset(nextPageLogicalTop) >= contentLogicalHeight)
2661 return strutToNextPage; // Content fits just fine in the next page or co lumn.
2662
2663 // Moving to the top of the next page or column doesn't result in enough spa ce for the content
2664 // that we're trying to fit. If we're in a nested fragmentation context, we may find enough
2665 // space if we move to a column further ahead, by effectively breaking to th e next outer
2666 // fragmentainer.
2667 LayoutFlowThread* flowThread = flowThreadContainingBlock();
2668 if (!flowThread) {
2669 // If there's no flow thread, we're not nested. All pages have the same height. Give up.
2670 return strutToNextPage;
2671 }
2672 // Start searching for a suitable offset at the top of the next page or colu mn.
2673 LayoutUnit flowThreadOffset = offsetFromLogicalTopOfFirstPage() + nextPageLo gicalTop;
2674 return strutToNextPage + flowThread->nextLogicalTopForUnbreakableContent(flo wThreadOffset, contentLogicalHeight) - flowThreadOffset;
2675 }
2676
2656 void LayoutBlock::paginatedContentWasLaidOut(LayoutUnit logicalTopOffsetAfterPag ination) 2677 void LayoutBlock::paginatedContentWasLaidOut(LayoutUnit logicalTopOffsetAfterPag ination)
2657 { 2678 {
2658 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) 2679 if (LayoutFlowThread* flowThread = flowThreadContainingBlock())
2659 flowThread->contentWasLaidOut(offsetFromLogicalTopOfFirstPage() + logica lTopOffsetAfterPagination); 2680 flowThread->contentWasLaidOut(offsetFromLogicalTopOfFirstPage() + logica lTopOffsetAfterPagination);
2660 } 2681 }
2661 2682
2662 LayoutUnit LayoutBlock::collapsedMarginBeforeForChild(const LayoutBox& child) co nst 2683 LayoutUnit LayoutBlock::collapsedMarginBeforeForChild(const LayoutBox& child) co nst
2663 { 2684 {
2664 // If the child has the same directionality as we do, then we can just retur n its 2685 // If the child has the same directionality as we do, then we can just retur n its
2665 // collapsed margin. 2686 // collapsed margin.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2891 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2912 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2892 { 2913 {
2893 showLayoutObject(); 2914 showLayoutObject();
2894 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2915 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2895 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2916 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2896 } 2917 }
2897 2918
2898 #endif 2919 #endif
2899 2920
2900 } // namespace blink 2921 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698