| OLD | NEW |
| 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 2577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2588 | 2588 |
| 2589 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const | 2589 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const |
| 2590 { | 2590 { |
| 2591 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); | 2591 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); |
| 2592 if (!pageLogicalHeight) | 2592 if (!pageLogicalHeight) |
| 2593 return logicalOffset; | 2593 return logicalOffset; |
| 2594 | 2594 |
| 2595 return logicalOffset + pageRemainingLogicalHeightForOffset(logicalOffset, pa
geBoundaryRule); | 2595 return logicalOffset + pageRemainingLogicalHeightForOffset(logicalOffset, pa
geBoundaryRule); |
| 2596 } | 2596 } |
| 2597 | 2597 |
| 2598 LayoutUnit LayoutBlock::pageLogicalHeightForOffset(LayoutUnit offset) const | |
| 2599 { | |
| 2600 LayoutView* layoutView = view(); | |
| 2601 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | |
| 2602 if (!flowThread) | |
| 2603 return layoutView->layoutState()->pageLogicalHeight(); | |
| 2604 return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopO
fFirstPage()); | |
| 2605 } | |
| 2606 | |
| 2607 LayoutUnit LayoutBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, P
ageBoundaryRule pageBoundaryRule) const | |
| 2608 { | |
| 2609 LayoutView* layoutView = view(); | |
| 2610 offset += offsetFromLogicalTopOfFirstPage(); | |
| 2611 | |
| 2612 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | |
| 2613 if (!flowThread) { | |
| 2614 LayoutUnit pageLogicalHeight = layoutView->layoutState()->pageLogicalHei
ght(); | |
| 2615 LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogi
calHeight); | |
| 2616 if (pageBoundaryRule == AssociateWithFormerPage) { | |
| 2617 // An offset exactly at a page boundary will act as being part of th
e former page in | |
| 2618 // question (i.e. no remaining space), rather than being part of the
latter (i.e. one | |
| 2619 // whole page length of remaining space). | |
| 2620 remainingHeight = intMod(remainingHeight, pageLogicalHeight); | |
| 2621 } | |
| 2622 return remainingHeight; | |
| 2623 } | |
| 2624 | |
| 2625 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR
ule); | |
| 2626 } | |
| 2627 | |
| 2628 LayoutUnit LayoutBlock::calculatePaginationStrutToFitContent(LayoutUnit offset,
LayoutUnit strutToNextPage, LayoutUnit contentLogicalHeight) const | |
| 2629 { | |
| 2630 ASSERT(strutToNextPage == pageRemainingLogicalHeightForOffset(offset, Associ
ateWithLatterPage)); | |
| 2631 LayoutUnit nextPageLogicalTop = offset + strutToNextPage; | |
| 2632 if (pageLogicalHeightForOffset(nextPageLogicalTop) >= contentLogicalHeight) | |
| 2633 return strutToNextPage; // Content fits just fine in the next page or co
lumn. | |
| 2634 | |
| 2635 // Moving to the top of the next page or column doesn't result in enough spa
ce for the content | |
| 2636 // that we're trying to fit. If we're in a nested fragmentation context, we
may find enough | |
| 2637 // space if we move to a column further ahead, by effectively breaking to th
e next outer | |
| 2638 // fragmentainer. | |
| 2639 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | |
| 2640 if (!flowThread) { | |
| 2641 // If there's no flow thread, we're not nested. All pages have the same
height. Give up. | |
| 2642 return strutToNextPage; | |
| 2643 } | |
| 2644 // Start searching for a suitable offset at the top of the next page or colu
mn. | |
| 2645 LayoutUnit flowThreadOffset = offsetFromLogicalTopOfFirstPage() + nextPageLo
gicalTop; | |
| 2646 return strutToNextPage + flowThread->nextLogicalTopForUnbreakableContent(flo
wThreadOffset, contentLogicalHeight) - flowThreadOffset; | |
| 2647 } | |
| 2648 | |
| 2649 void LayoutBlock::paginatedContentWasLaidOut(LayoutUnit logicalBottomOffsetAfter
Pagination) | 2598 void LayoutBlock::paginatedContentWasLaidOut(LayoutUnit logicalBottomOffsetAfter
Pagination) |
| 2650 { | 2599 { |
| 2651 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) | 2600 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) |
| 2652 flowThread->contentWasLaidOut(offsetFromLogicalTopOfFirstPage() + logica
lBottomOffsetAfterPagination); | 2601 flowThread->contentWasLaidOut(offsetFromLogicalTopOfFirstPage() + logica
lBottomOffsetAfterPagination); |
| 2653 } | 2602 } |
| 2654 | 2603 |
| 2655 LayoutUnit LayoutBlock::collapsedMarginBeforeForChild(const LayoutBox& child) co
nst | 2604 LayoutUnit LayoutBlock::collapsedMarginBeforeForChild(const LayoutBox& child) co
nst |
| 2656 { | 2605 { |
| 2657 // If the child has the same directionality as we do, then we can just retur
n its | 2606 // If the child has the same directionality as we do, then we can just retur
n its |
| 2658 // collapsed margin. | 2607 // collapsed margin. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2869 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2818 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 2870 { | 2819 { |
| 2871 showLayoutObject(); | 2820 showLayoutObject(); |
| 2872 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2821 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2873 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2822 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2874 } | 2823 } |
| 2875 | 2824 |
| 2876 #endif | 2825 #endif |
| 2877 | 2826 |
| 2878 } // namespace blink | 2827 } // namespace blink |
| OLD | NEW |