OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
6 * Copyright (C) 2015 Google Inc. All rights reserved. | 6 * Copyright (C) 2015 Google Inc. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 #include "core/HTMLNames.h" | 32 #include "core/HTMLNames.h" |
33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
34 #include "core/editing/EditingUtilities.h" | 34 #include "core/editing/EditingUtilities.h" |
35 #include "core/editing/Editor.h" | 35 #include "core/editing/Editor.h" |
36 #include "core/editing/FrameSelection.h" | 36 #include "core/editing/FrameSelection.h" |
37 #include "core/editing/RenderedPosition.h" | 37 #include "core/editing/RenderedPosition.h" |
38 #include "core/editing/VisibleSelection.h" | 38 #include "core/editing/VisibleSelection.h" |
39 #include "core/editing/iterators/TextIterator.h" | 39 #include "core/editing/iterators/TextIterator.h" |
40 #include "core/editing/markers/DocumentMarkerController.h" | 40 #include "core/editing/markers/DocumentMarkerController.h" |
| 41 #include "core/editing/suggestion/TextSuggestionController.h" |
41 #include "core/events/Event.h" | 42 #include "core/events/Event.h" |
42 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
43 #include "core/frame/LocalFrameView.h" | 44 #include "core/frame/LocalFrameView.h" |
44 #include "core/frame/Settings.h" | 45 #include "core/frame/Settings.h" |
45 #include "core/input/EventHandler.h" | 46 #include "core/input/EventHandler.h" |
46 #include "core/layout/LayoutView.h" | 47 #include "core/layout/LayoutView.h" |
47 #include "core/layout/api/LayoutViewItem.h" | 48 #include "core/layout/api/LayoutViewItem.h" |
48 #include "core/page/FocusController.h" | 49 #include "core/page/FocusController.h" |
49 #include "core/page/Page.h" | 50 #include "core/page/Page.h" |
50 #include "platform/RuntimeEnabledFeatures.h" | 51 #include "platform/RuntimeEnabledFeatures.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 326 } |
326 | 327 |
327 if (visible_pos.IsNull()) { | 328 if (visible_pos.IsNull()) { |
328 UpdateSelectionForMouseDownDispatchingSelectStart( | 329 UpdateSelectionForMouseDownDispatchingSelectStart( |
329 inner_node, SelectionInFlatTree(), TextGranularity::kCharacter, | 330 inner_node, SelectionInFlatTree(), TextGranularity::kCharacter, |
330 HandleVisibility::kNotVisible); | 331 HandleVisibility::kNotVisible); |
331 return false; | 332 return false; |
332 } | 333 } |
333 | 334 |
334 bool is_handle_visible = false; | 335 bool is_handle_visible = false; |
335 if (HasEditableStyle(*inner_node)) { | 336 const bool has_editable_style = HasEditableStyle(*inner_node); |
| 337 if (has_editable_style) { |
336 const bool is_text_box_empty = | 338 const bool is_text_box_empty = |
337 CreateVisibleSelection(SelectionInFlatTree::Builder() | 339 CreateVisibleSelection(SelectionInFlatTree::Builder() |
338 .SelectAllChildren(*inner_node) | 340 .SelectAllChildren(*inner_node) |
339 .Build()) | 341 .Build()) |
340 .IsCaret(); | 342 .IsCaret(); |
341 const bool not_left_click = | 343 const bool not_left_click = |
342 event.Event().button != WebPointerProperties::Button::kLeft; | 344 event.Event().button != WebPointerProperties::Button::kLeft; |
343 if (!is_text_box_empty || not_left_click) | 345 if (!is_text_box_empty || not_left_click) |
344 is_handle_visible = event.Event().FromTouch(); | 346 is_handle_visible = event.Event().FromTouch(); |
345 } | 347 } |
346 | 348 |
347 UpdateSelectionForMouseDownDispatchingSelectStart( | 349 UpdateSelectionForMouseDownDispatchingSelectStart( |
348 inner_node, | 350 inner_node, |
349 ExpandSelectionToRespectUserSelectAll( | 351 ExpandSelectionToRespectUserSelectAll( |
350 inner_node, CreateVisibleSelection( | 352 inner_node, CreateVisibleSelection( |
351 SelectionInFlatTree::Builder() | 353 SelectionInFlatTree::Builder() |
352 .Collapse(visible_pos.ToPositionWithAffinity()) | 354 .Collapse(visible_pos.ToPositionWithAffinity()) |
353 .Build())), | 355 .Build())), |
354 TextGranularity::kCharacter, | 356 TextGranularity::kCharacter, |
355 is_handle_visible ? HandleVisibility::kVisible | 357 is_handle_visible ? HandleVisibility::kVisible |
356 : HandleVisibility::kNotVisible); | 358 : HandleVisibility::kNotVisible); |
| 359 |
| 360 if (has_editable_style && event.Event().FromTouch()) { |
| 361 frame_->GetTextSuggestionController().HandlePotentialMisspelledWordTap( |
| 362 visible_pos); |
| 363 } |
| 364 |
357 return false; | 365 return false; |
358 } | 366 } |
359 | 367 |
360 // Returns true if selection starts from |SVGText| node and |target_node| is | 368 // Returns true if selection starts from |SVGText| node and |target_node| is |
361 // not the containing block of |SVGText| node. | 369 // not the containing block of |SVGText| node. |
362 // See https://bugs.webkit.org/show_bug.cgi?id=12334 for details. | 370 // See https://bugs.webkit.org/show_bug.cgi?id=12334 for details. |
363 static bool ShouldRespectSVGTextBoundaries( | 371 static bool ShouldRespectSVGTextBoundaries( |
364 const Node& target_node, | 372 const Node& target_node, |
365 const FrameSelection& frame_selection) { | 373 const FrameSelection& frame_selection) { |
366 const PositionInFlatTree& base = | 374 const PositionInFlatTree& base = |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 | 1231 |
1224 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) { | 1232 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) { |
1225 bool is_mouse_down_on_link_or_image = | 1233 bool is_mouse_down_on_link_or_image = |
1226 event.IsOverLink() || event.GetHitTestResult().GetImage(); | 1234 event.IsOverLink() || event.GetHitTestResult().GetImage(); |
1227 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) != | 1235 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) != |
1228 0 && | 1236 0 && |
1229 !is_mouse_down_on_link_or_image; | 1237 !is_mouse_down_on_link_or_image; |
1230 } | 1238 } |
1231 | 1239 |
1232 } // namespace blink | 1240 } // namespace blink |
OLD | NEW |