Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: Source/core/rendering/RenderBlockFlow.cpp

Issue 143383002: Region based multicol: support explicit column breaks (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) 1567 if (child->isHorizontalWritingMode() == isHorizontalWritingMode())
1568 return childStyle->marginBeforeCollapse() == MSEPARATE; 1568 return childStyle->marginBeforeCollapse() == MSEPARATE;
1569 1569
1570 // FIXME: See |mustDiscardMarginBeforeForChild| above. 1570 // FIXME: See |mustDiscardMarginBeforeForChild| above.
1571 return false; 1571 return false;
1572 } 1572 }
1573 1573
1574 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica lOffset) 1574 LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox* child, LayoutUnit logica lOffset)
1575 { 1575 {
1576 // FIXME: Add page break checking here when we support printing. 1576 // FIXME: Add page break checking here when we support printing.
1577 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); 1577 RenderFlowThread* flowThread = flowThreadContainingBlock();
1578 bool isInsideMulticolFlowThread = flowThread && !flowThread->isRenderNamedFl owThread();
1579 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState() ->isPaginatingColumns();
1578 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo gicalHeight; // FIXME: Once columns can print we have to check this. 1580 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo gicalHeight; // FIXME: Once columns can print we have to check this.
1579 RenderFlowThread* flowThread = flowThreadContainingBlock();
1580 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread() ; 1581 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread() ;
1581 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe fore() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS) 1582 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBe fore() == PBALWAYS)
1583 || (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS)
1582 || (checkRegionBreaks && child->style()->regionBreakBefore() == PBALWAYS ); 1584 || (checkRegionBreaks && child->style()->regionBreakBefore() == PBALWAYS );
1583 if (checkBeforeAlways && inNormalFlow(child) && hasNextPage(logicalOffset, I ncludePageBoundary)) { 1585 if (checkBeforeAlways && inNormalFlow(child) && hasNextPage(logicalOffset, I ncludePageBoundary)) {
1584 if (checkColumnBreaks) 1586 if (checkColumnBreaks) {
1585 view()->layoutState()->addForcedColumnBreak(child, logicalOffset); 1587 if (isInsideMulticolFlowThread)
1588 checkRegionBreaks = true;
1589 else
1590 view()->layoutState()->addForcedColumnBreak(child, logicalOffset );
1591 }
1586 if (checkRegionBreaks) { 1592 if (checkRegionBreaks) {
1587 LayoutUnit offsetBreakAdjustment = 0; 1593 LayoutUnit offsetBreakAdjustment = 0;
1588 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage () + logicalOffset, child, true, &offsetBreakAdjustment)) 1594 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage () + logicalOffset, child, true, &offsetBreakAdjustment))
1589 return logicalOffset + offsetBreakAdjustment; 1595 return logicalOffset + offsetBreakAdjustment;
1590 } 1596 }
1591 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); 1597 return nextPageLogicalTop(logicalOffset, IncludePageBoundary);
1592 } 1598 }
1593 return logicalOffset; 1599 return logicalOffset;
1594 } 1600 }
1595 1601
1596 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical Offset, MarginInfo& marginInfo) 1602 LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox* child, LayoutUnit logical Offset, MarginInfo& marginInfo)
1597 { 1603 {
1598 // FIXME: Add page break checking here when we support printing. 1604 // FIXME: Add page break checking here when we support printing.
1599 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); 1605 RenderFlowThread* flowThread = flowThreadContainingBlock();
1606 bool isInsideMulticolFlowThread = flowThread && !flowThread->isRenderNamedFl owThread();
1607 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState() ->isPaginatingColumns();
1600 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo gicalHeight; // FIXME: Once columns can print we have to check this. 1608 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageLo gicalHeight; // FIXME: Once columns can print we have to check this.
1601 RenderFlowThread* flowThread = flowThreadContainingBlock();
1602 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread() ; 1609 bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread() ;
1603 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft er() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakAfter() == PBA LWAYS) 1610 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAft er() == PBALWAYS)
1611 || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS)
1604 || (checkRegionBreaks && child->style()->regionBreakAfter() == PBALWAYS) ; 1612 || (checkRegionBreaks && child->style()->regionBreakAfter() == PBALWAYS) ;
1605 if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, In cludePageBoundary)) { 1613 if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, In cludePageBoundary)) {
1606 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? Lay outUnit() : marginInfo.margin(); 1614 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? Lay outUnit() : marginInfo.margin();
1607 1615
1608 // So our margin doesn't participate in the next collapsing steps. 1616 // So our margin doesn't participate in the next collapsing steps.
1609 marginInfo.clearMargin(); 1617 marginInfo.clearMargin();
1610 1618
1611 if (checkColumnBreaks) 1619 if (checkColumnBreaks) {
1612 view()->layoutState()->addForcedColumnBreak(child, logicalOffset); 1620 if (isInsideMulticolFlowThread)
1621 checkRegionBreaks = true;
1622 else
1623 view()->layoutState()->addForcedColumnBreak(child, logicalOffset );
1624 }
1613 if (checkRegionBreaks) { 1625 if (checkRegionBreaks) {
1614 LayoutUnit offsetBreakAdjustment = 0; 1626 LayoutUnit offsetBreakAdjustment = 0;
1615 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage () + logicalOffset + marginOffset, child, false, &offsetBreakAdjustment)) 1627 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage () + logicalOffset + marginOffset, child, false, &offsetBreakAdjustment))
1616 return logicalOffset + marginOffset + offsetBreakAdjustment; 1628 return logicalOffset + marginOffset + offsetBreakAdjustment;
1617 } 1629 }
1618 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); 1630 return nextPageLogicalTop(logicalOffset, IncludePageBoundary);
1619 } 1631 }
1620 return logicalOffset; 1632 return logicalOffset;
1621 } 1633 }
1622 1634
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2881 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2870 { 2882 {
2871 if (m_rareData) 2883 if (m_rareData)
2872 return *m_rareData; 2884 return *m_rareData;
2873 2885
2874 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 2886 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
2875 return *m_rareData; 2887 return *m_rareData;
2876 } 2888 }
2877 2889
2878 } // namespace WebCore 2890 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698