| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |