[webkit-changes] [WebKit/WebKit] 364718: Speedometer 3: getBoundingClientRect spends time u...

mattwoodrow noreply at github.com
Fri Sep 6 00:18:03 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 36471855c3cb59685b184d7632904cb9ad87468f
      https://github.com/WebKit/WebKit/commit/36471855c3cb59685b184d7632904cb9ad87468f
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2024-09-06 (Fri, 06 Sep 2024)

  Changed paths:
    M LayoutTests/fast/css/aspect-ratio-no-relayout.html
    M LayoutTests/fast/css/font-size-adjust-none-no-relayout.html
    M LayoutTests/fast/images/animated-gif-no-layout.html
    A LayoutTests/fast/layout/bounding-client-rect-no-layer-updates-expected.txt
    A LayoutTests/fast/layout/bounding-client-rect-no-layer-updates.html
    M LayoutTests/fast/repaint/list-item-equal-style-change-no-repaint.html
    M LayoutTests/fast/scrolling/mac/scrolling-triggerered-layouts.html
    M LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout-expected.txt
    M LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html
    M Source/WebCore/accessibility/AccessibilityRenderObject.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/MouseRelatedEvent.cpp
    M Source/WebCore/html/shadow/MediaControlTextTrackContainerElement.cpp
    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/RenderLayerInlines.h
    M Source/WebCore/rendering/RenderLayerScrollableArea.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl
    M Source/WebKitLegacy/mac/WebView/WebFrame.mm

  Log Message:
  -----------
  Speedometer 3: getBoundingClientRect spends time updating layer positions that it doesn't use.
https://bugs.webkit.org/show_bug.cgi?id=279150
<rdar://133492305>

Reviewed by Simon Fraser.

Adds a new option to Document::updateLayout for callers to request that updateLayerPositions
be deferred, and uses it for getBoundingClientRect.

Adds an assertion to RenderLayer::position/size() to make sure no code tries to access
layers positions while in this new state.
The assert only covers the scope of getBoundingClientRect, since arbtirary other code
can run next and might try to access the unflushed layer. This shouldn't be a new concern
though, since `needsLayout` will be true, and the other code should already be flushing layout
if it needs to access layer positions.

LocalFrameView::needsLayout now returns true if there's actual layout, or a pending layer
flush, so that we flush the layers next time to we try to layout.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::updateLayout):
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::boundingClientRect):
* Source/WebCore/dom/MouseRelatedEvent.cpp:
* Source/WebCore/html/shadow/MediaControlTextTrackContainerElement.cpp:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::topContentInsetDidChange):
(WebCore::LocalFrameView::hasPendingUpdateLayerPositions const):
(WebCore::LocalFrameView::flushUpdateLayerPositions):
(WebCore::LocalFrameView::didLayout):
(WebCore::LocalFrameView::updateLayerPositionsAfterScrolling):
(WebCore::LocalFrameView::updateLayerPositionsAfterOverflowScroll):
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::layout):
(WebCore::LocalFrameViewLayoutContext::performLayout):
(WebCore::LocalFrameViewLayoutContext::runOrScheduleAsynchronousTasks):
(WebCore::LocalFrameViewLayoutContext::needsLayout const):
(WebCore::LocalFrameViewLayoutContext::needsLayoutInternal const):
* Source/WebCore/page/LocalFrameViewLayoutContext.h:
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::didVisitSinceLayout const):
(WebCore::RenderElement::didVisitDuringLastLayout const): Deleted.
* Source/WebCore/rendering/RenderElement.h:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositionsAfterStyleChange):
(WebCore::RenderLayer::updateLayerPositionsAfterLayout):
(WebCore::RenderLayer::recursiveUpdateLayerPositions):
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderLayerInlines.h:
(WebCore::RenderLayer::location const):
(WebCore::RenderLayer::size const):
(WebCore::RenderLayer::rect const):
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::scrollTo):

Canonical link: https://commits.webkit.org/283252@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