| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 VisibleSelectionInFlatTree expandSelectionToRespectUserSelectAll( | 78 VisibleSelectionInFlatTree expandSelectionToRespectUserSelectAll( |
| 79 Node* targetNode, | 79 Node* targetNode, |
| 80 const VisibleSelectionInFlatTree& selection) { | 80 const VisibleSelectionInFlatTree& selection) { |
| 81 Node* const rootUserSelectAll = | 81 Node* const rootUserSelectAll = |
| 82 EditingInFlatTreeStrategy::rootUserSelectAllForNode(targetNode); | 82 EditingInFlatTreeStrategy::rootUserSelectAllForNode(targetNode); |
| 83 if (!rootUserSelectAll) | 83 if (!rootUserSelectAll) |
| 84 return selection; | 84 return selection; |
| 85 | 85 |
| 86 VisibleSelectionInFlatTree newSelection(selection); | 86 return createVisibleSelection( |
| 87 newSelection.setBase(mostBackwardCaretPosition( | 87 SelectionInFlatTree::Builder(selection.asSelection()) |
| 88 PositionInFlatTree::beforeNode(rootUserSelectAll), | 88 .collapse(mostBackwardCaretPosition( |
| 89 CanCrossEditingBoundary)); | 89 PositionInFlatTree::beforeNode(rootUserSelectAll), |
| 90 newSelection.setExtent( | 90 CanCrossEditingBoundary)) |
| 91 mostForwardCaretPosition(PositionInFlatTree::afterNode(rootUserSelectAll), | 91 .extend(mostForwardCaretPosition( |
| 92 CanCrossEditingBoundary)); | 92 PositionInFlatTree::afterNode(rootUserSelectAll), |
| 93 | 93 CanCrossEditingBoundary)) |
| 94 return newSelection; | 94 .build()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 static int textDistance(const PositionInFlatTree& start, | 97 static int textDistance(const PositionInFlatTree& start, |
| 98 const PositionInFlatTree& end) { | 98 const PositionInFlatTree& end) { |
| 99 return TextIteratorInFlatTree::rangeLength(start, end, true); | 99 return TextIteratorInFlatTree::rangeLength(start, end, true); |
| 100 } | 100 } |
| 101 | 101 |
| 102 bool canMouseDownStartSelect(Node* node) { | 102 bool canMouseDownStartSelect(Node* node) { |
| 103 if (!node || !node->layoutObject()) | 103 if (!node || !node->layoutObject()) |
| 104 return true; | 104 return true; |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 return event.event().altKey() && event.isOverLink(); | 965 return event.event().altKey() && event.isOverLink(); |
| 966 } | 966 } |
| 967 | 967 |
| 968 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { | 968 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { |
| 969 bool isMouseDownOnLinkOrImage = | 969 bool isMouseDownOnLinkOrImage = |
| 970 event.isOverLink() || event.hitTestResult().image(); | 970 event.isOverLink() || event.hitTestResult().image(); |
| 971 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; | 971 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; |
| 972 } | 972 } |
| 973 | 973 |
| 974 } // namespace blink | 974 } // namespace blink |
| OLD | NEW |