OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 const Position old_base = selection_.base_; | 187 const Position old_base = selection_.base_; |
188 const Position old_extent = selection_.extent_; | 188 const Position old_extent = selection_.extent_; |
189 const Position& new_base = | 189 const Position& new_base = |
190 ComputePositionForChildrenRemoval(old_base, container); | 190 ComputePositionForChildrenRemoval(old_base, container); |
191 const Position& new_extent = | 191 const Position& new_extent = |
192 ComputePositionForChildrenRemoval(old_extent, container); | 192 ComputePositionForChildrenRemoval(old_extent, container); |
193 if (new_base == old_base && new_extent == old_extent) | 193 if (new_base == old_base && new_extent == old_extent) |
194 return; | 194 return; |
195 selection_ = SelectionInDOMTree::Builder() | 195 selection_ = SelectionInDOMTree::Builder() |
196 .SetBaseAndExtent(new_base, new_extent) | 196 .SetBaseAndExtent(new_base, new_extent) |
197 .SetIsHandleVisible(selection_.IsHandleVisible()) | |
yosin_UTC9
2017/05/31 03:39:26
Good catch! (^_^)b
| |
197 .Build(); | 198 .Build(); |
198 MarkCacheDirty(); | 199 MarkCacheDirty(); |
199 } | 200 } |
200 | 201 |
201 void SelectionEditor::NodeWillBeRemoved(Node& node_to_be_removed) { | 202 void SelectionEditor::NodeWillBeRemoved(Node& node_to_be_removed) { |
202 if (selection_.IsNone()) | 203 if (selection_.IsNone()) |
203 return; | 204 return; |
204 const Position old_base = selection_.base_; | 205 const Position old_base = selection_.base_; |
205 const Position old_extent = selection_.extent_; | 206 const Position old_extent = selection_.extent_; |
206 const Position& new_base = | 207 const Position& new_base = |
207 ComputePositionForNodeRemoval(old_base, node_to_be_removed); | 208 ComputePositionForNodeRemoval(old_base, node_to_be_removed); |
208 const Position& new_extent = | 209 const Position& new_extent = |
209 ComputePositionForNodeRemoval(old_extent, node_to_be_removed); | 210 ComputePositionForNodeRemoval(old_extent, node_to_be_removed); |
210 if (new_base == old_base && new_extent == old_extent) | 211 if (new_base == old_base && new_extent == old_extent) |
211 return; | 212 return; |
212 selection_ = SelectionInDOMTree::Builder() | 213 selection_ = SelectionInDOMTree::Builder() |
213 .SetBaseAndExtent(new_base, new_extent) | 214 .SetBaseAndExtent(new_base, new_extent) |
215 .SetIsHandleVisible(selection_.IsHandleVisible()) | |
214 .Build(); | 216 .Build(); |
215 MarkCacheDirty(); | 217 MarkCacheDirty(); |
216 } | 218 } |
217 | 219 |
218 static Position UpdatePositionAfterAdoptingTextReplacement( | 220 static Position UpdatePositionAfterAdoptingTextReplacement( |
219 const Position& position, | 221 const Position& position, |
220 CharacterData* node, | 222 CharacterData* node, |
221 unsigned offset, | 223 unsigned offset, |
222 unsigned old_length, | 224 unsigned old_length, |
223 unsigned new_length) { | 225 unsigned new_length) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
442 DEFINE_TRACE(SelectionEditor) { | 444 DEFINE_TRACE(SelectionEditor) { |
443 visitor->Trace(frame_); | 445 visitor->Trace(frame_); |
444 visitor->Trace(selection_); | 446 visitor->Trace(selection_); |
445 visitor->Trace(cached_visible_selection_in_dom_tree_); | 447 visitor->Trace(cached_visible_selection_in_dom_tree_); |
446 visitor->Trace(cached_visible_selection_in_flat_tree_); | 448 visitor->Trace(cached_visible_selection_in_flat_tree_); |
447 visitor->Trace(cached_range_); | 449 visitor->Trace(cached_range_); |
448 SynchronousMutationObserver::Trace(visitor); | 450 SynchronousMutationObserver::Trace(visitor); |
449 } | 451 } |
450 | 452 |
451 } // namespace blink | 453 } // namespace blink |
OLD | NEW |