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 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2621 { | 2621 { |
2622 return createAnonymousWithParentAndDisplay(parent, style()->display()); | 2622 return createAnonymousWithParentAndDisplay(parent, style()->display()); |
2623 } | 2623 } |
2624 | 2624 |
2625 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const | 2625 LayoutUnit LayoutBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const |
2626 { | 2626 { |
2627 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); | 2627 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); |
2628 if (!pageLogicalHeight) | 2628 if (!pageLogicalHeight) |
2629 return logicalOffset; | 2629 return logicalOffset; |
2630 | 2630 |
2631 // The logicalOffset is in our coordinate space. We can add in our pushed o
ffset. | 2631 return logicalOffset + pageRemainingLogicalHeightForOffset(logicalOffset, pa
geBoundaryRule); |
2632 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi
calOffset); | |
2633 if (pageBoundaryRule == ExcludePageBoundary) | |
2634 return logicalOffset + (remainingLogicalHeight ? remainingLogicalHeight
: pageLogicalHeight); | |
2635 return logicalOffset + remainingLogicalHeight; | |
2636 } | 2632 } |
2637 | 2633 |
2638 LayoutUnit LayoutBlock::pageLogicalHeightForOffset(LayoutUnit offset) const | 2634 LayoutUnit LayoutBlock::pageLogicalHeightForOffset(LayoutUnit offset) const |
2639 { | 2635 { |
2640 LayoutView* layoutView = view(); | 2636 LayoutView* layoutView = view(); |
2641 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | 2637 LayoutFlowThread* flowThread = flowThreadContainingBlock(); |
2642 if (!flowThread) | 2638 if (!flowThread) |
2643 return layoutView->layoutState()->pageLogicalHeight(); | 2639 return layoutView->layoutState()->pageLogicalHeight(); |
2644 return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopO
fFirstPage()); | 2640 return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopO
fFirstPage()); |
2645 } | 2641 } |
2646 | 2642 |
2647 LayoutUnit LayoutBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, P
ageBoundaryRule pageBoundaryRule) const | 2643 LayoutUnit LayoutBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, P
ageBoundaryRule pageBoundaryRule) const |
2648 { | 2644 { |
2649 LayoutView* layoutView = view(); | 2645 LayoutView* layoutView = view(); |
2650 offset += offsetFromLogicalTopOfFirstPage(); | 2646 offset += offsetFromLogicalTopOfFirstPage(); |
2651 | 2647 |
2652 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | 2648 LayoutFlowThread* flowThread = flowThreadContainingBlock(); |
2653 if (!flowThread) { | 2649 if (!flowThread) { |
2654 LayoutUnit pageLogicalHeight = layoutView->layoutState()->pageLogicalHei
ght(); | 2650 LayoutUnit pageLogicalHeight = layoutView->layoutState()->pageLogicalHei
ght(); |
2655 LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogi
calHeight); | 2651 LayoutUnit remainingHeight = pageLogicalHeight - intMod(offset, pageLogi
calHeight); |
2656 if (pageBoundaryRule == IncludePageBoundary) { | 2652 if (pageBoundaryRule == AssociateWithFormerPage) { |
2657 // If includeBoundaryPoint is true the line exactly on the top edge
of a | 2653 // An offset exactly at a page boundary will act as being part of th
e former page in |
2658 // column will act as being part of the previous column. | 2654 // question (i.e. no remaining space), rather than being part of the
latter (i.e. one |
| 2655 // whole page length of remaining space). |
2659 remainingHeight = intMod(remainingHeight, pageLogicalHeight); | 2656 remainingHeight = intMod(remainingHeight, pageLogicalHeight); |
2660 } | 2657 } |
2661 return remainingHeight; | 2658 return remainingHeight; |
2662 } | 2659 } |
2663 | 2660 |
2664 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR
ule); | 2661 return flowThread->pageRemainingLogicalHeightForOffset(offset, pageBoundaryR
ule); |
2665 } | 2662 } |
2666 | 2663 |
2667 void LayoutBlock::setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) | 2664 void LayoutBlock::setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) |
2668 { | 2665 { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2918 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
2922 { | 2919 { |
2923 showLayoutObject(); | 2920 showLayoutObject(); |
2924 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2921 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
2925 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2922 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
2926 } | 2923 } |
2927 | 2924 |
2928 #endif | 2925 #endif |
2929 | 2926 |
2930 } // namespace blink | 2927 } // namespace blink |
OLD | NEW |