| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 const VisiblePositionInFlatTree& pos = visiblePositionOfHitTestResult(adjust
edHitTestResult); | 316 const VisiblePositionInFlatTree& pos = visiblePositionOfHitTestResult(adjust
edHitTestResult); |
| 317 if (pos.isNotNull()) { | 317 if (pos.isNotNull()) { |
| 318 newSelection = VisibleSelectionInFlatTree(pos); | 318 newSelection = VisibleSelectionInFlatTree(pos); |
| 319 newSelection.expandUsingGranularity(WordGranularity); | 319 newSelection.expandUsingGranularity(WordGranularity); |
| 320 } | 320 } |
| 321 | 321 |
| 322 if (selectInputEventType == SelectInputEventType::Touch) { | 322 if (selectInputEventType == SelectInputEventType::Touch) { |
| 323 // If node doesn't have text except space, tab or line break, do not | 323 // If node doesn't have text except space, tab or line break, do not |
| 324 // select that 'empty' area. | 324 // select that 'empty' area. |
| 325 EphemeralRangeInFlatTree range(newSelection.start(), newSelection.end())
; | 325 EphemeralRangeInFlatTree range(newSelection.start(), newSelection.end())
; |
| 326 const String& str = plainText(range, innerNode->hasEditableStyle() ? Tex
tIteratorEmitsObjectReplacementCharacter : TextIteratorDefaultBehavior); | 326 const String& str = plainText(range, hasEditableStyle(*innerNode) ? Text
IteratorEmitsObjectReplacementCharacter : TextIteratorDefaultBehavior); |
| 327 if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace()) | 327 if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace()) |
| 328 return; | 328 return; |
| 329 | 329 |
| 330 if (newSelection.rootEditableElement() && pos.deepEquivalent() == Visibl
ePositionInFlatTree::lastPositionInNode(newSelection.rootEditableElement()).deep
Equivalent()) | 330 if (newSelection.rootEditableElement() && pos.deepEquivalent() == Visibl
ePositionInFlatTree::lastPositionInNode(newSelection.rootEditableElement()).deep
Equivalent()) |
| 331 return; | 331 return; |
| 332 } | 332 } |
| 333 | 333 |
| 334 if (appendTrailingWhitespace == AppendTrailingWhitespace::ShouldAppend && ne
wSelection.isRange()) | 334 if (appendTrailingWhitespace == AppendTrailingWhitespace::ShouldAppend && ne
wSelection.isRange()) |
| 335 newSelection.appendTrailingWhitespace(); | 335 newSelection.appendTrailingWhitespace(); |
| 336 | 336 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 // press and it's not a context menu click. We do this so when clicking | 515 // press and it's not a context menu click. We do this so when clicking |
| 516 // on the selection, the selection goes away. However, if we are | 516 // on the selection, the selection goes away. However, if we are |
| 517 // editing, place the caret. | 517 // editing, place the caret. |
| 518 if (m_mouseDownWasSingleClickInSelection && m_selectionState != SelectionSta
te::ExtendedSelection | 518 if (m_mouseDownWasSingleClickInSelection && m_selectionState != SelectionSta
te::ExtendedSelection |
| 519 && dragStartPos == event.event().position() | 519 && dragStartPos == event.event().position() |
| 520 && selection().isRange() | 520 && selection().isRange() |
| 521 && event.event().button() != RightButton) { | 521 && event.event().button() != RightButton) { |
| 522 VisibleSelectionInFlatTree newSelection; | 522 VisibleSelectionInFlatTree newSelection; |
| 523 Node* node = event.innerNode(); | 523 Node* node = event.innerNode(); |
| 524 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBr
owsingEnabled(); | 524 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBr
owsingEnabled(); |
| 525 if (node && node->layoutObject() && (caretBrowsing || node->hasEditableS
tyle())) { | 525 if (node && node->layoutObject() && (caretBrowsing || hasEditableStyle(*
node))) { |
| 526 const VisiblePositionInFlatTree pos = visiblePositionOfHitTestResult
(event.hitTestResult()); | 526 const VisiblePositionInFlatTree pos = visiblePositionOfHitTestResult
(event.hitTestResult()); |
| 527 newSelection = VisibleSelectionInFlatTree(pos); | 527 newSelection = VisibleSelectionInFlatTree(pos); |
| 528 } | 528 } |
| 529 | 529 |
| 530 setSelectionIfNeeded(selection(), newSelection); | 530 setSelectionIfNeeded(selection(), newSelection); |
| 531 | 531 |
| 532 handled = true; | 532 handled = true; |
| 533 } | 533 } |
| 534 | 534 |
| 535 selection().notifyLayoutObjectOfSelectionChange(UserTriggered); | 535 selection().notifyLayoutObjectOfSelectionChange(UserTriggered); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 return event.event().altKey() && event.isOverLink(); | 675 return event.event().altKey() && event.isOverLink(); |
| 676 } | 676 } |
| 677 | 677 |
| 678 bool isExtendingSelection(const MouseEventWithHitTestResults& event) | 678 bool isExtendingSelection(const MouseEventWithHitTestResults& event) |
| 679 { | 679 { |
| 680 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult().
image(); | 680 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult().
image(); |
| 681 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; | 681 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; |
| 682 } | 682 } |
| 683 | 683 |
| 684 } // namespace blink | 684 } // namespace blink |
| OLD | NEW |