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

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

Issue 2920733002: Rename VisibleSelection::end() to End() (Closed)
Patch Set: 2017-06-01T18:31:38 Created 3 years, 6 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
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 LayoutSelection::LayoutSelection(FrameSelection& frame_selection) 77 LayoutSelection::LayoutSelection(FrameSelection& frame_selection)
78 : frame_selection_(&frame_selection), 78 : frame_selection_(&frame_selection),
79 has_pending_selection_(false), 79 has_pending_selection_(false),
80 paint_range_(SelectionPaintRange()) {} 80 paint_range_(SelectionPaintRange()) {}
81 81
82 SelectionInFlatTree LayoutSelection::CalcVisibleSelection( 82 SelectionInFlatTree LayoutSelection::CalcVisibleSelection(
83 const VisibleSelectionInFlatTree& original_selection) const { 83 const VisibleSelectionInFlatTree& original_selection) const {
84 const PositionInFlatTree& start = original_selection.Start(); 84 const PositionInFlatTree& start = original_selection.Start();
85 const PositionInFlatTree& end = original_selection.end(); 85 const PositionInFlatTree& end = original_selection.End();
86 SelectionType selection_type = original_selection.GetSelectionType(); 86 SelectionType selection_type = original_selection.GetSelectionType();
87 const TextAffinity affinity = original_selection.Affinity(); 87 const TextAffinity affinity = original_selection.Affinity();
88 88
89 bool paint_block_cursor = 89 bool paint_block_cursor =
90 frame_selection_->ShouldShowBlockCursor() && 90 frame_selection_->ShouldShowBlockCursor() &&
91 selection_type == SelectionType::kCaretSelection && 91 selection_type == SelectionType::kCaretSelection &&
92 !IsLogicalEndOfLine(CreateVisiblePosition(end, affinity)); 92 !IsLogicalEndOfLine(CreateVisiblePosition(end, affinity));
93 if (EnclosingTextControl(start.ComputeContainerNode())) { 93 if (EnclosingTextControl(start.ComputeContainerNode())) {
94 // TODO(yosin) We should use |PositionMoveType::CodePoint| to avoid 94 // TODO(yosin) We should use |PositionMoveType::CodePoint| to avoid
95 // ending paint at middle of character. 95 // ending paint at middle of character.
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // leftmost candidate for the end of the selection. Example: foo <a>bar</a>. 339 // leftmost candidate for the end of the selection. Example: foo <a>bar</a>.
340 // Imagine that a line wrap occurs after 'foo', and that 'bar' is selected. 340 // Imagine that a line wrap occurs after 'foo', and that 'bar' is selected.
341 // If we pass [foo, 3] as the start of the selection, the selection painting 341 // If we pass [foo, 3] as the start of the selection, the selection painting
342 // code will think that content on the line containing 'foo' is selected 342 // code will think that content on the line containing 'foo' is selected
343 // and will fill the gap before 'bar'. 343 // and will fill the gap before 'bar'.
344 PositionInFlatTree start_pos = selection.Start(); 344 PositionInFlatTree start_pos = selection.Start();
345 const PositionInFlatTree most_forward_start = 345 const PositionInFlatTree most_forward_start =
346 MostForwardCaretPosition(start_pos); 346 MostForwardCaretPosition(start_pos);
347 if (IsVisuallyEquivalentCandidate(most_forward_start)) 347 if (IsVisuallyEquivalentCandidate(most_forward_start))
348 start_pos = most_forward_start; 348 start_pos = most_forward_start;
349 PositionInFlatTree end_pos = selection.end(); 349 PositionInFlatTree end_pos = selection.End();
350 const PositionInFlatTree most_backward = MostBackwardCaretPosition(end_pos); 350 const PositionInFlatTree most_backward = MostBackwardCaretPosition(end_pos);
351 if (IsVisuallyEquivalentCandidate(most_backward)) 351 if (IsVisuallyEquivalentCandidate(most_backward))
352 end_pos = most_backward; 352 end_pos = most_backward;
353 353
354 DCHECK(start_pos.IsNotNull()); 354 DCHECK(start_pos.IsNotNull());
355 DCHECK(end_pos.IsNotNull()); 355 DCHECK(end_pos.IsNotNull());
356 DCHECK_LE(start_pos, end_pos); 356 DCHECK_LE(start_pos, end_pos);
357 LayoutObject* start_layout_object = start_pos.AnchorNode()->GetLayoutObject(); 357 LayoutObject* start_layout_object = start_pos.AnchorNode()->GetLayoutObject();
358 LayoutObject* end_layout_object = end_pos.AnchorNode()->GetLayoutObject(); 358 LayoutObject* end_layout_object = end_pos.AnchorNode()->GetLayoutObject();
359 DCHECK(start_layout_object); 359 DCHECK(start_layout_object);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 442
443 o->SetShouldInvalidateSelection(); 443 o->SetShouldInvalidateSelection();
444 } 444 }
445 } 445 }
446 446
447 DEFINE_TRACE(LayoutSelection) { 447 DEFINE_TRACE(LayoutSelection) {
448 visitor->Trace(frame_selection_); 448 visitor->Trace(frame_selection_);
449 } 449 }
450 450
451 } // namespace blink 451 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698