Chromium Code Reviews| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 if (selectInputEventType == SelectInputEventType::Touch && result.image()) | 309 if (selectInputEventType == SelectInputEventType::Touch && result.image()) |
| 310 adjustedHitTestResult.setNodeAndPosition(result.innerNode(), LayoutPoint (0, 0)); | 310 adjustedHitTestResult.setNodeAndPosition(result.innerNode(), LayoutPoint (0, 0)); |
| 311 | 311 |
| 312 const VisiblePositionInFlatTree& pos = visiblePositionOfHitTestResult(adjust edHitTestResult); | 312 const VisiblePositionInFlatTree& pos = visiblePositionOfHitTestResult(adjust edHitTestResult); |
| 313 if (pos.isNotNull()) { | 313 if (pos.isNotNull()) { |
| 314 newSelection = VisibleSelectionInFlatTree(pos); | 314 newSelection = VisibleSelectionInFlatTree(pos); |
| 315 newSelection.expandUsingGranularity(WordGranularity); | 315 newSelection.expandUsingGranularity(WordGranularity); |
| 316 } | 316 } |
| 317 | 317 |
| 318 if (selectInputEventType == SelectInputEventType::Touch) { | 318 if (selectInputEventType == SelectInputEventType::Touch) { |
| 319 if (pos.isNull()) | |
| 320 return; | |
| 321 | |
| 322 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesh eets | |
| 323 // needs to be audited. See http://crbug.com/590369 for more details. | |
| 324 pos.deepEquivalent().document()->updateStyleAndLayoutIgnorePendingStyles heets(); | |
|
yosin_UTC9
2016/08/31 04:58:21
There are only two call sites of selectClosestWord
Xiaocheng
2016/09/02 05:37:24
Done.
| |
| 325 | |
| 319 // If node doesn't have text except space, tab or line break, do not | 326 // If node doesn't have text except space, tab or line break, do not |
| 320 // select that 'empty' area. | 327 // select that 'empty' area. |
| 321 EphemeralRangeInFlatTree range(newSelection.start(), newSelection.end()) ; | 328 EphemeralRangeInFlatTree range(newSelection.start(), newSelection.end()) ; |
| 322 const String& str = plainText(range, hasEditableStyle(*innerNode) ? Text IteratorEmitsObjectReplacementCharacter : TextIteratorDefaultBehavior); | 329 const String& str = plainText(range, hasEditableStyle(*innerNode) ? Text IteratorEmitsObjectReplacementCharacter : TextIteratorDefaultBehavior); |
| 323 if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace()) | 330 if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace()) |
| 324 return; | 331 return; |
| 325 | 332 |
| 326 if (newSelection.rootEditableElement() && pos.deepEquivalent() == Visibl ePositionInFlatTree::lastPositionInNode(newSelection.rootEditableElement()).deep Equivalent()) | 333 if (newSelection.rootEditableElement() && pos.deepEquivalent() == Visibl ePositionInFlatTree::lastPositionInNode(newSelection.rootEditableElement()).deep Equivalent()) |
| 327 return; | 334 return; |
| 328 } | 335 } |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 return event.event().altKey() && event.isOverLink(); | 679 return event.event().altKey() && event.isOverLink(); |
| 673 } | 680 } |
| 674 | 681 |
| 675 bool isExtendingSelection(const MouseEventWithHitTestResults& event) | 682 bool isExtendingSelection(const MouseEventWithHitTestResults& event) |
| 676 { | 683 { |
| 677 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult(). image(); | 684 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult(). image(); |
| 678 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; | 685 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; |
| 679 } | 686 } |
| 680 | 687 |
| 681 } // namespace blink | 688 } // namespace blink |
| OLD | NEW |