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

Unified Diff: Source/core/editing/VisibleSelection.h

Issue 1089283002: Making VisibleSelection operator== take base and extent into account. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Need to check affinity() and isDirectional() even if selection is none. Created 5 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisibleSelection.h
diff --git a/Source/core/editing/VisibleSelection.h b/Source/core/editing/VisibleSelection.h
index 1e647e5c0a081ebb3bd9d341ead9d703004d81f3..4b51859d0f292cad40aff746b3786a3e0e8d29be 100644
--- a/Source/core/editing/VisibleSelection.h
+++ b/Source/core/editing/VisibleSelection.h
@@ -181,8 +181,14 @@ private:
inline bool operator==(const VisibleSelection& a, const VisibleSelection& b)
{
- return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.affinity() && a.isBaseFirst() == b.isBaseFirst()
- && a.isDirectional() == b.isDirectional();
+ if (a.affinity() != b.affinity() || a.isDirectional() != b.isDirectional())
+ return false;
+
+ if (a.isNone())
+ return b.isNone();
+
+ return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.affinity()
+ && a.isDirectional() == b.isDirectional() && a.base() == b.base() && a.extent() == b.extent();
}
inline bool operator!=(const VisibleSelection& a, const VisibleSelection& b)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698