[webkit-changes] [WebKit/WebKit] c7578c: Intruduce concept of render tree rebuild root

Antti Koivisto noreply at github.com
Thu Nov 23 09:03:51 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c7578c8aa8bf5e14ebebbc1f531f4001fd7d1327
      https://github.com/WebKit/WebKit/commit/c7578c8aa8bf5e14ebebbc1f531f4001fd7d1327
  Author: Antti Koivisto <antti at apple.com>
  Date:   2023-11-23 (Thu, 23 Nov 2023)

  Changed paths:
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
    M Source/WebCore/rendering/updating/RenderTreeBuilder.h
    M Source/WebCore/rendering/updating/RenderTreeUpdater.cpp
    M Source/WebCore/rendering/updating/RenderTreeUpdater.h
    M Source/WebCore/style/StyleUpdate.cpp
    M Source/WebCore/style/StyleUpdate.h

  Log Message:
  -----------
  Intruduce concept of render tree rebuild root
https://bugs.webkit.org/show_bug.cgi?id=265284
rdar://118744369

Reviewed by Alan Baradlay.

Add mechanism to rebuild render subtree starting from an ancestor of the changed element.

We can simplify render tree mutations if some complex cases are handled by tearing
down a larger structure with all the associated anonymous boxes and rebuilding them.

Use the mechanism for <ruby> subtrees when style-based ruby is enabled. This gets tested by

fast/ruby/rubyDOM-insert-rt-block-1.html
fast/ruby/rubyDOM-insert-rt-block-2.html
fast/ruby/rubyDOM-insert-rt-block-3.html
fast/ruby/rubyDOM-remove-rt-block-1.html
fast/ruby/rubyDOM-remove-rt-block-2.html
fast/ruby/rubyDOM-remove-rt-block-3.html

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::updateRenderTree):
* Source/WebCore/dom/Document.h:
* Source/WebCore/rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::isRebuildRootForChildren):

Test if a given renderer is rebuild root for its children. For now this only tests for ruby.

* Source/WebCore/rendering/updating/RenderTreeBuilder.h:
* Source/WebCore/rendering/updating/RenderTreeUpdater.cpp:
(WebCore::findRenderingAncestor):
(WebCore::findRenderingRoot):
(WebCore::RenderTreeUpdater::commit):
(WebCore::RenderTreeUpdater::updateRebuildRoots):

In the beginning of a commit check if any of the rebuild roots need a wider rebuild.
Add all the new elements that will get rebuild to the style update.

* Source/WebCore/rendering/updating/RenderTreeUpdater.h:
* Source/WebCore/style/StyleUpdate.cpp:
(WebCore::Style::Update::addElement):
(WebCore::Style::Update::addPossibleRebuildRoot):

Keep track of the rebuild roots.

* Source/WebCore/style/StyleUpdate.h:
(WebCore::Style::Update::rebuildRoots const):

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




More information about the webkit-changes mailing list