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

Side by Side Diff: Source/core/layout/PendingSelection.cpp

Issue 1202153004: Enable selection for the composed tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename the flag Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutView.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('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 reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (end.isNotNull() && (!end.inDocument() || end.document() != document)) 62 if (end.isNotNull() && (!end.inDocument() || end.document() != document))
63 return false; 63 return false;
64 PositionType extent = Strategy::selectionExtent(m_selection); 64 PositionType extent = Strategy::selectionExtent(m_selection);
65 if (extent.isNotNull() && (!extent.inDocument() || extent.document() != docu ment)) 65 if (extent.isNotNull() && (!extent.inDocument() || extent.document() != docu ment))
66 return false; 66 return false;
67 return true; 67 return true;
68 } 68 }
69 69
70 bool PendingSelection::isInDocument(const Document& document) const 70 bool PendingSelection::isInDocument(const Document& document) const
71 { 71 {
72 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled())
73 return isInDocumentAlgorithm<VisibleSelection::InComposedTree>(document) ;
72 return isInDocumentAlgorithm<VisibleSelection::InDOMTree>(document); 74 return isInDocumentAlgorithm<VisibleSelection::InDOMTree>(document);
73 } 75 }
74 76
75 template <typename Strategy> 77 template <typename Strategy>
76 VisibleSelection PendingSelection::calcVisibleSelectionAlgorithm() const 78 VisibleSelection PendingSelection::calcVisibleSelectionAlgorithm() const
77 { 79 {
78 using PositionType = typename Strategy::PositionType; 80 using PositionType = typename Strategy::PositionType;
79 81
80 PositionType start = Strategy::selectionStart(m_selection); 82 PositionType start = Strategy::selectionStart(m_selection);
81 PositionType end = Strategy::selectionEnd(m_selection); 83 PositionType end = Strategy::selectionEnd(m_selection);
(...skipping 13 matching lines...) Expand all
95 VisiblePosition visibleExtent(end, affinity); 97 VisiblePosition visibleExtent(end, affinity);
96 visibleExtent = visibleExtent.next(CanSkipOverEditingBoundary); 98 visibleExtent = visibleExtent.next(CanSkipOverEditingBoundary);
97 return VisibleSelection(visibleStart, visibleExtent); 99 return VisibleSelection(visibleStart, visibleExtent);
98 } 100 }
99 VisiblePosition visibleEnd(end, selectionType == SelectionType::RangeSelecti on ? UPSTREAM : affinity); 101 VisiblePosition visibleEnd(end, selectionType == SelectionType::RangeSelecti on ? UPSTREAM : affinity);
100 return VisibleSelection(visibleStart, visibleEnd); 102 return VisibleSelection(visibleStart, visibleEnd);
101 } 103 }
102 104
103 VisibleSelection PendingSelection::calcVisibleSelection() const 105 VisibleSelection PendingSelection::calcVisibleSelection() const
104 { 106 {
107 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled())
108 return calcVisibleSelectionAlgorithm<VisibleSelection::InComposedTree>() ;
105 return calcVisibleSelectionAlgorithm<VisibleSelection::InDOMTree>(); 109 return calcVisibleSelectionAlgorithm<VisibleSelection::InDOMTree>();
106 } 110 }
107 111
108 DEFINE_TRACE(PendingSelection) 112 DEFINE_TRACE(PendingSelection)
109 { 113 {
110 visitor->trace(m_selection); 114 visitor->trace(m_selection);
111 } 115 }
112 116
113 } // namespace blink 117 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutView.cpp ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698