| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 builder.setBaseAndExtent(range).setAffinity(affinity).setIsDirectional( | 121 builder.setBaseAndExtent(range).setAffinity(affinity).setIsDirectional( |
| 122 isDirectional); | 122 isDirectional); |
| 123 return createVisibleSelection(builder.build()); | 123 return createVisibleSelection(builder.build()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 VisibleSelectionInFlatTree createVisibleSelection( | 126 VisibleSelectionInFlatTree createVisibleSelection( |
| 127 const SelectionInFlatTree& selection) { | 127 const SelectionInFlatTree& selection) { |
| 128 return VisibleSelectionInFlatTree::create(selection); | 128 return VisibleSelectionInFlatTree::create(selection); |
| 129 } | 129 } |
| 130 | 130 |
| 131 VisibleSelectionInFlatTree createVisibleSelection( | |
| 132 const PositionInFlatTree& base, | |
| 133 const PositionInFlatTree& extent, | |
| 134 TextAffinity affinity, | |
| 135 bool isDirectional) { | |
| 136 DCHECK(!needsLayoutTreeUpdate(base)); | |
| 137 DCHECK(!needsLayoutTreeUpdate(extent)); | |
| 138 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid | |
| 139 // of callers passing |base.istNull()| but |extent.isNotNull()|. | |
| 140 SelectionInFlatTree::Builder builder; | |
| 141 builder.setBaseAndExtentDeprecated(base, extent) | |
| 142 .setAffinity(affinity) | |
| 143 .setIsDirectional(isDirectional); | |
| 144 return createVisibleSelection(builder.build()); | |
| 145 } | |
| 146 | |
| 147 template <typename Strategy> | 131 template <typename Strategy> |
| 148 static SelectionType computeSelectionType( | 132 static SelectionType computeSelectionType( |
| 149 const PositionTemplate<Strategy>& start, | 133 const PositionTemplate<Strategy>& start, |
| 150 const PositionTemplate<Strategy>& end) { | 134 const PositionTemplate<Strategy>& end) { |
| 151 if (start.isNull()) { | 135 if (start.isNull()) { |
| 152 DCHECK(end.isNull()); | 136 DCHECK(end.isNull()); |
| 153 return NoSelection; | 137 return NoSelection; |
| 154 } | 138 } |
| 155 if (start == end) | 139 if (start == end) |
| 156 return CaretSelection; | 140 return CaretSelection; |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 899 |
| 916 void showTree(const blink::VisibleSelectionInFlatTree& sel) { | 900 void showTree(const blink::VisibleSelectionInFlatTree& sel) { |
| 917 sel.showTreeForThis(); | 901 sel.showTreeForThis(); |
| 918 } | 902 } |
| 919 | 903 |
| 920 void showTree(const blink::VisibleSelectionInFlatTree* sel) { | 904 void showTree(const blink::VisibleSelectionInFlatTree* sel) { |
| 921 if (sel) | 905 if (sel) |
| 922 sel->showTreeForThis(); | 906 sel->showTreeForThis(); |
| 923 } | 907 } |
| 924 #endif | 908 #endif |
| OLD | NEW |