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

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

Issue 2890313003: Commands preserve handles (Closed)
Patch Set: added test Created 3 years, 7 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) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 affinity_ = other.affinity_; 117 affinity_ = other.affinity_;
118 selection_type_ = other.selection_type_; 118 selection_type_ = other.selection_type_;
119 base_is_first_ = other.base_is_first_; 119 base_is_first_ = other.base_is_first_;
120 is_directional_ = other.is_directional_; 120 is_directional_ = other.is_directional_;
121 granularity_ = other.granularity_; 121 granularity_ = other.granularity_;
122 has_trailing_whitespace_ = other.has_trailing_whitespace_; 122 has_trailing_whitespace_ = other.has_trailing_whitespace_;
123 return *this; 123 return *this;
124 } 124 }
125 125
126 template <typename Strategy> 126 template <typename Strategy>
127 SelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::AsSelection() 127 SelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::AsSelection(
128 const { 128 bool is_handle_visible) const {
129 typename SelectionTemplate<Strategy>::Builder builder; 129 typename SelectionTemplate<Strategy>::Builder builder;
130 if (base_.IsNotNull()) 130 if (base_.IsNotNull())
131 builder.SetBaseAndExtent(base_, extent_); 131 builder.SetBaseAndExtent(base_, extent_);
132 return builder.SetAffinity(affinity_) 132 return builder.SetAffinity(affinity_)
133 .SetGranularity(granularity_) 133 .SetGranularity(granularity_)
134 .SetIsDirectional(is_directional_) 134 .SetIsDirectional(is_directional_)
135 .SetHasTrailingWhitespace(has_trailing_whitespace_) 135 .SetHasTrailingWhitespace(has_trailing_whitespace_)
136 .SetIsHandleVisible(is_handle_visible)
136 .Build(); 137 .Build();
137 } 138 }
138 139
139 EphemeralRange FirstEphemeralRangeOf(const VisibleSelection& selection) { 140 EphemeralRange FirstEphemeralRangeOf(const VisibleSelection& selection) {
140 if (selection.IsNone()) 141 if (selection.IsNone())
141 return EphemeralRange(); 142 return EphemeralRange();
142 Position start = selection.Start().ParentAnchoredEquivalent(); 143 Position start = selection.Start().ParentAnchoredEquivalent();
143 Position end = selection.end().ParentAnchoredEquivalent(); 144 Position end = selection.end().ParentAnchoredEquivalent();
144 return EphemeralRange(start, end); 145 return EphemeralRange(start, end);
145 } 146 }
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 773
773 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 774 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
774 sel.ShowTreeForThis(); 775 sel.ShowTreeForThis();
775 } 776 }
776 777
777 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 778 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
778 if (sel) 779 if (sel)
779 sel->ShowTreeForThis(); 780 sel->ShowTreeForThis();
780 } 781 }
781 #endif 782 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698