| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
| 18 * | 18 * |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef RootInlineBox_h | 21 #ifndef RootInlineBox_h |
| 22 #define RootInlineBox_h | 22 #define RootInlineBox_h |
| 23 | 23 |
| 24 #include "core/rendering/FloatToLayoutUnit.h" |
| 24 #include "core/rendering/InlineFlowBox.h" | 25 #include "core/rendering/InlineFlowBox.h" |
| 25 #include "platform/text/BidiContext.h" | 26 #include "platform/text/BidiContext.h" |
| 26 | 27 |
| 27 namespace blink { | 28 namespace blink { |
| 28 | 29 |
| 29 class EllipsisBox; | 30 class EllipsisBox; |
| 30 class HitTestResult; | 31 class HitTestResult; |
| 31 class RenderBlockFlow; | 32 class RenderBlockFlow; |
| 32 | 33 |
| 33 struct BidiStatus; | 34 struct BidiStatus; |
| 34 struct GapRects; | 35 struct GapRects; |
| 35 | 36 |
| 36 class RootInlineBox : public InlineFlowBox { | 37 class RootInlineBox : public InlineFlowBox { |
| 37 public: | 38 public: |
| 38 explicit RootInlineBox(RenderBlockFlow&); | 39 explicit RootInlineBox(RenderBlockFlow&); |
| 39 | 40 |
| 40 virtual void destroy() override final; | 41 virtual void destroy() override final; |
| 41 | 42 |
| 42 virtual bool isRootInlineBox() const override final { return true; } | 43 virtual bool isRootInlineBox() const override final { return true; } |
| 43 | 44 |
| 44 void detachEllipsisBox(); | 45 void detachEllipsisBox(); |
| 45 | 46 |
| 46 RootInlineBox* nextRootBox() const { return static_cast<RootInlineBox*>(m_ne
xtLineBox); } | 47 RootInlineBox* nextRootBox() const { return static_cast<RootInlineBox*>(m_ne
xtLineBox); } |
| 47 RootInlineBox* prevRootBox() const { return static_cast<RootInlineBox*>(m_pr
evLineBox); } | 48 RootInlineBox* prevRootBox() const { return static_cast<RootInlineBox*>(m_pr
evLineBox); } |
| 48 | 49 |
| 49 virtual void adjustPosition(float dx, float dy) override final; | 50 virtual void adjustPosition(FloatWillBeLayoutUnit dx, FloatWillBeLayoutUnit
dy) override final; |
| 50 | 51 |
| 51 LayoutUnit lineTop() const { return m_lineTop; } | 52 LayoutUnit lineTop() const { return m_lineTop; } |
| 52 LayoutUnit lineBottom() const { return m_lineBottom; } | 53 LayoutUnit lineBottom() const { return m_lineBottom; } |
| 53 | 54 |
| 54 LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; } | 55 LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; } |
| 55 LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; } | 56 LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; } |
| 56 | 57 |
| 57 LayoutUnit paginationStrut() const { return m_paginationStrut; } | 58 LayoutUnit paginationStrut() const { return m_paginationStrut; } |
| 58 void setPaginationStrut(LayoutUnit strut) { m_paginationStrut = strut; } | 59 void setPaginationStrut(LayoutUnit strut) { m_paginationStrut = strut; } |
| 59 | 60 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 85 unsigned lineBreakPos() const { return m_lineBreakPos; } | 86 unsigned lineBreakPos() const { return m_lineBreakPos; } |
| 86 void setLineBreakPos(unsigned p) { m_lineBreakPos = p; } | 87 void setLineBreakPos(unsigned p) { m_lineBreakPos = p; } |
| 87 | 88 |
| 88 using InlineBox::endsWithBreak; | 89 using InlineBox::endsWithBreak; |
| 89 using InlineBox::setEndsWithBreak; | 90 using InlineBox::setEndsWithBreak; |
| 90 | 91 |
| 91 void childRemoved(InlineBox* box); | 92 void childRemoved(InlineBox* box); |
| 92 | 93 |
| 93 bool lineCanAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, in
t ellipsisWidth); | 94 bool lineCanAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, in
t ellipsisWidth); |
| 94 // Return the truncatedWidth, the width of the truncated text + ellipsis. | 95 // Return the truncatedWidth, the width of the truncated text + ellipsis. |
| 95 float placeEllipsis(const AtomicString& ellipsisStr, bool ltr, float blockLe
ftEdge, float blockRightEdge, float ellipsisWidth, InlineBox* markupBox = 0); | 96 FloatWillBeLayoutUnit placeEllipsis(const AtomicString& ellipsisStr, bool lt
r, FloatWillBeLayoutUnit blockLeftEdge, FloatWillBeLayoutUnit blockRightEdge, Fl
oatWillBeLayoutUnit ellipsisWidth, InlineBox* markupBox = 0); |
| 96 // Return the position of the EllipsisBox or -1. | 97 // Return the position of the EllipsisBox or -1. |
| 97 virtual float placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRig
htEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox) override fin
al; | 98 virtual FloatWillBeLayoutUnit placeEllipsisBox(bool ltr, FloatWillBeLayoutUn
it blockLeftEdge, FloatWillBeLayoutUnit blockRightEdge, FloatWillBeLayoutUnit el
lipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool& foundBox) override fin
al; |
| 98 | 99 |
| 99 using InlineBox::hasEllipsisBox; | 100 using InlineBox::hasEllipsisBox; |
| 100 EllipsisBox* ellipsisBox() const; | 101 EllipsisBox* ellipsisBox() const; |
| 101 | 102 |
| 102 virtual void clearTruncation() override final; | 103 virtual void clearTruncation() override final; |
| 103 | 104 |
| 104 virtual int baselinePosition(FontBaseline baselineType) const override final
; | 105 virtual int baselinePosition(FontBaseline baselineType) const override final
; |
| 105 virtual LayoutUnit lineHeight() const override final; | 106 virtual LayoutUnit lineHeight() const override final; |
| 106 | 107 |
| 107 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou
tUnit lineBottom) override; | 108 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou
tUnit lineBottom) override; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 LayoutUnit logicalTopLayoutOverflow() const | 164 LayoutUnit logicalTopLayoutOverflow() const |
| 164 { | 165 { |
| 165 return InlineFlowBox::logicalTopLayoutOverflow(lineTop()); | 166 return InlineFlowBox::logicalTopLayoutOverflow(lineTop()); |
| 166 } | 167 } |
| 167 LayoutUnit logicalBottomLayoutOverflow() const | 168 LayoutUnit logicalBottomLayoutOverflow() const |
| 168 { | 169 { |
| 169 return InlineFlowBox::logicalBottomLayoutOverflow(lineBottom()); | 170 return InlineFlowBox::logicalBottomLayoutOverflow(lineBottom()); |
| 170 } | 171 } |
| 171 | 172 |
| 172 // Used to calculate the underline offset for TextUnderlinePositionUnder. | 173 // Used to calculate the underline offset for TextUnderlinePositionUnder. |
| 173 float maxLogicalTop() const; | 174 FloatWillBeLayoutUnit maxLogicalTop() const; |
| 174 | 175 |
| 175 Node* getLogicalStartBoxWithNode(InlineBox*&) const; | 176 Node* getLogicalStartBoxWithNode(InlineBox*&) const; |
| 176 Node* getLogicalEndBoxWithNode(InlineBox*&) const; | 177 Node* getLogicalEndBoxWithNode(InlineBox*&) const; |
| 177 | 178 |
| 178 #ifndef NDEBUG | 179 #ifndef NDEBUG |
| 179 virtual const char* boxName() const override; | 180 virtual const char* boxName() const override; |
| 180 #endif | 181 #endif |
| 181 private: | 182 private: |
| 182 LayoutUnit beforeAnnotationsAdjustment() const; | 183 LayoutUnit beforeAnnotationsAdjustment() const; |
| 183 | 184 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 197 LayoutUnit m_lineBottom; | 198 LayoutUnit m_lineBottom; |
| 198 LayoutUnit m_lineTopWithLeading; | 199 LayoutUnit m_lineTopWithLeading; |
| 199 LayoutUnit m_lineBottomWithLeading; | 200 LayoutUnit m_lineBottomWithLeading; |
| 200 LayoutUnit m_selectionBottom; | 201 LayoutUnit m_selectionBottom; |
| 201 LayoutUnit m_paginationStrut; | 202 LayoutUnit m_paginationStrut; |
| 202 }; | 203 }; |
| 203 | 204 |
| 204 } // namespace blink | 205 } // namespace blink |
| 205 | 206 |
| 206 #endif // RootInlineBox_h | 207 #endif // RootInlineBox_h |
| OLD | NEW |