| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 namespace blink { | 48 namespace blink { |
| 49 PassOwnPtrWillBeRawPtr<SelectionController> SelectionController::create(LocalFra
me& frame) | 49 PassOwnPtrWillBeRawPtr<SelectionController> SelectionController::create(LocalFra
me& frame) |
| 50 { | 50 { |
| 51 return adoptPtrWillBeNoop(new SelectionController(frame)); | 51 return adoptPtrWillBeNoop(new SelectionController(frame)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 SelectionController::SelectionController(LocalFrame& frame) | 54 SelectionController::SelectionController(LocalFrame& frame) |
| 55 : m_frame(&frame) | 55 : m_frame(&frame) |
| 56 , m_mouseDownMayStartSelect(false) | 56 , m_mouseDownMayStartSelect(false) |
| 57 , m_mouseDownWasSingleClickInSelection(false) | 57 , m_mouseDownWasSingleClickInSelection(false) |
| 58 , m_selectionInitiationState(HaveNotStartedSelection) | 58 , m_selectionState(SelectionState::HaveNotStartedSelection) |
| 59 { | 59 { |
| 60 } | 60 } |
| 61 | 61 |
| 62 DEFINE_TRACE(SelectionController) | 62 DEFINE_TRACE(SelectionController) |
| 63 { | 63 { |
| 64 visitor->trace(m_frame); | 64 visitor->trace(m_frame); |
| 65 } | 65 } |
| 66 | 66 |
| 67 static void setSelectionIfNeeded(FrameSelection& selection, const VisibleSelecti
on& newSelection) | 67 static void setSelectionIfNeeded(FrameSelection& selection, const VisibleSelecti
on& newSelection) |
| 68 { | 68 { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 bool SelectionController::updateSelectionForMouseDownDispatchingSelectStart(Node
* targetNode, const VisibleSelection& selection, TextGranularity granularity) | 111 bool SelectionController::updateSelectionForMouseDownDispatchingSelectStart(Node
* targetNode, const VisibleSelection& selection, TextGranularity granularity) |
| 112 { | 112 { |
| 113 if (Position::nodeIsUserSelectNone(targetNode)) | 113 if (Position::nodeIsUserSelectNone(targetNode)) |
| 114 return false; | 114 return false; |
| 115 | 115 |
| 116 if (!dispatchSelectStart(targetNode)) | 116 if (!dispatchSelectStart(targetNode)) |
| 117 return false; | 117 return false; |
| 118 | 118 |
| 119 if (selection.isRange()) { | 119 if (selection.isRange()) { |
| 120 m_selectionInitiationState = ExtendedSelection; | 120 m_selectionState = SelectionState::ExtendedSelection; |
| 121 } else { | 121 } else { |
| 122 granularity = CharacterGranularity; | 122 granularity = CharacterGranularity; |
| 123 m_selectionInitiationState = PlacedCaret; | 123 m_selectionState = SelectionState::PlacedCaret; |
| 124 } | 124 } |
| 125 | 125 |
| 126 m_frame->selection().setNonDirectionalSelectionIfNeeded(selection, granulari
ty); | 126 m_frame->selection().setNonDirectionalSelectionIfNeeded(selection, granulari
ty); |
| 127 | 127 |
| 128 return true; | 128 return true; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void SelectionController::selectClosestWordFromHitTestResult(const HitTestResult
& result, AppendTrailingWhitespace appendTrailingWhitespace) | 131 void SelectionController::selectClosestWordFromHitTestResult(const HitTestResult
& result, AppendTrailingWhitespace appendTrailingWhitespace) |
| 132 { | 132 { |
| 133 Node* innerNode = result.innerNode(); | 133 Node* innerNode = result.innerNode(); |
| 134 VisibleSelection newSelection; | 134 VisibleSelection newSelection; |
| 135 | 135 |
| 136 if (innerNode && innerNode->layoutObject()) { | 136 if (innerNode && innerNode->layoutObject()) { |
| 137 VisiblePosition pos(innerNode->layoutObject()->positionForPoint(result.l
ocalPoint())); | 137 VisiblePosition pos(innerNode->layoutObject()->positionForPoint(result.l
ocalPoint())); |
| 138 if (pos.isNotNull()) { | 138 if (pos.isNotNull()) { |
| 139 newSelection = VisibleSelection(pos); | 139 newSelection = VisibleSelection(pos); |
| 140 expandSelectionUsingGranularity(newSelection, WordGranularity); | 140 expandSelectionUsingGranularity(newSelection, WordGranularity); |
| 141 } | 141 } |
| 142 | 142 |
| 143 if (appendTrailingWhitespace == ShouldAppendTrailingWhitespace && newSel
ection.isRange()) | 143 if (appendTrailingWhitespace == AppendTrailingWhitespace::ShouldAppend &
& newSelection.isRange()) |
| 144 newSelection.appendTrailingWhitespace(); | 144 newSelection.appendTrailingWhitespace(); |
| 145 | 145 |
| 146 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelec
tionToRespectUserSelectAll(innerNode, newSelection), WordGranularity); | 146 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelec
tionToRespectUserSelectAll(innerNode, newSelection), WordGranularity); |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 void SelectionController::selectClosestMisspellingFromHitTestResult(const HitTes
tResult& result, AppendTrailingWhitespace appendTrailingWhitespace) | 150 void SelectionController::selectClosestMisspellingFromHitTestResult(const HitTes
tResult& result, AppendTrailingWhitespace appendTrailingWhitespace) |
| 151 { | 151 { |
| 152 Node* innerNode = result.innerNode(); | 152 Node* innerNode = result.innerNode(); |
| 153 VisibleSelection newSelection; | 153 VisibleSelection newSelection; |
| 154 | 154 |
| 155 if (innerNode && innerNode->layoutObject()) { | 155 if (innerNode && innerNode->layoutObject()) { |
| 156 VisiblePosition pos(innerNode->layoutObject()->positionForPoint(result.l
ocalPoint())); | 156 VisiblePosition pos(innerNode->layoutObject()->positionForPoint(result.l
ocalPoint())); |
| 157 Position start = pos.deepEquivalent(); | 157 Position start = pos.deepEquivalent(); |
| 158 Position end = pos.deepEquivalent(); | 158 Position end = pos.deepEquivalent(); |
| 159 if (pos.isNotNull()) { | 159 if (pos.isNotNull()) { |
| 160 DocumentMarkerVector markers = innerNode->document().markers().marke
rsInRange(makeRange(pos, pos).get(), DocumentMarker::MisspellingMarkers()); | 160 DocumentMarkerVector markers = innerNode->document().markers().marke
rsInRange(makeRange(pos, pos).get(), DocumentMarker::MisspellingMarkers()); |
| 161 if (markers.size() == 1) { | 161 if (markers.size() == 1) { |
| 162 start.moveToOffset(markers[0]->startOffset()); | 162 start.moveToOffset(markers[0]->startOffset()); |
| 163 end.moveToOffset(markers[0]->endOffset()); | 163 end.moveToOffset(markers[0]->endOffset()); |
| 164 newSelection = VisibleSelection(start, end); | 164 newSelection = VisibleSelection(start, end); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 if (appendTrailingWhitespace == ShouldAppendTrailingWhitespace && newSel
ection.isRange()) | 168 if (appendTrailingWhitespace == AppendTrailingWhitespace::ShouldAppend &
& newSelection.isRange()) |
| 169 newSelection.appendTrailingWhitespace(); | 169 newSelection.appendTrailingWhitespace(); |
| 170 | 170 |
| 171 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelec
tionToRespectUserSelectAll(innerNode, newSelection), WordGranularity); | 171 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelec
tionToRespectUserSelectAll(innerNode, newSelection), WordGranularity); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 void SelectionController::selectClosestWordFromMouseEvent(const MouseEventWithHi
tTestResults& result) | 175 void SelectionController::selectClosestWordFromMouseEvent(const MouseEventWithHi
tTestResults& result) |
| 176 { | 176 { |
| 177 if (m_mouseDownMayStartSelect) { | 177 if (m_mouseDownMayStartSelect) { |
| 178 selectClosestWordFromHitTestResult(result.hitTestResult(), | 178 selectClosestWordFromHitTestResult(result.hitTestResult(), |
| 179 (result.event().clickCount() == 2 && m_frame->editor().isSelectTrail
ingWhitespaceEnabled()) ? ShouldAppendTrailingWhitespace : DontAppendTrailingWhi
tespace); | 179 (result.event().clickCount() == 2 && m_frame->editor().isSelectTrail
ingWhitespaceEnabled()) ? AppendTrailingWhitespace::ShouldAppend : AppendTrailin
gWhitespace::DontAppend); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 void SelectionController::selectClosestMisspellingFromMouseEvent(const MouseEven
tWithHitTestResults& result) | 183 void SelectionController::selectClosestMisspellingFromMouseEvent(const MouseEven
tWithHitTestResults& result) |
| 184 { | 184 { |
| 185 if (m_mouseDownMayStartSelect) { | 185 if (m_mouseDownMayStartSelect) { |
| 186 selectClosestMisspellingFromHitTestResult(result.hitTestResult(), | 186 selectClosestMisspellingFromHitTestResult(result.hitTestResult(), |
| 187 (result.event().clickCount() == 2 && m_frame->editor().isSelectTrail
ingWhitespaceEnabled()) ? ShouldAppendTrailingWhitespace : DontAppendTrailingWhi
tespace); | 187 (result.event().clickCount() == 2 && m_frame->editor().isSelectTrail
ingWhitespaceEnabled()) ? AppendTrailingWhitespace::ShouldAppend : AppendTrailin
gWhitespace::DontAppend); |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 void SelectionController::selectClosestWordOrLinkFromMouseEvent(const MouseEvent
WithHitTestResults& result) | 191 void SelectionController::selectClosestWordOrLinkFromMouseEvent(const MouseEvent
WithHitTestResults& result) |
| 192 { | 192 { |
| 193 if (!result.hitTestResult().isLiveLink()) | 193 if (!result.hitTestResult().isLiveLink()) |
| 194 return selectClosestWordFromMouseEvent(result); | 194 return selectClosestWordFromMouseEvent(result); |
| 195 | 195 |
| 196 Node* innerNode = result.innerNode(); | 196 Node* innerNode = result.innerNode(); |
| 197 | 197 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 212 | 212 |
| 213 if (event.event().button() != LeftButton) | 213 if (event.event().button() != LeftButton) |
| 214 return false; | 214 return false; |
| 215 | 215 |
| 216 if (m_frame->selection().isRange()) { | 216 if (m_frame->selection().isRange()) { |
| 217 // A double-click when range is already selected | 217 // A double-click when range is already selected |
| 218 // should not change the selection. So, do not call | 218 // should not change the selection. So, do not call |
| 219 // selectClosestWordFromMouseEvent, but do set | 219 // selectClosestWordFromMouseEvent, but do set |
| 220 // m_beganSelectingText to prevent handleMouseReleaseEvent | 220 // m_beganSelectingText to prevent handleMouseReleaseEvent |
| 221 // from setting caret selection. | 221 // from setting caret selection. |
| 222 m_selectionInitiationState = ExtendedSelection; | 222 m_selectionState = SelectionState::ExtendedSelection; |
| 223 } else { | 223 } else { |
| 224 selectClosestWordFromMouseEvent(event); | 224 selectClosestWordFromMouseEvent(event); |
| 225 } | 225 } |
| 226 return true; | 226 return true; |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool SelectionController::handleMousePressEventTripleClick(const MouseEventWithH
itTestResults& event) | 229 bool SelectionController::handleMousePressEventTripleClick(const MouseEventWithH
itTestResults& event) |
| 230 { | 230 { |
| 231 TRACE_EVENT0("blink", "SelectionController::handleMousePressEventTripleClick
"); | 231 TRACE_EVENT0("blink", "SelectionController::handleMousePressEventTripleClick
"); |
| 232 | 232 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 void SelectionController::handleMousePressEvent(const MouseEventWithHitTestResul
ts& event) | 346 void SelectionController::handleMousePressEvent(const MouseEventWithHitTestResul
ts& event) |
| 347 { | 347 { |
| 348 // If we got the event back, that must mean it wasn't prevented, | 348 // If we got the event back, that must mean it wasn't prevented, |
| 349 // so it's allowed to start a drag or selection if it wasn't in a scrollbar. | 349 // so it's allowed to start a drag or selection if it wasn't in a scrollbar. |
| 350 m_mouseDownMayStartSelect = canMouseDownStartSelect(event.innerNode()) && !e
vent.scrollbar(); | 350 m_mouseDownMayStartSelect = canMouseDownStartSelect(event.innerNode()) && !e
vent.scrollbar(); |
| 351 m_mouseDownWasSingleClickInSelection = false; | 351 m_mouseDownWasSingleClickInSelection = false; |
| 352 } | 352 } |
| 353 | 353 |
| 354 void SelectionController::handleMouseDraggedEvent(const MouseEventWithHitTestRes
ults& event, const IntPoint& mouseDownPos, const LayoutPoint& dragStartPos, Node
* mousePressNode, const IntPoint& lastKnownMousePosition) | 354 void SelectionController::handleMouseDraggedEvent(const MouseEventWithHitTestRes
ults& event, const IntPoint& mouseDownPos, const LayoutPoint& dragStartPos, Node
* mousePressNode, const IntPoint& lastKnownMousePosition) |
| 355 { | 355 { |
| 356 if (m_selectionInitiationState != ExtendedSelection) { | 356 if (m_selectionState != SelectionState::ExtendedSelection) { |
| 357 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); | 357 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); |
| 358 HitTestResult result(request, mouseDownPos); | 358 HitTestResult result(request, mouseDownPos); |
| 359 m_frame->document()->layoutView()->hitTest(result); | 359 m_frame->document()->layoutView()->hitTest(result); |
| 360 | 360 |
| 361 updateSelectionForMouseDrag(result, mousePressNode, dragStartPos, lastKn
ownMousePosition); | 361 updateSelectionForMouseDrag(result, mousePressNode, dragStartPos, lastKn
ownMousePosition); |
| 362 } | 362 } |
| 363 updateSelectionForMouseDrag(event.hitTestResult(), mousePressNode, dragStart
Pos, lastKnownMousePosition); | 363 updateSelectionForMouseDrag(event.hitTestResult(), mousePressNode, dragStart
Pos, lastKnownMousePosition); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void SelectionController::updateSelectionForMouseDrag(Node* mousePressNode, cons
t LayoutPoint& dragStartPos, const IntPoint& lastKnownMousePosition) | 366 void SelectionController::updateSelectionForMouseDrag(Node* mousePressNode, cons
t LayoutPoint& dragStartPos, const IntPoint& lastKnownMousePosition) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // FIXME: Isn't there a better non-SVG-specific way to do this? | 411 // FIXME: Isn't there a better non-SVG-specific way to do this? |
| 412 if (Node* selectionBaseNode = Strategy::selectionBase(newSelection).deprecat
edNode()) { | 412 if (Node* selectionBaseNode = Strategy::selectionBase(newSelection).deprecat
edNode()) { |
| 413 if (LayoutObject* selectionBaseLayoutObject = selectionBaseNode->layoutO
bject()) { | 413 if (LayoutObject* selectionBaseLayoutObject = selectionBaseNode->layoutO
bject()) { |
| 414 if (selectionBaseLayoutObject->isSVGText()) { | 414 if (selectionBaseLayoutObject->isSVGText()) { |
| 415 if (target->layoutObject()->containingBlock() != selectionBaseLa
youtObject->containingBlock()) | 415 if (target->layoutObject()->containingBlock() != selectionBaseLa
youtObject->containingBlock()) |
| 416 return; | 416 return; |
| 417 } | 417 } |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 if (m_selectionInitiationState == HaveNotStartedSelection && !dispatchSelect
Start(target)) | 421 if (m_selectionState == SelectionState::HaveNotStartedSelection && !dispatch
SelectStart(target)) |
| 422 return; | 422 return; |
| 423 | 423 |
| 424 if (m_selectionInitiationState != ExtendedSelection) { | 424 if (m_selectionState != SelectionState::ExtendedSelection) { |
| 425 // Always extend selection here because it's caused by a mouse drag | 425 // Always extend selection here because it's caused by a mouse drag |
| 426 m_selectionInitiationState = ExtendedSelection; | 426 m_selectionState = SelectionState::ExtendedSelection; |
| 427 newSelection = VisibleSelection(targetPosition); | 427 newSelection = VisibleSelection(targetPosition); |
| 428 } | 428 } |
| 429 | 429 |
| 430 if (RuntimeEnabledFeatures::userSelectAllEnabled()) { | 430 if (RuntimeEnabledFeatures::userSelectAllEnabled()) { |
| 431 Node* rootUserSelectAllForMousePressNode = Position::rootUserSelectAllFo
rNode(mousePressNode); | 431 Node* rootUserSelectAllForMousePressNode = Position::rootUserSelectAllFo
rNode(mousePressNode); |
| 432 if (rootUserSelectAllForMousePressNode && rootUserSelectAllForMousePress
Node == Position::rootUserSelectAllForNode(target)) { | 432 if (rootUserSelectAllForMousePressNode && rootUserSelectAllForMousePress
Node == Position::rootUserSelectAllForNode(target)) { |
| 433 newSelection.setBase(PositionType::beforeNode(rootUserSelectAllForMo
usePressNode).upstream(CanCrossEditingBoundary)); | 433 newSelection.setBase(PositionType::beforeNode(rootUserSelectAllForMo
usePressNode).upstream(CanCrossEditingBoundary)); |
| 434 newSelection.setExtent(PositionType::afterNode(rootUserSelectAllForM
ousePressNode).downstream(CanCrossEditingBoundary)); | 434 newSelection.setExtent(PositionType::afterNode(rootUserSelectAllForM
ousePressNode).downstream(CanCrossEditingBoundary)); |
| 435 } else { | 435 } else { |
| 436 // Reset base for user select all when base is inside user-select-al
l area and extent < base. | 436 // Reset base for user select all when base is inside user-select-al
l area and extent < base. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 461 } | 461 } |
| 462 | 462 |
| 463 bool SelectionController::handleMouseReleaseEvent(const MouseEventWithHitTestRes
ults& event, const LayoutPoint& dragStartPos) | 463 bool SelectionController::handleMouseReleaseEvent(const MouseEventWithHitTestRes
ults& event, const LayoutPoint& dragStartPos) |
| 464 { | 464 { |
| 465 bool handled = false; | 465 bool handled = false; |
| 466 m_mouseDownMayStartSelect = false; | 466 m_mouseDownMayStartSelect = false; |
| 467 // Clear the selection if the mouse didn't move after the last mouse | 467 // Clear the selection if the mouse didn't move after the last mouse |
| 468 // press and it's not a context menu click. We do this so when clicking | 468 // press and it's not a context menu click. We do this so when clicking |
| 469 // on the selection, the selection goes away. However, if we are | 469 // on the selection, the selection goes away. However, if we are |
| 470 // editing, place the caret. | 470 // editing, place the caret. |
| 471 if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != Ex
tendedSelection | 471 if (m_mouseDownWasSingleClickInSelection && m_selectionState != SelectionSta
te::ExtendedSelection |
| 472 && dragStartPos == event.event().position() | 472 && dragStartPos == event.event().position() |
| 473 && m_frame->selection().isRange() | 473 && m_frame->selection().isRange() |
| 474 && event.event().button() != RightButton) { | 474 && event.event().button() != RightButton) { |
| 475 VisibleSelection newSelection; | 475 VisibleSelection newSelection; |
| 476 Node* node = event.innerNode(); | 476 Node* node = event.innerNode(); |
| 477 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBr
owsingEnabled(); | 477 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBr
owsingEnabled(); |
| 478 if (node && node->layoutObject() && (caretBrowsing || node->hasEditableS
tyle())) { | 478 if (node && node->layoutObject() && (caretBrowsing || node->hasEditableS
tyle())) { |
| 479 VisiblePosition pos = VisiblePosition(node->layoutObject()->position
ForPoint(event.localPoint())); | 479 VisiblePosition pos = VisiblePosition(node->layoutObject()->position
ForPoint(event.localPoint())); |
| 480 newSelection = VisibleSelection(pos); | 480 newSelection = VisibleSelection(pos); |
| 481 } | 481 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 #endif | 538 #endif |
| 539 if (shouldLongPressSelectWord) { | 539 if (shouldLongPressSelectWord) { |
| 540 | 540 |
| 541 | 541 |
| 542 Node* innerNode = hitTestResult.innerNode(); | 542 Node* innerNode = hitTestResult.innerNode(); |
| 543 if (!hitTestResult.isLiveLink() && innerNode && (innerNode->isContentEdi
table() || innerNode->isTextNode() | 543 if (!hitTestResult.isLiveLink() && innerNode && (innerNode->isContentEdi
table() || innerNode->isTextNode() |
| 544 #if OS(ANDROID) | 544 #if OS(ANDROID) |
| 545 || innerNode->canStartSelection() | 545 || innerNode->canStartSelection() |
| 546 #endif | 546 #endif |
| 547 )) { | 547 )) { |
| 548 selectClosestWordFromHitTestResult(hitTestResult, DontAppendTrailing
Whitespace); | 548 selectClosestWordFromHitTestResult(hitTestResult, AppendTrailingWhit
espace::DontAppend); |
| 549 if (m_frame->selection().isRange()) | 549 if (m_frame->selection().isRange()) |
| 550 return true; | 550 return true; |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 return false; | 553 return false; |
| 554 } | 554 } |
| 555 | 555 |
| 556 void SelectionController::sendContextMenuEvent(const MouseEventWithHitTestResult
s& mev, const LayoutPoint& position) | 556 void SelectionController::sendContextMenuEvent(const MouseEventWithHitTestResult
s& mev, const LayoutPoint& position) |
| 557 { | 557 { |
| 558 if (!m_frame->selection().contains(position) | 558 if (!m_frame->selection().contains(position) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 580 if (m_frame->selection().contains(p)) { | 580 if (m_frame->selection().contains(p)) { |
| 581 VisiblePosition visiblePos( | 581 VisiblePosition visiblePos( |
| 582 mev.innerNode()->layoutObject()->positionForPoint(mev.localPoint()))
; | 582 mev.innerNode()->layoutObject()->positionForPoint(mev.localPoint()))
; |
| 583 VisibleSelection newSelection(visiblePos); | 583 VisibleSelection newSelection(visiblePos); |
| 584 m_frame->selection().setSelection(newSelection); | 584 m_frame->selection().setSelection(newSelection); |
| 585 } | 585 } |
| 586 } | 586 } |
| 587 | 587 |
| 588 void SelectionController::initializeSelectionState() | 588 void SelectionController::initializeSelectionState() |
| 589 { | 589 { |
| 590 m_selectionInitiationState = HaveNotStartedSelection; | 590 m_selectionState = SelectionState::HaveNotStartedSelection; |
| 591 } | 591 } |
| 592 | 592 |
| 593 void SelectionController::setMouseDownMayStartSelect(bool mayStartSelect) | 593 void SelectionController::setMouseDownMayStartSelect(bool mayStartSelect) |
| 594 { | 594 { |
| 595 m_mouseDownMayStartSelect = mayStartSelect; | 595 m_mouseDownMayStartSelect = mayStartSelect; |
| 596 } | 596 } |
| 597 | 597 |
| 598 bool SelectionController::mouseDownMayStartSelect() const | 598 bool SelectionController::mouseDownMayStartSelect() const |
| 599 { | 599 { |
| 600 return m_mouseDownMayStartSelect; | 600 return m_mouseDownMayStartSelect; |
| 601 } | 601 } |
| 602 | 602 |
| 603 bool SelectionController::mouseDownWasSingleClickInSelection() const | 603 bool SelectionController::mouseDownWasSingleClickInSelection() const |
| 604 { | 604 { |
| 605 return m_mouseDownWasSingleClickInSelection; | 605 return m_mouseDownWasSingleClickInSelection; |
| 606 } | 606 } |
| 607 | 607 |
| 608 } // namespace blink | 608 } // namespace blink |
| OLD | NEW |