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

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

Issue 1958093002: CONTINUED Make FrameSelection to hold non-canonicalized positions Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2017-01-16T20:04:35 Created 3 years, 11 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 SelectionInFlatTree::Builder builder; 103 SelectionInFlatTree::Builder builder;
104 builder.collapse(visibleStart.toPositionWithAffinity()); 104 builder.collapse(visibleStart.toPositionWithAffinity());
105 builder.extend(visibleEnd.deepEquivalent()); 105 builder.extend(visibleEnd.deepEquivalent());
106 return createVisibleSelection(builder.build()); 106 return createVisibleSelection(builder.build());
107 } 107 }
108 108
109 void PendingSelection::commit(LayoutView& layoutView) { 109 void PendingSelection::commit(LayoutView& layoutView) {
110 if (!hasPendingSelection()) 110 if (!hasPendingSelection())
111 return; 111 return;
112 DCHECK(!layoutView.needsLayout()); 112 DCHECK(!layoutView.needsLayout());
113 // We should check have |DCHECK(!document().m_needsLayout()); but,
114 // media/track/track-model.html and others don't satisfied.
115 // m_frameSelection->document().assertLayoutTreeIsUpToDate();
113 m_hasPendingSelection = false; 116 m_hasPendingSelection = false;
114 117
115 const VisibleSelectionInFlatTree& originalSelection = 118 const VisibleSelectionInFlatTree& originalSelection =
116 m_frameSelection->visibleSelection<EditingInFlatTreeStrategy>(); 119 m_frameSelection->computeVisibleSelectionInFlatTree();
117 120
118 // Skip if pending VisibilePositions became invalid before we reach here. 121 // Skip if pending VisibilePositions became invalid before we reach here.
119 if (!isSelectionInDocument(originalSelection, layoutView.document())) 122 if (!isSelectionInDocument(originalSelection, layoutView.document()))
120 return; 123 return;
121 124
122 // Construct a new VisibleSolution, since visibleSelection() is not 125 // Construct a new VisibleSolution, since visibleSelection() is not
123 // necessarily valid, and the following steps assume a valid selection. See 126 // necessarily valid, and the following steps assume a valid selection. See
124 // <https://bugs.webkit.org/show_bug.cgi?id=69563> and 127 // <https://bugs.webkit.org/show_bug.cgi?id=69563> and
125 // <rdar://problem/10232866>. 128 // <rdar://problem/10232866>.
126 const VisibleSelectionInFlatTree& selection = 129 const VisibleSelectionInFlatTree& selection =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 DCHECK(layoutView == endLayoutObject->view()); 164 DCHECK(layoutView == endLayoutObject->view());
162 layoutView.setSelection(startLayoutObject, startPos.computeEditingOffset(), 165 layoutView.setSelection(startLayoutObject, startPos.computeEditingOffset(),
163 endLayoutObject, endPos.computeEditingOffset()); 166 endLayoutObject, endPos.computeEditingOffset());
164 } 167 }
165 168
166 DEFINE_TRACE(PendingSelection) { 169 DEFINE_TRACE(PendingSelection) {
167 visitor->trace(m_frameSelection); 170 visitor->trace(m_frameSelection);
168 } 171 }
169 172
170 } // namespace blink 173 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp ('k') | third_party/WebKit/Source/core/editing/Position.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698