New issue
Advanced search Search tips

Issue 906915 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 21
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug
Team-Accessibility



Sign in to add a comment

LayoutText::LastCharacterAfterWhitespaceCollapsing() should return valid Unicode code point

Project Member Reported by yosin@chromium.org, Nov 20

Issue description

LayoutText::LastCharacterAfterWhitespaceCollapsing() uses String::CharacterStringAt() with length-1 then it returns last part of surrogate pair of UTF-16 instead of Unicode code point.

UChar32 StringImpl::CharacterStartingAt(wtf_size_t i) {
  if (Is8Bit())
    return Characters8()[i];
  if (U16_IS_SINGLE(Characters16()[i]))
    return Characters16()[i];
  if (i + 1 < length_ && U16_IS_LEAD(Characters16()[i]) &&
      U16_IS_TRAIL(Characters16()[i + 1]))
    return U16_GET_SUPPLEMENTARY(Characters16()[i], Characters16()[i + 1]);
  return 0;
}
 
Owner: yosin@chromium.org
Status: Started (was: Available)
Project Member

Comment 2 by bugdroid1@chromium.org, Nov 20

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8d78c42cc8e811a947fa5908b0ccea6eedce4954

commit 8d78c42cc8e811a947fa5908b0ccea6eedce4954
Author: Yoshifumi Inoue <yosin@chromium.org>
Date: Tue Nov 20 09:53:40 2018

[LayoutNG] Implement LayoutNG version of {First,Last}CharacterAfterWhitespaceCollapsing()

This patch implements LayoutNG version of |LayoutText::
{First,Last}CharacterAfterWhitespaceCollapsing()| with making a unit test,
|CharacterAfterWhitespaceCollapsing| to run on both legacy and ng layout tree.

This patch also changes legacy layout tree path of
|LastCharacterAfterWhitespaceCollapsing()| to use |StringView::CodepointAt()|
instead of |String::CharacterStartingAt()| to return last code point in string
instead of trail part of surrogate pair.

Bug:  906915 
Change-Id: I364195c5b9366cf7ca890ba2738a4be37779a6bd
Reviewed-on: https://chromium-review.googlesource.com/c/1341776
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609652}
[modify] https://crrev.com/8d78c42cc8e811a947fa5908b0ccea6eedce4954/third_party/blink/renderer/core/layout/layout_text.cc
[modify] https://crrev.com/8d78c42cc8e811a947fa5908b0ccea6eedce4954/third_party/blink/renderer/core/layout/layout_text_test.cc

Status: Fixed (was: Started)

Sign in to add a comment