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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Check www.msnbc.com and try clicking around to find the case where this | 141 // Check www.msnbc.com and try clicking around to find the case where this |
142 // happened. | 142 // happened. |
143 if ((start && !end) || (end && !start)) | 143 if ((start && !end) || (end && !start)) |
144 return; | 144 return; |
145 | 145 |
146 // Just return if the selection hasn't changed. | 146 // Just return if the selection hasn't changed. |
147 if (selection_start_ == start && selection_start_pos_ == start_pos && | 147 if (selection_start_ == start && selection_start_pos_ == start_pos && |
148 selection_end_ == end && selection_end_pos_ == end_pos) | 148 selection_end_ == end && selection_end_pos_ == end_pos) |
149 return; | 149 return; |
150 | 150 |
| 151 DCHECK(frame_selection_->GetDocument().GetLayoutView()->GetFrameView()); |
| 152 |
151 // Record the old selected objects. These will be used later when we compare | 153 // Record the old selected objects. These will be used later when we compare |
152 // against the new selected objects. | 154 // against the new selected objects. |
153 int old_start_pos = selection_start_pos_; | 155 int old_start_pos = selection_start_pos_; |
154 int old_end_pos = selection_end_pos_; | 156 int old_end_pos = selection_end_pos_; |
155 | 157 |
156 // Objects each have a single selection rect to examine. | 158 // Objects each have a single selection rect to examine. |
157 typedef HashMap<LayoutObject*, SelectionState> SelectedObjectMap; | 159 typedef HashMap<LayoutObject*, SelectionState> SelectedObjectMap; |
158 SelectedObjectMap old_selected_objects; | 160 SelectedObjectMap old_selected_objects; |
159 // FIXME: |newSelectedObjects| doesn't really need to store the | 161 // FIXME: |newSelectedObjects| doesn't really need to store the |
160 // SelectionState, it's just more convenient to have it use the same data | 162 // SelectionState, it's just more convenient to have it use the same data |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 if (!result.is_new_entry) | 251 if (!result.is_new_entry) |
250 break; | 252 break; |
251 cb = cb->ContainingBlock(); | 253 cb = cb->ContainingBlock(); |
252 } | 254 } |
253 } | 255 } |
254 | 256 |
255 o = GetNextOrPrevLayoutObjectBasedOnDirection(o, stop, continue_exploring, | 257 o = GetNextOrPrevLayoutObjectBasedOnDirection(o, stop, continue_exploring, |
256 exploring_backwards); | 258 exploring_backwards); |
257 } | 259 } |
258 | 260 |
259 // TODO(yoichio): DCHECK(frame_selection_->,,,->GetFrameView()); | |
260 if (!frame_selection_->GetDocument().GetLayoutView()->GetFrameView()) | |
261 return; | |
262 | |
263 // Have any of the old selected objects changed compared to the new selection? | 261 // Have any of the old selected objects changed compared to the new selection? |
264 for (SelectedObjectMap::iterator i = old_selected_objects.begin(); | 262 for (SelectedObjectMap::iterator i = old_selected_objects.begin(); |
265 i != old_objects_end; ++i) { | 263 i != old_objects_end; ++i) { |
266 LayoutObject* obj = i->key; | 264 LayoutObject* obj = i->key; |
267 SelectionState new_selection_state = obj->GetSelectionState(); | 265 SelectionState new_selection_state = obj->GetSelectionState(); |
268 SelectionState old_selection_state = i->value; | 266 SelectionState old_selection_state = i->value; |
269 if (new_selection_state != old_selection_state || | 267 if (new_selection_state != old_selection_state || |
270 (selection_start_ == obj && old_start_pos != selection_start_pos_) || | 268 (selection_start_ == obj && old_start_pos != selection_start_pos_) || |
271 (selection_end_ == obj && old_end_pos != selection_end_pos_)) { | 269 (selection_end_ == obj && old_end_pos != selection_end_pos_)) { |
272 obj->SetShouldInvalidateSelection(); | 270 obj->SetShouldInvalidateSelection(); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 440 |
443 o->SetShouldInvalidateSelection(); | 441 o->SetShouldInvalidateSelection(); |
444 } | 442 } |
445 } | 443 } |
446 | 444 |
447 DEFINE_TRACE(LayoutSelection) { | 445 DEFINE_TRACE(LayoutSelection) { |
448 visitor->Trace(frame_selection_); | 446 visitor->Trace(frame_selection_); |
449 } | 447 } |
450 | 448 |
451 } // namespace blink | 449 } // namespace blink |
OLD | NEW |