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

Side by Side Diff: Source/core/layout/LayoutBlockFlow.cpp

Issue 1122323002: Cleanup: Remove LayoutRegion. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase master Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutBlockFlowLine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 // line and all following lines. 822 // line and all following lines.
823 LayoutRect logicalVisualOverflow = lineBox.logicalVisualOverflowRect(lineBox .lineTop(), lineBox.lineBottom()); 823 LayoutRect logicalVisualOverflow = lineBox.logicalVisualOverflowRect(lineBox .lineTop(), lineBox.lineBottom());
824 LayoutUnit logicalOffset = std::min(lineBox.lineTopWithLeading(), logicalVis ualOverflow.y()); 824 LayoutUnit logicalOffset = std::min(lineBox.lineTopWithLeading(), logicalVis ualOverflow.y());
825 LayoutUnit logicalBottom = std::max(lineBox.lineBottomWithLeading(), logical VisualOverflow.maxY()); 825 LayoutUnit logicalBottom = std::max(lineBox.lineBottomWithLeading(), logical VisualOverflow.maxY());
826 LayoutUnit lineHeight = logicalBottom - logicalOffset; 826 LayoutUnit lineHeight = logicalBottom - logicalOffset;
827 updateMinimumPageHeight(logicalOffset, calculateMinimumPageHeight(styleRef() , &lineBox, logicalOffset, logicalBottom)); 827 updateMinimumPageHeight(logicalOffset, calculateMinimumPageHeight(styleRef() , &lineBox, logicalOffset, logicalBottom));
828 logicalOffset += delta; 828 logicalOffset += delta;
829 lineBox.setPaginationStrut(0); 829 lineBox.setPaginationStrut(0);
830 lineBox.setIsFirstAfterPageBreak(false); 830 lineBox.setIsFirstAfterPageBreak(false);
831 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 831 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
832 bool hasUniformPageLogicalHeight = !flowThread || flowThread->regionsHaveUni formLogicalHeight(); 832 bool hasUniformPageLogicalHeight = !flowThread || flowThread->columnSetsHave UniformLogicalHeight();
833 // If lineHeight is greater than pageLogicalHeight, but logicalVisualOverflo w.height() still fits, we are 833 // If lineHeight is greater than pageLogicalHeight, but logicalVisualOverflo w.height() still fits, we are
834 // still going to add a strut, so that the visible overflow fits on a single page. 834 // still going to add a strut, so that the visible overflow fits on a single page.
835 if (!pageLogicalHeight || (hasUniformPageLogicalHeight && logicalVisualOverf low.height() > pageLogicalHeight)) { 835 if (!pageLogicalHeight || (hasUniformPageLogicalHeight && logicalVisualOverf low.height() > pageLogicalHeight)) {
836 // FIXME: In case the line aligns with the top of the page (or it's slig htly shifted downwards) it will not be marked as the first line in the page. 836 // FIXME: In case the line aligns with the top of the page (or it's slig htly shifted downwards) it will not be marked as the first line in the page.
837 // From here, the fix is not straightforward because it's not easy to al ways determine when the current line is the first in the page. 837 // From here, the fix is not straightforward because it's not easy to al ways determine when the current line is the first in the page.
838 return; 838 return;
839 } 839 }
840 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary); 840 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, ExcludePageBoundary);
841 841
842 int lineIndex = lineCount(&lineBox); 842 int lineIndex = lineCount(&lineBox);
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 LayoutFlowThread* flowThread = flowThreadContainingBlock(); 1736 LayoutFlowThread* flowThread = flowThreadContainingBlock();
1737 bool isInsideMulticolFlowThread = flowThread; 1737 bool isInsideMulticolFlowThread = flowThread;
1738 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState() ->isPaginatingColumns(); 1738 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState() ->isPaginatingColumns();
1739 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // FIXME: Once columns can print we have to check this. 1739 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // FIXME: Once columns can print we have to check this.
1740 bool checkBeforeAlways = (checkColumnBreaks && child.style()->columnBreakBef ore() == PBALWAYS) 1740 bool checkBeforeAlways = (checkColumnBreaks && child.style()->columnBreakBef ore() == PBALWAYS)
1741 || (checkPageBreaks && child.style()->pageBreakBefore() == PBALWAYS); 1741 || (checkPageBreaks && child.style()->pageBreakBefore() == PBALWAYS);
1742 if (checkBeforeAlways && inNormalFlow(&child)) { 1742 if (checkBeforeAlways && inNormalFlow(&child)) {
1743 if (checkColumnBreaks) { 1743 if (checkColumnBreaks) {
1744 if (isInsideMulticolFlowThread) { 1744 if (isInsideMulticolFlowThread) {
1745 LayoutUnit offsetBreakAdjustment = 0; 1745 LayoutUnit offsetBreakAdjustment = 0;
1746 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirst Page() + logicalOffset, &child, true, &offsetBreakAdjustment)) 1746 if (flowThread->addForcedColumnBreak(offsetFromLogicalTopOfFirst Page() + logicalOffset, &child, true, &offsetBreakAdjustment))
1747 return logicalOffset + offsetBreakAdjustment; 1747 return logicalOffset + offsetBreakAdjustment;
1748 } else { 1748 } else {
1749 view()->layoutState()->addForcedColumnBreak(child, logicalOffset ); 1749 view()->layoutState()->addForcedColumnBreak(child, logicalOffset );
1750 } 1750 }
1751 } 1751 }
1752 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); 1752 return nextPageLogicalTop(logicalOffset, IncludePageBoundary);
1753 } 1753 }
1754 return logicalOffset; 1754 return logicalOffset;
1755 } 1755 }
1756 1756
1757 LayoutUnit LayoutBlockFlow::applyAfterBreak(LayoutBox& child, LayoutUnit logical Offset, MarginInfo& marginInfo) 1757 LayoutUnit LayoutBlockFlow::applyAfterBreak(LayoutBox& child, LayoutUnit logical Offset, MarginInfo& marginInfo)
1758 { 1758 {
1759 // FIXME: Add page break checking here when we support printing. 1759 // FIXME: Add page break checking here when we support printing.
1760 LayoutFlowThread* flowThread = flowThreadContainingBlock(); 1760 LayoutFlowThread* flowThread = flowThreadContainingBlock();
1761 bool isInsideMulticolFlowThread = flowThread; 1761 bool isInsideMulticolFlowThread = flowThread;
1762 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState() ->isPaginatingColumns(); 1762 bool checkColumnBreaks = isInsideMulticolFlowThread || view()->layoutState() ->isPaginatingColumns();
1763 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // FIXME: Once columns can print we have to check this. 1763 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // FIXME: Once columns can print we have to check this.
1764 bool checkAfterAlways = (checkColumnBreaks && child.style()->columnBreakAfte r() == PBALWAYS) 1764 bool checkAfterAlways = (checkColumnBreaks && child.style()->columnBreakAfte r() == PBALWAYS)
1765 || (checkPageBreaks && child.style()->pageBreakAfter() == PBALWAYS); 1765 || (checkPageBreaks && child.style()->pageBreakAfter() == PBALWAYS);
1766 if (checkAfterAlways && inNormalFlow(&child)) { 1766 if (checkAfterAlways && inNormalFlow(&child)) {
1767 // So our margin doesn't participate in the next collapsing steps. 1767 // So our margin doesn't participate in the next collapsing steps.
1768 marginInfo.clearMargin(); 1768 marginInfo.clearMargin();
1769 1769
1770 if (checkColumnBreaks) { 1770 if (checkColumnBreaks) {
1771 if (isInsideMulticolFlowThread) { 1771 if (isInsideMulticolFlowThread) {
1772 LayoutUnit offsetBreakAdjustment = 0; 1772 LayoutUnit offsetBreakAdjustment = 0;
1773 if (flowThread->addForcedRegionBreak(offsetFromLogicalTopOfFirst Page() + logicalOffset, &child, false, &offsetBreakAdjustment)) 1773 if (flowThread->addForcedColumnBreak(offsetFromLogicalTopOfFirst Page() + logicalOffset, &child, false, &offsetBreakAdjustment))
1774 return logicalOffset + offsetBreakAdjustment; 1774 return logicalOffset + offsetBreakAdjustment;
1775 } else { 1775 } else {
1776 view()->layoutState()->addForcedColumnBreak(child, logicalOffset ); 1776 view()->layoutState()->addForcedColumnBreak(child, logicalOffset );
1777 } 1777 }
1778 } 1778 }
1779 return nextPageLogicalTop(logicalOffset, IncludePageBoundary); 1779 return nextPageLogicalTop(logicalOffset, IncludePageBoundary);
1780 } 1780 }
1781 return logicalOffset; 1781 return logicalOffset;
1782 } 1782 }
1783 1783
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 2555
2556 m_floatingObjects->add(floatingObject->copyToNewContainer(offset )); 2556 m_floatingObjects->add(floatingObject->copyToNewContainer(offset ));
2557 } 2557 }
2558 } 2558 }
2559 } 2559 }
2560 } 2560 }
2561 2561
2562 void LayoutBlockFlow::addOverhangingFloats(LayoutBlockFlow* child, bool makeChil dPaintOtherFloats) 2562 void LayoutBlockFlow::addOverhangingFloats(LayoutBlockFlow* child, bool makeChil dPaintOtherFloats)
2563 { 2563 {
2564 // Prevent floats from being added to the canvas by the root element, e.g., <html>. 2564 // Prevent floats from being added to the canvas by the root element, e.g., <html>.
2565 if (!child->containsFloats() || child->isLayoutRegion() || child->createsNew FormattingContext()) 2565 if (!child->containsFloats() || child->createsNewFormattingContext())
2566 return; 2566 return;
2567 2567
2568 LayoutUnit childLogicalTop = child->logicalTop(); 2568 LayoutUnit childLogicalTop = child->logicalTop();
2569 LayoutUnit childLogicalLeft = child->logicalLeft(); 2569 LayoutUnit childLogicalLeft = child->logicalLeft();
2570 2570
2571 // Floats that will remain the child's responsibility to paint should factor into its 2571 // Floats that will remain the child's responsibility to paint should factor into its
2572 // overflow. 2572 // overflow.
2573 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); 2573 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end();
2574 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg in(); childIt != childEnd; ++childIt) { 2574 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg in(); childIt != childEnd; ++childIt) {
2575 FloatingObject* floatingObject = childIt->get(); 2575 FloatingObject* floatingObject = childIt->get();
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 FrameView* frameView = document().view(); 3153 FrameView* frameView = document().view();
3154 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 3154 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
3155 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 3155 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
3156 if (size().height() < visibleHeight) 3156 if (size().height() < visibleHeight)
3157 top += (visibleHeight - size().height()) / 2; 3157 top += (visibleHeight - size().height()) / 2;
3158 setY(top); 3158 setY(top);
3159 dialog->setCentered(top); 3159 dialog->setCentered(top);
3160 } 3160 }
3161 3161
3162 } // namespace blink 3162 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutBlockFlowLine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698