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

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

Issue 2425623002: Get rid of flat tree version of createVisibleSelection() taking two VisiblePositionInFlatTree (Closed)
Patch Set: 2016-10-18T17:29:55 Created 4 years, 2 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 | third_party/WebKit/Source/core/editing/VisibleSelection.h » ('j') | 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 PositionMoveType::CodeUnit) 75 PositionMoveType::CodeUnit)
76 : end; 76 : end;
77 selection.setWithoutValidation(start, endPosition); 77 selection.setWithoutValidation(start, endPosition);
78 return selection; 78 return selection;
79 } 79 }
80 80
81 const VisiblePositionInFlatTree& visibleStart = createVisiblePosition( 81 const VisiblePositionInFlatTree& visibleStart = createVisiblePosition(
82 start, selectionType == SelectionType::RangeSelection 82 start, selectionType == SelectionType::RangeSelection
83 ? TextAffinity::Downstream 83 ? TextAffinity::Downstream
84 : affinity); 84 : affinity);
85 if (visibleStart.isNull())
Xiaocheng 2016/10/19 02:33:47 Does it change the behavior? |createVisiblePositio
yosin_UTC9 2016/10/19 03:59:58 In the call site (only one), we do: const Visib
86 return VisibleSelectionInFlatTree();
85 if (paintBlockCursor) { 87 if (paintBlockCursor) {
86 VisiblePositionInFlatTree visibleExtent = 88 const VisiblePositionInFlatTree visibleExtent = nextPositionOf(
87 createVisiblePosition(end, affinity); 89 createVisiblePosition(end, affinity), CanSkipOverEditingBoundary);
88 visibleExtent = nextPositionOf(visibleExtent, CanSkipOverEditingBoundary); 90 if (visibleExtent.isNull())
Xiaocheng 2016/10/19 02:33:47 Same question.
yosin_UTC9 2016/10/19 03:59:58 ditto.
89 return createVisibleSelection(visibleStart, visibleExtent); 91 return VisibleSelectionInFlatTree();
92 SelectionInFlatTree::Builder builder;
93 builder.collapse(visibleStart.toPositionWithAffinity());
94 builder.extend(visibleExtent.deepEquivalent());
95 return createVisibleSelection(builder.build());
90 } 96 }
91 const VisiblePositionInFlatTree visibleEnd = 97 const VisiblePositionInFlatTree visibleEnd =
92 createVisiblePosition(end, selectionType == SelectionType::RangeSelection 98 createVisiblePosition(end, selectionType == SelectionType::RangeSelection
93 ? TextAffinity::Upstream 99 ? TextAffinity::Upstream
94 : affinity); 100 : affinity);
95 return createVisibleSelection(visibleStart, visibleEnd); 101 if (visibleEnd.isNull())
Xiaocheng 2016/10/19 02:33:47 Same question.
yosin_UTC9 2016/10/19 03:59:58 ditto.
102 return VisibleSelectionInFlatTree();
103 SelectionInFlatTree::Builder builder;
104 builder.collapse(visibleStart.toPositionWithAffinity());
105 builder.extend(visibleEnd.deepEquivalent());
106 return createVisibleSelection(builder.build());
96 } 107 }
97 108
98 void PendingSelection::commit(LayoutView& layoutView) { 109 void PendingSelection::commit(LayoutView& layoutView) {
99 if (!hasPendingSelection()) 110 if (!hasPendingSelection())
100 return; 111 return;
101 DCHECK(!layoutView.needsLayout()); 112 DCHECK(!layoutView.needsLayout());
102 m_hasPendingSelection = false; 113 m_hasPendingSelection = false;
103 114
104 const VisibleSelectionInFlatTree& originalSelection = 115 const VisibleSelectionInFlatTree& originalSelection =
105 m_frameSelection->visibleSelection<EditingInFlatTreeStrategy>(); 116 m_frameSelection->visibleSelection<EditingInFlatTreeStrategy>();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 DCHECK(layoutView == endLayoutObject->view()); 161 DCHECK(layoutView == endLayoutObject->view());
151 layoutView.setSelection(startLayoutObject, startPos.computeEditingOffset(), 162 layoutView.setSelection(startLayoutObject, startPos.computeEditingOffset(),
152 endLayoutObject, endPos.computeEditingOffset()); 163 endLayoutObject, endPos.computeEditingOffset());
153 } 164 }
154 165
155 DEFINE_TRACE(PendingSelection) { 166 DEFINE_TRACE(PendingSelection) {
156 visitor->trace(m_frameSelection); 167 visitor->trace(m_frameSelection);
157 } 168 }
158 169
159 } // namespace blink 170 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698