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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 return handled; | 536 return handled; |
537 } | 537 } |
538 | 538 |
539 bool SelectionController::handleMouseReleaseEvent(const MouseEventWithHitTestRes ults& event, const LayoutPoint& dragStartPos) | 539 bool SelectionController::handleMouseReleaseEvent(const MouseEventWithHitTestRes ults& event, const LayoutPoint& dragStartPos) |
540 { | 540 { |
541 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) | 541 if (RuntimeEnabledFeatures::selectionForComposedTreeEnabled()) |
542 return handleMouseReleaseEventAlgorithm<EditingInComposedTreeStrategy>(e vent, dragStartPos); | 542 return handleMouseReleaseEventAlgorithm<EditingInComposedTreeStrategy>(e vent, dragStartPos); |
543 return handleMouseReleaseEventAlgorithm<EditingStrategy>(event, dragStartPos ); | 543 return handleMouseReleaseEventAlgorithm<EditingStrategy>(event, dragStartPos ); |
544 } | 544 } |
545 | 545 |
546 bool SelectionController::selectWordAtPositionIfAny(const IntPoint& position) | |
547 { | |
548 HitTestRequest request(HitTestRequest::Active); | |
549 HitTestResult result(request, position); | |
550 m_frame->document()->layoutView()->hitTest(result); | |
Rick Byers
2015/12/21 16:31:08
You just did a hit-test up in WebViewImpl, it's a
spqchan
2016/01/06 22:52:31
Done.
| |
551 | |
552 if (result.scrollbar() | |
553 || result.isLiveLink() | |
554 || !(selection().isContentEditable() | |
555 || (result.innerNode() && result.innerNode()->isTextNode()))) | |
556 return false; | |
557 | |
558 selectClosestWordFromHitTestResult<EditingStrategy>(result, AppendTrailingWh itespace::DontAppend); | |
559 return true; | |
560 } | |
561 | |
546 bool SelectionController::handlePasteGlobalSelection(const PlatformMouseEvent& m ouseEvent) | 562 bool SelectionController::handlePasteGlobalSelection(const PlatformMouseEvent& m ouseEvent) |
547 { | 563 { |
548 // If the event was a middle click, attempt to copy global selection in afte r | 564 // If the event was a middle click, attempt to copy global selection in afte r |
549 // the newly set caret position. | 565 // the newly set caret position. |
550 // | 566 // |
551 // This code is called from either the mouse up or mouse down handling. Ther e | 567 // This code is called from either the mouse up or mouse down handling. Ther e |
552 // is some debate about when the global selection is pasted: | 568 // is some debate about when the global selection is pasted: |
553 // xterm: pastes on up. | 569 // xterm: pastes on up. |
554 // GTK: pastes on down. | 570 // GTK: pastes on down. |
555 // Qt: pastes on up. | 571 // Qt: pastes on up. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 else | 695 else |
680 m_selectionState = SelectionState::HaveNotStartedSelection; | 696 m_selectionState = SelectionState::HaveNotStartedSelection; |
681 } | 697 } |
682 | 698 |
683 FrameSelection& SelectionController::selection() const | 699 FrameSelection& SelectionController::selection() const |
684 { | 700 { |
685 return m_frame->selection(); | 701 return m_frame->selection(); |
686 } | 702 } |
687 | 703 |
688 } // namespace blink | 704 } // namespace blink |
OLD | NEW |