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

Side by Side Diff: Source/core/rendering/InlineBox.h

Issue 182413005: Return refererence from InlineBox::root() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-upload because previous patch didn't upload correctly. Created 6 years, 9 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
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/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
(...skipping 15 matching lines...) Expand all
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 // InlineBox represents a rectangle that occurs on a line. It corresponds to 33 // InlineBox represents a rectangle that occurs on a line. It corresponds to
34 // some RenderObject (i.e., it represents a portion of that RenderObject). 34 // some RenderObject (i.e., it represents a portion of that RenderObject).
35 class InlineBox { 35 class InlineBox {
36 WTF_MAKE_NONCOPYABLE(InlineBox);
36 public: 37 public:
37 InlineBox(RenderObject& obj) 38 InlineBox(RenderObject& obj)
38 : m_next(0) 39 : m_next(0)
39 , m_prev(0) 40 , m_prev(0)
40 , m_parent(0) 41 , m_parent(0)
41 , m_renderer(obj) 42 , m_renderer(obj)
42 , m_logicalWidth(0) 43 , m_logicalWidth(0)
43 #ifndef NDEBUG 44 #ifndef NDEBUG
44 , m_hasBadParent(false) 45 , m_hasBadParent(false)
45 #endif 46 #endif
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 176
176 RenderObject& renderer() const { return m_renderer; } 177 RenderObject& renderer() const { return m_renderer; }
177 178
178 InlineFlowBox* parent() const 179 InlineFlowBox* parent() const
179 { 180 {
180 ASSERT(!m_hasBadParent); 181 ASSERT(!m_hasBadParent);
181 return m_parent; 182 return m_parent;
182 } 183 }
183 void setParent(InlineFlowBox* par) { m_parent = par; } 184 void setParent(InlineFlowBox* par) { m_parent = par; }
184 185
185 const RootInlineBox* root() const; 186 const RootInlineBox& root() const;
186 RootInlineBox* root(); 187 RootInlineBox& root();
187 188
188 // x() is the left side of the box in the containing block's coordinate syst em. 189 // x() is the left side of the box in the containing block's coordinate syst em.
189 void setX(float x) { m_topLeft.setX(x); } 190 void setX(float x) { m_topLeft.setX(x); }
190 float x() const { return m_topLeft.x(); } 191 float x() const { return m_topLeft.x(); }
191 float left() const { return m_topLeft.x(); } 192 float left() const { return m_topLeft.x(); }
192 193
193 // y() is the top side of the box in the containing block's coordinate syste m. 194 // y() is the top side of the box in the containing block's coordinate syste m.
194 void setY(float y) { m_topLeft.setY(y); } 195 void setY(float y) { m_topLeft.setY(y); }
195 float y() const { return m_topLeft.y(); } 196 float y() const { return m_topLeft.y(); }
196 float top() const { return m_topLeft.y(); } 197 float top() const { return m_topLeft.y(); }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 #ifndef NDEBUG 420 #ifndef NDEBUG
420 inline void InlineBox::setHasBadParent() 421 inline void InlineBox::setHasBadParent()
421 { 422 {
422 m_hasBadParent = true; 423 m_hasBadParent = true;
423 } 424 }
424 #endif 425 #endif
425 426
426 #define DEFINE_INLINE_BOX_TYPE_CASTS(typeName) \ 427 #define DEFINE_INLINE_BOX_TYPE_CASTS(typeName) \
427 DEFINE_TYPE_CASTS(typeName, InlineBox, box, box->is##typeName(), box.is##typ eName()) 428 DEFINE_TYPE_CASTS(typeName, InlineBox, box, box->is##typeName(), box.is##typ eName())
428 429
430 // Allow equality comparisons of InlineBox's by reference or pointer, interchang eably.
Inactive 2014/03/03 20:25:18 I don't mind this but I'd like to hear esprehn's o
esprehn 2014/03/03 20:57:23 This is fine with me, having to marshall between r
431 inline bool operator==(const InlineBox& a, const InlineBox& b) { return &a == &b ; }
432 inline bool operator==(const InlineBox& a, const InlineBox* b) { return &a == b; }
433 inline bool operator==(const InlineBox* a, const InlineBox& b) { return a == &b; }
434 inline bool operator!=(const InlineBox& a, const InlineBox& b) { return !(a == b ); }
435 inline bool operator!=(const InlineBox& a, const InlineBox* b) { return !(a == b ); }
436 inline bool operator!=(const InlineBox* a, const InlineBox& b) { return !(a == b ); }
437
429 } // namespace WebCore 438 } // namespace WebCore
430 439
431 #ifndef NDEBUG 440 #ifndef NDEBUG
432 // Outside the WebCore namespace for ease of invocation from gdb. 441 // Outside the WebCore namespace for ease of invocation from gdb.
433 void showTree(const WebCore::InlineBox*); 442 void showTree(const WebCore::InlineBox*);
434 void showLineTree(const WebCore::InlineBox*); 443 void showLineTree(const WebCore::InlineBox*);
435 #endif 444 #endif
436 445
437 #endif // InlineBox_h 446 #endif // InlineBox_h
OLDNEW
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/InlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698