Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / LayoutState.cpp
index a9c6fcf..8c46caa 100644 (file)
@@ -35,7 +35,6 @@ namespace WebCore {
 
 LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, ColumnInfo* columnInfo)
     : m_columnInfo(columnInfo)
-    , m_lineGrid(0)
     , m_next(prev)
     , m_shapeInsideInfo(0)
 #ifndef NDEBUG
@@ -102,9 +101,6 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz
             m_pageLogicalHeight = 0;
     }
 
-    // Propagate line grid information.
-    propagateLineGridInfo(renderer);
-
     if (!m_columnInfo)
         m_columnInfo = m_next->m_columnInfo;
 
@@ -125,13 +121,6 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz
 
     m_isPaginated = m_pageLogicalHeight || m_columnInfo || renderer->isRenderFlowThread();
 
-    if (lineGrid() && renderer->hasColumns() && renderer->style()->hasInlineColumnAxis())
-        computeLineGridPaginationOrigin(renderer);
-
-    // If we have a new grid to track, then add it to our set.
-    if (renderer->style()->lineGrid() != RenderStyle::initialLineGrid() && renderer->isRenderBlockFlow())
-        establishLineGrid(toRenderBlockFlow(renderer));
-
     // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
 }
 
@@ -144,7 +133,6 @@ LayoutState::LayoutState(RenderObject* root)
     , m_layoutDeltaYSaturated(false)
 #endif
     , m_columnInfo(0)
-    , m_lineGrid(0)
     , m_next(0)
     , m_shapeInsideInfo(0)
     , m_pageLogicalHeight(0)
@@ -181,7 +169,7 @@ void LayoutState::clearPaginationInformation()
     m_columnInfo = m_next->m_columnInfo;
 }
 
-LayoutUnit LayoutState::pageLogicalOffset(RenderBox* child, LayoutUnit childLogicalOffset) const
+LayoutUnit LayoutState::pageLogicalOffset(const RenderBox* child, LayoutUnit childLogicalOffset) const
 {
     if (child->isHorizontalWritingMode())
         return m_layoutOffset.height() + childLogicalOffset - m_pageOffset.height();
@@ -195,84 +183,4 @@ void LayoutState::addForcedColumnBreak(RenderBox* child, LayoutUnit childLogical
     m_columnInfo->addForcedBreak(pageLogicalOffset(child, 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_lineGrid = m_next->m_lineGrid;
-    m_lineGridOffset = m_next->m_lineGridOffset;
-    m_lineGridPaginationOrigin = m_next->m_lineGridPaginationOrigin;
-}
-
-void LayoutState::establishLineGrid(RenderBlockFlow* block)
-{
-    // First check to see if this grid has been established already.
-    if (m_lineGrid) {
-        if (m_lineGrid->style()->lineGrid() == block->style()->lineGrid())
-            return;
-        RenderBlockFlow* currentGrid = m_lineGrid;
-        for (LayoutState* currentState = m_next; currentState; currentState = currentState->m_next) {
-            if (currentState->m_lineGrid == currentGrid)
-                continue;
-            currentGrid = currentState->m_lineGrid;
-            if (!currentGrid)
-                break;
-            if (currentGrid->style()->lineGrid() == block->style()->lineGrid()) {
-                m_lineGrid = currentGrid;
-                m_lineGridOffset = currentState->m_lineGridOffset;
-                return;
-            }
-        }
-    }
-
-    // We didn't find an already-established grid with this identifier. Our render object establishes the grid.
-    m_lineGrid = block;
-    m_lineGridOffset = m_layoutOffset;
-}
-
-void LayoutState::computeLineGridPaginationOrigin(RenderBox* renderer)
-{
-    // We need to cache a line grid pagination origin so that we understand how to reset the line grid
-    // at the top of each column.
-    // Get the current line grid and offset.
-    if (!lineGrid() || lineGrid()->style()->writingMode() != renderer->style()->writingMode())
-        return;
-
-    // Get the hypothetical line box used to establish the grid.
-    RootInlineBox* lineGridBox = lineGrid()->lineGridBox();
-    if (!lineGridBox)
-        return;
-
-    bool isHorizontalWritingMode = lineGrid()->isHorizontalWritingMode();
-
-    LayoutUnit lineGridBlockOffset = isHorizontalWritingMode ? lineGridOffset().height() : lineGridOffset().width();
-
-    // Now determine our position on the grid. Our baseline needs to be adjusted to the nearest baseline multiple
-    // as established by the line box.
-    // FIXME: Need to handle crazy line-box-contain values that cause the root line box to not be considered. I assume
-    // the grid should honor line-box-contain.
-    LayoutUnit gridLineHeight = lineGridBox->lineBottomWithLeading() - lineGridBox->lineTopWithLeading();
-    if (!gridLineHeight)
-        return;
-
-    LayoutUnit firstLineTopWithLeading = lineGridBlockOffset + lineGridBox->lineTopWithLeading();
-
-    if (isPaginated() && pageLogicalHeight()) {
-        LayoutUnit pageLogicalTop = renderer->isHorizontalWritingMode() ? m_pageOffset.height() : m_pageOffset.width();
-        if (pageLogicalTop > firstLineTopWithLeading) {
-            // Shift to the next highest line grid multiple past the page logical top. Cache the delta
-            // between this new value and the page logical top as the pagination origin.
-            LayoutUnit remainder = roundToInt(pageLogicalTop - firstLineTopWithLeading) % roundToInt(gridLineHeight);
-            LayoutUnit paginationDelta = gridLineHeight - remainder;
-            if (isHorizontalWritingMode)
-                m_lineGridPaginationOrigin.setHeight(paginationDelta);
-            else
-                m_lineGridPaginationOrigin.setWidth(paginationDelta);
-        }
-    }
-}
-
 } // namespace WebCore