Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Side by Side Diff: third_party/WebKit/Source/core/editing/SelectionController.cpp

Issue 2104883002: Change text selection iterator behaviour for non-editable empty selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added myself in AUTHORS list. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 const VisiblePositionInFlatTree& pos = visiblePositionOfHitTestResult(adjust edHitTestResult); 311 const VisiblePositionInFlatTree& pos = visiblePositionOfHitTestResult(adjust edHitTestResult);
312 if (pos.isNotNull()) { 312 if (pos.isNotNull()) {
313 newSelection = VisibleSelectionInFlatTree(pos); 313 newSelection = VisibleSelectionInFlatTree(pos);
314 newSelection.expandUsingGranularity(WordGranularity); 314 newSelection.expandUsingGranularity(WordGranularity);
315 } 315 }
316 316
317 if (selectInputEventType == SelectInputEventType::Touch) { 317 if (selectInputEventType == SelectInputEventType::Touch) {
318 // If node doesn't have text except space, tab or line break, do not 318 // If node doesn't have text except space, tab or line break, do not
319 // select that 'empty' area. 319 // select that 'empty' area.
320 EphemeralRangeInFlatTree range(newSelection.start(), newSelection.end()) ; 320 EphemeralRangeInFlatTree range(newSelection.start(), newSelection.end()) ;
321 const String& str = plainText(range, TextIteratorEmitsObjectReplacementC haracter); 321 const String& str = plainText(range, innerNode->hasEditableStyle() ? Tex tIteratorEmitsObjectReplacementCharacter : TextIteratorDefaultBehavior);
322 if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace()) 322 if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace())
323 return; 323 return;
324 324
325 if (newSelection.rootEditableElement() && pos.deepEquivalent() == Visibl ePositionInFlatTree::lastPositionInNode(newSelection.rootEditableElement()).deep Equivalent()) 325 if (newSelection.rootEditableElement() && pos.deepEquivalent() == Visibl ePositionInFlatTree::lastPositionInNode(newSelection.rootEditableElement()).deep Equivalent())
326 return; 326 return;
327 } 327 }
328 328
329 if (appendTrailingWhitespace == AppendTrailingWhitespace::ShouldAppend && ne wSelection.isRange()) 329 if (appendTrailingWhitespace == AppendTrailingWhitespace::ShouldAppend && ne wSelection.isRange())
330 newSelection.appendTrailingWhitespace(); 330 newSelection.appendTrailingWhitespace();
331 331
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 { 664 {
665 return m_frame->selection(); 665 return m_frame->selection();
666 } 666 }
667 667
668 bool isLinkSelection(const MouseEventWithHitTestResults& event) 668 bool isLinkSelection(const MouseEventWithHitTestResults& event)
669 { 669 {
670 return event.event().altKey() && event.isOverLink(); 670 return event.event().altKey() && event.isOverLink();
671 } 671 }
672 672
673 } // namespace blink 673 } // namespace blink
OLDNEW
« no previous file with comments | « AUTHORS ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698