[webkit-changes] [WebKit/WebKit] 436867: [IFC][Partial layout] Add support for removing tex...

Alan Baradlay noreply at github.com
Sat Mar 4 15:35:16 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4368671df993cb3f5dfa1cb24c786d110830e735
      https://github.com/WebKit/WebKit/commit/4368671df993cb3f5dfa1cb24c786d110830e735
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-03-04 (Sat, 04 Mar 2023)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/invalidation/InlineDamage.h
    M Source/WebCore/layout/formattingContexts/inline/invalidation/InlineInvalidation.cpp
    M Source/WebCore/layout/formattingContexts/inline/invalidation/InlineInvalidation.h
    M Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp
    M Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h
    M Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp
    M Source/WebCore/layout/integration/LayoutIntegrationCoverage.h
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.h
    M Source/WebCore/rendering/RenderObject.cpp

  Log Message:
  -----------
  [IFC][Partial layout] Add support for removing text renderers
https://bugs.webkit.org/show_bug.cgi?id=253221

Reviewed by Antti Koivisto.

Removing a text node is similar to regular text content mutation in the context of finding the damage boundary.
However we need to take care of the associated layout box by
1. detaching it from the layout tree
2. but still keeping it around by adding it to the m_lineDamage object until after the subsequent layout is done.
It ensures that geometry type of requests (e.g. repaint) still work between mutation and the subsequent layout (note that while geometry information is stored in display boxes, these boxes hold weak references to layout boxes)
We may revisit this approach and force a policy to run all geometry type of tasks before willBeRemoved() and/or detach the display content from the associated layout boxes (i.e. remove all weak references).

This patch also introduces additional check(s) for node removal (specifically when the about-to-be-removed node is the last one in the inline formatting context).

* Source/WebCore/layout/formattingContexts/inline/invalidation/InlineDamage.h:
(WebCore::Layout::InlineDamage::addDetachedBox):
* Source/WebCore/layout/formattingContexts/inline/invalidation/InlineInvalidation.cpp:
(WebCore::Layout::damagedLineIndex):
(WebCore::Layout::leadingInlineItemPositionForDamage):
(WebCore::Layout::InlineInvalidation::textWillBeRemoved):
* Source/WebCore/layout/formattingContexts/inline/invalidation/InlineInvalidation.h:
* Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::remove):
* Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h:
* Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::shouldInvalidateLineLayoutPathAfterChangeFor):
(WebCore::LayoutIntegration::shouldInvalidateLineLayoutPathAfterContentChangeFor): Deleted.
* Source/WebCore/layout/integration/LayoutIntegrationCoverage.h:
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::shouldInvalidateLineLayoutPathAfterContentChange):
(WebCore::LayoutIntegration::LineLayout::shouldInvalidateLineLayoutPathAfterTreeMutation):
(WebCore::LayoutIntegration::LineLayout::removedFromTree):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.h:
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::invalidateLineLayoutAfterTreeMutationIfNeeded):
(WebCore::RenderObject::insertedIntoTree):
(WebCore::RenderObject::willBeRemovedFromTree):

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




More information about the webkit-changes mailing list