OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // If the context menu gesture will trigger a selection all selectable nodes | 133 // If the context menu gesture will trigger a selection all selectable nodes |
134 // are valid targets. | 134 // are valid targets. |
135 if (node->GetLayoutObject() | 135 if (node->GetLayoutObject() |
136 ->GetFrame() | 136 ->GetFrame() |
137 ->GetEditor() | 137 ->GetEditor() |
138 .Behavior() | 138 .Behavior() |
139 .ShouldSelectOnContextualMenuClick()) | 139 .ShouldSelectOnContextualMenuClick()) |
140 return true; | 140 return true; |
141 // Only the selected part of the layoutObject is a valid target, but this | 141 // Only the selected part of the layoutObject is a valid target, but this |
142 // will be corrected in appendContextSubtargetsForNode. | 142 // will be corrected in appendContextSubtargetsForNode. |
143 if (node->GetLayoutObject()->GetSelectionState() != SelectionNone) | 143 if (node->GetLayoutObject()->GetSelectionState() != SelectionState::kNone) |
144 return true; | 144 return true; |
145 } | 145 } |
146 return false; | 146 return false; |
147 } | 147 } |
148 | 148 |
149 static inline void AppendQuadsToSubtargetList( | 149 static inline void AppendQuadsToSubtargetList( |
150 Vector<FloatQuad>& quads, | 150 Vector<FloatQuad>& quads, |
151 Node* node, | 151 Node* node, |
152 SubtargetGeometryList& subtargets) { | 152 SubtargetGeometryList& subtargets) { |
153 Vector<FloatQuad>::const_iterator it = quads.begin(); | 153 Vector<FloatQuad>::const_iterator it = quads.begin(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 int offset; | 195 int offset; |
196 while ((offset = word_iterator->next()) != -1) { | 196 while ((offset = word_iterator->next()) != -1) { |
197 if (IsWordTextBreak(word_iterator)) { | 197 if (IsWordTextBreak(word_iterator)) { |
198 Vector<FloatQuad> quads; | 198 Vector<FloatQuad> quads; |
199 text_layout_object->AbsoluteQuadsForRange(quads, last_offset, offset); | 199 text_layout_object->AbsoluteQuadsForRange(quads, last_offset, offset); |
200 AppendQuadsToSubtargetList(quads, text_node, subtargets); | 200 AppendQuadsToSubtargetList(quads, text_node, subtargets); |
201 } | 201 } |
202 last_offset = offset; | 202 last_offset = offset; |
203 } | 203 } |
204 } else { | 204 } else { |
205 if (text_layout_object->GetSelectionState() == SelectionNone) | 205 if (text_layout_object->GetSelectionState() == SelectionState::kNone) |
206 return AppendBasicSubtargetsForNode(node, subtargets); | 206 return AppendBasicSubtargetsForNode(node, subtargets); |
207 // If selected, make subtargets out of only the selected part of the text. | 207 // If selected, make subtargets out of only the selected part of the text. |
208 int start_pos, end_pos; | 208 int start_pos, end_pos; |
209 switch (text_layout_object->GetSelectionState()) { | 209 switch (text_layout_object->GetSelectionState()) { |
210 case SelectionInside: | 210 case SelectionState::kInside: |
211 start_pos = 0; | 211 start_pos = 0; |
212 end_pos = text_layout_object->TextLength(); | 212 end_pos = text_layout_object->TextLength(); |
213 break; | 213 break; |
214 case SelectionStart: | 214 case SelectionState::kStart: |
215 std::tie(start_pos, end_pos) = text_layout_object->SelectionStartEnd(); | 215 std::tie(start_pos, end_pos) = text_layout_object->SelectionStartEnd(); |
216 end_pos = text_layout_object->TextLength(); | 216 end_pos = text_layout_object->TextLength(); |
217 break; | 217 break; |
218 case SelectionEnd: | 218 case SelectionState::kEnd: |
219 std::tie(start_pos, end_pos) = text_layout_object->SelectionStartEnd(); | 219 std::tie(start_pos, end_pos) = text_layout_object->SelectionStartEnd(); |
220 start_pos = 0; | 220 start_pos = 0; |
221 break; | 221 break; |
222 case SelectionBoth: | 222 case SelectionState::kStartAndEnd: |
223 std::tie(start_pos, end_pos) = text_layout_object->SelectionStartEnd(); | 223 std::tie(start_pos, end_pos) = text_layout_object->SelectionStartEnd(); |
224 break; | 224 break; |
225 default: | 225 default: |
226 NOTREACHED(); | 226 NOTREACHED(); |
227 return; | 227 return; |
228 } | 228 } |
229 Vector<FloatQuad> quads; | 229 Vector<FloatQuad> quads; |
230 text_layout_object->AbsoluteQuadsForRange(quads, start_pos, end_pos); | 230 text_layout_object->AbsoluteQuadsForRange(quads, start_pos, end_pos); |
231 AppendQuadsToSubtargetList(quads, text_node, subtargets); | 231 AppendQuadsToSubtargetList(quads, text_node, subtargets); |
232 } | 232 } |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 const HeapVector<Member<Node>>& nodes) { | 564 const HeapVector<Member<Node>>& nodes) { |
565 IntPoint target_point; | 565 IntPoint target_point; |
566 TouchAdjustment::SubtargetGeometryList subtargets; | 566 TouchAdjustment::SubtargetGeometryList subtargets; |
567 TouchAdjustment::CompileZoomableSubtargets(nodes, subtargets); | 567 TouchAdjustment::CompileZoomableSubtargets(nodes, subtargets); |
568 return TouchAdjustment::FindNodeWithLowestDistanceMetric( | 568 return TouchAdjustment::FindNodeWithLowestDistanceMetric( |
569 target_node, target_point, target_area, touch_hotspot, touch_area, | 569 target_node, target_point, target_area, touch_hotspot, touch_area, |
570 subtargets, TouchAdjustment::ZoomableIntersectionQuotient); | 570 subtargets, TouchAdjustment::ZoomableIntersectionQuotient); |
571 } | 571 } |
572 | 572 |
573 } // namespace blink | 573 } // namespace blink |
OLD | NEW |