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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 if (!innerNode || !innerNode->layoutObject()) | 297 if (!innerNode || !innerNode->layoutObject()) |
| 298 return; | 298 return; |
| 299 | 299 |
| 300 const VisiblePositionTemplate<Strategy> pos = createVisiblePosition(fromPosi tionInDOMTree<Strategy>(innerNode->layoutObject()->positionForPoint(result.local Point()))); | 300 const VisiblePositionTemplate<Strategy> pos = createVisiblePosition(fromPosi tionInDOMTree<Strategy>(innerNode->layoutObject()->positionForPoint(result.local Point()))); |
| 301 if (pos.isNotNull()) { | 301 if (pos.isNotNull()) { |
| 302 newSelection = VisibleSelectionTemplate<Strategy>(pos); | 302 newSelection = VisibleSelectionTemplate<Strategy>(pos); |
| 303 newSelection.expandUsingGranularity(WordGranularity); | 303 newSelection.expandUsingGranularity(WordGranularity); |
| 304 } | 304 } |
| 305 | 305 |
| 306 #if OS(ANDROID) | 306 #if OS(ANDROID) |
| 307 // If node is not editable and doesn't have text except space, tab or | 307 // If node doesn't have text except space, tab or line break, do not |
| 308 // line break, do not select that 'empty' area. | 308 // select that 'empty' area. |
| 309 if (!innerNode->hasEditableStyle()) { | 309 EphemeralRangeTemplate<Strategy> range = EphemeralRangeTemplate<Strategy>(ne wSelection.start(), newSelection.end()); |
| 310 EphemeralRangeTemplate<Strategy> range = EphemeralRangeTemplate<Strategy >(newSelection.start(), newSelection.end()); | 310 String str = plainText(range, TextIteratorDefaultBehavior); |
|
yosin_UTC9
2016/02/03 06:49:28
nit: |const String&| to avoid unnecessary copy of
| |
| 311 String str = plainText(range, TextIteratorDefaultBehavior); | 311 if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace()) |
| 312 if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace()) | 312 return; |
| 313 return; | |
| 314 } | |
| 315 #endif | 313 #endif |
| 316 | 314 |
| 317 if (appendTrailingWhitespace == AppendTrailingWhitespace::ShouldAppend && ne wSelection.isRange()) | 315 if (appendTrailingWhitespace == AppendTrailingWhitespace::ShouldAppend && ne wSelection.isRange()) |
| 318 newSelection.appendTrailingWhitespace(); | 316 newSelection.appendTrailingWhitespace(); |
| 319 | 317 |
| 320 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelection ToRespectUserSelectAll(innerNode, newSelection), WordGranularity); | 318 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelection ToRespectUserSelectAll(innerNode, newSelection), WordGranularity); |
| 321 } | 319 } |
| 322 | 320 |
| 323 template <typename Strategy> | 321 template <typename Strategy> |
| 324 void SelectionController::selectClosestMisspellingFromHitTestResult(const HitTes tResult& result, AppendTrailingWhitespace appendTrailingWhitespace) | 322 void SelectionController::selectClosestMisspellingFromHitTestResult(const HitTes tResult& result, AppendTrailingWhitespace appendTrailingWhitespace) |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 else | 676 else |
| 679 m_selectionState = SelectionState::HaveNotStartedSelection; | 677 m_selectionState = SelectionState::HaveNotStartedSelection; |
| 680 } | 678 } |
| 681 | 679 |
| 682 FrameSelection& SelectionController::selection() const | 680 FrameSelection& SelectionController::selection() const |
| 683 { | 681 { |
| 684 return m_frame->selection(); | 682 return m_frame->selection(); |
| 685 } | 683 } |
| 686 | 684 |
| 687 } // namespace blink | 685 } // namespace blink |
| OLD | NEW |