OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #include "core/dom/AXObjectCache.h" | 23 #include "core/dom/AXObjectCache.h" |
24 #include "core/layout/BidiRunForLine.h" | 24 #include "core/layout/BidiRunForLine.h" |
25 #include "core/layout/LayoutCounter.h" | 25 #include "core/layout/LayoutCounter.h" |
26 #include "core/layout/LayoutFlowThread.h" | |
27 #include "core/layout/LayoutListMarker.h" | 26 #include "core/layout/LayoutListMarker.h" |
28 #include "core/layout/LayoutObject.h" | 27 #include "core/layout/LayoutObject.h" |
29 #include "core/layout/LayoutRubyRun.h" | 28 #include "core/layout/LayoutRubyRun.h" |
30 #include "core/layout/LayoutView.h" | 29 #include "core/layout/LayoutView.h" |
31 #include "core/layout/TextRunConstructor.h" | 30 #include "core/layout/TextRunConstructor.h" |
32 #include "core/layout/VerticalPositionCache.h" | 31 #include "core/layout/VerticalPositionCache.h" |
33 #include "core/layout/api/LineLayoutItem.h" | 32 #include "core/layout/api/LineLayoutItem.h" |
34 #include "core/layout/api/SelectionState.h" | 33 #include "core/layout/api/SelectionState.h" |
35 #include "core/layout/line/BreakingContextInlineHeaders.h" | 34 #include "core/layout/line/BreakingContextInlineHeaders.h" |
36 #include "core/layout/line/GlyphOverflow.h" | 35 #include "core/layout/line/GlyphOverflow.h" |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 maxLogicalWidth = std::max(maxLogicalWidth, inlineMax); | 1532 maxLogicalWidth = std::max(maxLogicalWidth, inlineMax); |
1534 } | 1533 } |
1535 | 1534 |
1536 static bool isInlineWithOutlineAndContinuation(const LayoutObject& o) | 1535 static bool isInlineWithOutlineAndContinuation(const LayoutObject& o) |
1537 { | 1536 { |
1538 return o.isLayoutInline() && o.styleRef().hasOutline() && !o.isElementContin
uation() && toLayoutInline(o).continuation(); | 1537 return o.isLayoutInline() && o.styleRef().hasOutline() && !o.isElementContin
uation() && toLayoutInline(o).continuation(); |
1539 } | 1538 } |
1540 | 1539 |
1541 void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa
intInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUni
t afterEdge) | 1540 void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa
intInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUni
t afterEdge) |
1542 { | 1541 { |
1543 LayoutFlowThread* flowThread = flowThreadContainingBlock(); | |
1544 bool clearLinesForPagination = firstLineBox() && flowThread && !flowThread->
hasColumnSets(); | |
1545 | |
1546 // Figure out if we should clear out our line boxes. | 1542 // Figure out if we should clear out our line boxes. |
1547 // FIXME: Handle resize eventually! | 1543 // FIXME: Handle resize eventually! |
1548 bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren
|| clearLinesForPagination; | 1544 bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren
; |
1549 LineLayoutState layoutState(isFullLayout, paintInvalidationLogicalTop, paint
InvalidationLogicalBottom, flowThread); | 1545 LineLayoutState layoutState(isFullLayout, paintInvalidationLogicalTop, paint
InvalidationLogicalBottom); |
1550 | 1546 |
1551 if (isFullLayout) { | 1547 if (isFullLayout) { |
1552 // Ensure the old line boxes will be erased. | 1548 // Ensure the old line boxes will be erased. |
1553 if (firstLineBox()) | 1549 if (firstLineBox()) |
1554 setShouldDoFullPaintInvalidation(); | 1550 setShouldDoFullPaintInvalidation(); |
1555 lineBoxes()->deleteLineBoxes(); | 1551 lineBoxes()->deleteLineBoxes(); |
1556 } | 1552 } |
1557 | 1553 |
1558 // Text truncation kicks in in two cases: | 1554 // Text truncation kicks in in two cases: |
1559 // 1) If your overflow isn't visible and your text-overflow-mode isn't c
lip. | 1555 // 1) If your overflow isn't visible and your text-overflow-mode isn't c
lip. |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 | 1794 |
1799 for (RootInlineBox* line = last; line; line = line->nextRootBox()) | 1795 for (RootInlineBox* line = last; line; line = line->nextRootBox()) |
1800 line->extractLine(); // Disconnect all line boxes from their layout obje
cts while preserving | 1796 line->extractLine(); // Disconnect all line boxes from their layout obje
cts while preserving |
1801 // their connections to one another. | 1797 // their connections to one another. |
1802 | 1798 |
1803 layoutState.setEndLine(last); | 1799 layoutState.setEndLine(last); |
1804 } | 1800 } |
1805 | 1801 |
1806 bool LayoutBlockFlow::checkPaginationAndFloatsAtEndLine(LineLayoutState& layoutS
tate) | 1802 bool LayoutBlockFlow::checkPaginationAndFloatsAtEndLine(LineLayoutState& layoutS
tate) |
1807 { | 1803 { |
| 1804 if (!m_floatingObjects || !layoutState.endLine()) |
| 1805 return true; |
| 1806 |
1808 LayoutUnit lineDelta = logicalHeight() - layoutState.endLineLogicalTop(); | 1807 LayoutUnit lineDelta = logicalHeight() - layoutState.endLineLogicalTop(); |
1809 | 1808 |
1810 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated
(); | 1809 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated
(); |
1811 if (paginated && layoutState.flowThread()) { | 1810 if (paginated) { |
1812 // Check all lines from here to the end, and see if the hypothetical new
position for the lines will result | 1811 // Check all lines from here to the end, and see if the hypothetical new
position for the lines will result |
1813 // in a different available line width. | 1812 // in a different available line width. |
1814 for (RootInlineBox* lineBox = layoutState.endLine(); lineBox; lineBox =
lineBox->nextRootBox()) { | 1813 for (RootInlineBox* lineBox = layoutState.endLine(); lineBox; lineBox =
lineBox->nextRootBox()) { |
1815 if (paginated) { | 1814 // This isn't the real move we're going to do, so don't update the l
ine box's pagination |
1816 // This isn't the real move we're going to do, so don't update t
he line box's pagination | 1815 // strut yet. |
1817 // strut yet. | 1816 LayoutUnit oldPaginationStrut = lineBox->paginationStrut(); |
1818 LayoutUnit oldPaginationStrut = lineBox->paginationStrut(); | 1817 lineDelta -= oldPaginationStrut; |
1819 lineDelta -= oldPaginationStrut; | 1818 adjustLinePositionForPagination(*lineBox, lineDelta); |
1820 adjustLinePositionForPagination(*lineBox, lineDelta); | 1819 lineBox->setPaginationStrut(oldPaginationStrut); |
1821 lineBox->setPaginationStrut(oldPaginationStrut); | |
1822 } | |
1823 } | 1820 } |
1824 } | 1821 } |
1825 | 1822 if (!lineDelta) |
1826 if (!lineDelta || !m_floatingObjects) | |
1827 return true; | 1823 return true; |
1828 | 1824 |
1829 // See if any floats end in the range along which we want to shift the lines
vertically. | 1825 // See if any floats end in the range along which we want to shift the lines
vertically. |
1830 LayoutUnit logicalTop = std::min(logicalHeight(), layoutState.endLineLogical
Top()); | 1826 LayoutUnit logicalTop = std::min(logicalHeight(), layoutState.endLineLogical
Top()); |
1831 | 1827 |
1832 RootInlineBox* lastLine = layoutState.endLine(); | 1828 LayoutUnit logicalBottom = lastRootBox()->lineBottomWithLeading() + absolute
Value(lineDelta); |
1833 while (RootInlineBox* nextLine = lastLine->nextRootBox()) | |
1834 lastLine = nextLine; | |
1835 | |
1836 LayoutUnit logicalBottom = lastLine->lineBottomWithLeading() + absoluteValue
(lineDelta); | |
1837 | 1829 |
1838 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 1830 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
1839 FloatingObjectSetIterator end = floatingObjectSet.end(); | 1831 FloatingObjectSetIterator end = floatingObjectSet.end(); |
1840 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 1832 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
1841 const FloatingObject& floatingObject = *it->get(); | 1833 const FloatingObject& floatingObject = *it->get(); |
1842 if (logicalBottomForFloat(floatingObject) >= logicalTop && logicalBottom
ForFloat(floatingObject) < logicalBottom) | 1834 if (logicalBottomForFloat(floatingObject) >= logicalTop && logicalBottom
ForFloat(floatingObject) < logicalBottom) |
1843 return false; | 1835 return false; |
1844 } | 1836 } |
1845 | 1837 |
1846 return true; | 1838 return true; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2078 if (!line || !line->isFirstLineStyle()) | 2070 if (!line || !line->isFirstLineStyle()) |
2079 return reason; | 2071 return reason; |
2080 // It's the RootInlineBox that paints the ::first-line background. Note that
since it may be | 2072 // It's the RootInlineBox that paints the ::first-line background. Note that
since it may be |
2081 // expensive to figure out if the first line is affected by any ::first-line
selectors at all, | 2073 // expensive to figure out if the first line is affected by any ::first-line
selectors at all, |
2082 // we just invalidate it unconditionally, since that's typically cheaper. | 2074 // we just invalidate it unconditionally, since that's typically cheaper. |
2083 invalidateDisplayItemClient(*line); | 2075 invalidateDisplayItemClient(*line); |
2084 return reason; | 2076 return reason; |
2085 } | 2077 } |
2086 | 2078 |
2087 } // namespace blink | 2079 } // namespace blink |
OLD | NEW |