15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/*
25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This library is free software; you can redistribute it and/or
55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modify it under the terms of the GNU Library General Public
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * License as published by the Free Software Foundation; either
75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * version 2 of the License, or (at your option) any later version.
85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This library is distributed in the hope that it will be useful,
105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * but WITHOUT ANY WARRANTY; without even the implied warranty of
115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Library General Public License for more details.
135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * You should have received a copy of the GNU Library General Public License
155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * along with this library; see the file COPYING.LIB.  If not, write to
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Boston, MA 02110-1301, USA.
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef RootInlineBox_h
225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define RootInlineBox_h
235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/rendering/InlineFlowBox.h"
251e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "platform/text/BidiContext.h"
265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
27c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class EllipsisBox;
305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class HitTestResult;
3151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)class RenderBlockFlow;
325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)struct BidiStatus;
345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)struct GapRects;
355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class RootInlineBox : public InlineFlowBox {
375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public:
38d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    explicit RootInlineBox(RenderBlockFlow&);
395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
40f5e4ad553afbc08dd2e729bb77e937a9a94d5827Torne (Richard Coles)    virtual void destroy() OVERRIDE FINAL;
415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
4253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual bool isRootInlineBox() const OVERRIDE FINAL { return true; }
435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
44f5e4ad553afbc08dd2e729bb77e937a9a94d5827Torne (Richard Coles)    void detachEllipsisBox();
455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    RootInlineBox* nextRootBox() const { return static_cast<RootInlineBox*>(m_nextLineBox); }
475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    RootInlineBox* prevRootBox() const { return static_cast<RootInlineBox*>(m_prevLineBox); }
485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
4953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual void adjustPosition(float dx, float dy) OVERRIDE FINAL;
505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit lineTop() const { return m_lineTop; }
525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit lineBottom() const { return m_lineBottom; }
535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; }
555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; }
5602772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch
57926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    LayoutUnit paginationStrut() const { return m_fragmentationData ? m_fragmentationData->m_paginationStrut : LayoutUnit(0); }
58926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    void setPaginationStrut(LayoutUnit strut) { ensureLineFragmentationData()->m_paginationStrut = strut; }
595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
60926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    bool isFirstAfterPageBreak() const { return m_fragmentationData ? m_fragmentationData->m_isFirstAfterPageBreak : false; }
61926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    void setIsFirstAfterPageBreak(bool isFirstAfterPageBreak) { ensureLineFragmentationData()->m_isFirstAfterPageBreak = isFirstAfterPageBreak; }
625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
63926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    LayoutUnit paginatedLineWidth() const { return m_fragmentationData ? m_fragmentationData->m_paginatedLineWidth : LayoutUnit(0); }
64926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    void setPaginatedLineWidth(LayoutUnit width) { ensureLineFragmentationData()->m_paginatedLineWidth = width; }
65926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit selectionTop() const;
675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit selectionBottom() const;
685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit selectionHeight() const { return max<LayoutUnit>(0, selectionBottom() - selectionTop()); }
695c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
705c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit selectionTopAdjustedForPrecedingBlock() const;
715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit selectionHeightAdjustedForPrecedingBlock() const { return max<LayoutUnit>(0, selectionBottom() - selectionTopAdjustedForPrecedingBlock()); }
725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    int blockDirectionPointInLine() const;
745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);
76197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    void setLineTopBottomPositions(LayoutUnit top, LayoutUnit bottom, LayoutUnit topWithLeading, LayoutUnit bottomWithLeading, LayoutUnit selectionBottom = LayoutUnit::min())
7702772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    {
7802772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch        m_lineTop = top;
795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        m_lineBottom = bottom;
805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        m_lineTopWithLeading = topWithLeading;
815c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        m_lineBottomWithLeading = bottomWithLeading;
82197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch        m_selectionBottom = selectionBottom == LayoutUnit::min() ? bottom : selectionBottom;
835c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
845c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
8553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual RenderLineBoxList* rendererLineBoxes() const OVERRIDE FINAL;
865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    RenderObject* lineBreakObj() const { return m_lineBreakObj; }
885c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    BidiStatus lineBreakBidiStatus() const;
895c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void setLineBreakInfo(RenderObject*, unsigned breakPos, const BidiStatus&);
905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    unsigned lineBreakPos() const { return m_lineBreakPos; }
925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void setLineBreakPos(unsigned p) { m_lineBreakPos = p; }
935c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
945c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    using InlineBox::endsWithBreak;
955c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    using InlineBox::setEndsWithBreak;
965c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
975c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void childRemoved(InlineBox* box);
985c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
995c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool lineCanAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, int ellipsisWidth);
1005c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // Return the truncatedWidth, the width of the truncated text + ellipsis.
1015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    float placeEllipsis(const AtomicString& ellipsisStr, bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, InlineBox* markupBox = 0);
1025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // Return the position of the EllipsisBox or -1.
10353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual float placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox) OVERRIDE FINAL;
1045c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1055c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    using InlineBox::hasEllipsisBox;
1065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    EllipsisBox* ellipsisBox() const;
1075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void paintEllipsisBox(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) const;
1095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
11053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual void clearTruncation() OVERRIDE FINAL;
1115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
11253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual int baselinePosition(FontBaseline baselineType) const OVERRIDE FINAL;
11353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual LayoutUnit lineHeight() const OVERRIDE FINAL;
1145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
11509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE;
11653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE FINAL;
1175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    using InlineBox::hasSelectedChildren;
1195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    using InlineBox::setHasSelectedChildren;
1205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1217242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    virtual RenderObject::SelectionState selectionState() const OVERRIDE FINAL;
1227242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    InlineBox* firstSelectedBox() const;
1237242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    InlineBox* lastSelectedBox() const;
1245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1257242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    GapRects lineSelectionGap(const RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, LayoutUnit selTop, LayoutUnit selHeight, const PaintInfo*) const;
1265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
127d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    RenderBlockFlow& block() const;
1285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    InlineBox* closestLeafChildForPoint(const IntPoint&, bool onlyEditableLeaves);
1305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    InlineBox* closestLeafChildForLogicalLeftPosition(int, bool onlyEditableLeaves = false);
1315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void appendFloat(RenderBox* floatingBox)
1335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    {
1345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        ASSERT(!isDirty());
1355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        if (m_floats)
1365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            m_floats->append(floatingBox);
1375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        else
1385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)            m_floats= adoptPtr(new Vector<RenderBox*>(1, floatingBox));
1395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
1405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    Vector<RenderBox*>* floatsPtr() { ASSERT(!isDirty()); return m_floats.get(); }
1425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
14353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual void extractLineBoxFromRenderObject() OVERRIDE FINAL;
14453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual void attachLineBoxToRenderObject() OVERRIDE FINAL;
14553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    virtual void removeLineBoxFromRenderObject() OVERRIDE FINAL;
14602772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch
1475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    FontBaseline baselineType() const { return static_cast<FontBaseline>(m_baselineType); }
1485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool hasAnnotationsBefore() const { return m_hasAnnotationsBefore; }
1505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool hasAnnotationsAfter() const { return m_hasAnnotationsAfter; }
1515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutRect paddedLayoutOverflowRect(LayoutUnit endPadding) const;
1535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, int& ascent, int& descent, bool& affectsAscent, bool& affectsDescent) const;
1555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit verticalPositionForBox(InlineBox*, VerticalPositionCache&);
1565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool includeLeadingForBox(InlineBox*) const;
1575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool includeFontForBox(InlineBox*) const;
1585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool includeGlyphsForBox(InlineBox*) const;
1595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool includeMarginForBox(InlineBox*) const;
1605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool fitsToGlyphs() const;
1615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool includesRootLineBoxFontOrLeading() const;
16202772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch
1635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit logicalTopVisualOverflow() const
1645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    {
1655c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        return InlineFlowBox::logicalTopVisualOverflow(lineTop());
1665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
1675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit logicalBottomVisualOverflow() const
1685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    {
1695c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        return InlineFlowBox::logicalBottomVisualOverflow(lineBottom());
1705c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
1715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit logicalTopLayoutOverflow() const
1725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    {
1735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        return InlineFlowBox::logicalTopLayoutOverflow(lineTop());
1745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
1755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit logicalBottomLayoutOverflow() const
1765c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    {
1775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        return InlineFlowBox::logicalBottomLayoutOverflow(lineBottom());
1785c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
1795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
180926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // Used to calculate the underline offset for TextUnderlinePositionUnder.
18193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    float maxLogicalTop() const;
182926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
1835c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    Node* getLogicalStartBoxWithNode(InlineBox*&) const;
1845c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    Node* getLogicalEndBoxWithNode(InlineBox*&) const;
1855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef NDEBUG
18709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual const char* boxName() const OVERRIDE;
1885c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif
1895c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)private:
1905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    LayoutUnit beforeAnnotationsAdjustment() const;
1915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
192926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    struct LineFragmentationData;
193926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    LineFragmentationData* ensureLineFragmentationData()
194926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    {
195926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        if (!m_fragmentationData)
196926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)            m_fragmentationData = adoptPtr(new LineFragmentationData());
197926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
198926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return m_fragmentationData.get();
199926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    }
200926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
2015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // This folds into the padding at the end of InlineFlowBox on 64-bit.
2025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    unsigned m_lineBreakPos;
2035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2045c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // Where this line ended.  The exact object and the position within that object are stored so that
2055c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // we can create an InlineIterator beginning just after the end of this line.
2065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    RenderObject* m_lineBreakObj;
2075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    RefPtr<BidiContext> m_lineBreakContext;
2085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
209926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    struct LineFragmentationData {
210926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        WTF_MAKE_NONCOPYABLE(LineFragmentationData); WTF_MAKE_FAST_ALLOCATED;
211926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    public:
212926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        LineFragmentationData()
21309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            : m_paginationStrut(0)
214926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)            , m_paginatedLineWidth(0)
215926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)            , m_isFirstAfterPageBreak(false)
216926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        {
217926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
218926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        }
219926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
220926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        LayoutUnit m_paginationStrut;
221926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        LayoutUnit m_paginatedLineWidth;
222926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        bool m_isFirstAfterPageBreak;
223926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    };
224926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
225926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    OwnPtr<LineFragmentationData> m_fragmentationData;
2265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // Floats hanging off the line are pushed into this vector during layout. It is only
2285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // good for as long as the line has not been marked dirty.
2295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    OwnPtr<Vector<RenderBox*> > m_floats;
230197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
231197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    LayoutUnit m_lineTop;
232197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    LayoutUnit m_lineBottom;
233197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    LayoutUnit m_lineTopWithLeading;
234197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    LayoutUnit m_lineBottomWithLeading;
235197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    LayoutUnit m_selectionBottom;
2365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)};
2375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
238c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink
2395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // RootInlineBox_h
241