Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / RootInlineBox.cpp
index 0d95caf..b110fc6 100644 (file)
@@ -209,29 +209,6 @@ void RootInlineBox::childRemoved(InlineBox* box)
     }
 }
 
-RenderRegion* RootInlineBox::containingRegion() const
-{
-    RenderRegion* region = m_fragmentationData ? m_fragmentationData->m_containingRegion : 0;
-
-#ifndef NDEBUG
-    if (region) {
-        RenderFlowThread* flowThread = block()->flowThreadContainingBlock();
-        const RenderRegionList& regionList = flowThread->renderRegionList();
-        ASSERT(regionList.contains(region));
-    }
-#endif
-
-    return region;
-}
-
-void RootInlineBox::setContainingRegion(RenderRegion* region)
-{
-    ASSERT(!isDirty());
-    ASSERT(block()->flowThreadContainingBlock());
-    LineFragmentationData* fragmentationData  = ensureLineFragmentationData();
-    fragmentationData->m_containingRegion = region;
-}
-
 LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache)
 {
     // SVG will handle vertical alignment on its own.
@@ -272,7 +249,7 @@ LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, G
     maxHeight = max<LayoutUnit>(0, maxHeight); // FIXME: Is this really necessary?
 
     setLineTopBottomPositions(lineTop, lineBottom, heightOfBlock, heightOfBlock + maxHeight);
-    setPaginatedLineWidth(block()->availableLogicalWidthForContent(heightOfBlock));
+    setPaginatedLineWidth(block()->availableLogicalWidthForContent());
 
     LayoutUnit annotationsAdjustment = beforeAnnotationsAdjustment();
     if (annotationsAdjustment) {
@@ -282,12 +259,6 @@ LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, G
         heightOfBlock += annotationsAdjustment;
     }
 
-    LayoutUnit gridSnapAdjustment = lineSnapAdjustment();
-    if (gridSnapAdjustment) {
-        adjustBlockDirectionPosition(gridSnapAdjustment);
-        heightOfBlock += gridSnapAdjustment;
-    }
-
     return heightOfBlock + maxHeight;
 }
 
@@ -329,97 +300,6 @@ LayoutUnit RootInlineBox::beforeAnnotationsAdjustment() const
     return result;
 }
 
