OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
5 * Copyright (C) 2015 Google Inc. All rights reserved. | 5 * Copyright (C) 2015 Google Inc. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return handled; | 535 return handled; |
536 } | 536 } |
537 | 537 |
538 bool SelectionController::handleMouseReleaseEvent(const MouseEventWithHitTestRes
ults& event, const LayoutPoint& dragStartPos) | 538 bool SelectionController::handleMouseReleaseEvent(const MouseEventWithHitTestRes
ults& event, const LayoutPoint& dragStartPos) |
539 { | 539 { |
540 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) | 540 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) |
541 return handleMouseReleaseEventAlgorithm<EditingInComposedTreeStrategy>(e
vent, dragStartPos); | 541 return handleMouseReleaseEventAlgorithm<EditingInComposedTreeStrategy>(e
vent, dragStartPos); |
542 return handleMouseReleaseEventAlgorithm<EditingStrategy>(event, dragStartPos
); | 542 return handleMouseReleaseEventAlgorithm<EditingStrategy>(event, dragStartPos
); |
543 } | 543 } |
544 | 544 |
| 545 bool SelectionController::selectWordAtPositionIfAny(const HitTestResult& result) |
| 546 { |
| 547 if (result.scrollbar() |
| 548 || result.isLiveLink() |
| 549 || !(selection().isContentEditable() |
| 550 || (result.innerNode() && result.innerNode()->isTextNode()))) |
| 551 return false; |
| 552 |
| 553 selectClosestWordFromHitTestResult<EditingStrategy>(result, AppendTrailingWh
itespace::DontAppend); |
| 554 return true; |
| 555 } |
| 556 |
545 bool SelectionController::handlePasteGlobalSelection(const PlatformMouseEvent& m
ouseEvent) | 557 bool SelectionController::handlePasteGlobalSelection(const PlatformMouseEvent& m
ouseEvent) |
546 { | 558 { |
547 // If the event was a middle click, attempt to copy global selection in afte
r | 559 // If the event was a middle click, attempt to copy global selection in afte
r |
548 // the newly set caret position. | 560 // the newly set caret position. |
549 // | 561 // |
550 // This code is called from either the mouse up or mouse down handling. Ther
e | 562 // This code is called from either the mouse up or mouse down handling. Ther
e |
551 // is some debate about when the global selection is pasted: | 563 // is some debate about when the global selection is pasted: |
552 // xterm: pastes on up. | 564 // xterm: pastes on up. |
553 // GTK: pastes on down. | 565 // GTK: pastes on down. |
554 // Qt: pastes on up. | 566 // Qt: pastes on up. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 else | 690 else |
679 m_selectionState = SelectionState::HaveNotStartedSelection; | 691 m_selectionState = SelectionState::HaveNotStartedSelection; |
680 } | 692 } |
681 | 693 |
682 FrameSelection& SelectionController::selection() const | 694 FrameSelection& SelectionController::selection() const |
683 { | 695 { |
684 return m_frame->selection(); | 696 return m_frame->selection(); |
685 } | 697 } |
686 | 698 |
687 } // namespace blink | 699 } // namespace blink |
OLD | NEW |