Commit 0d80add3 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

LayoutText::LocalSelectionRect should return early if range is invalid

While working on supporting LayoutNG, it turns out that there are
several cases where the selection range becomes start > end.
  e.g., fast/text/selection/emphasis.html

Layout functions generally prefer proper checks are done in the
callers, rather than input arguments automatically corrected in
lower-level functions.

This patch makes LayoutText::LocalSelectionRect match to it.

Bug: 636993, 827925
Change-Id: I3068e70886f7cd425a2fd5f701ac0b7d77a8a978
Reviewed-on: https://chromium-review.googlesource.com/989474Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547430}
parent bc2dffe9
......@@ -2012,9 +2012,10 @@ LayoutRect LayoutText::LocalSelectionRect() const {
}
}
// TODO(yoichio): The following DCHECK should pass, but fails 14 tests.
// DCHECK_LE(start_pos, end_pos);
LayoutRect rect;
if (start_pos == end_pos)
if (start_pos >= end_pos)
return rect;
for (InlineTextBox* box : TextBoxes()) {
......
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