| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class HitTestResult; | 30 class HitTestResult; |
| 31 class LayoutBlockFlow; | 31 class LayoutBlockFlow; |
| 32 | 32 |
| 33 struct BidiStatus; | 33 struct BidiStatus; |
| 34 struct GapRects; | 34 struct GapRects; |
| 35 | 35 |
| 36 class RootInlineBox : public InlineFlowBox { | 36 class RootInlineBox : public InlineFlowBox { |
| 37 public: | 37 public: |
| 38 explicit RootInlineBox(LayoutBlockFlow&); | 38 explicit RootInlineBox(LayoutBlockFlow&); |
| 39 | 39 |
| 40 virtual void destroy() override final; | 40 void destroy() final; |
| 41 | 41 |
| 42 virtual bool isRootInlineBox() const override final { return true; } | 42 bool isRootInlineBox() const final { return true; } |
| 43 | 43 |
| 44 void detachEllipsisBox(); | 44 void detachEllipsisBox(); |
| 45 | 45 |
| 46 RootInlineBox* nextRootBox() const { return static_cast<RootInlineBox*>(m_ne
xtLineBox); } | 46 RootInlineBox* nextRootBox() const { return static_cast<RootInlineBox*>(m_ne
xtLineBox); } |
| 47 RootInlineBox* prevRootBox() const { return static_cast<RootInlineBox*>(m_pr
evLineBox); } | 47 RootInlineBox* prevRootBox() const { return static_cast<RootInlineBox*>(m_pr
evLineBox); } |
| 48 | 48 |
| 49 virtual void move(const LayoutSize&) override final; | 49 void move(const LayoutSize&) final; |
| 50 | 50 |
| 51 LayoutUnit lineTop() const { return m_lineTop; } | 51 LayoutUnit lineTop() const { return m_lineTop; } |
| 52 LayoutUnit lineBottom() const { return m_lineBottom; } | 52 LayoutUnit lineBottom() const { return m_lineBottom; } |
| 53 | 53 |
| 54 LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; } | 54 LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; } |
| 55 LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; } | 55 LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; } |
| 56 | 56 |
| 57 LayoutUnit paginationStrut() const { return m_paginationStrut; } | 57 LayoutUnit paginationStrut() const { return m_paginationStrut; } |
| 58 void setPaginationStrut(LayoutUnit strut) { m_paginationStrut = strut; } | 58 void setPaginationStrut(LayoutUnit strut) { m_paginationStrut = strut; } |
| 59 | 59 |
| 60 LayoutUnit selectionTop() const; | 60 LayoutUnit selectionTop() const; |
| 61 LayoutUnit selectionBottom() const; | 61 LayoutUnit selectionBottom() const; |
| 62 LayoutUnit selectionHeight() const { return max<LayoutUnit>(0, selectionBott
om() - selectionTop()); } | 62 LayoutUnit selectionHeight() const { return max<LayoutUnit>(0, selectionBott
om() - selectionTop()); } |
| 63 | 63 |
| 64 LayoutUnit selectionTopAdjustedForPrecedingBlock() const; | 64 LayoutUnit selectionTopAdjustedForPrecedingBlock() const; |
| 65 LayoutUnit selectionHeightAdjustedForPrecedingBlock() const { return max<Lay
outUnit>(0, selectionBottom() - selectionTopAdjustedForPrecedingBlock()); } | 65 LayoutUnit selectionHeightAdjustedForPrecedingBlock() const { return max<Lay
outUnit>(0, selectionBottom() - selectionTopAdjustedForPrecedingBlock()); } |
| 66 | 66 |
| 67 LayoutUnit blockDirectionPointInLine() const; | 67 LayoutUnit blockDirectionPointInLine() const; |
| 68 | 68 |
| 69 LayoutUnit alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflo
wAndFallbackFontsMap&, VerticalPositionCache&); | 69 LayoutUnit alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflo
wAndFallbackFontsMap&, VerticalPositionCache&); |
| 70 void setLineTopBottomPositions(LayoutUnit top, LayoutUnit bottom, LayoutUnit
topWithLeading, LayoutUnit bottomWithLeading, LayoutUnit selectionBottom = Layo
utUnit::min()) | 70 void setLineTopBottomPositions(LayoutUnit top, LayoutUnit bottom, LayoutUnit
topWithLeading, LayoutUnit bottomWithLeading, LayoutUnit selectionBottom = Layo
utUnit::min()) |
| 71 { | 71 { |
| 72 m_lineTop = top; | 72 m_lineTop = top; |
| 73 m_lineBottom = bottom; | 73 m_lineBottom = bottom; |
| 74 m_lineTopWithLeading = topWithLeading; | 74 m_lineTopWithLeading = topWithLeading; |
| 75 m_lineBottomWithLeading = bottomWithLeading; | 75 m_lineBottomWithLeading = bottomWithLeading; |
| 76 m_selectionBottom = selectionBottom == LayoutUnit::min() ? bottom : sele
ctionBottom; | 76 m_selectionBottom = selectionBottom == LayoutUnit::min() ? bottom : sele
ctionBottom; |
| 77 } | 77 } |
| 78 | 78 |
| 79 virtual LineBoxList* lineBoxes() const override final; | 79 LineBoxList* lineBoxes() const final; |
| 80 | 80 |
| 81 LayoutObject* lineBreakObj() const { return m_lineBreakObj; } | 81 LayoutObject* lineBreakObj() const { return m_lineBreakObj; } |
| 82 BidiStatus lineBreakBidiStatus() const; | 82 BidiStatus lineBreakBidiStatus() const; |
| 83 void setLineBreakInfo(LayoutObject*, unsigned breakPos, const BidiStatus&); | 83 void setLineBreakInfo(LayoutObject*, unsigned breakPos, const BidiStatus&); |
| 84 | 84 |
| 85 unsigned lineBreakPos() const { return m_lineBreakPos; } | 85 unsigned lineBreakPos() const { return m_lineBreakPos; } |
| 86 void setLineBreakPos(unsigned p) { m_lineBreakPos = p; } | 86 void setLineBreakPos(unsigned p) { m_lineBreakPos = p; } |
| 87 | 87 |
| 88 using InlineBox::endsWithBreak; | 88 using InlineBox::endsWithBreak; |
| 89 using InlineBox::setEndsWithBreak; | 89 using InlineBox::setEndsWithBreak; |
| 90 | 90 |
| 91 void childRemoved(InlineBox*); | 91 void childRemoved(InlineBox*); |
| 92 | 92 |
| 93 bool lineCanAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, in
t ellipsisWidth); | 93 bool lineCanAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, in
t ellipsisWidth); |
| 94 // Return the truncatedWidth, the width of the truncated text + ellipsis. | 94 // Return the truncatedWidth, the width of the truncated text + ellipsis. |
| 95 LayoutUnit placeEllipsis(const AtomicString& ellipsisStr, bool ltr, LayoutUn
it blockLeftEdge, LayoutUnit blockRightEdge, LayoutUnit ellipsisWidth); | 95 LayoutUnit placeEllipsis(const AtomicString& ellipsisStr, bool ltr, LayoutUn
it blockLeftEdge, LayoutUnit blockRightEdge, LayoutUnit ellipsisWidth); |
| 96 // Return the position of the EllipsisBox or -1. | 96 // Return the position of the EllipsisBox or -1. |
| 97 virtual LayoutUnit placeEllipsisBox(bool ltr, LayoutUnit blockLeftEdge, Layo
utUnit blockRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &truncatedWidth, boo
l& foundBox) override final; | 97 LayoutUnit placeEllipsisBox(bool ltr, LayoutUnit blockLeftEdge, LayoutUnit b
lockRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &truncatedWidth, bool& found
Box) final; |
| 98 | 98 |
| 99 using InlineBox::hasEllipsisBox; | 99 using InlineBox::hasEllipsisBox; |
| 100 EllipsisBox* ellipsisBox() const; | 100 EllipsisBox* ellipsisBox() const; |
| 101 | 101 |
| 102 virtual void clearTruncation() override final; | 102 void clearTruncation() final; |
| 103 | 103 |
| 104 virtual int baselinePosition(FontBaseline baselineType) const override final
; | 104 int baselinePosition(FontBaseline baselineType) const final; |
| 105 virtual LayoutUnit lineHeight() const override final; | 105 LayoutUnit lineHeight() const final; |
| 106 | 106 |
| 107 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop,
LayoutUnit lineBottom) override; | 107 void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutU
nit lineBottom) override; |
| 108 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo
ntainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit li
neBottom) override final; | 108 bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInContainer,
const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom
) final; |
| 109 | 109 |
| 110 using InlineBox::hasSelectedChildren; | 110 using InlineBox::hasSelectedChildren; |
| 111 using InlineBox::setHasSelectedChildren; | 111 using InlineBox::setHasSelectedChildren; |
| 112 | 112 |
| 113 virtual LayoutObject::SelectionState selectionState() const override final; | 113 LayoutObject::SelectionState selectionState() const final; |
| 114 InlineBox* firstSelectedBox() const; | 114 InlineBox* firstSelectedBox() const; |
| 115 InlineBox* lastSelectedBox() const; | 115 InlineBox* lastSelectedBox() const; |
| 116 | 116 |
| 117 GapRects lineSelectionGap(const LayoutBlock* rootBlock, const LayoutPoint& r
ootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, LayoutUnit selT
op, LayoutUnit selHeight, const PaintInfo*) const; | 117 GapRects lineSelectionGap(const LayoutBlock* rootBlock, const LayoutPoint& r
ootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, LayoutUnit selT
op, LayoutUnit selHeight, const PaintInfo*) const; |
| 118 | 118 |
| 119 LayoutBlockFlow& block() const; | 119 LayoutBlockFlow& block() const; |
| 120 | 120 |
| 121 InlineBox* closestLeafChildForPoint(const LayoutPoint&, bool onlyEditableLea
ves); | 121 InlineBox* closestLeafChildForPoint(const LayoutPoint&, bool onlyEditableLea
ves); |
| 122 InlineBox* closestLeafChildForLogicalLeftPosition(LayoutUnit, bool onlyEdita
bleLeaves = false); | 122 InlineBox* closestLeafChildForLogicalLeftPosition(LayoutUnit, bool onlyEdita
bleLeaves = false); |
| 123 | 123 |
| 124 void appendFloat(LayoutBox* floatingBox) | 124 void appendFloat(LayoutBox* floatingBox) |
| 125 { | 125 { |
| 126 ASSERT(!isDirty()); | 126 ASSERT(!isDirty()); |
| 127 if (m_floats) | 127 if (m_floats) |
| 128 m_floats->append(floatingBox); | 128 m_floats->append(floatingBox); |
| 129 else | 129 else |
| 130 m_floats= adoptPtr(new Vector<LayoutBox*>(1, floatingBox)); | 130 m_floats= adoptPtr(new Vector<LayoutBox*>(1, floatingBox)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 Vector<LayoutBox*>* floatsPtr() { ASSERT(!isDirty()); return m_floats.get();
} | 133 Vector<LayoutBox*>* floatsPtr() { ASSERT(!isDirty()); return m_floats.get();
} |
| 134 | 134 |
| 135 virtual void extractLineBoxFromLayoutObject() override final; | 135 void extractLineBoxFromLayoutObject() final; |
| 136 virtual void attachLineBoxToLayoutObject() override final; | 136 void attachLineBoxToLayoutObject() final; |
| 137 virtual void removeLineBoxFromLayoutObject() override final; | 137 void removeLineBoxFromLayoutObject() final; |
| 138 | 138 |
| 139 FontBaseline baselineType() const { return static_cast<FontBaseline>(m_basel
ineType); } | 139 FontBaseline baselineType() const { return static_cast<FontBaseline>(m_basel
ineType); } |
| 140 | 140 |
| 141 bool hasAnnotationsBefore() const { return m_hasAnnotationsBefore; } | 141 bool hasAnnotationsBefore() const { return m_hasAnnotationsBefore; } |
| 142 bool hasAnnotationsAfter() const { return m_hasAnnotationsAfter; } | 142 bool hasAnnotationsAfter() const { return m_hasAnnotationsAfter; } |
| 143 | 143 |
| 144 LayoutRect paddedLayoutOverflowRect(LayoutUnit endPadding) const; | 144 LayoutRect paddedLayoutOverflowRect(LayoutUnit endPadding) const; |
| 145 | 145 |
| 146 void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, i
nt& ascent, int& descent, bool& affectsAscent, bool& affectsDescent) const; | 146 void ascentAndDescentForBox(InlineBox*, GlyphOverflowAndFallbackFontsMap&, i
nt& ascent, int& descent, bool& affectsAscent, bool& affectsDescent) const; |
| 147 LayoutUnit verticalPositionForBox(InlineBox*, VerticalPositionCache&); | 147 LayoutUnit verticalPositionForBox(InlineBox*, VerticalPositionCache&); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 168 { | 168 { |
| 169 return InlineFlowBox::logicalBottomLayoutOverflow(lineBottom()); | 169 return InlineFlowBox::logicalBottomLayoutOverflow(lineBottom()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Used to calculate the underline offset for TextUnderlinePositionUnder. | 172 // Used to calculate the underline offset for TextUnderlinePositionUnder. |
| 173 LayoutUnit maxLogicalTop() const; | 173 LayoutUnit maxLogicalTop() const; |
| 174 | 174 |
| 175 Node* getLogicalStartBoxWithNode(InlineBox*&) const; | 175 Node* getLogicalStartBoxWithNode(InlineBox*&) const; |
| 176 Node* getLogicalEndBoxWithNode(InlineBox*&) const; | 176 Node* getLogicalEndBoxWithNode(InlineBox*&) const; |
| 177 | 177 |
| 178 virtual const char* boxName() const override; | 178 const char* boxName() const override; |
| 179 | 179 |
| 180 private: | 180 private: |
| 181 LayoutUnit beforeAnnotationsAdjustment() const; | 181 LayoutUnit beforeAnnotationsAdjustment() const; |
| 182 | 182 |
| 183 // This folds into the padding at the end of InlineFlowBox on 64-bit. | 183 // This folds into the padding at the end of InlineFlowBox on 64-bit. |
| 184 unsigned m_lineBreakPos; | 184 unsigned m_lineBreakPos; |
| 185 | 185 |
| 186 // Where this line ended. The exact object and the position within that obj
ect are stored so that | 186 // Where this line ended. The exact object and the position within that obj
ect are stored so that |
| 187 // we can create an InlineIterator beginning just after the end of this line
. | 187 // we can create an InlineIterator beginning just after the end of this line
. |
| 188 LayoutObject* m_lineBreakObj; | 188 LayoutObject* m_lineBreakObj; |
| 189 RefPtr<BidiContext> m_lineBreakContext; | 189 RefPtr<BidiContext> m_lineBreakContext; |
| 190 | 190 |
| 191 // Floats hanging off the line are pushed into this vector during layout. It
is only | 191 // Floats hanging off the line are pushed into this vector during layout. It
is only |
| 192 // good for as long as the line has not been marked dirty. | 192 // good for as long as the line has not been marked dirty. |
| 193 OwnPtr<Vector<LayoutBox*>> m_floats; | 193 OwnPtr<Vector<LayoutBox*>> m_floats; |
| 194 | 194 |
| 195 LayoutUnit m_lineTop; | 195 LayoutUnit m_lineTop; |
| 196 LayoutUnit m_lineBottom; | 196 LayoutUnit m_lineBottom; |
| 197 LayoutUnit m_lineTopWithLeading; | 197 LayoutUnit m_lineTopWithLeading; |
| 198 LayoutUnit m_lineBottomWithLeading; | 198 LayoutUnit m_lineBottomWithLeading; |
| 199 LayoutUnit m_selectionBottom; | 199 LayoutUnit m_selectionBottom; |
| 200 LayoutUnit m_paginationStrut; | 200 LayoutUnit m_paginationStrut; |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 } // namespace blink | 203 } // namespace blink |
| 204 | 204 |
| 205 #endif // RootInlineBox_h | 205 #endif // RootInlineBox_h |
| OLD | NEW |