diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-03 09:55:33 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-03 09:55:33 +0100 |
| commit | cd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch) | |
| tree | 8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/WebCore/rendering/LayoutState.cpp | |
| parent | d11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff) | |
| download | qtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz | |
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Source/WebCore/rendering/LayoutState.cpp')
| -rw-r--r-- | Source/WebCore/rendering/LayoutState.cpp | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/Source/WebCore/rendering/LayoutState.cpp b/Source/WebCore/rendering/LayoutState.cpp index add5b017b..c59e97002 100644 --- a/Source/WebCore/rendering/LayoutState.cpp +++ b/Source/WebCore/rendering/LayoutState.cpp @@ -37,6 +37,7 @@ namespace WebCore { LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, ColumnInfo* columnInfo) : m_columnInfo(columnInfo) + , m_currentLineGrid(0) , m_next(prev) #ifndef NDEBUG , m_renderer(renderer) @@ -107,7 +108,14 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz m_layoutDelta = m_next->m_layoutDelta; m_isPaginated = m_pageLogicalHeight || m_columnInfo; - + + // Propagate line grid information. + propagateLineGridInfo(renderer); + + // If we have a new grid to track, then add it to our set. + if (renderer->style()->lineGrid() != RenderStyle::initialLineGrid() && renderer->isBlockFlow()) + establishLineGrid(toRenderBlock(renderer)); + // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. } @@ -117,6 +125,7 @@ LayoutState::LayoutState(LayoutState* prev, RenderFlowThread* flowThread, bool r , m_pageLogicalHeight(1) // Use a fake height here. That value is not important, just needs to be non-zero. , m_pageLogicalHeightChanged(regionsChanged) , m_columnInfo(0) + , m_currentLineGrid(0) , m_next(prev) #ifndef NDEBUG , m_renderer(flowThread) @@ -133,6 +142,7 @@ LayoutState::LayoutState(RenderObject* root) , m_pageLogicalHeight(0) , m_pageLogicalHeightChanged(false) , m_columnInfo(0) + , m_currentLineGrid(0) , m_next(0) #ifndef NDEBUG , m_renderer(root) @@ -196,4 +206,41 @@ void LayoutState::addForcedColumnBreak(LayoutUnit childLogicalOffset) m_columnInfo->addForcedBreak(pageLogicalOffset(childLogicalOffset)); } +void LayoutState::propagateLineGridInfo(RenderBox* renderer) +{ + // Disable line grids for objects we don't support. For now this includes overflow:scroll/auto, inline blocks and + // writing mode roots. + if (!m_next || renderer->isUnsplittableForPagination()) + return; + + m_currentLineGrid = m_next->m_currentLineGrid; + m_currentLineGridOffset = m_next->m_currentLineGridOffset; +} + +void LayoutState::establishLineGrid(RenderBlock* block) +{ + // First check to see if this grid has been established already. + if (m_currentLineGrid) { + if (m_currentLineGrid->style()->lineGrid() == block->style()->lineGrid()) + return; + RenderBlock* currentGrid = m_currentLineGrid; + for (LayoutState* currentState = m_next; currentState; currentState = currentState->m_next) { + if (currentState->m_currentLineGrid == currentGrid) + continue; + currentGrid = currentState->m_currentLineGrid; + if (!currentGrid) + break; + if (currentGrid->style()->lineGrid() == block->style()->lineGrid()) { + m_currentLineGrid = currentGrid; + m_currentLineGridOffset = currentState->m_currentLineGridOffset; + return; + } + } + } + + // We didn't find an already-established grid with this identifier. Our render object establishes the grid. + m_currentLineGrid = block; + m_currentLineGridOffset = m_layoutOffset; +} + } // namespace WebCore |
