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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 cached_visible_selection_in_dom_tree_ = VisibleSelection(); | 170 cached_visible_selection_in_dom_tree_ = VisibleSelection(); |
171 cached_visible_selection_in_flat_tree_ = VisibleSelectionInFlatTree(); | 171 cached_visible_selection_in_flat_tree_ = VisibleSelectionInFlatTree(); |
172 cached_visible_selection_in_dom_tree_is_dirty_ = false; | 172 cached_visible_selection_in_dom_tree_is_dirty_ = false; |
173 cached_visible_selection_in_flat_tree_is_dirty_ = false; | 173 cached_visible_selection_in_flat_tree_is_dirty_ = false; |
174 } | 174 } |
175 | 175 |
176 static Position ComputePositionForChildrenRemoval(const Position& position, | 176 static Position ComputePositionForChildrenRemoval(const Position& position, |
177 ContainerNode& container) { | 177 ContainerNode& container) { |
178 Node* node = position.ComputeContainerNode(); | 178 Node* node = position.ComputeContainerNode(); |
179 if (container.ContainsIncludingHostElements(*node)) | 179 if (container.ContainsIncludingHostElements(*node)) |
180 return Position::FirstPositionInNode(&container); | 180 return Position::FirstPositionInNode(container); |
181 return position; | 181 return position; |
182 } | 182 } |
183 | 183 |
184 void SelectionEditor::NodeChildrenWillBeRemoved(ContainerNode& container) { | 184 void SelectionEditor::NodeChildrenWillBeRemoved(ContainerNode& container) { |
185 if (selection_.IsNone()) | 185 if (selection_.IsNone()) |
186 return; | 186 return; |
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); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 DEFINE_TRACE(SelectionEditor) { | 442 DEFINE_TRACE(SelectionEditor) { |
443 visitor->Trace(frame_); | 443 visitor->Trace(frame_); |
444 visitor->Trace(selection_); | 444 visitor->Trace(selection_); |
445 visitor->Trace(cached_visible_selection_in_dom_tree_); | 445 visitor->Trace(cached_visible_selection_in_dom_tree_); |
446 visitor->Trace(cached_visible_selection_in_flat_tree_); | 446 visitor->Trace(cached_visible_selection_in_flat_tree_); |
447 visitor->Trace(cached_range_); | 447 visitor->Trace(cached_range_); |
448 SynchronousMutationObserver::Trace(visitor); | 448 SynchronousMutationObserver::Trace(visitor); |
449 } | 449 } |
450 | 450 |
451 } // namespace blink | 451 } // namespace blink |
OLD | NEW |