[webkit-changes] [WebKit/WebKit] 4a5b56: Limit the number of repaint candidates after simpl...

Alan Baradlay noreply at github.com
Fri Jun 7 18:34:09 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4a5b56e32671dd7cc4768db52d1b8b0681b17ee9
      https://github.com/WebKit/WebKit/commit/4a5b56e32671dd7cc4768db52d1b8b0681b17ee9
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h
    M Source/WebCore/page/LocalFrameViewLayoutContext.cpp
    M Source/WebCore/page/LocalFrameViewLayoutContext.h
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderElement.h
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayer.h
    M Source/WebCore/rendering/RenderObject.cpp
    M Source/WebCore/rendering/RenderView.cpp

  Log Message:
  -----------
  Limit the number of repaint candidates after simplified layout
https://bugs.webkit.org/show_bug.cgi?id=275153

Reviewed by Simon Fraser.

"simplified normal-flow layout" is initiated when the only property that requires attention
at layout time throughout the entire tree is overflow.

It simply means that the current (outstanding) style and/or content mutation that we try to recover from
is not supposed to change any in- or out-of-flow box size and/or position.
Such change may be triggered by
- out-of-flow box is inserted and/or removed (note that at insertion, we run non-simplified layout
  _inside_ the freshly added subtree)
- StyleDifferenceContextSensitiveProperty::Transform changes but nothing else (e.g. scale changes on an element.
  This only applies to mutating existing properties, i.e. when a new transform related property is added,
  non-simplified layout is initiated)

1. These type of changes are not supposed to expand the damaged area (marking additional renderers dirty as
   we run layout on the tree).
2. The entry point in most cases is still the RenderView but it could very well be a subtree layout.

Layout:
  We traverse through descendants by calling layout() all the way to the dirty renderer(s).
  However while descending, we only run simplifiedLayout().

After layout:
  We run RenderLayer::updateLayerPositionsAfterLayout() where we traverse the _layer_ tree
  and (almost unconditionally) re-compute repaint rects on associated renderers (and even issue redundant repaints).
  When the damage is limited to relatively small subtree(s), most of this work is redundant.

This patch ensures that in case of "simplified normal-flow layout", "repaint rects" related work happens only on affected renderers.

1. Assign a layout identifier to each layout run (LocalFrameViewLayoutContext::performLayout)
2. Mark each renderer involved in current layout with said layout identifier (RenderObject::clearNeedsLayout)
3. Check if the current layout is "simplified normal-flow layout" by looking at the layout root's dirty bit.
   (note that "simplified normal-flow layout" is not supposed to get upgraded to "normal layout" during layout or
   "normal layout" downgraded to "simple".)
4. Only issue repaint in RenderLayer::recursiveUpdateLayerPositions() when the associated renderer
   participated in the most recent layout.

* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::performLayout):
* Source/WebCore/page/LocalFrameViewLayoutContext.h:
* Source/WebCore/rendering/RenderElement.h:
(WebCore::RenderElement::setNormalFlowLayoutFrameId):
(WebCore::RenderElement::normalFlowLayoutFrameId const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositionsAfterLayout):
(WebCore::RenderLayer::recursiveUpdateLayerPositions):
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::clearNeedsLayout):
(WebCore::RenderObject::outputRenderObject const):
* Source/WebCore/rendering/RenderView.cpp: remove redundant clear.
(WebCore::RenderView::layout):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list