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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // number of columns. | 301 // number of columns. |
302 bool done = false; | 302 bool done = false; |
303 LayoutUnit pageLogicalHeight = 0; | 303 LayoutUnit pageLogicalHeight = 0; |
304 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); | 304 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); |
305 while (!done) | 305 while (!done) |
306 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope)
; | 306 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope)
; |
307 | 307 |
308 fitBorderToLinesIfNeeded(); | 308 fitBorderToLinesIfNeeded(); |
309 | 309 |
310 RenderView* renderView = view(); | 310 RenderView* renderView = view(); |
311 if (renderView->layoutState()->m_pageLogicalHeight) | 311 if (renderView->layoutState()->pageLogicalHeight()) |
312 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(*this,
logicalTop())); | 312 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(*this,
logicalTop())); |
313 | 313 |
314 updateLayerTransform(); | 314 updateLayerTransform(); |
315 | 315 |
316 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if | 316 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if |
317 // we overflow or not. | 317 // we overflow or not. |
318 updateScrollInfoAfterLayout(); | 318 updateScrollInfoAfterLayout(); |
319 | 319 |
320 // Repaint with our new bounds if they are different from our old bounds. | 320 // Repaint with our new bounds if they are different from our old bounds. |
321 bool didFullRepaint = repainter.repaintAfterLayout(); | 321 bool didFullRepaint = repainter.repaintAfterLayout(); |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 // FIXME: See |mustDiscardMarginBeforeForChild| above. | 1594 // FIXME: See |mustDiscardMarginBeforeForChild| above. |
1595 return false; | 1595 return false; |
1596 } | 1596 } |
1597 | 1597 |
1598 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica
lOffset) | 1598 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica
lOffset) |
1599 { | 1599 { |
1600 // FIXME: Add page break checking here when we support printing. | 1600 // FIXME: Add page break checking here when we support printing. |
1601 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 1601 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
1602 bool isInsideMulticolFlowThread = flowThread; | 1602 bool isInsideMulticolFlowThread = flowThread; |
1603 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); | 1603 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); |
1604 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. | 1604 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi
calHeight(); // FIXME: Once columns can print we have to check this. |
1605 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe
fore() == PBALWAYS) | 1605 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe
fore() == PBALWAYS) |
1606 || (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS); | 1606 || (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS); |
1607 if (checkBeforeAlways && inNormalFlow(child)) { | 1607 if (checkBeforeAlways && inNormalFlow(child)) { |
1608 if (checkColumnBreaks) { | 1608 if (checkColumnBreaks) { |
1609 if (isInsideMulticolFlowThread) { | 1609 if (isInsideMulticolFlowThread) { |
1610 LayoutUnit offsetBreakAdjustment = 0; | 1610 LayoutUnit offsetBreakAdjustment = 0; |
1611 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirst
Page() + logicalOffset, child, true, &offsetBreakAdjustment)) | 1611 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirst
Page() + logicalOffset, child, true, &offsetBreakAdjustment)) |
1612 return logicalOffset + offsetBreakAdjustment; | 1612 return logicalOffset + offsetBreakAdjustment; |
1613 } else { | 1613 } else { |
1614 view()->layoutState()->addForcedColumnBreak(*child, logicalOffse
t); | 1614 view()->layoutState()->addForcedColumnBreak(*child, logicalOffse
t); |
1615 } | 1615 } |
1616 } | 1616 } |
1617 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); | 1617 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); |
1618 } | 1618 } |
1619 return logicalOffset; | 1619 return logicalOffset; |
1620 } | 1620 } |
1621 | 1621 |
1622 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical
Offset, MarginInfo& marginInfo) | 1622 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical
Offset, MarginInfo& marginInfo) |
1623 { | 1623 { |
1624 // FIXME: Add page break checking here when we support printing. | 1624 // FIXME: Add page break checking here when we support printing. |
1625 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 1625 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
1626 bool isInsideMulticolFlowThread = flowThread; | 1626 bool isInsideMulticolFlowThread = flowThread; |
1627 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); | 1627 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState()
->isPaginatingColumns(); |
1628 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo
gicalHeight; // FIXME: Once columns can print we have to check this. | 1628 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi
calHeight(); // FIXME: Once columns can print we have to check this. |
1629 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft
er() == PBALWAYS) | 1629 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft
er() == PBALWAYS) |
1630 || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS); | 1630 || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS); |
1631 if (checkAfterAlways && inNormalFlow(child)) { | 1631 if (checkAfterAlways && inNormalFlow(child)) { |
1632 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? Lay
outUnit() : marginInfo.margin(); | 1632 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? Lay
outUnit() : marginInfo.margin(); |
1633 | 1633 |
1634 // So our margin doesn't participate in the next collapsing steps. | 1634 // So our margin doesn't participate in the next collapsing steps. |
1635 marginInfo.clearMargin(); | 1635 marginInfo.clearMargin(); |
1636 | 1636 |
1637 if (checkColumnBreaks) { | 1637 if (checkColumnBreaks) { |
1638 if (isInsideMulticolFlowThread) { | 1638 if (isInsideMulticolFlowThread) { |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2816 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
2817 { | 2817 { |
2818 if (m_rareData) | 2818 if (m_rareData) |
2819 return *m_rareData; | 2819 return *m_rareData; |
2820 | 2820 |
2821 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2821 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
2822 return *m_rareData; | 2822 return *m_rareData; |
2823 } | 2823 } |
2824 | 2824 |
2825 } // namespace WebCore | 2825 } // namespace WebCore |
OLD | NEW |