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

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

Issue 2646963002: Stop dismissing selection handles when selection is kept (Closed)
Patch Set: avoid control flow in IMC and rebase 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) 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 29 matching lines...) Expand all
40 40
41 namespace blink { 41 namespace blink {
42 42
43 template <typename Strategy> 43 template <typename Strategy>
44 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate() 44 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate()
45 : m_affinity(TextAffinity::Downstream), 45 : m_affinity(TextAffinity::Downstream),
46 m_selectionType(NoSelection), 46 m_selectionType(NoSelection),
47 m_baseIsFirst(true), 47 m_baseIsFirst(true),
48 m_isDirectional(false), 48 m_isDirectional(false),
49 m_granularity(CharacterGranularity), 49 m_granularity(CharacterGranularity),
50 m_hasTrailingWhitespace(false) {} 50 m_hasTrailingWhitespace(false),
51 m_isHandleVisible(false) {}
yosin_UTC9 2017/01/25 03:49:08 Please don't add |m_isHandleVisible| to |VisibleSe
Changwan Ryu 2017/02/08 00:40:33 Done.
51 52
52 template <typename Strategy> 53 template <typename Strategy>
53 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate( 54 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(
54 const SelectionTemplate<Strategy>& selection) 55 const SelectionTemplate<Strategy>& selection)
55 : m_base(selection.base()), 56 : m_base(selection.base()),
56 m_extent(selection.extent()), 57 m_extent(selection.extent()),
57 m_affinity(selection.affinity()), 58 m_affinity(selection.affinity()),
58 m_selectionType(NoSelection), 59 m_selectionType(NoSelection),
59 m_isDirectional(selection.isDirectional()), 60 m_isDirectional(selection.isDirectional()),
60 m_granularity(selection.granularity()), 61 m_granularity(selection.granularity()),
61 m_hasTrailingWhitespace(selection.hasTrailingWhitespace()) { 62 m_hasTrailingWhitespace(selection.hasTrailingWhitespace()),
63 m_isHandleVisible(selection.isHandleVisible()) {
62 validate(m_granularity); 64 validate(m_granularity);
63 } 65 }
64 66
65 template <typename Strategy> 67 template <typename Strategy>
66 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::create( 68 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::create(
67 const SelectionTemplate<Strategy>& selection) { 69 const SelectionTemplate<Strategy>& selection) {
68 return VisibleSelectionTemplate(selection); 70 return VisibleSelectionTemplate(selection);
69 } 71 }
70 72
71 VisibleSelection createVisibleSelection(const SelectionInDOMTree& selection) { 73 VisibleSelection createVisibleSelection(const SelectionInDOMTree& selection) {
(...skipping 30 matching lines...) Expand all
102 const VisibleSelectionTemplate<Strategy>& other) 104 const VisibleSelectionTemplate<Strategy>& other)
103 : m_base(other.m_base), 105 : m_base(other.m_base),
104 m_extent(other.m_extent), 106 m_extent(other.m_extent),
105 m_start(other.m_start), 107 m_start(other.m_start),
106 m_end(other.m_end), 108 m_end(other.m_end),
107 m_affinity(other.m_affinity), 109 m_affinity(other.m_affinity),
108 m_selectionType(other.m_selectionType), 110 m_selectionType(other.m_selectionType),
109 m_baseIsFirst(other.m_baseIsFirst), 111 m_baseIsFirst(other.m_baseIsFirst),
110 m_isDirectional(other.m_isDirectional), 112 m_isDirectional(other.m_isDirectional),
111 m_granularity(other.m_granularity), 113 m_granularity(other.m_granularity),
112 m_hasTrailingWhitespace(other.m_hasTrailingWhitespace) {} 114 m_hasTrailingWhitespace(other.m_hasTrailingWhitespace),
115 m_isHandleVisible(other.m_isHandleVisible) {}
113 116
114 template <typename Strategy> 117 template <typename Strategy>
115 VisibleSelectionTemplate<Strategy>& VisibleSelectionTemplate<Strategy>:: 118 VisibleSelectionTemplate<Strategy>& VisibleSelectionTemplate<Strategy>::
116 operator=(const VisibleSelectionTemplate<Strategy>& other) { 119 operator=(const VisibleSelectionTemplate<Strategy>& other) {
117 m_base = other.m_base; 120 m_base = other.m_base;
118 m_extent = other.m_extent; 121 m_extent = other.m_extent;
119 m_start = other.m_start; 122 m_start = other.m_start;
120 m_end = other.m_end; 123 m_end = other.m_end;
121 m_affinity = other.m_affinity; 124 m_affinity = other.m_affinity;
122 m_selectionType = other.m_selectionType; 125 m_selectionType = other.m_selectionType;
123 m_baseIsFirst = other.m_baseIsFirst; 126 m_baseIsFirst = other.m_baseIsFirst;
124 m_isDirectional = other.m_isDirectional; 127 m_isDirectional = other.m_isDirectional;
125 m_granularity = other.m_granularity; 128 m_granularity = other.m_granularity;
126 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace; 129 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace;
130 m_isHandleVisible = other.m_isHandleVisible;
127 return *this; 131 return *this;
128 } 132 }
129 133
130 template <typename Strategy> 134 template <typename Strategy>
131 SelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::asSelection() 135 SelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::asSelection()
132 const { 136 const {
133 typename SelectionTemplate<Strategy>::Builder builder; 137 typename SelectionTemplate<Strategy>::Builder builder;
134 if (m_base.isNotNull()) 138 if (m_base.isNotNull())
135 builder.setBaseAndExtent(m_base, m_extent); 139 builder.setBaseAndExtent(m_base, m_extent);
136 return builder.setAffinity(m_affinity) 140 return builder.setAffinity(m_affinity)
137 .setGranularity(m_granularity) 141 .setGranularity(m_granularity)
138 .setIsDirectional(m_isDirectional) 142 .setIsDirectional(m_isDirectional)
139 .setHasTrailingWhitespace(m_hasTrailingWhitespace) 143 .setHasTrailingWhitespace(m_hasTrailingWhitespace)
144 .setIsHandleVisible(m_isHandleVisible)
140 .build(); 145 .build();
141 } 146 }
142 147
143 template <typename Strategy> 148 template <typename Strategy>
144 void VisibleSelectionTemplate<Strategy>::setBase( 149 void VisibleSelectionTemplate<Strategy>::setBase(
145 const PositionTemplate<Strategy>& position) { 150 const PositionTemplate<Strategy>& position) {
146 DCHECK(!needsLayoutTreeUpdate(position)); 151 DCHECK(!needsLayoutTreeUpdate(position));
147 m_base = position; 152 m_base = position;
148 validate(); 153 validate();
149 } 154 }
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 848
844 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 849 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
845 sel.showTreeForThis(); 850 sel.showTreeForThis();
846 } 851 }
847 852
848 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 853 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
849 if (sel) 854 if (sel)
850 sel->showTreeForThis(); 855 sel->showTreeForThis();
851 } 856 }
852 #endif 857 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698