-LayoutUnit RootInlineBox::lineSnapAdjustment(LayoutUnit delta) const
-{
-    // If our block doesn't have snapping turned on, do nothing.
-    // FIXME: Implement bounds snapping.
-    if (block()->style()->lineSnap() == LineSnapNone)
-        return 0;
-
-    // Get the current line grid and offset.
-    LayoutState* layoutState = block()->view()->layoutState();
-    RenderBlockFlow* lineGrid = layoutState->lineGrid();
-    LayoutSize lineGridOffset = layoutState->lineGridOffset();
-    if (!lineGrid || lineGrid->style()->writingMode() != block()->style()->writingMode())
-        return 0;
-
-    // Get the hypothetical line box used to establish the grid.
-    RootInlineBox* lineGridBox = lineGrid->lineGridBox();
-    if (!lineGridBox)
-        return 0;
-
-    LayoutUnit lineGridBlockOffset = lineGrid->isHorizontalWritingMode() ? lineGridOffset.height() : lineGridOffset.width();
-    LayoutUnit blockOffset = block()->isHorizontalWritingMode() ? layoutState->layoutOffset().height() : layoutState->layoutOffset().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 0;
-
-    LayoutUnit lineGridFontAscent = lineGrid->style()->fontMetrics().ascent(baselineType());
-    LayoutUnit lineGridFontHeight = lineGridBox->logicalHeight();
-    LayoutUnit firstTextTop = lineGridBlockOffset + lineGridBox->logicalTop();
-    LayoutUnit firstLineTopWithLeading = lineGridBlockOffset + lineGridBox->lineTopWithLeading();
-    LayoutUnit firstBaselinePosition = firstTextTop + lineGridFontAscent;
-
-    LayoutUnit currentTextTop = blockOffset + logicalTop() + delta;
-    LayoutUnit currentFontAscent = block()->style()->fontMetrics().ascent(baselineType());
-    LayoutUnit currentBaselinePosition = currentTextTop + currentFontAscent;
-
-    LayoutUnit lineGridPaginationOrigin = isHorizontal() ? layoutState->lineGridPaginationOrigin().height() : layoutState->lineGridPaginationOrigin().width();
-
-    // If we're paginated, see if we're on a page after the first one. If so, the grid resets on subsequent pages.
-    // FIXME: If the grid is an ancestor of the pagination establisher, then this is incorrect.
-    LayoutUnit pageLogicalTop = 0;
-    if (layoutState->isPaginated() && layoutState->pageLogicalHeight()) {
-        pageLogicalTop = block()->pageLogicalTopForOffset(lineTopWithLeading() + delta);
-        if (pageLogicalTop > firstLineTopWithLeading)
-            firstTextTop = pageLogicalTop + lineGridBox->logicalTop() - lineGrid->borderBefore() - lineGrid->paddingBefore() + lineGridPaginationOrigin;
-    }
-
-    if (block()->style()->lineSnap() == LineSnapContain) {
-        // Compute the desired offset from the text-top of a grid line.
-        // Look at our height (logicalHeight()).
-        // Look at the total available height. It's going to be (textBottom - textTop) + (n-1)*(multiple with leading)
-        // where n is number of grid lines required to enclose us.
-        if (logicalHeight() <= lineGridFontHeight)
-            firstTextTop += (lineGridFontHeight - logicalHeight()) / 2;
-        else {
-            LayoutUnit numberOfLinesWithLeading = ceilf(static_cast<float>(logicalHeight() - lineGridFontHeight) / gridLineHeight);
-            LayoutUnit totalHeight = lineGridFontHeight + numberOfLinesWithLeading * gridLineHeight;
-            firstTextTop += (totalHeight - logicalHeight()) / 2;
-        }
-        firstBaselinePosition = firstTextTop + currentFontAscent;
-    } else
-        firstBaselinePosition = firstTextTop + lineGridFontAscent;
-
-    // If we're above the first line, just push to the first line.
-    if (currentBaselinePosition < firstBaselinePosition)
-        return delta + firstBaselinePosition - currentBaselinePosition;
-
-    // Otherwise we're in the middle of the grid somewhere. Just push to the next line.
-    LayoutUnit baselineOffset = currentBaselinePosition - firstBaselinePosition;
-    LayoutUnit remainder = roundToInt(baselineOffset) % roundToInt(gridLineHeight);
-    LayoutUnit result = delta;
-    if (remainder)
-        result += gridLineHeight - remainder;
-
-    // If we aren't paginated we can return the result.
-    if (!layoutState->isPaginated() || !layoutState->pageLogicalHeight() || result == delta)
-        return result;
-
-    // We may end up shifted to a new page. We need to do a re-snap when that happens.
-    LayoutUnit newPageLogicalTop = block()->pageLogicalTopForOffset(lineBottomWithLeading() + result);
-    if (newPageLogicalTop == pageLogicalTop)
-        return result;
-
-    // Put ourselves at the top of the next page to force a snap onto the new grid established by that page.
-    return lineSnapAdjustment(newPageLogicalTop - (blockOffset + lineTopWithLeading()));
-}
-
 GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
                                          LayoutUnit selTop, LayoutUnit selHeight, const PaintInfo* paintInfo)
 {
@@ -865,7 +745,7 @@ LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositio
     if (verticalAlign != BASELINE) {
         const Font& font = parent->style(firstLine)->font();
         const FontMetrics& fontMetrics = font.fontMetrics();
-        int fontSize = font.pixelSize();
+        int fontSize = font.fontDescription().computedPixelSize();
 
         LineDirectionMode lineDirection = parent->isHorizontalWritingMode() ? HorizontalLine : VerticalLine;