New issue
Advanced search Search tips

Issue 800887 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task



Sign in to add a comment

[LayoutNG] Generated characters and TextIterator

Project Member Reported by kojii@chromium.org, Jan 10 2018

Issue description

From the discussion in CL:859817

There are some meta-characters in NGInlineNode:
1. A collapsed space after nowrap space will generate ZWS.
2. <br> generates LF.
3. <wbr> generates ZWS.

1 is new to LayoutNG.

Should we eliminate all/some of them from the output of TI? If so, how?
 

Comment 1 by kojii@chromium.org, Jan 10 2018

4. Bidi control characters.
Only 1 seems problematic to me.

2 and 3 are consistent with legacy, and are kind of expected.

4 is not associated to any text node, and hence, ignored by TI

Comment 3 by kojii@chromium.org, Jan 10 2018

Ok, how can I tell TI that a character is not associated to any text node?
A character is associated to a text node only if it is "annotated" in NGOffsetMappingBuilder.

Conceptually, NGOffsetMappingBuilder maintains:

A. source string, which is a concatenation of DOM text nodes and generated content

B. "annotation" of source string: for each character in the source string, it gives the text node (possibly null) that the char comes from

C. destination string, which is |text_content_|

D. mapping info from source string to destination string, i.e., which characters in source strings are collapsed and which are preserved

For this issue, my proposa is:

HTML: <span style='white-space: nowrap'>foo </span> bar


Current behavior:

source string: "foo  bar"
annotation: TEXT"foo " for "foo ", and TEXT" bar" for " bar"
destination string: "foo " + ZWS + "bar"
mapping: "foo " to "foo ", " " to ZWS, "bar" to "bar"

Proposed change:

source string: "foo " + ZWS + " bar"
annotation: TEXT"foo " for "foo ", null for ZWS, " bar" for " bar"
destination string: "foo " + ZWS + "bar"
mapping: "foo " to "foo ", ZWS to ZWS, " " collapsed, "bar" to "bar"


In some sense, it's treating the ZWS as a generated character that's not part of any node
I can make a patch of that :)

Comment 6 by kojii@chromium.org, Jan 10 2018

The proposed change looks good to me, just don't know how to code it. Thank you for taking this!
Project Member

Comment 7 by bugdroid1@chromium.org, Jan 11 2018

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

commit e4bb0f008e7ea866f938c72c1ab8536c4fc86adf
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Thu Jan 11 04:21:47 2018

[LayoutNG] Stop emitting ZWS for collapsed space after no-wrap space

When there is a collapsed space following a nowrap space, we used to convert
the collapsed space into a ZWS to allow wrapping, which, however, makes
TextIterator emit a ZWS for the collapsed space.

This patch fixes the issue by not treating the ZWS part of the text node, but
as generated text between the two text nodes instead.

Bug:  800887 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I6cda36042b145f3733a33067f9787fd6c2fa4c94
Reviewed-on: https://chromium-review.googlesource.com/861056
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528558}
[modify] https://crrev.com/e4bb0f008e7ea866f938c72c1ab8536c4fc86adf/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
[modify] https://crrev.com/e4bb0f008e7ea866f938c72c1ab8536c4fc86adf/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_items_builder.cc
[modify] https://crrev.com/e4bb0f008e7ea866f938c72c1ab8536c4fc86adf/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
[modify] https://crrev.com/e4bb0f008e7ea866f938c72c1ab8536c4fc86adf/third_party/WebKit/Source/core/layout/ng/inline/ng_offset_mapping_test.cc

Status: Fixed (was: Available)

Sign in to add a comment