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

Side by Side Diff: Source/core/layout/line/InlineBox.h

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
« no previous file with comments | « Source/core/layout/line/EllipsisBox.h ('k') | Source/core/layout/line/InlineBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All r ights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All r ights 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 "core/layout/LayoutObject.h"
24 #include "core/layout/line/FloatToLayoutUnit.h" 25 #include "core/layout/line/FloatToLayoutUnit.h"
25 #include "core/rendering/RenderBoxModelObject.h" 26 #include "core/rendering/RenderBoxModelObject.h"
26 #include "core/rendering/RenderObjectInlines.h"
27 #include "platform/graphics/paint/DisplayItemClient.h" 27 #include "platform/graphics/paint/DisplayItemClient.h"
28 #include "platform/text/TextDirection.h" 28 #include "platform/text/TextDirection.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 class HitTestRequest; 32 class HitTestRequest;
33 class HitTestResult; 33 class HitTestResult;
34 class RootInlineBox; 34 class RootInlineBox;
35 35
36 enum MarkLineBoxes { MarkLineBoxesDirty, DontMarkLineBoxes }; 36 enum MarkLineBoxes { MarkLineBoxesDirty, DontMarkLineBoxes };
37 37
38 // InlineBox represents a rectangle that occurs on a line. It corresponds to 38 // InlineBox represents a rectangle that occurs on a line. It corresponds to
39 // some RenderObject (i.e., it represents a portion of that RenderObject). 39 // some LayoutObject (i.e., it represents a portion of that LayoutObject).
40 class InlineBox { 40 class InlineBox {
41 WTF_MAKE_NONCOPYABLE(InlineBox); 41 WTF_MAKE_NONCOPYABLE(InlineBox);
42 public: 42 public:
43 InlineBox(RenderObject& obj) 43 InlineBox(LayoutObject& obj)
44 : m_next(0) 44 : m_next(0)
45 , m_prev(0) 45 , m_prev(0)
46 , m_parent(0) 46 , m_parent(0)
47 , m_renderer(obj) 47 , m_renderer(obj)
48 , m_logicalWidth() 48 , m_logicalWidth()
49 #if ENABLE(ASSERT) 49 #if ENABLE(ASSERT)
50 , m_hasBadParent(false) 50 , m_hasBadParent(false)
51 #endif 51 #endif
52 { 52 {
53 } 53 }
54 54
55 InlineBox(RenderObject& obj, FloatPointWillBeLayoutPoint topLeft, FloatWillB eLayoutUnit logicalWidth, bool firstLine, bool constructed, bool dirty, bool ext racted, bool isHorizontal, InlineBox* next, InlineBox* prev, InlineFlowBox* pare nt) 55 InlineBox(LayoutObject& obj, FloatPointWillBeLayoutPoint topLeft, FloatWillB eLayoutUnit logicalWidth, bool firstLine, bool constructed,
56 bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBo x* prev, InlineFlowBox* parent)
56 : m_next(next) 57 : m_next(next)
57 , m_prev(prev) 58 , m_prev(prev)
58 , m_parent(parent) 59 , m_parent(parent)
59 , m_renderer(obj) 60 , m_renderer(obj)
60 , m_topLeft(topLeft) 61 , m_topLeft(topLeft)
61 , m_logicalWidth(logicalWidth) 62 , m_logicalWidth(logicalWidth)
62 , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal) 63 , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal)
63 #if ENABLE(ASSERT) 64 #if ENABLE(ASSERT)
64 , m_hasBadParent(false) 65 , m_hasBadParent(false)
65 #endif 66 #endif
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 105
105 // InlineBoxes are allocated out of the rendering partition. 106 // InlineBoxes are allocated out of the rendering partition.
106 void* operator new(size_t); 107 void* operator new(size_t);
107 void operator delete(void*); 108 void operator delete(void*);
108 109
109 #ifndef NDEBUG 110 #ifndef NDEBUG
110 void showTreeForThis() const; 111 void showTreeForThis() const;
111 void showLineTreeForThis() const; 112 void showLineTreeForThis() const;
112 113
113 virtual void showBox(int = 0) const; 114 virtual void showBox(int = 0) const;
114 virtual void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, cons t InlineBox* = 0, const char* = 0, const RenderObject* = 0, int = 0) const; 115 virtual void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, cons t InlineBox* = 0, const char* = 0, const LayoutObject* = 0, int = 0) const;
115 virtual const char* boxName() const; 116 virtual const char* boxName() const;
116 #endif 117 #endif
117 118
118 bool isText() const { return m_bitfields.isText(); } 119 bool isText() const { return m_bitfields.isText(); }
119 void setIsText(bool isText) { m_bitfields.setIsText(isText); } 120 void setIsText(bool isText) { m_bitfields.setIsText(isText); }
120 121
121 virtual bool isInlineFlowBox() const { return false; } 122 virtual bool isInlineFlowBox() const { return false; }
122 virtual bool isInlineTextBox() const { return false; } 123 virtual bool isInlineTextBox() const { return false; }
123 virtual bool isRootInlineBox() const { return false; } 124 virtual bool isRootInlineBox() const { return false; }
124 125
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 172
172 InlineBox* nextLeafChild() const; 173 InlineBox* nextLeafChild() const;
173 InlineBox* prevLeafChild() const; 174 InlineBox* prevLeafChild() const;
174 175
175 // Helper functions for editing and hit-testing code. 176 // Helper functions for editing and hit-testing code.
176 // FIXME: These two functions should be moved to RenderedPosition once the c ode to convert between 177 // FIXME: These two functions should be moved to RenderedPosition once the c ode to convert between
177 // Position and inline box, offset pair is moved to RenderedPosition. 178 // Position and inline box, offset pair is moved to RenderedPosition.
178 InlineBox* nextLeafChildIgnoringLineBreak() const; 179 InlineBox* nextLeafChildIgnoringLineBreak() const;
179 InlineBox* prevLeafChildIgnoringLineBreak() const; 180 InlineBox* prevLeafChildIgnoringLineBreak() const;
180 181
181 RenderObject& renderer() const { return m_renderer; } 182 LayoutObject& renderer() const { return m_renderer; }
182 183
183 InlineFlowBox* parent() const 184 InlineFlowBox* parent() const
184 { 185 {
185 ASSERT(!m_hasBadParent); 186 ASSERT(!m_hasBadParent);
186 return m_parent; 187 return m_parent;
187 } 188 }
188 void setParent(InlineFlowBox* par) { m_parent = par; } 189 void setParent(InlineFlowBox* par) { m_parent = par; }
189 190
190 const RootInlineBox& root() const; 191 const RootInlineBox& root() const;
191 RootInlineBox& root(); 192 RootInlineBox& root();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 int caretLeftmostOffset() const { return isLeftToRightDirection() ? caretMin Offset() : caretMaxOffset(); } 257 int caretLeftmostOffset() const { return isLeftToRightDirection() ? caretMin Offset() : caretMaxOffset(); }
257 int caretRightmostOffset() const { return isLeftToRightDirection() ? caretMa xOffset() : caretMinOffset(); } 258 int caretRightmostOffset() const { return isLeftToRightDirection() ? caretMa xOffset() : caretMinOffset(); }
258 259
259 virtual void clearTruncation() { } 260 virtual void clearTruncation() { }
260 261
261 bool isDirty() const { return m_bitfields.dirty(); } 262 bool isDirty() const { return m_bitfields.dirty(); }
262 virtual void markDirty() { m_bitfields.setDirty(true); } 263 virtual void markDirty() { m_bitfields.setDirty(true); }
263 264
264 virtual void dirtyLineBoxes(); 265 virtual void dirtyLineBoxes();
265 266
266 virtual RenderObject::SelectionState selectionState() const; 267 virtual LayoutObject::SelectionState selectionState() const;
267 268
268 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid th) const; 269 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid th) const;
269 // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system. 270 // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system.
270 virtual FloatWillBeLayoutUnit placeEllipsisBox(bool ltr, FloatWillBeLayoutUn it visibleLeftEdge, FloatWillBeLayoutUnit visibleRightEdge, FloatWillBeLayoutUni t ellipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool&); 271 virtual FloatWillBeLayoutUnit placeEllipsisBox(bool ltr, FloatWillBeLayoutUn it visibleLeftEdge, FloatWillBeLayoutUnit visibleRightEdge, FloatWillBeLayoutUni t ellipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool&);
271 272
272 #if ENABLE(ASSERT) 273 #if ENABLE(ASSERT)
273 void setHasBadParent(); 274 void setHasBadParent();
274 #endif 275 #endif
275 276
276 int expansion() const { return m_bitfields.expansion(); } 277 int expansion() const { return m_bitfields.expansion(); }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 signed expansion() const { return m_expansion; } 378 signed expansion() const { return m_expansion; }
378 void setExpansion(signed expansion) { m_expansion = expansion; } 379 void setExpansion(signed expansion) { m_expansion = expansion; }
379 }; 380 };
380 #undef ADD_BOOLEAN_BITFIELD 381 #undef ADD_BOOLEAN_BITFIELD
381 382
382 private: 383 private:
383 InlineBox* m_next; // The next element on the same line as us. 384 InlineBox* m_next; // The next element on the same line as us.
384 InlineBox* m_prev; // The previous element on the same line as us. 385 InlineBox* m_prev; // The previous element on the same line as us.
385 386
386 InlineFlowBox* m_parent; // The box that contains us. 387 InlineFlowBox* m_parent; // The box that contains us.
387 RenderObject& m_renderer; 388 LayoutObject& m_renderer;
388 389
389 protected: 390 protected:
390 // For RootInlineBox 391 // For RootInlineBox
391 bool endsWithBreak() const { return m_bitfields.endsWithBreak(); } 392 bool endsWithBreak() const { return m_bitfields.endsWithBreak(); }
392 void setEndsWithBreak(bool endsWithBreak) { m_bitfields.setEndsWithBreak(end sWithBreak); } 393 void setEndsWithBreak(bool endsWithBreak) { m_bitfields.setEndsWithBreak(end sWithBreak); }
393 bool hasEllipsisBox() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } 394 bool hasEllipsisBox() const { return m_bitfields.hasEllipsisBoxOrHyphen(); }
394 bool hasSelectedChildren() const { return m_bitfields.hasSelectedChildrenOrC anHaveLeadingExpansion(); } 395 bool hasSelectedChildren() const { return m_bitfields.hasSelectedChildrenOrC anHaveLeadingExpansion(); }
395 void setHasSelectedChildren(bool hasSelectedChildren) { m_bitfields.setHasSe lectedChildrenOrCanHaveLeadingExpansion(hasSelectedChildren); } 396 void setHasSelectedChildren(bool hasSelectedChildren) { m_bitfields.setHasSe lectedChildrenOrCanHaveLeadingExpansion(hasSelectedChildren); }
396 void setHasEllipsisBox(bool hasEllipsisBox) { m_bitfields.setHasEllipsisBoxO rHyphen(hasEllipsisBox); } 397 void setHasEllipsisBox(bool hasEllipsisBox) { m_bitfields.setHasEllipsisBoxO rHyphen(hasEllipsisBox); }
397 398
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 439
439 } // namespace blink 440 } // namespace blink
440 441
441 #ifndef NDEBUG 442 #ifndef NDEBUG
442 // Outside the WebCore namespace for ease of invocation from gdb. 443 // Outside the WebCore namespace for ease of invocation from gdb.
443 void showTree(const blink::InlineBox*); 444 void showTree(const blink::InlineBox*);
444 void showLineTree(const blink::InlineBox*); 445 void showLineTree(const blink::InlineBox*);
445 #endif 446 #endif
446 447
447 #endif // InlineBox_h 448 #endif // InlineBox_h
OLDNEW
« no previous file with comments | « Source/core/layout/line/EllipsisBox.h ('k') | Source/core/layout/line/InlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698