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

Side by Side Diff: Source/core/editing/Editor.cpp

Issue 1307803003: Introduce nextPositionOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T18:13:02 Created 5 years, 3 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 | « Source/core/editing/EditingUtilities.cpp ('k') | Source/core/editing/FrameSelection.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, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 { 1016 {
1017 if (!canEdit()) 1017 if (!canEdit())
1018 return; 1018 return;
1019 1019
1020 VisibleSelection selection = frame().selection().selection(); 1020 VisibleSelection selection = frame().selection().selection();
1021 if (!selection.isCaret()) 1021 if (!selection.isCaret())
1022 return; 1022 return;
1023 1023
1024 // Make a selection that goes back one character and forward two characters. 1024 // Make a selection that goes back one character and forward two characters.
1025 VisiblePosition caret = selection.visibleStart(); 1025 VisiblePosition caret = selection.visibleStart();
1026 VisiblePosition next = isEndOfParagraph(caret) ? caret : caret.next(); 1026 VisiblePosition next = isEndOfParagraph(caret) ? caret : nextPositionOf(care t);
1027 VisiblePosition previous = previousPositionOf(next); 1027 VisiblePosition previous = previousPositionOf(next);
1028 if (next.deepEquivalent() == previous.deepEquivalent()) 1028 if (next.deepEquivalent() == previous.deepEquivalent())
1029 return; 1029 return;
1030 previous = previousPositionOf(previous); 1030 previous = previousPositionOf(previous);
1031 if (!inSameParagraph(next, previous)) 1031 if (!inSameParagraph(next, previous))
1032 return; 1032 return;
1033 const EphemeralRange range = makeRange(previous, next); 1033 const EphemeralRange range = makeRange(previous, next);
1034 if (range.isNull()) 1034 if (range.isNull())
1035 return; 1035 return;
1036 VisibleSelection newSelection(range); 1036 VisibleSelection newSelection(range);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 } 1301 }
1302 1302
1303 DEFINE_TRACE(Editor) 1303 DEFINE_TRACE(Editor)
1304 { 1304 {
1305 visitor->trace(m_frame); 1305 visitor->trace(m_frame);
1306 visitor->trace(m_lastEditCommand); 1306 visitor->trace(m_lastEditCommand);
1307 visitor->trace(m_mark); 1307 visitor->trace(m_mark);
1308 } 1308 }
1309 1309
1310 } // namespace blink 1310 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/EditingUtilities.cpp ('k') | Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698