OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
4 * reserved. | 4 * reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 void LayoutSelection::ClearSelection() { | 308 void LayoutSelection::ClearSelection() { |
309 // For querying Layer::compositingState() | 309 // For querying Layer::compositingState() |
310 // This is correct, since destroying layout objects needs to cause eager paint | 310 // This is correct, since destroying layout objects needs to cause eager paint |
311 // invalidations. | 311 // invalidations. |
312 DisableCompositingQueryAsserts disabler; | 312 DisableCompositingQueryAsserts disabler; |
313 | 313 |
314 // Just return if the selection is already empty. | 314 // Just return if the selection is already empty. |
315 if (paint_range_.IsNull()) | 315 if (paint_range_.IsNull()) |
316 return; | 316 return; |
317 | 317 |
318 const SelectedMap& old_selected_map = CollectSelectedMap( | 318 for (auto layout_object : paint_range_) { |
319 paint_range_, CollectSelectedMapOption::kNotCollectBlock); | |
320 // Clear SelectionState and invalidation. | |
321 // TODO(yoichio): Iterate with *this directrly. | |
322 for (auto layout_object : old_selected_map.object_map.Keys()) { | |
323 const SelectionState old_state = layout_object->GetSelectionState(); | 319 const SelectionState old_state = layout_object->GetSelectionState(); |
324 layout_object->SetSelectionStateIfNeeded(SelectionState::kNone); | 320 layout_object->SetSelectionStateIfNeeded(SelectionState::kNone); |
325 if (layout_object->GetSelectionState() == old_state) | 321 if (layout_object->GetSelectionState() == old_state) |
326 continue; | 322 continue; |
327 layout_object->SetShouldInvalidateSelection(); | 323 layout_object->SetShouldInvalidateSelection(); |
328 } | 324 } |
329 | 325 |
330 // Reset selection. | 326 // Reset selection. |
331 paint_range_ = SelectionPaintRange(); | 327 paint_range_ = SelectionPaintRange(); |
332 } | 328 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 458 |
463 runner->SetShouldInvalidateSelection(); | 459 runner->SetShouldInvalidateSelection(); |
464 } | 460 } |
465 } | 461 } |
466 | 462 |
467 DEFINE_TRACE(LayoutSelection) { | 463 DEFINE_TRACE(LayoutSelection) { |
468 visitor->Trace(frame_selection_); | 464 visitor->Trace(frame_selection_); |
469 } | 465 } |
470 | 466 |
471 } // namespace blink | 467 } // namespace blink |
OLD | NEW |