Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't do whitespace re-attachment for ::first-letter. #12588

Merged
merged 1 commit into from Aug 21, 2018

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Aug 21, 2018

If we have a white-space node before the text node with the first
letter, we would try to re-attach the white-space node with an incorrect
previous in-flow LayoutObject because we attach the ::first-letter after
all children have been attached, not where the ::first-letter would end
up in the layout tree.

We don't need to re-attach whitespace after ::first-letter because:

  • We always create a remaining LayoutTextFragment for the text node
    which contains the first formatted letter. Wether the remaining text
    consists of white-space or is even empty.

  • If the LayoutObject sibling following first-letter+remaining-text
    consists of white-space, it would have gotten a LayoutObject when
    attaching the LayoutText for the text node where the first-letter
    comes from.

That is, we will always have a LayoutObject for a white-space LayoutText
sibling of a first-letter LayoutObject.

Split out a separate method for ::first-letter for less complexity and
cost with which WhitespaceAttacher to use.

Bug: 876150
Change-Id: Ib1f34f0ba596d5fa5f1c7fcbd7c75550dd4f9d12
Reviewed-on: https://chromium-review.googlesource.com/1183231
Reviewed-by: Xiaocheng Hu xiaochengh@chromium.org
Commit-Queue: Rune Lillesveen futhark@chromium.org
Cr-Commit-Position: refs/heads/master@{#584866}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already reviewed downstream.

If we have a white-space node before the text node with the first
letter, we would try to re-attach the white-space node with an incorrect
previous in-flow LayoutObject because we attach the ::first-letter after
all children have been attached, not where the ::first-letter would end
up in the layout tree.

We don't need to re-attach whitespace after ::first-letter because:

* We always create a remaining LayoutTextFragment for the text node
  which contains the first formatted letter. Wether the remaining text
  consists of white-space or is even empty.

* If the LayoutObject sibling following first-letter+remaining-text
  consists of white-space, it would have gotten a LayoutObject when
  attaching the LayoutText for the text node where the first-letter
  comes from.

That is, we will always have a LayoutObject for a white-space LayoutText
sibling of a first-letter LayoutObject.

Split out a separate method for ::first-letter for less complexity and
cost with which WhitespaceAttacher to use.

Bug: 876150
Change-Id: Ib1f34f0ba596d5fa5f1c7fcbd7c75550dd4f9d12
Reviewed-on: https://chromium-review.googlesource.com/1183231
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584866}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants