Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: third_party/WebKit/Source/core/editing/LayoutSelection.cpp

Issue 2968363002: Return null SelectionPaintRange if no LayoutObject. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return SelectionPaintRange(); 315 return SelectionPaintRange();
316 316
317 const PositionInFlatTree start_pos = selection.StartPosition(); 317 const PositionInFlatTree start_pos = selection.StartPosition();
318 const PositionInFlatTree end_pos = selection.EndPosition(); 318 const PositionInFlatTree end_pos = selection.EndPosition();
319 DCHECK_LE(start_pos, end_pos); 319 DCHECK_LE(start_pos, end_pos);
320 LayoutObject* start_layout_object = start_pos.AnchorNode()->GetLayoutObject(); 320 LayoutObject* start_layout_object = start_pos.AnchorNode()->GetLayoutObject();
321 LayoutObject* end_layout_object = end_pos.AnchorNode()->GetLayoutObject(); 321 LayoutObject* end_layout_object = end_pos.AnchorNode()->GetLayoutObject();
322 DCHECK(start_layout_object); 322 DCHECK(start_layout_object);
323 DCHECK(end_layout_object); 323 DCHECK(end_layout_object);
324 DCHECK(start_layout_object->View() == end_layout_object->View()); 324 DCHECK(start_layout_object->View() == end_layout_object->View());
325 if (!start_layout_object || !end_layout_object)
326 return SelectionPaintRange();
325 327
326 return SelectionPaintRange(start_layout_object, 328 return SelectionPaintRange(start_layout_object,
327 start_pos.ComputeEditingOffset(), 329 start_pos.ComputeEditingOffset(),
328 end_layout_object, end_pos.ComputeEditingOffset()); 330 end_layout_object, end_pos.ComputeEditingOffset());
329 } 331 }
330 332
331 void LayoutSelection::Commit() { 333 void LayoutSelection::Commit() {
332 if (!HasPendingSelection()) 334 if (!HasPendingSelection())
333 return; 335 return;
334 has_pending_selection_ = false; 336 has_pending_selection_ = false;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 392
391 runner->SetShouldInvalidateSelection(); 393 runner->SetShouldInvalidateSelection();
392 } 394 }
393 } 395 }
394 396
395 DEFINE_TRACE(LayoutSelection) { 397 DEFINE_TRACE(LayoutSelection) {
396 visitor->Trace(frame_selection_); 398 visitor->Trace(frame_selection_);
397 } 399 }
398 400
399 } // namespace blink 401 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698