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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/InlineBox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/InlineBox.h
diff --git a/Source/core/rendering/InlineBox.h b/Source/core/rendering/InlineBox.h
index 82dc339ecc957cd78d5273a541a8981deb060af8..53e450d9031034c4e0b919ed971c933d34636be2 100644
--- a/Source/core/rendering/InlineBox.h
+++ b/Source/core/rendering/InlineBox.h
@@ -33,6 +33,7 @@ class RootInlineBox;
// InlineBox represents a rectangle that occurs on a line. It corresponds to
// some RenderObject (i.e., it represents a portion of that RenderObject).
class InlineBox {
+ WTF_MAKE_NONCOPYABLE(InlineBox);
public:
InlineBox(RenderObject& obj)
: m_next(0)
@@ -182,8 +183,8 @@ public:
}
void setParent(InlineFlowBox* par) { m_parent = par; }
- const RootInlineBox* root() const;
- RootInlineBox* root();
+ const RootInlineBox& root() const;
+ RootInlineBox& root();
// x() is the left side of the box in the containing block's coordinate system.
void setX(float x) { m_topLeft.setX(x); }
@@ -426,6 +427,14 @@ inline void InlineBox::setHasBadParent()
#define DEFINE_INLINE_BOX_TYPE_CASTS(typeName) \
DEFINE_TYPE_CASTS(typeName, InlineBox, box, box->is##typeName(), box.is##typeName())
+// Allow equality comparisons of InlineBox's by reference or pointer, interchangeably.
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
+inline bool operator==(const InlineBox& a, const InlineBox& b) { return &a == &b; }
+inline bool operator==(const InlineBox& a, const InlineBox* b) { return &a == b; }
+inline bool operator==(const InlineBox* a, const InlineBox& b) { return a == &b; }
+inline bool operator!=(const InlineBox& a, const InlineBox& b) { return !(a == b); }
+inline bool operator!=(const InlineBox& a, const InlineBox* b) { return !(a == b); }
+inline bool operator!=(const InlineBox* a, const InlineBox& b) { return !(a == b); }
+
} // namespace WebCore
#ifndef NDEBUG
« 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