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

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

Issue 2897633002: Remove SetSelectedRange from ExpandSelectionToGranularity() (Closed)
Patch Set: updated Created 3 years, 7 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 | no next file » | 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 frame.Selection() 401 frame.Selection()
402 .ComputeVisibleSelectionInDOMTreeDeprecated() 402 .ComputeVisibleSelectionInDOMTreeDeprecated()
403 .Extent()) 403 .Extent())
404 .SetGranularity(granularity) 404 .SetGranularity(granularity)
405 .Build()); 405 .Build());
406 const EphemeralRange new_range = selection.ToNormalizedEphemeralRange(); 406 const EphemeralRange new_range = selection.ToNormalizedEphemeralRange();
407 if (new_range.IsNull()) 407 if (new_range.IsNull())
408 return false; 408 return false;
409 if (new_range.IsCollapsed()) 409 if (new_range.IsCollapsed())
410 return false; 410 return false;
411 TextAffinity affinity = frame.Selection().GetSelectionInDOMTree().Affinity(); 411 frame.Selection().SetSelection(
412 frame.Selection().SetSelectedRange(new_range, affinity, 412 SelectionInDOMTree::Builder().SetBaseAndExtent(new_range).Build(),
413 SelectionDirectionalMode::kNonDirectional, 413 FrameSelection::kCloseTyping);
414 FrameSelection::kCloseTyping);
415 return true; 414 return true;
416 } 415 }
417 416
418 static bool HasChildTags(Element& element, const QualifiedName& tag_name) { 417 static bool HasChildTags(Element& element, const QualifiedName& tag_name) {
419 return !element.getElementsByTagName(tag_name.LocalName())->IsEmpty(); 418 return !element.getElementsByTagName(tag_name.LocalName())->IsEmpty();
420 } 419 }
421 420
422 static TriState SelectionListState(const FrameSelection& selection, 421 static TriState SelectionListState(const FrameSelection& selection,
423 const QualifiedName& tag_name) { 422 const QualifiedName& tag_name) {
424 if (selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsCaret()) { 423 if (selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsCaret()) {
(...skipping 2603 matching lines...) Expand 10 before | Expand all | Expand 10 after
3028 *frame_, kDirectionBackward, kWordGranularity); 3027 *frame_, kDirectionBackward, kWordGranularity);
3029 case WebEditingCommandType::kDeleteWordForward: 3028 case WebEditingCommandType::kDeleteWordForward:
3030 return RangesFromCurrentSelectionOrExtendCaret(*frame_, kDirectionForward, 3029 return RangesFromCurrentSelectionOrExtendCaret(*frame_, kDirectionForward,
3031 kWordGranularity); 3030 kWordGranularity);
3032 default: 3031 default:
3033 return TargetRangesForInputEvent(*target); 3032 return TargetRangesForInputEvent(*target);
3034 } 3033 }
3035 } 3034 }
3036 3035
3037 } // namespace blink 3036 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698