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

Unified Diff: third_party/WebKit/Source/core/editing/LayoutSelection.cpp

Issue 2951893003: Remove redundant canonicalization in LayoutSelection::CalacSelectionRange (Closed)
Patch Set: nit 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/LayoutSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
index d94c6482ea6e6c022c2e2be0955179e909e4b311..1264e56f10343f4c7234bbb57c73e22940cbff85 100644
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
@@ -339,24 +339,8 @@ static SelectionPaintRange CalcSelectionPaintRange(
return SelectionPaintRange();
DCHECK(!selection.IsNone());
- // Use the rightmost candidate for the start of the selection, and the
- // leftmost candidate for the end of the selection. Example: foo <a>bar</a>.
- // Imagine that a line wrap occurs after 'foo', and that 'bar' is selected.
- // If we pass [foo, 3] as the start of the selection, the selection painting
- // code will think that content on the line containing 'foo' is selected
- // and will fill the gap before 'bar'.
- PositionInFlatTree start_pos = selection.Start();
- const PositionInFlatTree most_forward_start =
- MostForwardCaretPosition(start_pos);
- if (IsVisuallyEquivalentCandidate(most_forward_start))
- start_pos = most_forward_start;
- PositionInFlatTree end_pos = selection.End();
- const PositionInFlatTree most_backward = MostBackwardCaretPosition(end_pos);
- if (IsVisuallyEquivalentCandidate(most_backward))
- end_pos = most_backward;
-
- DCHECK(start_pos.IsNotNull());
- DCHECK(end_pos.IsNotNull());
+ const PositionInFlatTree start_pos = selection.Start();
+ const PositionInFlatTree end_pos = selection.End();
DCHECK_LE(start_pos, end_pos);
LayoutObject* start_layout_object = start_pos.AnchorNode()->GetLayoutObject();
LayoutObject* end_layout_object = end_pos.AnchorNode()->GetLayoutObject();
« 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