[webkit-changes] [WebKit/WebKit] 1b5393: [css-lists] `content: counter()` does not update v...

Alan Baradlay noreply at github.com
Wed Mar 29 05:30:56 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1b539330d2addabb80fda1703357c623a77d4dfd
      https://github.com/WebKit/WebKit/commit/1b539330d2addabb80fda1703357c623a77d4dfd
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-03-29 (Wed, 29 Mar 2023)

  Changed paths:
    A LayoutTests/fast/dynamic/out-of-flow-counter-do-not-update-expected.html
    A LayoutTests/fast/dynamic/out-of-flow-counter-do-not-update.html
    M Source/WebCore/rendering/CounterNode.cpp

  Log Message:
  -----------
  [css-lists] `content: counter()` does not update visually if `position: absolute` is set
https://bugs.webkit.org/show_bug.cgi?id=254575

Reviewed by Antti Koivisto.

1. In order to update counters in IFC, the containing RenderBlockFlow needs to get invalidated (a new InlineTextBox is created for the text).
2. With in-flow pseudo renderers, where the RenderCounter is nested inside an inline box,
invalidation goes through the normal styleDidChange codepath.

RenderBlockFlow (A) <- this is where the counter is.
  <pseudo> RenderInline (B) <- in-flow :after
    RenderCounter (C)

However out-of-flow pseudo content initiates a different type of tree structure
where the RenderCounter is not part of the initial RenderBlockFlow anymore

RenderBlockFlow (A) <- this is where the counter is
  <pseudo> RenderBlockFlow (B) <- out-of-flow :after
    RenderCounter (C)
Which means invalidating (A) (where the style change happens) does not trigger an IFC tree re-build at (B)
and we end up re-layouting the exact same content over again (C).

This patch ensures we always invalidate the block flow where the damage happens
(and this should cover some more involved cases with counters in arbitrary number of subtrees).

* LayoutTests/fast/dynamic/out-of-flow-counter-do-not-update-expected.html: Added.
* LayoutTests/fast/dynamic/out-of-flow-counter-do-not-update.html: Added.
* Source/WebCore/rendering/CounterNode.cpp:
(WebCore::CounterNode::resetRenderers): This function is called whenever a new counter node is added/removed/updated. This is also where we call setNeedsLayoutAndPrefWidthsRecalc
which eventually updates the counter for legacy line layout.

Canonical link: https://commits.webkit.org/262269@main




More information about the webkit-changes mailing list