| 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 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2478 | 2478 |
| 2479 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const | 2479 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const |
| 2480 { | 2480 { |
| 2481 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); | 2481 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); |
| 2482 if (!pageLogicalHeight) | 2482 if (!pageLogicalHeight) |
| 2483 return logicalOffset; | 2483 return logicalOffset; |
| 2484 | 2484 |
| 2485 return logicalOffset + pageRemainingLogicalHeightForOffset(logicalOffset, pa
geBoundaryRule); | 2485 return logicalOffset + pageRemainingLogicalHeightForOffset(logicalOffset, pa
geBoundaryRule); |
| 2486 } | 2486 } |
| 2487 | 2487 |
| 2488 LayoutUnit LayoutBlock::pageLogicalHeightForOffset(LayoutUnit offset) const | |
| 2489 { | |
| 2490 LayoutView* layoutView = view(); | |
| 2491 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | |
| 2492 if (!flowThread) | |
| 2493 return layoutView->layoutState()->pageLogicalHeight(); | |
| 2494 return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopO
fFirstPage()); | |
| 2495 } | |
| 2496 | |
| 2497 LayoutUnit LayoutBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, P
ageBoundaryRule pageBoundaryRule) const | |
| 2498 { | |
| 2499 LayoutView* layoutView = view(); | |
| 2500 offset += offsetFromLogicalTopOfFirstPage(); | |
| 2501 | |
| 2502 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | |
| 2503 if (!flowThread) { | |
| 2504 LayoutUnit pageLogicalHeight = layoutView->layoutState()->pageLogicalHei
ght(); | |
| 2505 LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogi
calHeight); | |
| 2506 if (pageBoundaryRule == AssociateWithFormerPage) { | |
| 2507 // An offset exactly at a page boundary will act as being part of th
e former page in | |
| 2508 // question (i.e. no remaining space), rather than being part of the
latter (i.e. one | |
| 2509 // whole page length of remaining space). | |
| 2510 remainingHeight = intMod(remainingHeight, pageLogicalHeight); | |
| 2511 } | |
| 2512 return remainingHeight; | |
| 2513 } | |
| 2514 | |
| 2515 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR
ule); | |
| 2516 } | |
| 2517 | |
| 2518 LayoutUnit LayoutBlock::calculatePaginationStrutToFitContent(LayoutUnit offset,
LayoutUnit strutToNextPage, LayoutUnit contentLogicalHeight) const | |
| 2519 { | |
| 2520 ASSERT(strutToNextPage == pageRemainingLogicalHeightForOffset(offset, Associ
ateWithLatterPage)); | |
| 2521 LayoutUnit nextPageLogicalTop = offset + strutToNextPage; | |
| 2522 if (pageLogicalHeightForOffset(nextPageLogicalTop) >= contentLogicalHeight) | |
| 2523 return strutToNextPage; // Content fits just fine in the next page or co
lumn. | |
| 2524 | |
| 2525 // Moving to the top of the next page or column doesn't result in enough spa
ce for the content | |
| 2526 // that we're trying to fit. If we're in a nested fragmentation context, we
may find enough | |
| 2527 // space if we move to a column further ahead, by effectively breaking to th
e next outer | |
| 2528 // fragmentainer. | |
| 2529 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | |
| 2530 if (!flowThread) { | |
| 2531 // If there's no flow thread, we're not nested. All pages have the same
height. Give up. | |
| 2532 return strutToNextPage; | |
| 2533 } | |
| 2534 // Start searching for a suitable offset at the top of the next page or colu
mn. | |
| 2535 LayoutUnit flowThreadOffset = offsetFromLogicalTopOfFirstPage() + nextPageLo
gicalTop; | |
| 2536 return strutToNextPage + flowThread->nextLogicalTopForUnbreakableContent(flo
wThreadOffset, contentLogicalHeight) - flowThreadOffset; | |
| 2537 } | |
| 2538 | |
| 2539 void LayoutBlock::paginatedContentWasLaidOut(LayoutUnit logicalBottomOffsetAfter
Pagination) | 2488 void LayoutBlock::paginatedContentWasLaidOut(LayoutUnit logicalBottomOffsetAfter
Pagination) |
| 2540 { | 2489 { |
| 2541 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) | 2490 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) |
| 2542 flowThread->contentWasLaidOut(offsetFromLogicalTopOfFirstPage() + logica
lBottomOffsetAfterPagination); | 2491 flowThread->contentWasLaidOut(offsetFromLogicalTopOfFirstPage() + logica
lBottomOffsetAfterPagination); |
| 2543 } | 2492 } |
| 2544 | 2493 |
| 2545 LayoutUnit LayoutBlock::collapsedMarginBeforeForChild(const LayoutBox& child) co
nst | 2494 LayoutUnit LayoutBlock::collapsedMarginBeforeForChild(const LayoutBox& child) co
nst |
| 2546 { | 2495 { |
| 2547 // If the child has the same directionality as we do, then we can just retur
n its | 2496 // If the child has the same directionality as we do, then we can just retur
n its |
| 2548 // collapsed margin. | 2497 // collapsed margin. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2759 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2708 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 2760 { | 2709 { |
| 2761 showLayoutObject(); | 2710 showLayoutObject(); |
| 2762 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2711 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2763 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2712 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2764 } | 2713 } |
| 2765 | 2714 |
| 2766 #endif | 2715 #endif |
| 2767 | 2716 |
| 2768 } // namespace blink | 2717 } // namespace blink |
| OLD | NEW |