OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) | 1520 if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) |
1521 return childStyle->marginBeforeCollapse() == MSEPARATE; | 1521 return childStyle->marginBeforeCollapse() == MSEPARATE; |
1522 | 1522 |
1523 // FIXME: See |mustDiscardMarginBeforeForChild| above. | 1523 // FIXME: See |mustDiscardMarginBeforeForChild| above. |
1524 return false; | 1524 return false; |
1525 } | 1525 } |
1526 | 1526 |
1527 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica
lOffset) | 1527 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica
lOffset) |
1528 { | 1528 { |
1529 // FIXME: Add page break checking here when we support printing. | 1529 // FIXME: Add page break checking here when we support printing. |
1530 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); | 1530 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
| 1531 bool isInsideMulticolFlowThread = flowThread && !flowThread->isRenderNamedFl
owThread(); |
| 1532 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); |
1531 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. | 1533 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. |
1532 RenderFlowThread* flowThread = flowThreadContainingBlock(); | |
1533 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread()
; | 1534 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread()
; |
1534 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe
fore() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakBefore() ==
PBALWAYS) | 1535 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe
fore() == PBALWAYS) |
| 1536 || (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS) |
1535 || (checkRegionBreaks && child->style()->regionBreakBefore() == PBALWAYS
); | 1537 || (checkRegionBreaks && child->style()->regionBreakBefore() == PBALWAYS
); |
1536 if (checkBeforeAlways && inNormalFlow(child) && hasNextPage(logicalOffset, I
ncludePageBoundary)) { | 1538 if (checkBeforeAlways && inNormalFlow(child) && hasNextPage(logicalOffset, I
ncludePageBoundary)) { |
1537 if (checkColumnBreaks) | 1539 if (checkColumnBreaks) { |
1538 view()->layoutState()->addForcedColumnBreak(child, logicalOffset); | 1540 if (isInsideMulticolFlowThread) |
| 1541 checkRegionBreaks = true; |
| 1542 else |
| 1543 view()->layoutState()->addForcedColumnBreak(child, logicalOffset
); |
| 1544 } |
1539 if (checkRegionBreaks) { | 1545 if (checkRegionBreaks) { |
1540 LayoutUnit offsetBreakAdjustment = 0; | 1546 LayoutUnit offsetBreakAdjustment = 0; |
1541 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage
() + logicalOffset, child, true, &offsetBreakAdjustment)) | 1547 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage
() + logicalOffset, child, true, &offsetBreakAdjustment)) |
1542 return logicalOffset + offsetBreakAdjustment; | 1548 return logicalOffset + offsetBreakAdjustment; |
1543 } | 1549 } |
1544 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); | 1550 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); |
1545 } | 1551 } |
1546 return logicalOffset; | 1552 return logicalOffset; |
1547 } | 1553 } |
1548 | 1554 |
1549 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical
Offset, MarginInfo& marginInfo) | 1555 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical
Offset, MarginInfo& marginInfo) |
1550 { | 1556 { |
1551 // FIXME: Add page break checking here when we support printing. | 1557 // FIXME: Add page break checking here when we support printing. |
1552 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); | 1558 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
| 1559 bool isInsideMulticolFlowThread = flowThread && !flowThread->isRenderNamedFl
owThread(); |
| 1560 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); |
1553 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. | 1561 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. |
1554 RenderFlowThread* flowThread = flowThreadContainingBlock(); | |
1555 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread()
; | 1562 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread()
; |
1556 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft
er() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakAfter() == PBA
LWAYS) | 1563 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft
er() == PBALWAYS) |
| 1564 || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS) |
1557 || (checkRegionBreaks && child->style()->regionBreakAfter() == PBALWAYS)
; | 1565 || (checkRegionBreaks && child->style()->regionBreakAfter() == PBALWAYS)
; |
1558 if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, In
cludePageBoundary)) { | 1566 if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, In
cludePageBoundary)) { |
1559 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? Lay
outUnit() : marginInfo.margin(); | 1567 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? Lay
outUnit() : marginInfo.margin(); |
1560 | 1568 |
1561 // So our margin doesn't participate in the next collapsing steps. | 1569 // So our margin doesn't participate in the next collapsing steps. |
1562 marginInfo.clearMargin(); | 1570 marginInfo.clearMargin(); |
1563 | 1571 |
1564 if (checkColumnBreaks) | 1572 if (checkColumnBreaks) { |
1565 view()->layoutState()->addForcedColumnBreak(child, logicalOffset); | 1573 if (isInsideMulticolFlowThread) |
| 1574 checkRegionBreaks = true; |
| 1575 else |
| 1576 view()->layoutState()->addForcedColumnBreak(child, logicalOffset
); |
| 1577 } |
1566 if (checkRegionBreaks) { | 1578 if (checkRegionBreaks) { |
1567 LayoutUnit offsetBreakAdjustment = 0; | 1579 LayoutUnit offsetBreakAdjustment = 0; |
1568 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage
() + logicalOffset + marginOffset, child, false, &offsetBreakAdjustment)) | 1580 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage
() + logicalOffset + marginOffset, child, false, &offsetBreakAdjustment)) |
1569 return logicalOffset + marginOffset + offsetBreakAdjustment; | 1581 return logicalOffset + marginOffset + offsetBreakAdjustment; |
1570 } | 1582 } |
1571 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); | 1583 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); |
1572 } | 1584 } |
1573 return logicalOffset; | 1585 return logicalOffset; |
1574 } | 1586 } |
1575 | 1587 |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2822 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2834 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
2823 { | 2835 { |
2824 if (m_rareData) | 2836 if (m_rareData) |
2825 return *m_rareData; | 2837 return *m_rareData; |
2826 | 2838 |
2827 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2839 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
2828 return *m_rareData; | 2840 return *m_rareData; |
2829 } | 2841 } |
2830 | 2842 |
2831 } // namespace WebCore | 2843 } // namespace WebCore |
OLD | NEW |