| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 static inline bool dispatchSelectStart(Node* node) | 73 static inline bool dispatchSelectStart(Node* node) |
| 74 { | 74 { |
| 75 if (!node || !node->layoutObject()) | 75 if (!node || !node->layoutObject()) |
| 76 return true; | 76 return true; |
| 77 | 77 |
| 78 return node->dispatchEvent(Event::createCancelableBubble(EventTypeNames::sel
ectstart)); | 78 return node->dispatchEvent(Event::createCancelableBubble(EventTypeNames::sel
ectstart)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 template <typename Strategy> |
| 82 VisibleSelection expandSelectionToRespectUserSelectAllAlgorithm(Node* targetNode
, const VisibleSelection& selection) |
| 83 { |
| 84 using PositionType = typename Strategy::PositionType; |
| 85 |
| 86 Node* rootUserSelectAll = PositionType::rootUserSelectAllForNode(targetNode)
; |
| 87 if (!rootUserSelectAll) |
| 88 return selection; |
| 89 |
| 90 VisibleSelection newSelection(selection); |
| 91 newSelection.setBase(PositionType::beforeNode(rootUserSelectAll).upstream(Ca
nCrossEditingBoundary)); |
| 92 newSelection.setExtent(PositionType::afterNode(rootUserSelectAll).downstream
(CanCrossEditingBoundary)); |
| 93 |
| 94 return newSelection; |
| 95 } |
| 96 |
| 81 static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode,
const VisibleSelection& selection) | 97 static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode,
const VisibleSelection& selection) |
| 82 { | 98 { |
| 83 Node* rootUserSelectAll = Position::rootUserSelectAllForNode(targetNode); | 99 return expandSelectionToRespectUserSelectAllAlgorithm<VisibleSelection::InDO
MTree>(targetNode, selection); |
| 84 if (!rootUserSelectAll) | |
| 85 return selection; | |
| 86 | |
| 87 VisibleSelection newSelection(selection); | |
| 88 newSelection.setBase(positionBeforeNode(rootUserSelectAll).upstream(CanCross
EditingBoundary)); | |
| 89 newSelection.setExtent(positionAfterNode(rootUserSelectAll).downstream(CanCr
ossEditingBoundary)); | |
| 90 | |
| 91 return newSelection; | |
| 92 } | 100 } |
| 93 | 101 |
| 94 bool SelectionController::updateSelectionForMouseDownDispatchingSelectStart(Node
* targetNode, const VisibleSelection& selection, TextGranularity granularity) | 102 bool SelectionController::updateSelectionForMouseDownDispatchingSelectStart(Node
* targetNode, const VisibleSelection& selection, TextGranularity granularity) |
| 95 { | 103 { |
| 96 if (Position::nodeIsUserSelectNone(targetNode)) | 104 if (Position::nodeIsUserSelectNone(targetNode)) |
| 97 return false; | 105 return false; |
| 98 | 106 |
| 99 if (!dispatchSelectStart(targetNode)) | 107 if (!dispatchSelectStart(targetNode)) |
| 100 return false; | 108 return false; |
| 101 | 109 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 { | 565 { |
| 558 return m_mouseDownMayStartSelect; | 566 return m_mouseDownMayStartSelect; |
| 559 } | 567 } |
| 560 | 568 |
| 561 bool SelectionController::mouseDownWasSingleClickInSelection() const | 569 bool SelectionController::mouseDownWasSingleClickInSelection() const |
| 562 { | 570 { |
| 563 return m_mouseDownWasSingleClickInSelection; | 571 return m_mouseDownWasSingleClickInSelection; |
| 564 } | 572 } |
| 565 | 573 |
| 566 } // namespace blink | 574 } // namespace blink |
| OLD | NEW |