| OLD | NEW |
| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 DCHECK(!needsLayoutTreeUpdate(extent)); | 143 DCHECK(!needsLayoutTreeUpdate(extent)); |
| 144 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid | 144 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid |
| 145 // of callers passing |base.istNull()| but |extent.isNotNull()|. | 145 // of callers passing |base.istNull()| but |extent.isNotNull()|. |
| 146 SelectionInFlatTree::Builder builder; | 146 SelectionInFlatTree::Builder builder; |
| 147 builder.setBaseAndExtentDeprecated(base, extent) | 147 builder.setBaseAndExtentDeprecated(base, extent) |
| 148 .setAffinity(affinity) | 148 .setAffinity(affinity) |
| 149 .setIsDirectional(isDirectional); | 149 .setIsDirectional(isDirectional); |
| 150 return createVisibleSelection(builder.build()); | 150 return createVisibleSelection(builder.build()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 VisibleSelectionInFlatTree createVisibleSelection( | |
| 154 const VisiblePositionInFlatTree& base, | |
| 155 const VisiblePositionInFlatTree& extent, | |
| 156 bool isDirectional) { | |
| 157 DCHECK(base.isValid()); | |
| 158 DCHECK(extent.isValid()); | |
| 159 // TODO(xiaochengh): We should check |base.isNotNull() || extent.isNull()| | |
| 160 // after all call sites have ensured that. | |
| 161 return createVisibleSelection(base.deepEquivalent(), extent.deepEquivalent(), | |
| 162 base.affinity(), isDirectional); | |
| 163 } | |
| 164 | |
| 165 template <typename Strategy> | 153 template <typename Strategy> |
| 166 static SelectionType computeSelectionType( | 154 static SelectionType computeSelectionType( |
| 167 const PositionTemplate<Strategy>& start, | 155 const PositionTemplate<Strategy>& start, |
| 168 const PositionTemplate<Strategy>& end) { | 156 const PositionTemplate<Strategy>& end) { |
| 169 if (start.isNull()) { | 157 if (start.isNull()) { |
| 170 DCHECK(end.isNull()); | 158 DCHECK(end.isNull()); |
| 171 return NoSelection; | 159 return NoSelection; |
| 172 } | 160 } |
| 173 if (start == end) | 161 if (start == end) |
| 174 return CaretSelection; | 162 return CaretSelection; |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 | 921 |
| 934 void showTree(const blink::VisibleSelectionInFlatTree& sel) { | 922 void showTree(const blink::VisibleSelectionInFlatTree& sel) { |
| 935 sel.showTreeForThis(); | 923 sel.showTreeForThis(); |
| 936 } | 924 } |
| 937 | 925 |
| 938 void showTree(const blink::VisibleSelectionInFlatTree* sel) { | 926 void showTree(const blink::VisibleSelectionInFlatTree* sel) { |
| 939 if (sel) | 927 if (sel) |
| 940 sel->showTreeForThis(); | 928 sel->showTreeForThis(); |
| 941 } | 929 } |
| 942 #endif | 930 #endif |
| OLD | NEW |