Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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(SelectionInDOMTree::Builder() |
| 412 frame.Selection().SetSelectedRange(new_range, affinity, | 412 .SetBaseAndExtent(new_range) |
| 413 SelectionDirectionalMode::kNonDirectional, | 413 .SetAffinity(VP_DEFAULT_AFFINITY) |
|
yosin_UTC9
2017/05/22 04:59:44
nit: We don't need to call |SetAffinity(VP_DEFAULT
tanvir
2017/05/22 12:29:46
Done.
| |
| 414 FrameSelection::kCloseTyping); | 414 .SetIsDirectional(false) |
|
yosin_UTC9
2017/05/22 04:59:43
nit: No need to call |SetIsDirectional()|. The def
tanvir
2017/05/22 12:29:46
Done.
| |
| 415 .Build(), | |
| 416 FrameSelection::kCloseTyping); | |
| 415 return true; | 417 return true; |
| 416 } | 418 } |
| 417 | 419 |
| 418 static bool HasChildTags(Element& element, const QualifiedName& tag_name) { | 420 static bool HasChildTags(Element& element, const QualifiedName& tag_name) { |
| 419 return !element.getElementsByTagName(tag_name.LocalName())->IsEmpty(); | 421 return !element.getElementsByTagName(tag_name.LocalName())->IsEmpty(); |
| 420 } | 422 } |
| 421 | 423 |
| 422 static TriState SelectionListState(const FrameSelection& selection, | 424 static TriState SelectionListState(const FrameSelection& selection, |
| 423 const QualifiedName& tag_name) { | 425 const QualifiedName& tag_name) { |
| 424 if (selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsCaret()) { | 426 if (selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsCaret()) { |
| (...skipping 2603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3028 *frame_, kDirectionBackward, kWordGranularity); | 3030 *frame_, kDirectionBackward, kWordGranularity); |
| 3029 case WebEditingCommandType::kDeleteWordForward: | 3031 case WebEditingCommandType::kDeleteWordForward: |
| 3030 return RangesFromCurrentSelectionOrExtendCaret(*frame_, kDirectionForward, | 3032 return RangesFromCurrentSelectionOrExtendCaret(*frame_, kDirectionForward, |
| 3031 kWordGranularity); | 3033 kWordGranularity); |
| 3032 default: | 3034 default: |
| 3033 return TargetRangesForInputEvent(*target); | 3035 return TargetRangesForInputEvent(*target); |
| 3034 } | 3036 } |
| 3035 } | 3037 } |
| 3036 | 3038 |
| 3037 } // namespace blink | 3039 } // namespace blink |
| OLD | NEW |