ApplyBlockElementCommand::doApply() has redundant null selection check |
||
Issue description
ApplyBlockElementCommand::doApply, L78-
if (visibleEnd.deepEquivalent() != visibleStart.deepEquivalent() &&
isStartOfParagraph(visibleEnd)) {
const Position& newEnd =
previousPositionOf(visibleEnd, CannotCrossEditingBoundary)
.deepEquivalent();
SelectionInDOMTree::Builder builder;
builder.collapse(visibleStart.toPositionWithAffinity());
if (newEnd.isNotNull())
builder.extend(newEnd);
builder.setIsDirectional(endingSelection().isDirectional());
const SelectionInDOMTree& newSelection = builder.build();
// This is redundant, since |visilbeStart| is not null here.
if (newSelection.isNone())
return;
setEndingSelection(newSelection);
}
,
Feb 14 2018
,
Mar 20 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c75064c05568d94869822773ce134c66153a04aa commit c75064c05568d94869822773ce134c66153a04aa Author: Zhuoyu Qian <zhuoyu.qian@samsung.com> Date: Tue Mar 20 10:54:12 2018 Remove redundant null check in ApplyBlockElementCommand::DoApply() Since ApplyBlockElementCommand::DoApply() has checked |visible_start| is not null before, and |new_selection|'s base is |visible_start|, so |new_selection| can not be an empty selection and the null check of |new_selection| is redundant, we can remove it. Bug: 689392 Signed-off-by: Zhuoyu Qian <zhuoyu.qian@samsung.com> Change-Id: Ic278963f06b05b65a2d1a08532b9a2a78ef530d3 Reviewed-on: https://chromium-review.googlesource.com/967631 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#544325} [modify] https://crrev.com/c75064c05568d94869822773ce134c66153a04aa/third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp |
||
►
Sign in to add a comment |
||
Comment 1 by sheriffbot@chromium.org
, Feb 12 2018Status: Untriaged (was: Available)