Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: third_party/WebKit/Source/core/layout/line/InlineTextBox.h

Issue 2393693002: Reformat comments in core/layout/line (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.
5 * All rights reserved.
5 * 6 *
6 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
10 * 11 *
11 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 15 * Library General Public License for more details.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return LineLayoutText(InlineBox::getLineLayoutItem()); 64 return LineLayoutText(InlineBox::getLineLayoutItem());
64 } 65 }
65 66
66 void destroy() final; 67 void destroy() final;
67 68
68 InlineTextBox* prevTextBox() const { return m_prevTextBox; } 69 InlineTextBox* prevTextBox() const { return m_prevTextBox; }
69 InlineTextBox* nextTextBox() const { return m_nextTextBox; } 70 InlineTextBox* nextTextBox() const { return m_nextTextBox; }
70 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; } 71 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; }
71 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; } 72 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; }
72 73
73 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit.o rg/show_bug.cgi?id=97264 74 // FIXME: These accessors should ASSERT(!isDirty()). See
75 // https://bugs.webkit.org/show_bug.cgi?id=97264
74 unsigned start() const { return m_start; } 76 unsigned start() const { return m_start; }
75 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; } 77 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; }
76 unsigned len() const { return m_len; } 78 unsigned len() const { return m_len; }
77 79
78 void offsetRun(int delta); 80 void offsetRun(int delta);
79 81
80 unsigned short truncation() const { return m_truncation; } 82 unsigned short truncation() const { return m_truncation; }
81 83
82 void markDirty() final; 84 void markDirty() final;
83 85
(...skipping 15 matching lines...) Expand all
99 101
100 LayoutRect logicalOverflowRect() const; 102 LayoutRect logicalOverflowRect() const;
101 void setLogicalOverflowRect(const LayoutRect&); 103 void setLogicalOverflowRect(const LayoutRect&);
102 LayoutUnit logicalTopVisualOverflow() const { 104 LayoutUnit logicalTopVisualOverflow() const {
103 return logicalOverflowRect().y(); 105 return logicalOverflowRect().y();
104 } 106 }
105 LayoutUnit logicalBottomVisualOverflow() const { 107 LayoutUnit logicalBottomVisualOverflow() const {
106 return logicalOverflowRect().maxY(); 108 return logicalOverflowRect().maxY();
107 } 109 }
108 110
109 // charactersWithHyphen, if provided, must not be destroyed before the TextRun . 111 // charactersWithHyphen, if provided, must not be destroyed before the
112 // TextRun.
110 TextRun constructTextRun(const ComputedStyle&, 113 TextRun constructTextRun(const ComputedStyle&,
111 StringBuilder* charactersWithHyphen = nullptr) const; 114 StringBuilder* charactersWithHyphen = nullptr) const;
112 TextRun constructTextRun(const ComputedStyle&, 115 TextRun constructTextRun(const ComputedStyle&,
113 StringView, 116 StringView,
114 int maximumLength, 117 int maximumLength,
115 StringBuilder* charactersWithHyphen = nullptr) const; 118 StringBuilder* charactersWithHyphen = nullptr) const;
116 119
117 #ifndef NDEBUG 120 #ifndef NDEBUG
118 void showBox(int = 0) const override; 121 void showBox(int = 0) const override;
119 #endif 122 #endif
120 const char* boxName() const override; 123 const char* boxName() const override;
121 String debugName() const override; 124 String debugName() const override;
122 125
123 String text() const; 126 String text() const;
124 127
125 public: 128 public:
126 TextRun constructTextRunForInspector(const ComputedStyle&) const; 129 TextRun constructTextRunForInspector(const ComputedStyle&) const;
127 LayoutRect calculateBoundaries() const override { 130 LayoutRect calculateBoundaries() const override {
128 return LayoutRect(x(), y(), width(), height()); 131 return LayoutRect(x(), y(), width(), height());
129 } 132 }
130 133
131 virtual LayoutRect localSelectionRect(int startPos, int endPos) const; 134 virtual LayoutRect localSelectionRect(int startPos, int endPos) const;
132 bool isSelected(int startPos, int endPos) const; 135 bool isSelected(int startPos, int endPos) const;
133 void selectionStartEnd(int& sPos, int& ePos) const; 136 void selectionStartEnd(int& sPos, int& ePos) const;
134 137
135 // These functions both paint markers and update the DocumentMarker's rendered Rect. 138 // These functions both paint markers and update the DocumentMarker's
139 // renderedRect.
136 virtual void paintDocumentMarker(GraphicsContext&, 140 virtual void paintDocumentMarker(GraphicsContext&,
137 const LayoutPoint& boxOrigin, 141 const LayoutPoint& boxOrigin,
138 DocumentMarker*, 142 DocumentMarker*,
139 const ComputedStyle&, 143 const ComputedStyle&,
140 const Font&, 144 const Font&,
141 bool grammar) const; 145 bool grammar) const;
142 virtual void paintTextMatchMarkerForeground(const PaintInfo&, 146 virtual void paintTextMatchMarkerForeground(const PaintInfo&,
143 const LayoutPoint& boxOrigin, 147 const LayoutPoint& boxOrigin,
144 DocumentMarker*, 148 DocumentMarker*,
145 const ComputedStyle&, 149 const ComputedStyle&,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 m_logicalWidth += newExpansion; 197 m_logicalWidth += newExpansion;
194 } 198 }
195 199
196 private: 200 private:
197 bool isInlineTextBox() const final { return true; } 201 bool isInlineTextBox() const final { return true; }
198 202
199 public: 203 public:
200 int caretMinOffset() const final; 204 int caretMinOffset() const final;
201 int caretMaxOffset() const final; 205 int caretMaxOffset() const final;
202 206
203 LayoutUnit textPos() 207 // Returns the x position relative to the left start of the text line.
204 const; // returns the x position relative to the left start of the text l ine. 208 LayoutUnit textPos() const;
205 209
206 public: 210 public:
207 virtual int offsetForPosition(LayoutUnit x, 211 virtual int offsetForPosition(LayoutUnit x,
208 bool includePartialGlyphs = true) const; 212 bool includePartialGlyphs = true) const;
209 virtual LayoutUnit positionForOffset(int offset) const; 213 virtual LayoutUnit positionForOffset(int offset) const;
210 214
211 bool containsCaretOffset( 215 // Returns false for offset after line break.
212 int offset) const; // false for offset after line break 216 bool containsCaretOffset(int offset) const;
213 217
214 // Fills a vector with the pixel width of each character. 218 // Fills a vector with the pixel width of each character.
215 void characterWidths(Vector<float>&) const; 219 void characterWidths(Vector<float>&) const;
216 220
217 private: 221 private:
218 InlineTextBox* 222 // The previous box that also uses our LayoutObject.
219 m_prevTextBox; // The previous box that also uses our LayoutObject 223 InlineTextBox* m_prevTextBox;
220 InlineTextBox* m_nextTextBox; // The next box that also uses our LayoutObject 224 // The next box that also uses our LayoutObject.
225 InlineTextBox* m_nextTextBox;
221 226
222 int m_start; 227 int m_start;
223 unsigned short m_len; 228 unsigned short m_len;
224 229
225 // Where to truncate when text overflow is applied. We use special constants to denote 230 // Where to truncate when text overflow is applied. We use special constants
226 // no truncation (the whole run paints) and full truncation (nothing paints at all). 231 // to denote no truncation (the whole run paints) and full truncation (nothing
232 // paints at all).
227 unsigned short m_truncation; 233 unsigned short m_truncation;
228 234
229 private: 235 private:
230 TextRun::ExpansionBehavior expansionBehavior() const { 236 TextRun::ExpansionBehavior expansionBehavior() const {
231 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion 237 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion
232 : TextRun::ForbidLeadingExpansion) | 238 : TextRun::ForbidLeadingExpansion) |
233 (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion 239 (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion
234 : TextRun::ForbidTrailingExpansion); 240 : TextRun::ForbidTrailingExpansion);
235 } 241 }
236 }; 242 };
237 243
238 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); 244 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox);
239 245
240 } // namespace blink 246 } // namespace blink
241 247
242 #endif // InlineTextBox_h 248 #endif // InlineTextBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698