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

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

Issue 1311853004: Rename visiblePositionOf() to createVisiblePosition() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-01T14:43:58 Created 5 years, 3 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 | « Source/core/layout/HitTestResult.cpp ('k') | Source/core/testing/Internals.cpp » ('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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 template <typename Strategy> 78 template <typename Strategy>
79 VisibleSelection PendingSelection::calcVisibleSelectionAlgorithm() const 79 VisibleSelection PendingSelection::calcVisibleSelectionAlgorithm() const
80 { 80 {
81 using PositionType = typename Strategy::PositionType; 81 using PositionType = typename Strategy::PositionType;
82 82
83 PositionType start = Strategy::selectionStart(m_selection); 83 PositionType start = Strategy::selectionStart(m_selection);
84 PositionType end = Strategy::selectionEnd(m_selection); 84 PositionType end = Strategy::selectionEnd(m_selection);
85 SelectionType selectionType = VisibleSelection::selectionType(start, end); 85 SelectionType selectionType = VisibleSelection::selectionType(start, end);
86 TextAffinity affinity = m_selection.affinity(); 86 TextAffinity affinity = m_selection.affinity();
87 87
88 bool paintBlockCursor = m_shouldShowBlockCursor && selectionType == Selectio nType::CaretSelection && !isLogicalEndOfLine(visiblePositionOf(end, affinity)); 88 bool paintBlockCursor = m_shouldShowBlockCursor && selectionType == Selectio nType::CaretSelection && !isLogicalEndOfLine(createVisiblePosition(end, affinity ));
89 VisibleSelection selection; 89 VisibleSelection selection;
90 if (enclosingTextFormControl(start.computeContainerNode())) { 90 if (enclosingTextFormControl(start.computeContainerNode())) {
91 // TODO(yosin) We should use |PositionMoveType::Character| to avoid 91 // TODO(yosin) We should use |PositionMoveType::Character| to avoid
92 // ending paint at middle of character. 92 // ending paint at middle of character.
93 PositionType endPosition = paintBlockCursor ? nextPositionOf(Strategy::s electionExtent(m_selection), PositionMoveType::CodePoint) : end; 93 PositionType endPosition = paintBlockCursor ? nextPositionOf(Strategy::s electionExtent(m_selection), PositionMoveType::CodePoint) : end;
94 selection.setWithoutValidation(start, endPosition); 94 selection.setWithoutValidation(start, endPosition);
95 return selection; 95 return selection;
96 } 96 }
97 97
98 VisiblePosition visibleStart = visiblePositionOf(start, selectionType == Sel ectionType::RangeSelection ? TextAffinity::Downstream : affinity); 98 VisiblePosition visibleStart = createVisiblePosition(start, selectionType == SelectionType::RangeSelection ? TextAffinity::Downstream : affinity);
99 if (paintBlockCursor) { 99 if (paintBlockCursor) {
100 VisiblePosition visibleExtent = visiblePositionOf(end, affinity); 100 VisiblePosition visibleExtent = createVisiblePosition(end, affinity);
101 visibleExtent = nextPositionOf(visibleExtent, CanSkipOverEditingBoundary ); 101 visibleExtent = nextPositionOf(visibleExtent, CanSkipOverEditingBoundary );
102 return VisibleSelection(visibleStart, visibleExtent); 102 return VisibleSelection(visibleStart, visibleExtent);
103 } 103 }
104 VisiblePosition visibleEnd = visiblePositionOf(end, selectionType == Selecti onType::RangeSelection ? TextAffinity::Upstream : affinity); 104 VisiblePosition visibleEnd = createVisiblePosition(end, selectionType == Sel ectionType::RangeSelection ? TextAffinity::Upstream : affinity);
105 return VisibleSelection(visibleStart, visibleEnd); 105 return VisibleSelection(visibleStart, visibleEnd);
106 } 106 }
107 107
108 VisibleSelection PendingSelection::calcVisibleSelection() const 108 VisibleSelection PendingSelection::calcVisibleSelection() const
109 { 109 {
110 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) 110 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled())
111 return calcVisibleSelectionAlgorithm<VisibleSelection::InComposedTree>() ; 111 return calcVisibleSelectionAlgorithm<VisibleSelection::InComposedTree>() ;
112 return calcVisibleSelectionAlgorithm<VisibleSelection::InDOMTree>(); 112 return calcVisibleSelectionAlgorithm<VisibleSelection::InDOMTree>();
113 } 113 }
114 114
115 DEFINE_TRACE(PendingSelection) 115 DEFINE_TRACE(PendingSelection)
116 { 116 {
117 visitor->trace(m_selection); 117 visitor->trace(m_selection);
118 } 118 }
119 119
120 } // namespace blink 120 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/HitTestResult.cpp ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698