| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } | 337 } |
| 337 | 338 |
| 338 if (visible_pos.IsNull()) { | 339 if (visible_pos.IsNull()) { |
| 339 UpdateSelectionForMouseDownDispatchingSelectStart( | 340 UpdateSelectionForMouseDownDispatchingSelectStart( |
| 340 inner_node, SelectionInFlatTree(), TextGranularity::kCharacter, | 341 inner_node, SelectionInFlatTree(), TextGranularity::kCharacter, |
| 341 HandleVisibility::kNotVisible); | 342 HandleVisibility::kNotVisible); |
| 342 return false; | 343 return false; |
| 343 } | 344 } |
| 344 | 345 |
| 345 bool is_handle_visible = false; | 346 bool is_handle_visible = false; |
| 346 if (HasEditableStyle(*inner_node)) { | 347 const bool has_editable_style = HasEditableStyle(*inner_node); |
| 348 if (has_editable_style) { |
| 347 const bool is_text_box_empty = | 349 const bool is_text_box_empty = |
| 348 CreateVisibleSelection(SelectionInFlatTree::Builder() | 350 CreateVisibleSelection(SelectionInFlatTree::Builder() |
| 349 .SelectAllChildren(*inner_node) | 351 .SelectAllChildren(*inner_node) |
| 350 .Build()) | 352 .Build()) |
| 351 .IsCaret(); | 353 .IsCaret(); |
| 352 const bool not_left_click = | 354 const bool not_left_click = |
| 353 event.Event().button != WebPointerProperties::Button::kLeft; | 355 event.Event().button != WebPointerProperties::Button::kLeft; |
| 354 if (!is_text_box_empty || not_left_click) | 356 if (!is_text_box_empty || not_left_click) |
| 355 is_handle_visible = event.Event().FromTouch(); | 357 is_handle_visible = event.Event().FromTouch(); |
| 356 } | 358 } |
| 357 | 359 |
| 358 UpdateSelectionForMouseDownDispatchingSelectStart( | 360 UpdateSelectionForMouseDownDispatchingSelectStart( |
| 359 inner_node, | 361 inner_node, |
| 360 ExpandSelectionToRespectUserSelectAll( | 362 ExpandSelectionToRespectUserSelectAll( |
| 361 inner_node, CreateVisibleSelection( | 363 inner_node, CreateVisibleSelection( |
| 362 SelectionInFlatTree::Builder() | 364 SelectionInFlatTree::Builder() |
| 363 .Collapse(visible_pos.ToPositionWithAffinity()) | 365 .Collapse(visible_pos.ToPositionWithAffinity()) |
| 364 .Build())), | 366 .Build())), |
| 365 TextGranularity::kCharacter, | 367 TextGranularity::kCharacter, |
| 366 is_handle_visible ? HandleVisibility::kVisible | 368 is_handle_visible ? HandleVisibility::kVisible |
| 367 : HandleVisibility::kNotVisible); | 369 : HandleVisibility::kNotVisible); |
| 370 |
| 371 if (has_editable_style && event.Event().FromTouch()) { |
| 372 frame_->GetTextSuggestionController().HandlePotentialMisspelledWordTap( |
| 373 visible_pos); |
| 374 } |
| 375 |
| 368 return false; | 376 return false; |
| 369 } | 377 } |
| 370 | 378 |
| 371 // Returns true if selection starts from |SVGText| node and |target_node| is | 379 // Returns true if selection starts from |SVGText| node and |target_node| is |
| 372 // not the containing block of |SVGText| node. | 380 // not the containing block of |SVGText| node. |
| 373 // See https://bugs.webkit.org/show_bug.cgi?id=12334 for details. | 381 // See https://bugs.webkit.org/show_bug.cgi?id=12334 for details. |
| 374 static bool ShouldRespectSVGTextBoundaries( | 382 static bool ShouldRespectSVGTextBoundaries( |
| 375 const Node& target_node, | 383 const Node& target_node, |
| 376 const FrameSelection& frame_selection) { | 384 const FrameSelection& frame_selection) { |
| 377 const PositionInFlatTree& base = | 385 const PositionInFlatTree& base = |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 | 1243 |
| 1236 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) { | 1244 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) { |
| 1237 bool is_mouse_down_on_link_or_image = | 1245 bool is_mouse_down_on_link_or_image = |
| 1238 event.IsOverLink() || event.GetHitTestResult().GetImage(); | 1246 event.IsOverLink() || event.GetHitTestResult().GetImage(); |
| 1239 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) != | 1247 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) != |
| 1240 0 && | 1248 0 && |
| 1241 !is_mouse_down_on_link_or_image; | 1249 !is_mouse_down_on_link_or_image; |
| 1242 } | 1250 } |
| 1243 | 1251 |
| 1244 } // namespace blink | 1252 } // namespace blink |
| OLD | NEW |