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

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

Issue 2201853002: Blink handle selection handle visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: default handle visibility should be false Created 4 years, 4 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 { 52 {
53 } 53 }
54 54
55 template <typename Strategy> 55 template <typename Strategy>
56 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const PositionTempl ate<Strategy>& pos, TextAffinity affinity, bool isDirectional) 56 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const PositionTempl ate<Strategy>& pos, TextAffinity affinity, bool isDirectional)
57 : VisibleSelectionTemplate(pos, pos, affinity, isDirectional) 57 : VisibleSelectionTemplate(pos, pos, affinity, isDirectional)
58 { 58 {
59 } 59 }
60 60
61 template <typename Strategy> 61 template <typename Strategy>
62 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const PositionTempl ate<Strategy>& base, const PositionTemplate<Strategy>& extent, TextAffinity affi nity, bool isDirectional) 62 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const PositionTempl ate<Strategy>& base, const PositionTemplate<Strategy>& extent, TextAffinity affi nity, bool isDirectional, bool isHandleVisible)
63 : m_base(base) 63 : m_base(base)
64 , m_extent(extent) 64 , m_extent(extent)
65 , m_affinity(affinity) 65 , m_affinity(affinity)
66 , m_isDirectional(isDirectional) 66 , m_isDirectional(isDirectional)
67 , m_granularity(CharacterGranularity) 67 , m_granularity(CharacterGranularity)
68 , m_hasTrailingWhitespace(false) 68 , m_hasTrailingWhitespace(false)
69 , m_isHandleVisible(isHandleVisible)
69 { 70 {
70 validate(); 71 validate();
71 } 72 }
72 73
73 template <typename Strategy> 74 template <typename Strategy>
74 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const PositionWithA ffinityTemplate<Strategy>& pos, bool isDirectional) 75 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const PositionWithA ffinityTemplate<Strategy>& pos, bool isDirectional)
75 : VisibleSelectionTemplate(pos.position(), pos.affinity(), isDirectional) 76 : VisibleSelectionTemplate(pos.position(), pos.affinity(), isDirectional)
76 { 77 {
77 } 78 }
78 79
79 template <typename Strategy> 80 template <typename Strategy>
80 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const VisiblePositi onTemplate<Strategy>& pos, bool isDirectional) 81 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const VisiblePositi onTemplate<Strategy>& pos, bool isDirectional)
81 : VisibleSelectionTemplate(pos, pos, isDirectional) 82 : VisibleSelectionTemplate(pos, pos, isDirectional)
82 { 83 {
83 } 84 }
84 85
85 template <typename Strategy> 86 template <typename Strategy>
86 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const VisiblePositi onTemplate<Strategy>& base, const VisiblePositionTemplate<Strategy>& extent, boo l isDirectional) 87 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const VisiblePositi onTemplate<Strategy>& base, const VisiblePositionTemplate<Strategy>& extent, boo l isDirectional, bool isHandleVisible)
87 : VisibleSelectionTemplate(base.deepEquivalent(), extent.deepEquivalent(), b ase.affinity(), isDirectional) 88 : VisibleSelectionTemplate(base.deepEquivalent(), extent.deepEquivalent(), b ase.affinity(), isDirectional, isHandleVisible)
88 { 89 {
89 } 90 }
90 91
91 template <typename Strategy> 92 template <typename Strategy>
92 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const EphemeralRang eTemplate<Strategy>& range, TextAffinity affinity, bool isDirectional) 93 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate(const EphemeralRang eTemplate<Strategy>& range, TextAffinity affinity, bool isDirectional)
93 : VisibleSelectionTemplate(range.startPosition(), range.endPosition(), affin ity, isDirectional) 94 : VisibleSelectionTemplate(range.startPosition(), range.endPosition(), affin ity, isDirectional)
94 { 95 {
95 } 96 }
96 97
97 template <typename Strategy> 98 template <typename Strategy>
(...skipping 20 matching lines...) Expand all
118 : m_base(other.m_base) 119 : m_base(other.m_base)
119 , m_extent(other.m_extent) 120 , m_extent(other.m_extent)
120 , m_start(other.m_start) 121 , m_start(other.m_start)
121 , m_end(other.m_end) 122 , m_end(other.m_end)
122 , m_affinity(other.m_affinity) 123 , m_affinity(other.m_affinity)
123 , m_selectionType(other.m_selectionType) 124 , m_selectionType(other.m_selectionType)
124 , m_baseIsFirst(other.m_baseIsFirst) 125 , m_baseIsFirst(other.m_baseIsFirst)
125 , m_isDirectional(other.m_isDirectional) 126 , m_isDirectional(other.m_isDirectional)
126 , m_granularity(other.m_granularity) 127 , m_granularity(other.m_granularity)
127 , m_hasTrailingWhitespace(other.m_hasTrailingWhitespace) 128 , m_hasTrailingWhitespace(other.m_hasTrailingWhitespace)
129 , m_isHandleVisible(other.m_isHandleVisible)
128 { 130 {
129 } 131 }
130 132
131 template <typename Strategy> 133 template <typename Strategy>
132 VisibleSelectionTemplate<Strategy>& VisibleSelectionTemplate<Strategy>::operator =(const VisibleSelectionTemplate<Strategy>& other) 134 VisibleSelectionTemplate<Strategy>& VisibleSelectionTemplate<Strategy>::operator =(const VisibleSelectionTemplate<Strategy>& other)
133 { 135 {
134 m_base = other.m_base; 136 m_base = other.m_base;
135 m_extent = other.m_extent; 137 m_extent = other.m_extent;
136 m_start = other.m_start; 138 m_start = other.m_start;
137 m_end = other.m_end; 139 m_end = other.m_end;
138 m_affinity = other.m_affinity; 140 m_affinity = other.m_affinity;
139 m_selectionType = other.m_selectionType; 141 m_selectionType = other.m_selectionType;
140 m_baseIsFirst = other.m_baseIsFirst; 142 m_baseIsFirst = other.m_baseIsFirst;
141 m_isDirectional = other.m_isDirectional; 143 m_isDirectional = other.m_isDirectional;
142 m_granularity = other.m_granularity; 144 m_granularity = other.m_granularity;
143 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace; 145 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace;
146 m_isHandleVisible = other.m_isHandleVisible;
144 return *this; 147 return *this;
145 } 148 }
146 149
147 template <typename Strategy> 150 template <typename Strategy>
148 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::selection FromContentsOfNode(Node* node) 151 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::selection FromContentsOfNode(Node* node)
149 { 152 {
150 DCHECK(!Strategy::editingIgnoresContent(node)); 153 DCHECK(!Strategy::editingIgnoresContent(node));
151 return VisibleSelectionTemplate(PositionTemplate<Strategy>::firstPositionInN ode(node), PositionTemplate<Strategy>::lastPositionInNode(node)); 154 return VisibleSelectionTemplate(PositionTemplate<Strategy>::firstPositionInN ode(node), PositionTemplate<Strategy>::lastPositionInNode(node));
152 } 155 }
153 156
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 if (!m_base.isConnected() || !m_extent.isConnected()) { 754 if (!m_base.isConnected() || !m_extent.isConnected()) {
752 *this = VisibleSelectionTemplate(); 755 *this = VisibleSelectionTemplate();
753 return; 756 return;
754 } 757 }
755 updateIfNeeded(); 758 updateIfNeeded();
756 } 759 }
757 760
758 template <typename Strategy> 761 template <typename Strategy>
759 static bool equalSelectionsAlgorithm(const VisibleSelectionTemplate<Strategy>& s election1, const VisibleSelectionTemplate<Strategy>& selection2) 762 static bool equalSelectionsAlgorithm(const VisibleSelectionTemplate<Strategy>& s election1, const VisibleSelectionTemplate<Strategy>& selection2)
760 { 763 {
761 if (selection1.affinity() != selection2.affinity() || selection1.isDirection al() != selection2.isDirectional()) 764 if (selection1.affinity() != selection2.affinity()
765 || selection1.isDirectional() != selection2.isDirectional()
766 || selection1.isHandleVisible() != selection2.isHandleVisible())
762 return false; 767 return false;
763 768
764 if (selection1.isNone()) 769 if (selection1.isNone())
765 return selection2.isNone(); 770 return selection2.isNone();
766 771
767 const VisibleSelectionTemplate<Strategy> selectionWrapper1(selection1); 772 const VisibleSelectionTemplate<Strategy> selectionWrapper1(selection1);
768 const VisibleSelectionTemplate<Strategy> selectionWrapper2(selection2); 773 const VisibleSelectionTemplate<Strategy> selectionWrapper2(selection2);
769 774
770 return selectionWrapper1.start() == selectionWrapper2.start() 775 return selectionWrapper1.start() == selectionWrapper2.start()
771 && selectionWrapper1.end() == selectionWrapper2.end() 776 && selectionWrapper1.end() == selectionWrapper2.end()
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 { 896 {
892 sel.showTreeForThis(); 897 sel.showTreeForThis();
893 } 898 }
894 899
895 void showTree(const blink::VisibleSelectionInFlatTree* sel) 900 void showTree(const blink::VisibleSelectionInFlatTree* sel)
896 { 901 {
897 if (sel) 902 if (sel)
898 sel->showTreeForThis(); 903 sel->showTreeForThis();
899 } 904 }
900 #endif 905 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698