| 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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 // editing, place the caret. | 812 // editing, place the caret. |
| 813 if (m_mouseDownWasSingleClickInSelection && | 813 if (m_mouseDownWasSingleClickInSelection && |
| 814 m_selectionState != SelectionState::ExtendedSelection && | 814 m_selectionState != SelectionState::ExtendedSelection && |
| 815 dragStartPos == event.event().position() && selection().isRange() && | 815 dragStartPos == event.event().position() && selection().isRange() && |
| 816 event.event().pointerProperties().button != | 816 event.event().pointerProperties().button != |
| 817 WebPointerProperties::Button::Right) { | 817 WebPointerProperties::Button::Right) { |
| 818 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 818 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 819 // needs to be audited. See http://crbug.com/590369 for more details. | 819 // needs to be audited. See http://crbug.com/590369 for more details. |
| 820 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 820 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 821 | 821 |
| 822 VisibleSelectionInFlatTree newSelection; | 822 SelectionInFlatTree::Builder builder; |
| 823 Node* node = event.innerNode(); | 823 Node* node = event.innerNode(); |
| 824 if (node && node->layoutObject() && hasEditableStyle(*node)) { | 824 if (node && node->layoutObject() && hasEditableStyle(*node)) { |
| 825 const VisiblePositionInFlatTree pos = | 825 const VisiblePositionInFlatTree pos = |
| 826 visiblePositionOfHitTestResult(event.hitTestResult()); | 826 visiblePositionOfHitTestResult(event.hitTestResult()); |
| 827 if (pos.isNotNull()) { | 827 if (pos.isNotNull()) |
| 828 SelectionInFlatTree::Builder builder; | |
| 829 builder.collapse(pos.toPositionWithAffinity()); | 828 builder.collapse(pos.toPositionWithAffinity()); |
| 830 newSelection = createVisibleSelection(builder.build()); | |
| 831 } | |
| 832 } | 829 } |
| 833 | 830 |
| 834 if (selection().visibleSelection<EditingInFlatTreeStrategy>() != | 831 if (selection().visibleSelection<EditingInFlatTreeStrategy>() != |
| 835 newSelection) { | 832 createVisibleSelection(builder.build())) { |
| 836 selection().setSelection(newSelection); | 833 selection().setSelection(builder.build()); |
| 837 } | 834 } |
| 838 | 835 |
| 839 handled = true; | 836 handled = true; |
| 840 } | 837 } |
| 841 | 838 |
| 842 selection().notifyLayoutObjectOfSelectionChange(UserTriggered); | 839 selection().notifyLayoutObjectOfSelectionChange(UserTriggered); |
| 843 | 840 |
| 844 selection().selectFrameElementInParentIfFullySelected(); | 841 selection().selectFrameElementInParentIfFullySelected(); |
| 845 | 842 |
| 846 if (event.event().pointerProperties().button == | 843 if (event.event().pointerProperties().button == |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 if (!selection().contains(p)) | 975 if (!selection().contains(p)) |
| 979 return; | 976 return; |
| 980 | 977 |
| 981 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 978 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 982 // needs to be audited. See http://crbug.com/590369 for more details. | 979 // needs to be audited. See http://crbug.com/590369 for more details. |
| 983 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 980 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 984 | 981 |
| 985 const VisiblePositionInFlatTree& visiblePos = | 982 const VisiblePositionInFlatTree& visiblePos = |
| 986 visiblePositionOfHitTestResult(mev.hitTestResult()); | 983 visiblePositionOfHitTestResult(mev.hitTestResult()); |
| 987 if (visiblePos.isNull()) { | 984 if (visiblePos.isNull()) { |
| 988 selection().setSelection(VisibleSelectionInFlatTree()); | 985 selection().setSelection(SelectionInFlatTree()); |
| 989 return; | 986 return; |
| 990 } | 987 } |
| 991 SelectionInFlatTree::Builder builder; | 988 selection().setSelection(SelectionInFlatTree::Builder() |
| 992 builder.collapse(visiblePos.toPositionWithAffinity()); | 989 .collapse(visiblePos.toPositionWithAffinity()) |
| 993 selection().setSelection(createVisibleSelection(builder.build())); | 990 .build()); |
| 994 } | 991 } |
| 995 | 992 |
| 996 void SelectionController::initializeSelectionState() { | 993 void SelectionController::initializeSelectionState() { |
| 997 m_selectionState = SelectionState::HaveNotStartedSelection; | 994 m_selectionState = SelectionState::HaveNotStartedSelection; |
| 998 } | 995 } |
| 999 | 996 |
| 1000 void SelectionController::setMouseDownMayStartSelect(bool mayStartSelect) { | 997 void SelectionController::setMouseDownMayStartSelect(bool mayStartSelect) { |
| 1001 m_mouseDownMayStartSelect = mayStartSelect; | 998 m_mouseDownMayStartSelect = mayStartSelect; |
| 1002 } | 999 } |
| 1003 | 1000 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1026 return event.event().altKey() && event.isOverLink(); | 1023 return event.event().altKey() && event.isOverLink(); |
| 1027 } | 1024 } |
| 1028 | 1025 |
| 1029 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { | 1026 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { |
| 1030 bool isMouseDownOnLinkOrImage = | 1027 bool isMouseDownOnLinkOrImage = |
| 1031 event.isOverLink() || event.hitTestResult().image(); | 1028 event.isOverLink() || event.hitTestResult().image(); |
| 1032 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; | 1029 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; |
| 1033 } | 1030 } |
| 1034 | 1031 |
| 1035 } // namespace blink | 1032 } // namespace blink |
| OLD | NEW |