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

Side by Side Diff: Source/core/rendering/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
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/rendering/FloatToLayoutUnit.h" 25 #include "core/rendering/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, 55 InlineBox(LayoutObject& obj, FloatPointWillBeLayoutPoint topLeft, FloatWillB eLayoutUnit logicalWidth, bool firstLine, bool constructed,
56 bool dirty, bool extracted, bool isHorizontal, InlineBox* next, In lineBox* prev, InlineFlowBox* parent) 56 bool dirty, bool extracted, bool isHorizontal, InlineBox* next, In lineBox* prev, InlineFlowBox* parent)
57 : m_next(next) 57 : m_next(next)
58 , m_prev(prev) 58 , m_prev(prev)
59 , m_parent(parent) 59 , m_parent(parent)
60 , m_renderer(obj) 60 , m_renderer(obj)
61 , m_topLeft(topLeft) 61 , m_topLeft(topLeft)
62 , m_logicalWidth(logicalWidth) 62 , m_logicalWidth(logicalWidth)
63 , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal) 63 , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal)
64 #if ENABLE(ASSERT) 64 #if ENABLE(ASSERT)
65 , m_hasBadParent(false) 65 , m_hasBadParent(false)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // InlineBoxes are allocated out of the rendering partition. 106 // InlineBoxes are allocated out of the rendering partition.
107 void* operator new(size_t); 107 void* operator new(size_t);
108 void operator delete(void*); 108 void operator delete(void*);
109 109
110 #ifndef NDEBUG 110 #ifndef NDEBUG
111 void showTreeForThis() const; 111 void showTreeForThis() const;
112 void showLineTreeForThis() const; 112 void showLineTreeForThis() const;
113 113
114 virtual void showBox(int = 0) const; 114 virtual void showBox(int = 0) const;
115 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;
116 virtual const char* boxName() const; 116 virtual const char* boxName() const;
117 #endif 117 #endif
118 118
119 bool isText() const { return m_bitfields.isText(); } 119 bool isText() const { return m_bitfields.isText(); }
120 void setIsText(bool isText) { m_bitfields.setIsText(isText); } 120 void setIsText(bool isText) { m_bitfields.setIsText(isText); }
121 121
122 virtual bool isInlineFlowBox() const { return false; } 122 virtual bool isInlineFlowBox() const { return false; }
123 virtual bool isInlineTextBox() const { return false; } 123 virtual bool isInlineTextBox() const { return false; }
124 virtual bool isRootInlineBox() const { return false; } 124 virtual bool isRootInlineBox() const { return false; }
125 125
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 InlineBox* nextLeafChild() const; 173 InlineBox* nextLeafChild() const;
174 InlineBox* prevLeafChild() const; 174 InlineBox* prevLeafChild() const;
175 175
176 // Helper functions for editing and hit-testing code. 176 // Helper functions for editing and hit-testing code.
177 // 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
178 // Position and inline box, offset pair is moved to RenderedPosition. 178 // Position and inline box, offset pair is moved to RenderedPosition.
179 InlineBox* nextLeafChildIgnoringLineBreak() const; 179 InlineBox* nextLeafChildIgnoringLineBreak() const;
180 InlineBox* prevLeafChildIgnoringLineBreak() const; 180 InlineBox* prevLeafChildIgnoringLineBreak() const;
181 181
182 RenderObject& renderer() const { return m_renderer; } 182 LayoutObject& renderer() const { return m_renderer; }
183 183
184 InlineFlowBox* parent() const 184 InlineFlowBox* parent() const
185 { 185 {
186 ASSERT(!m_hasBadParent); 186 ASSERT(!m_hasBadParent);
187 return m_parent; 187 return m_parent;
188 } 188 }
189 void setParent(InlineFlowBox* par) { m_parent = par; } 189 void setParent(InlineFlowBox* par) { m_parent = par; }
190 190
191 const RootInlineBox& root() const; 191 const RootInlineBox& root() const;
192 RootInlineBox& root(); 192 RootInlineBox& root();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 int caretLeftmostOffset() const { return isLeftToRightDirection() ? caretMin Offset() : caretMaxOffset(); } 257 int caretLeftmostOffset() const { return isLeftToRightDirection() ? caretMin Offset() : caretMaxOffset(); }
258 int caretRightmostOffset() const { return isLeftToRightDirection() ? caretMa xOffset() : caretMinOffset(); } 258 int caretRightmostOffset() const { return isLeftToRightDirection() ? caretMa xOffset() : caretMinOffset(); }
259 259
260 virtual void clearTruncation() { } 260 virtual void clearTruncation() { }
261 261
262 bool isDirty() const { return m_bitfields.dirty(); } 262 bool isDirty() const { return m_bitfields.dirty(); }
263 virtual void markDirty() { m_bitfields.setDirty(true); } 263 virtual void markDirty() { m_bitfields.setDirty(true); }
264 264
265 virtual void dirtyLineBoxes(); 265 virtual void dirtyLineBoxes();
266 266
267 virtual RenderObject::SelectionState selectionState() const; 267 virtual LayoutObject::SelectionState selectionState() const;
268 268
269 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid th) const; 269 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid th) const;
270 // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system. 270 // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system.
271 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&);
272 272
273 #if ENABLE(ASSERT) 273 #if ENABLE(ASSERT)
274 void setHasBadParent(); 274 void setHasBadParent();
275 #endif 275 #endif
276 276
277 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
378 signed expansion() const { return m_expansion; } 378 signed expansion() const { return m_expansion; }
379 void setExpansion(signed expansion) { m_expansion = expansion; } 379 void setExpansion(signed expansion) { m_expansion = expansion; }
380 }; 380 };
381 #undef ADD_BOOLEAN_BITFIELD 381 #undef ADD_BOOLEAN_BITFIELD
382 382
383 private: 383 private:
384 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.
385 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.
386 386
387 InlineFlowBox* m_parent; // The box that contains us. 387 InlineFlowBox* m_parent; // The box that contains us.
388 RenderObject& m_renderer; 388 LayoutObject& m_renderer;
389 389
390 protected: 390 protected:
391 // For RootInlineBox 391 // For RootInlineBox
392 bool endsWithBreak() const { return m_bitfields.endsWithBreak(); } 392 bool endsWithBreak() const { return m_bitfields.endsWithBreak(); }
393 void setEndsWithBreak(bool endsWithBreak) { m_bitfields.setEndsWithBreak(end sWithBreak); } 393 void setEndsWithBreak(bool endsWithBreak) { m_bitfields.setEndsWithBreak(end sWithBreak); }
394 bool hasEllipsisBox() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } 394 bool hasEllipsisBox() const { return m_bitfields.hasEllipsisBoxOrHyphen(); }
395 bool hasSelectedChildren() const { return m_bitfields.hasSelectedChildrenOrC anHaveLeadingExpansion(); } 395 bool hasSelectedChildren() const { return m_bitfields.hasSelectedChildrenOrC anHaveLeadingExpansion(); }
396 void setHasSelectedChildren(bool hasSelectedChildren) { m_bitfields.setHasSe lectedChildrenOrCanHaveLeadingExpansion(hasSelectedChildren); } 396 void setHasSelectedChildren(bool hasSelectedChildren) { m_bitfields.setHasSe lectedChildrenOrCanHaveLeadingExpansion(hasSelectedChildren); }
397 void setHasEllipsisBox(bool hasEllipsisBox) { m_bitfields.setHasEllipsisBoxO rHyphen(hasEllipsisBox); } 397 void setHasEllipsisBox(bool hasEllipsisBox) { m_bitfields.setHasEllipsisBoxO rHyphen(hasEllipsisBox); }
398 398
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 } // namespace blink 440 } // namespace blink
441 441
442 #ifndef NDEBUG 442 #ifndef NDEBUG
443 // Outside the WebCore namespace for ease of invocation from gdb. 443 // Outside the WebCore namespace for ease of invocation from gdb.
444 void showTree(const blink::InlineBox*); 444 void showTree(const blink::InlineBox*);
445 void showLineTree(const blink::InlineBox*); 445 void showLineTree(const blink::InlineBox*);
446 #endif 446 #endif
447 447
448 #endif // InlineBox_h 448 #endif // InlineBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698