Commit 24652e9f authored by yoichio's avatar yoichio Committed by Commit Bot

Remove redundant selection judge from EmbeddedContentPainter

EmbeddedContentPainter::IsSelected() is used to decide if paint 
 selection or not.
This function is strange because it refers selection_start/end.
That's because seletion_start/end means offset in the layout object
 and since replaced element neither be text nor have child 
LayoutObject.
Thus we should just consider SelectionState is kNone or not.

Bug: 739062
Change-Id: I249d8c2acef959ad437f3a636a490f42b61270e0
Reviewed-on: https://chromium-review.googlesource.com/575126Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488109}
parent 7645a808
......@@ -23,25 +23,8 @@ bool EmbeddedContentPainter::IsSelected() const {
SelectionState s = layout_embedded_content_.GetSelectionState();
if (s == SelectionState::kNone)
return false;
if (s == SelectionState::kInside)
return true;
int selection_start, selection_end;
std::tie(selection_start, selection_end) =
layout_embedded_content_.SelectionStartEnd();
if (s == SelectionState::kStart)
return selection_start == 0;
int end = layout_embedded_content_.GetNode()->hasChildren()
? layout_embedded_content_.GetNode()->CountChildren()
: 1;
if (s == SelectionState::kEnd)
return selection_end == end;
if (s == SelectionState::kStartAndEnd)
return selection_start == 0 && selection_end == end;
DCHECK(0);
return false;
return true;
}
void EmbeddedContentPainter::Paint(const PaintInfo& paint_info,
......
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