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

Side by Side Diff: Source/core/editing/VisibleSelection.cpp

Issue 1201423002: Use VisibleSelection::InDOMTree::equalSelections() instead of operator==() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-06-24T15:30:20 Rebase - exclude FrameSelection Created 5 years, 6 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/editing/VisibleSelection.h ('k') | no next file » | 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) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 } 1148 }
1149 1149
1150 void VisibleSelection::validatePositionsIfNeeded() 1150 void VisibleSelection::validatePositionsIfNeeded()
1151 { 1151 {
1152 if (!isValidPosition(m_base) || !isValidPosition(m_extent) || !isValidPositi on(m_start) || !isValidPosition(m_end)) 1152 if (!isValidPosition(m_base) || !isValidPosition(m_extent) || !isValidPositi on(m_start) || !isValidPosition(m_end))
1153 validate(); 1153 validate();
1154 } 1154 }
1155 1155
1156 bool VisibleSelection::InDOMTree::equalSelections(const VisibleSelection& select ion1, const VisibleSelection& selection2) 1156 bool VisibleSelection::InDOMTree::equalSelections(const VisibleSelection& select ion1, const VisibleSelection& selection2)
1157 { 1157 {
1158 return selection1 == selection2; 1158 if (selection1.affinity() != selection2.affinity() || selection1.isDirection al() != selection2.isDirectional())
hajimehoshi 2015/06/24 06:48:45 Why is this needed? This seems redundant. The comp
yosin_UTC9 2015/06/24 07:02:52 I just copied from original code. It seems we nee
1159 return false;
1160
1161 if (selection1.isNone())
hajimehoshi 2015/06/24 06:48:45 This could also be redundant, but I'm not sure. Wh
yosin_UTC9 2015/06/24 07:02:52 I just copied from original code. If we should rem
1162 return selection2.isNone();
1163
1164 return selection1.start() == selection2.start() && selection1.end() == selec tion2.end() && selection1.affinity() == selection2.affinity()
1165 && selection1.isDirectional() == selection2.isDirectional() && selection 1.base() == selection2.base() && selection1.extent() == selection2.extent();
1159 } 1166 }
1160 1167
1161 bool VisibleSelection::InComposedTree::equalSelections(const VisibleSelection& a , const VisibleSelection& b) 1168 bool VisibleSelection::InComposedTree::equalSelections(const VisibleSelection& a , const VisibleSelection& b)
1162 { 1169 {
1163 return a.startInComposedTree() == b.startInComposedTree() && a.endInComposed Tree() == b.endInComposedTree() && a.affinity() == b.affinity() && a.isBaseFirst () == b.isBaseFirst() && a.isDirectional() == b.isDirectional(); 1170 return a.startInComposedTree() == b.startInComposedTree() && a.endInComposed Tree() == b.endInComposedTree() && a.affinity() == b.affinity() && a.isBaseFirst () == b.isBaseFirst() && a.isDirectional() == b.isDirectional();
1164 } 1171 }
1165 1172
1166 #ifndef NDEBUG 1173 #ifndef NDEBUG
1167 1174
1168 void VisibleSelection::debugPosition(const char* message) const 1175 void VisibleSelection::debugPosition(const char* message) const
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 sel.showTreeForThis(); 1247 sel.showTreeForThis();
1241 } 1248 }
1242 1249
1243 void showTree(const blink::VisibleSelection* sel) 1250 void showTree(const blink::VisibleSelection* sel)
1244 { 1251 {
1245 if (sel) 1252 if (sel)
1246 sel->showTreeForThis(); 1253 sel->showTreeForThis();
1247 } 1254 }
1248 1255
1249 #endif 1256 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleSelection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698