[webkit-changes] [WebKit/WebKit] 7d4f34: Office.com is slow to respond

Alan Baradlay noreply at github.com
Tue Sep 19 14:40:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7d4f344fa9a70f3b92972faeaf1352c03d384b74
      https://github.com/WebKit/WebKit/commit/7d4f344fa9a70f3b92972faeaf1352c03d384b74
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-09-19 (Tue, 19 Sep 2023)

  Changed paths:
    A LayoutTests/fast/dynamic/display-none-iframe-async-layout-expected.html
    A LayoutTests/fast/dynamic/display-none-iframe-async-layout.html
    M Source/WebCore/dom/Document.cpp

  Log Message:
  -----------
  Office.com is slow to respond
https://bugs.webkit.org/show_bug.cgi?id=261741
<rdar://112494003>

Reviewed by Antti Koivisto.

1. we do _not_ construct renderers for “display: none” iframes
2. we do construct render tree for the “display: none” iframe’s content

we do #2 because JS may ask for geometry information on content inside a “display: none” iframe.

e.g.
<div><iframe srcdoc=“text” style="display: none;" id=iframe></iframe></div>

where:
iframe.contentDocument.body.offsetHeight should return the value of “18px”

the markup above triggers the following 2 render trees:

Main document:
  RenderView
    HTML RenderBlock
      BODY RenderBody
        DIV RenderBlock

(^^ no renderer here for the “display: none” iframe)

iframe document:
  RenderView
    HTML RenderBlock
      BODY RenderBody
        #text RenderText

(^^ this is the content _inside_ the "display: none" iframe)

We not only construct a render tree for the invisible iframe content, but also (as part of the tree construction) we schedule an async layout on them
This patch drops such async layout requests on the floor and keep the renderers dirty until after either
1. sync layout is triggered (JS -> DOM API)
2. iframe becomes visible (display != none)

* LayoutTests/fast/dynamic/display-none-iframe-async-layout-expected.html: Added.
* LayoutTests/fast/dynamic/display-none-iframe-async-layout.html: Added.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::shouldScheduleLayout const):

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




More information about the webkit-changes mailing list