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

Side by Side Diff: third_party/WebKit/WebCore/rendering/InlineBox.h

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 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 InlineBox_h 21 #ifndef InlineBox_h
22 #define InlineBox_h 22 #define InlineBox_h
23 23
24 #include "RenderBox.h" 24 #include "RenderBoxModelObject.h"
25 #include "TextDirection.h" 25 #include "TextDirection.h"
26 26
27 namespace WebCore { 27 namespace WebCore {
28 28
29 class HitTestRequest; 29 class HitTestRequest;
30 class HitTestResult; 30 class HitTestResult;
31 class RootInlineBox; 31 class RootInlineBox;
32 32
33 33
34 // InlineBox represents a rectangle that occurs on a line. It corresponds to 34 // InlineBox represents a rectangle that occurs on a line. It corresponds to
35 // some RenderObject (i.e., it represents a portion of that RenderObject). 35 // some RenderObject (i.e., it represents a portion of that RenderObject).
36 class InlineBox { 36 class InlineBox {
37 public: 37 public:
38 InlineBox(RenderObject* obj) 38 InlineBox(RenderObject* obj)
39 : m_object(obj) 39 : m_object(obj)
40 , m_x(0) 40 , m_x(0)
41 , m_y(0) 41 , m_y(0)
42 , m_width(0) 42 , m_width(0)
43 , m_height(0) 43 , m_height(0)
44 , m_baseline(0) 44 , m_baseline(0)
45 , m_next(0) 45 , m_next(0)
46 , m_prev(0) 46 , m_prev(0)
47 , m_parent(0) 47 , m_parent(0)
48 , m_firstLine(false) 48 , m_firstLine(false)
49 , m_constructed(false) 49 , m_constructed(false)
50 , m_bidiEmbeddingLevel(0) 50 , m_bidiEmbeddingLevel(0)
51 , m_dirty(false) 51 , m_dirty(false)
52 , m_extracted(false) 52 , m_extracted(false)
53 , m_includeLeftEdge(false)
54 , m_includeRightEdge(false)
55 , m_hasTextChildren(true)
56 , m_endsWithBreak(false) 53 , m_endsWithBreak(false)
57 , m_hasSelectedChildren(false) 54 , m_hasSelectedChildren(false)
58 , m_hasEllipsisBox(false) 55 , m_hasEllipsisBox(false)
59 , m_dirOverride(false) 56 , m_dirOverride(false)
60 , m_treatAsText(true) 57 , m_treatAsText(true)
61 , m_determinedIfNextOnLineExists(false) 58 , m_determinedIfNextOnLineExists(false)
62 , m_determinedIfPrevOnLineExists(false) 59 , m_determinedIfPrevOnLineExists(false)
63 , m_nextOnLineExists(false) 60 , m_nextOnLineExists(false)
64 , m_prevOnLineExists(false) 61 , m_prevOnLineExists(false)
65 , m_toAdd(0) 62 , m_toAdd(0)
(...skipping 12 matching lines...) Expand all
78 , m_height(height) 75 , m_height(height)
79 , m_baseline(baseline) 76 , m_baseline(baseline)
80 , m_next(next) 77 , m_next(next)
81 , m_prev(prev) 78 , m_prev(prev)
82 , m_parent(parent) 79 , m_parent(parent)
83 , m_firstLine(firstLine) 80 , m_firstLine(firstLine)
84 , m_constructed(constructed) 81 , m_constructed(constructed)
85 , m_bidiEmbeddingLevel(0) 82 , m_bidiEmbeddingLevel(0)
86 , m_dirty(dirty) 83 , m_dirty(dirty)
87 , m_extracted(extracted) 84 , m_extracted(extracted)
88 , m_includeLeftEdge(false)
89 , m_includeRightEdge(false)
90 , m_hasTextChildren(true)
91 , m_endsWithBreak(false) 85 , m_endsWithBreak(false)
92 , m_hasSelectedChildren(false) 86 , m_hasSelectedChildren(false)
93 , m_hasEllipsisBox(false) 87 , m_hasEllipsisBox(false)
94 , m_dirOverride(false) 88 , m_dirOverride(false)
95 , m_treatAsText(true) 89 , m_treatAsText(true)
96 , m_determinedIfNextOnLineExists(false) 90 , m_determinedIfNextOnLineExists(false)
97 , m_determinedIfPrevOnLineExists(false) 91 , m_determinedIfPrevOnLineExists(false)
98 , m_nextOnLineExists(false) 92 , m_nextOnLineExists(false)
99 , m_prevOnLineExists(false) 93 , m_prevOnLineExists(false)
100 , m_toAdd(0) 94 , m_toAdd(0)
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 191
198 void setYPos(int y) { m_y = y; } 192 void setYPos(int y) { m_y = y; }
199 int yPos() const { return m_y; } 193 int yPos() const { return m_y; }
200 194
201 void setHeight(int h) { m_height = h; } 195 void setHeight(int h) { m_height = h; }
202 int height() const { return m_height; } 196 int height() const { return m_height; }
203 197
204 void setBaseline(int b) { m_baseline = b; } 198 void setBaseline(int b) { m_baseline = b; }
205 int baseline() const { return m_baseline; } 199 int baseline() const { return m_baseline; }
206 200
207 bool hasTextChildren() const { return m_hasTextChildren; }
208
209 virtual int topOverflow() { return yPos(); } 201 virtual int topOverflow() { return yPos(); }
210 virtual int bottomOverflow() { return yPos() + height(); } 202 virtual int bottomOverflow() { return yPos() + height(); }
211 virtual int leftOverflow() { return xPos(); } 203 virtual int leftOverflow() { return xPos(); }
212 virtual int rightOverflow() { return xPos() + width(); } 204 virtual int rightOverflow() { return xPos() + width(); }
213 205
214 virtual int caretMinOffset() const; 206 virtual int caretMinOffset() const;
215 virtual int caretMaxOffset() const; 207 virtual int caretMaxOffset() const;
216 virtual unsigned caretMaxRenderedOffset() const; 208 virtual unsigned caretMaxRenderedOffset() const;
217 209
218 unsigned char bidiLevel() const { return m_bidiEmbeddingLevel; } 210 unsigned char bidiLevel() const { return m_bidiEmbeddingLevel; }
(...skipping 14 matching lines...) Expand all
233 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid th); 225 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid th);
234 virtual int placeEllipsisBox(bool ltr, int blockEdge, int ellipsisWidth, boo l&); 226 virtual int placeEllipsisBox(bool ltr, int blockEdge, int ellipsisWidth, boo l&);
235 227
236 void setHasBadParent(); 228 void setHasBadParent();
237 229
238 int toAdd() const { return m_toAdd; } 230 int toAdd() const { return m_toAdd; }
239 231
240 bool visibleToHitTesting() const { return object()->style()->visibility() == VISIBLE && object()->style()->pointerEvents() != PE_NONE; } 232 bool visibleToHitTesting() const { return object()->style()->visibility() == VISIBLE && object()->style()->pointerEvents() != PE_NONE; }
241 233
242 // Use with caution! The type is not checked! 234 // Use with caution! The type is not checked!
243 RenderBox* renderBox() const { return toRenderBox(m_object); } 235 RenderBoxModelObject* boxModelObject() const
236 {
237 if (!m_object->isText())
238 return static_cast<RenderBoxModelObject*>(m_object);
239 return 0;
240 }
244 241
245 public: 242 public:
246 RenderObject* m_object; 243 RenderObject* m_object;
247 244
248 int m_x; 245 int m_x;
249 int m_y; 246 int m_y;
250 int m_width; 247 int m_width;
251 int m_height; 248 int m_height;
252 int m_baseline; 249 int m_baseline;
253 250
254 private: 251 private:
255 InlineBox* m_next; // The next element on the same line as us. 252 InlineBox* m_next; // The next element on the same line as us.
256 InlineBox* m_prev; // The previous element on the same line as us. 253 InlineBox* m_prev; // The previous element on the same line as us.
257 254
258 InlineFlowBox* m_parent; // The box that contains us. 255 InlineFlowBox* m_parent; // The box that contains us.
259 256
260 // Some of these bits are actually for subclasses and moved here to compact the structures. 257 // Some of these bits are actually for subclasses and moved here to compact the structures.
261 258
262 // for this class 259 // for this class
263 protected: 260 protected:
264 bool m_firstLine : 1; 261 bool m_firstLine : 1;
265 private: 262 private:
266 bool m_constructed : 1; 263 bool m_constructed : 1;
267 unsigned char m_bidiEmbeddingLevel : 6; 264 unsigned char m_bidiEmbeddingLevel : 6;
268 protected: 265 protected:
269 bool m_dirty : 1; 266 bool m_dirty : 1;
270 bool m_extracted : 1; 267 bool m_extracted : 1;
271 268
272 // for InlineFlowBox
273 bool m_includeLeftEdge : 1;
274 bool m_includeRightEdge : 1;
275 bool m_hasTextChildren : 1;
276
277 // for RootInlineBox 269 // for RootInlineBox
278 bool m_endsWithBreak : 1; // Whether the line ends with a <br>. 270 bool m_endsWithBreak : 1; // Whether the line ends with a <br>.
279 bool m_hasSelectedChildren : 1; // Whether we have any children selected (th is bit will also be set if the <br> that terminates our line is selected). 271 bool m_hasSelectedChildren : 1; // Whether we have any children selected (th is bit will also be set if the <br> that terminates our line is selected).
280 bool m_hasEllipsisBox : 1; 272 bool m_hasEllipsisBox : 1;
281 273
282 // for InlineTextBox 274 // for InlineTextBox
283 public: 275 public:
284 bool m_dirOverride : 1; 276 bool m_dirOverride : 1;
285 bool m_treatAsText : 1; // Whether or not to treat a <br> as text for the pu rposes of line height. 277 bool m_treatAsText : 1; // Whether or not to treat a <br> as text for the pu rposes of line height.
286 protected: 278 protected:
(...skipping 23 matching lines...) Expand all
310 } 302 }
311 303
312 } // namespace WebCore 304 } // namespace WebCore
313 305
314 #ifndef NDEBUG 306 #ifndef NDEBUG
315 // Outside the WebCore namespace for ease of invocation from gdb. 307 // Outside the WebCore namespace for ease of invocation from gdb.
316 void showTree(const WebCore::InlineBox*); 308 void showTree(const WebCore::InlineBox*);
317 #endif 309 #endif
318 310
319 #endif // InlineBox_h 311 #endif // InlineBox_h
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/platform/gtk/ScrollViewGtk.cpp ('k') | third_party/WebKit/WebCore/rendering/InlineFlowBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698