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

Unified Diff: Source/core/rendering/RenderObject.h

Issue 184023003: Make InlineBox::renderer() and related subclass methods return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated by review comments. 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
Index: Source/core/rendering/RenderObject.h
diff --git a/Source/core/rendering/RenderObject.h b/Source/core/rendering/RenderObject.h
index 399c0380079a52efb44ec07c23aca9afcdf972da..b0239d5910d993b294062f7a6305d505be86cd08 100644
--- a/Source/core/rendering/RenderObject.h
+++ b/Source/core/rendering/RenderObject.h
@@ -1217,6 +1217,18 @@ private:
LayoutRect m_newRepaintRect;
};
+// Allow equality comparisons of RenderObject's by reference or pointer, interchangeably.
+inline bool operator==(const RenderObject& a, const RenderObject& b) { return &a == &b; }
+inline bool operator==(const RenderObject& a, const RenderObject* b) { return &a == b; }
+inline bool operator==(const RenderObject* a, const RenderObject& b) { return a == &b; }
+inline bool operator!=(const RenderObject& a, const RenderObject& b) { return !(a == b); }
+inline bool operator!=(const RenderObject& a, const RenderObject* b) { return !(a == b); }
+inline bool operator!=(const RenderObject* a, const RenderObject& b) { return !(a == b); }
+inline bool operator==(const PassRefPtr<RenderObject>& a, const RenderObject& b) { return a.get() == &b; }
Inactive 2014/02/28 14:16:42 Are the ones taking PassRefPtrs really needed righ
ostap 2014/02/28 15:37:23 Done.
+inline bool operator==(const RenderObject& a, const PassRefPtr<RenderObject>& b) { return &a == b.get(); }
+inline bool operator!=(const PassRefPtr<RenderObject>& a, const RenderObject& b) { return !(a == b); }
+inline bool operator!=(const RenderObject& a, const PassRefPtr<RenderObject>& b) { return !(a == b); }
+
inline bool RenderObject::documentBeingDestroyed() const
{
return !document().renderer();

Powered by Google App Engine
This is Rietveld 408576698