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

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

Issue 328243004: Change a FrameSelection::setSelectedRange argument type from bool to enum. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 | « no previous file | Source/core/editing/FrameSelection.h » ('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 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 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 * Copyright (C) 2009 Igalia S.L. 4 * Copyright (C) 2009 Igalia S.L.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 static bool expandSelectionToGranularity(LocalFrame& frame, TextGranularity gran ularity) 212 static bool expandSelectionToGranularity(LocalFrame& frame, TextGranularity gran ularity)
213 { 213 {
214 VisibleSelection selection = frame.selection().selection(); 214 VisibleSelection selection = frame.selection().selection();
215 selection.expandUsingGranularity(granularity); 215 selection.expandUsingGranularity(granularity);
216 RefPtrWillBeRawPtr<Range> newRange = selection.toNormalizedRange(); 216 RefPtrWillBeRawPtr<Range> newRange = selection.toNormalizedRange();
217 if (!newRange) 217 if (!newRange)
218 return false; 218 return false;
219 if (newRange->collapsed()) 219 if (newRange->collapsed())
220 return false; 220 return false;
221 EAffinity affinity = frame.selection().affinity(); 221 EAffinity affinity = frame.selection().affinity();
222 frame.selection().setSelectedRange(newRange.get(), affinity, false, FrameSel ection::CloseTyping); 222 frame.selection().setSelectedRange(newRange.get(), affinity, FrameSelection: :NonDirectional, FrameSelection::CloseTyping);
223 return true; 223 return true;
224 } 224 }
225 225
226 static TriState stateStyle(LocalFrame& frame, CSSPropertyID propertyID, const ch ar* desiredValue) 226 static TriState stateStyle(LocalFrame& frame, CSSPropertyID propertyID, const ch ar* desiredValue)
227 { 227 {
228 if (frame.editor().behavior().shouldToggleStyleBasedOnStartOfSelection()) 228 if (frame.editor().behavior().shouldToggleStyleBasedOnStartOfSelection())
229 return frame.editor().selectionStartHasStyle(propertyID, desiredValue) ? TrueTriState : FalseTriState; 229 return frame.editor().selectionStartHasStyle(propertyID, desiredValue) ? TrueTriState : FalseTriState;
230 return frame.editor().selectionHasStyle(propertyID, desiredValue); 230 return frame.editor().selectionHasStyle(propertyID, desiredValue);
231 } 231 }
232 232
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // Despite its name, this command should delete the newline at the end of 374 // Despite its name, this command should delete the newline at the end of
375 // a paragraph if you are at the end of a paragraph. 375 // a paragraph if you are at the end of a paragraph.
376 frame.editor().deleteWithDirection(DirectionForward, ParagraphBoundary, true , false); 376 frame.editor().deleteWithDirection(DirectionForward, ParagraphBoundary, true , false);
377 return true; 377 return true;
378 } 378 }
379 379
380 static bool executeDeleteToMark(LocalFrame& frame, Event*, EditorCommandSource, const String&) 380 static bool executeDeleteToMark(LocalFrame& frame, Event*, EditorCommandSource, const String&)
381 { 381 {
382 RefPtrWillBeRawPtr<Range> mark = frame.editor().mark().toNormalizedRange(); 382 RefPtrWillBeRawPtr<Range> mark = frame.editor().mark().toNormalizedRange();
383 if (mark) { 383 if (mark) {
384 bool selected = frame.selection().setSelectedRange(unionDOMRanges(mark.g et(), frame.editor().selectedRange().get()).get(), DOWNSTREAM, false, FrameSelec tion::CloseTyping); 384 bool selected = frame.selection().setSelectedRange(unionDOMRanges(mark.g et(), frame.editor().selectedRange().get()).get(), DOWNSTREAM, FrameSelection::N onDirectional, FrameSelection::CloseTyping);
385 ASSERT(selected); 385 ASSERT(selected);
386 if (!selected) 386 if (!selected)
387 return false; 387 return false;
388 } 388 }
389 frame.editor().performDelete(); 389 frame.editor().performDelete();
390 frame.editor().setMark(frame.selection().selection()); 390 frame.editor().setMark(frame.selection().selection());
391 return true; 391 return true;
392 } 392 }
393 393
394 static bool executeDeleteWordBackward(LocalFrame& frame, Event*, EditorCommandSo urce, const String&) 394 static bool executeDeleteWordBackward(LocalFrame& frame, Event*, EditorCommandSo urce, const String&)
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 { 1024 {
1025 return expandSelectionToGranularity(frame, SentenceGranularity); 1025 return expandSelectionToGranularity(frame, SentenceGranularity);
1026 } 1026 }
1027 1027
1028 static bool executeSelectToMark(LocalFrame& frame, Event*, EditorCommandSource, const String&) 1028 static bool executeSelectToMark(LocalFrame& frame, Event*, EditorCommandSource, const String&)
1029 { 1029 {
1030 RefPtrWillBeRawPtr<Range> mark = frame.editor().mark().toNormalizedRange(); 1030 RefPtrWillBeRawPtr<Range> mark = frame.editor().mark().toNormalizedRange();
1031 RefPtrWillBeRawPtr<Range> selection = frame.editor().selectedRange(); 1031 RefPtrWillBeRawPtr<Range> selection = frame.editor().selectedRange();
1032 if (!mark || !selection) 1032 if (!mark || !selection)
1033 return false; 1033 return false;
1034 frame.selection().setSelectedRange(unionDOMRanges(mark.get(), selection.get( )).get(), DOWNSTREAM, false, FrameSelection::CloseTyping); 1034 frame.selection().setSelectedRange(unionDOMRanges(mark.get(), selection.get( )).get(), DOWNSTREAM, FrameSelection::NonDirectional, FrameSelection::CloseTypin g);
1035 return true; 1035 return true;
1036 } 1036 }
1037 1037
1038 static bool executeSelectWord(LocalFrame& frame, Event*, EditorCommandSource, co nst String&) 1038 static bool executeSelectWord(LocalFrame& frame, Event*, EditorCommandSource, co nst String&)
1039 { 1039 {
1040 return expandSelectionToGranularity(frame, WordGranularity); 1040 return expandSelectionToGranularity(frame, WordGranularity);
1041 } 1041 }
1042 1042
1043 static bool executeSetMark(LocalFrame& frame, Event*, EditorCommandSource, const String&) 1043 static bool executeSetMark(LocalFrame& frame, Event*, EditorCommandSource, const String&)
1044 { 1044 {
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 { 1734 {
1735 return m_command && m_command->isTextInsertion; 1735 return m_command && m_command->isTextInsertion;
1736 } 1736 }
1737 1737
1738 int Editor::Command::idForHistogram() const 1738 int Editor::Command::idForHistogram() const
1739 { 1739 {
1740 return isSupported() ? m_command->idForUserMetrics : 0; 1740 return isSupported() ? m_command->idForUserMetrics : 0;
1741 } 1741 }
1742 1742
1743 } // namespace WebCore 1743 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/FrameSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698