Chromium Code Reviews| 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1772 m_rareData->m_spannerPlaceholder = nullptr; | 1772 m_rareData->m_spannerPlaceholder = nullptr; |
| 1773 } | 1773 } |
| 1774 | 1774 |
| 1775 void LayoutBox::setPaginationStrut(LayoutUnit strut) | 1775 void LayoutBox::setPaginationStrut(LayoutUnit strut) |
| 1776 { | 1776 { |
| 1777 if (!strut && !m_rareData) | 1777 if (!strut && !m_rareData) |
| 1778 return; | 1778 return; |
| 1779 ensureRareData().m_paginationStrut = strut; | 1779 ensureRareData().m_paginationStrut = strut; |
| 1780 } | 1780 } |
| 1781 | 1781 |
| 1782 static bool isForcedBreakAllowed(const LayoutBox* child) | |
| 1783 { | |
| 1784 // We currently only support forced breaks on in-flow block level elements, which is the minimum | |
| 1785 // requirement according to the spec. | |
| 1786 if (child->isInline() || child->isFloatingOrOutOfFlowPositioned()) | |
| 1787 return false; | |
| 1788 const LayoutBlock* curr = child->containingBlock(); | |
| 1789 if (!curr || !curr->isLayoutBlockFlow()) | |
| 1790 return false; | |
| 1791 const LayoutView* layoutView = child->view(); | |
| 1792 while (curr && curr != layoutView) { | |
| 1793 if (curr->isLayoutFlowThread()) | |
| 1794 return true; | |
| 1795 if (curr->isFloatingOrOutOfFlowPositioned()) | |
| 1796 return false; | |
| 1797 curr = curr->containingBlock(); | |
| 1798 } | |
| 1799 return true; | |
| 1800 } | |
| 1801 | |
| 1802 bool LayoutBox::hasForcedBreakBefore() const | |
| 1803 { | |
| 1804 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | |
| 1805 bool checkColumnBreaks = flowThread; | |
| 1806 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this. | |
|
leviw_travelin_and_unemployed
2015/10/08 08:29:14
Can you toss these TODO's on a different line?
| |
| 1807 bool checkBeforeAlways = (checkColumnBreaks && style()->columnBreakBefore() == PBALWAYS) | |
| 1808 || (checkPageBreaks && style()->pageBreakBefore() == PBALWAYS); | |
| 1809 return checkBeforeAlways && isForcedBreakAllowed(this); | |
| 1810 } | |
| 1811 | |
| 1812 bool LayoutBox::hasForcedBreakAfter() const | |
| 1813 { | |
| 1814 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | |
| 1815 bool checkColumnBreaks = flowThread; | |
| 1816 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this. | |
|
leviw_travelin_and_unemployed
2015/10/08 08:29:14
Same as above.
| |
| 1817 bool checkAfterAlways = (checkColumnBreaks && style()->columnBreakAfter() == PBALWAYS) | |
|
leviw_travelin_and_unemployed
2015/10/08 08:29:14
We should really rename these enums, unless we wan
| |
| 1818 || (checkPageBreaks && style()->pageBreakAfter() == PBALWAYS); | |
| 1819 return checkAfterAlways && isForcedBreakAllowed(this); | |
| 1820 } | |
| 1821 | |
| 1782 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid ationState) const | 1822 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid ationState) const |
| 1783 { | 1823 { |
| 1784 if (style()->visibility() != VISIBLE) { | 1824 if (style()->visibility() != VISIBLE) { |
| 1785 PaintLayer* layer = enclosingLayer(); | 1825 PaintLayer* layer = enclosingLayer(); |
| 1786 layer->updateDescendantDependentFlags(); | 1826 layer->updateDescendantDependentFlags(); |
| 1787 if (layer->subtreeIsInvisible()) | 1827 if (layer->subtreeIsInvisible()) |
| 1788 return LayoutRect(); | 1828 return LayoutRect(); |
| 1789 } | 1829 } |
| 1790 | 1830 |
| 1791 LayoutRect r = visualOverflowRect(); | 1831 LayoutRect r = visualOverflowRect(); |
| (...skipping 2972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4764 StyleImage* borderImage = style()->borderImage().image(); | 4804 StyleImage* borderImage = style()->borderImage().image(); |
| 4765 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); | 4805 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); |
| 4766 } | 4806 } |
| 4767 | 4807 |
| 4768 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const | 4808 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const |
| 4769 { | 4809 { |
| 4770 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; | 4810 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; |
| 4771 } | 4811 } |
| 4772 | 4812 |
| 4773 } // namespace blink | 4813 } // namespace blink |
| OLD | NEW |