OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 21 matching lines...) Expand all Loading... |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class DocumentMarker; | 34 class DocumentMarker; |
35 class GraphicsContext; | 35 class GraphicsContext; |
36 | 36 |
37 const unsigned short cNoTruncation = USHRT_MAX; | 37 const unsigned short cNoTruncation = USHRT_MAX; |
38 const unsigned short cFullTruncation = USHRT_MAX - 1; | 38 const unsigned short cFullTruncation = USHRT_MAX - 1; |
39 | 39 |
40 class InlineTextBox : public InlineBox { | 40 class InlineTextBox : public InlineBox { |
41 public: | 41 public: |
42 InlineTextBox(RenderObject& obj, int start, unsigned short length) | 42 InlineTextBox(LayoutObject& obj, int start, unsigned short length) |
43 : InlineBox(obj) | 43 : InlineBox(obj) |
44 , m_prevTextBox(0) | 44 , m_prevTextBox(0) |
45 , m_nextTextBox(0) | 45 , m_nextTextBox(0) |
46 , m_start(start) | 46 , m_start(start) |
47 , m_len(length) | 47 , m_len(length) |
48 , m_truncation(cNoTruncation) | 48 , m_truncation(cNoTruncation) |
49 { | 49 { |
50 setIsText(true); | 50 setIsText(true); |
51 } | 51 } |
52 | 52 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 protected: | 111 protected: |
112 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop,
LayoutUnit lineBottom) override; | 112 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop,
LayoutUnit lineBottom) override; |
113 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit
lineTop, LayoutUnit lineBottom) override; | 113 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit
lineTop, LayoutUnit lineBottom) override; |
114 | 114 |
115 private: | 115 private: |
116 virtual void deleteLine() override final; | 116 virtual void deleteLine() override final; |
117 virtual void extractLine() override final; | 117 virtual void extractLine() override final; |
118 virtual void attachLine() override final; | 118 virtual void attachLine() override final; |
119 | 119 |
120 public: | 120 public: |
121 virtual RenderObject::SelectionState selectionState() const override final; | 121 virtual LayoutObject::SelectionState selectionState() const override final; |
122 | 122 |
123 private: | 123 private: |
124 virtual void clearTruncation() override final { m_truncation = cNoTruncation
; } | 124 virtual void clearTruncation() override final { m_truncation = cNoTruncation
; } |
125 virtual FloatWillBeLayoutUnit placeEllipsisBox(bool flowIsLTR, FloatWillBeLa
youtUnit visibleLeftEdge, FloatWillBeLayoutUnit visibleRightEdge, FloatWillBeLay
outUnit ellipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool& foundBox) ov
erride final; | 125 virtual FloatWillBeLayoutUnit placeEllipsisBox(bool flowIsLTR, FloatWillBeLa
youtUnit visibleLeftEdge, FloatWillBeLayoutUnit visibleRightEdge, FloatWillBeLay
outUnit ellipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool& foundBox) ov
erride final; |
126 | 126 |
127 public: | 127 public: |
128 virtual bool isLineBreak() const override final; | 128 virtual bool isLineBreak() const override final; |
129 | 129 |
130 void setExpansion(int newExpansion) | 130 void setExpansion(int newExpansion) |
131 { | 131 { |
(...skipping 14 matching lines...) Expand all Loading... |
146 public: | 146 public: |
147 virtual int offsetForPosition(FloatWillBeLayoutUnit x, bool includePartialGl
yphs = true) const; | 147 virtual int offsetForPosition(FloatWillBeLayoutUnit x, bool includePartialGl
yphs = true) const; |
148 virtual FloatWillBeLayoutUnit positionForOffset(int offset) const; | 148 virtual FloatWillBeLayoutUnit positionForOffset(int offset) const; |
149 | 149 |
150 bool containsCaretOffset(int offset) const; // false for offset after line b
reak | 150 bool containsCaretOffset(int offset) const; // false for offset after line b
reak |
151 | 151 |
152 // Fills a vector with the pixel width of each character. | 152 // Fills a vector with the pixel width of each character. |
153 void characterWidths(Vector<FloatWillBeLayoutUnit>&) const; | 153 void characterWidths(Vector<FloatWillBeLayoutUnit>&) const; |
154 | 154 |
155 private: | 155 private: |
156 InlineTextBox* m_prevTextBox; // The previous box that also uses our RenderO
bject | 156 InlineTextBox* m_prevTextBox; // The previous box that also uses our LayoutO
bject |
157 InlineTextBox* m_nextTextBox; // The next box that also uses our RenderObjec
t | 157 InlineTextBox* m_nextTextBox; // The next box that also uses our LayoutObjec
t |
158 | 158 |
159 int m_start; | 159 int m_start; |
160 unsigned short m_len; | 160 unsigned short m_len; |
161 | 161 |
162 // Where to truncate when text overflow is applied. We use special constant
s to denote | 162 // Where to truncate when text overflow is applied. We use special constant
s to denote |
163 // no truncation (the whole run paints) and full truncation (nothing paints
at all). | 163 // no truncation (the whole run paints) and full truncation (nothing paints
at all). |
164 unsigned short m_truncation; | 164 unsigned short m_truncation; |
165 | 165 |
166 private: | 166 private: |
167 TextRun::ExpansionBehavior expansionBehavior() const | 167 TextRun::ExpansionBehavior expansionBehavior() const |
168 { | 168 { |
169 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex
tRun::ForbidLeadingExpansion) | 169 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex
tRun::ForbidLeadingExpansion) |
170 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion
: TextRun::ForbidTrailingExpansion); | 170 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion
: TextRun::ForbidTrailingExpansion); |
171 } | 171 } |
172 }; | 172 }; |
173 | 173 |
174 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); | 174 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); |
175 | 175 |
176 void alignSelectionRectToDevicePixels(FloatRectWillBeLayoutRect&); | 176 void alignSelectionRectToDevicePixels(FloatRectWillBeLayoutRect&); |
177 | 177 |
178 } // namespace blink | 178 } // namespace blink |
179 | 179 |
180 #endif // InlineTextBox_h | 180 #endif // InlineTextBox_h |
OLD | NEW |