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

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

Issue 1234513004: Make follow the same pattern for equalSelections() in VisibleSelection. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | 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 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 } 1139 }
1140 1140
1141 bool VisibleSelection::InDOMTree::equalSelections(const VisibleSelection& select ion1, const VisibleSelection& selection2) 1141 bool VisibleSelection::InDOMTree::equalSelections(const VisibleSelection& select ion1, const VisibleSelection& selection2)
1142 { 1142 {
1143 if (selection1.affinity() != selection2.affinity() || selection1.isDirection al() != selection2.isDirectional()) 1143 if (selection1.affinity() != selection2.affinity() || selection1.isDirection al() != selection2.isDirectional())
1144 return false; 1144 return false;
1145 1145
1146 if (selection1.isNone()) 1146 if (selection1.isNone())
1147 return selection2.isNone(); 1147 return selection2.isNone();
1148 1148
1149 return selection1.start() == selection2.start() && selection1.end() == selec tion2.end() && selection1.affinity() == selection2.affinity() 1149 return selection1.start() == selection2.start() && selection1.end() == selec tion2.end() && selection1.base() == selection2.base() && selection1.extent() == selection2.extent();
1150 && selection1.isDirectional() == selection2.isDirectional() && selection 1.base() == selection2.base() && selection1.extent() == selection2.extent();
1151 } 1150 }
1152 1151
1153 bool VisibleSelection::InComposedTree::equalSelections(const VisibleSelection& a , const VisibleSelection& b) 1152 bool VisibleSelection::InComposedTree::equalSelections(const VisibleSelection& a , const VisibleSelection& b)
1154 { 1153 {
1155 return a.startInComposedTree() == b.startInComposedTree() && a.endInComposed Tree() == b.endInComposedTree() && a.affinity() == b.affinity() && a.isBaseFirst () == b.isBaseFirst() && a.isDirectional() == b.isDirectional(); 1154 return a.startInComposedTree() == b.startInComposedTree() && a.endInComposed Tree() == b.endInComposedTree() && a.affinity() == b.affinity() && a.isBaseFirst () == b.isBaseFirst() && a.isDirectional() == b.isDirectional();
yosin_UTC9 2015/07/16 07:24:20 Could you get rid of duplicate conditions here too
hyup 2015/07/16 09:41:02 I removed conditions about affinity and isDirectio
yosin_UTC9 2015/07/17 01:06:07 Oops, composed tree version isn't matched DOM tree
1156 } 1155 }
1157 1156
1158 #ifndef NDEBUG 1157 #ifndef NDEBUG
1159 1158
1160 void VisibleSelection::debugPosition(const char* message) const 1159 void VisibleSelection::debugPosition(const char* message) const
1161 { 1160 {
1162 fprintf(stderr, "VisibleSelection (%s) ===============\n", message); 1161 fprintf(stderr, "VisibleSelection (%s) ===============\n", message);
1163 1162
1164 if (m_baseIsFirst) { 1163 if (m_baseIsFirst) {
1165 m_start.debugPosition("start: "); 1164 m_start.debugPosition("start: ");
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 sel.showTreeForThis(); 1231 sel.showTreeForThis();
1233 } 1232 }
1234 1233
1235 void showTree(const blink::VisibleSelection* sel) 1234 void showTree(const blink::VisibleSelection* sel)
1236 { 1235 {
1237 if (sel) 1236 if (sel)
1238 sel->showTreeForThis(); 1237 sel->showTreeForThis();
1239 } 1238 }
1240 1239
1241 #endif 1240 #endif
OLDNEW
« 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