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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // ending paint at middle of character. 72 // ending paint at middle of character.
73 PositionInFlatTree endPosition = 73 PositionInFlatTree endPosition =
74 paintBlockCursor ? nextPositionOf(originalSelection.extent(), 74 paintBlockCursor ? nextPositionOf(originalSelection.extent(),
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,
83 ? TextAffinity::Downstream 83 selectionType == SelectionType::RangeSelection ? TextAffinity::Downstream
84 : affinity); 84 : affinity);
85 if (visibleStart.isNull()) 85 if (visibleStart.isNull())
86 return VisibleSelectionInFlatTree(); 86 return VisibleSelectionInFlatTree();
87 if (paintBlockCursor) { 87 if (paintBlockCursor) {
88 const VisiblePositionInFlatTree visibleExtent = nextPositionOf( 88 const VisiblePositionInFlatTree visibleExtent = nextPositionOf(
89 createVisiblePosition(end, affinity), CanSkipOverEditingBoundary); 89 createVisiblePosition(end, affinity), CanSkipOverEditingBoundary);
90 if (visibleExtent.isNull()) 90 if (visibleExtent.isNull())
91 return VisibleSelectionInFlatTree(); 91 return VisibleSelectionInFlatTree();
92 SelectionInFlatTree::Builder builder; 92 SelectionInFlatTree::Builder builder;
93 builder.collapse(visibleStart.toPositionWithAffinity()); 93 builder.collapse(visibleStart.toPositionWithAffinity());
94 builder.extend(visibleExtent.deepEquivalent()); 94 builder.extend(visibleExtent.deepEquivalent());
95 return createVisibleSelection(builder.build()); 95 return createVisibleSelection(builder.build());
96 } 96 }
97 const VisiblePositionInFlatTree visibleEnd = 97 const VisiblePositionInFlatTree visibleEnd = createVisiblePosition(
98 createVisiblePosition(end, selectionType == SelectionType::RangeSelection 98 end,
99 ? TextAffinity::Upstream 99 selectionType == SelectionType::RangeSelection ? TextAffinity::Upstream
100 : affinity); 100 : affinity);
101 if (visibleEnd.isNull()) 101 if (visibleEnd.isNull())
102 return VisibleSelectionInFlatTree(); 102 return VisibleSelectionInFlatTree();
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())
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 DCHECK(layoutView == endLayoutObject->view()); 161 DCHECK(layoutView == endLayoutObject->view());
162 layoutView.setSelection(startLayoutObject, startPos.computeEditingOffset(), 162 layoutView.setSelection(startLayoutObject, startPos.computeEditingOffset(),
163 endLayoutObject, endPos.computeEditingOffset()); 163 endLayoutObject, endPos.computeEditingOffset());
164 } 164 }
165 165
166 DEFINE_TRACE(PendingSelection) { 166 DEFINE_TRACE(PendingSelection) {
167 visitor->trace(m_frameSelection); 167 visitor->trace(m_frameSelection);
168 } 168 }
169 169
170 } // namespace blink 170 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698