Commit 88f8d725 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Chromium LUCI CQ

Get rid of unused function VisibleSelection::CreateWithoutValidationDeprecated()

This patch gets rid of unused function |VisibleSelection::
CreateWithoutValidationDeprecated()| for improving code health.

Change-Id: I17802935d39859369c62630c91e26acaa95fa8db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563389
Commit-Queue: Kent Tamura <tkent@chromium.org>
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832116}
parent 2e1dd46f
...@@ -264,37 +264,6 @@ bool VisibleSelectionTemplate<Strategy>::IsValidFor( ...@@ -264,37 +264,6 @@ bool VisibleSelectionTemplate<Strategy>::IsValidFor(
return base_.IsValidFor(document) && extent_.IsValidFor(document); return base_.IsValidFor(document) && extent_.IsValidFor(document);
} }
// TODO(yosin) This function breaks the invariant of this class.
// But because we use VisibleSelection to store values in editing commands for
// use when undoing the command, we need to be able to create a selection that
// while currently invalid, will be valid once the changes are undone. This is a
// design problem. To fix it we either need to change the invariants of
// |VisibleSelection| or create a new class for editing to use that can
// manipulate selections that are not currently valid.
template <typename Strategy>
VisibleSelectionTemplate<Strategy>
VisibleSelectionTemplate<Strategy>::CreateWithoutValidationDeprecated(
const PositionTemplate<Strategy>& base,
const PositionTemplate<Strategy>& extent,
TextAffinity affinity) {
DCHECK(base.IsNotNull());
DCHECK(extent.IsNotNull());
VisibleSelectionTemplate<Strategy> visible_selection;
visible_selection.base_ = base;
visible_selection.extent_ = extent;
visible_selection.base_is_first_ = base.CompareTo(extent) <= 0;
if (base == extent) {
visible_selection.affinity_ = affinity;
return visible_selection;
}
// Since |affinity_| for non-|CaretSelection| is always |kDownstream|,
// we should keep this invariant. Note: This function can be called with
// |affinity_| is |kUpstream|.
visible_selection.affinity_ = TextAffinity::kDownstream;
return visible_selection;
}
template <typename Strategy> template <typename Strategy>
bool VisibleSelectionTemplate<Strategy>::IsContentEditable() const { bool VisibleSelectionTemplate<Strategy>::IsContentEditable() const {
return IsEditablePosition(Start()); return IsEditablePosition(Start());
......
...@@ -87,14 +87,6 @@ class VisibleSelectionTemplate { ...@@ -87,14 +87,6 @@ class VisibleSelectionTemplate {
bool IsValidFor(const Document&) const; bool IsValidFor(const Document&) const;
// TODO(editing-dev): |CreateWithoutValidationDeprecated()| is allowed
// only to use in |TypingCommand| to remove part of grapheme cluster.
// Note: |base| and |extent| can be disconnect position.
static VisibleSelectionTemplate<Strategy> CreateWithoutValidationDeprecated(
const PositionTemplate<Strategy>& base,
const PositionTemplate<Strategy>& extent,
TextAffinity);
void Trace(Visitor*) const; void Trace(Visitor*) const;
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment