Changeset 290047 in webkit


Ignore:
Timestamp:
Feb 17, 2022 12:05:29 PM (5 months ago)
Author:
Patrick Angle
Message:

Web Inspector: [Flexbox] Gaps and free space do not have pattern fills when navigating to a page with Web Inspector already open
https://bugs.webkit.org/show_bug.cgi?id=236741

Reviewed by Devin Rousso.

Because calls to getDocument actually resets the InspectorDOMAgent, we don't want to clear cached layout
information inside reset. The cached layout information is in a WeakHashMap, we aren't going to end up keeping
stale references around anyways, and the under most circumstances the map will clean itself up as it is used.
We should, however go ahead and clear the cached layout information when we are forcing a re-layout to collect
the information again for a new document.

Additionally, if a new document is set, we want to trigger a layout just like we did for a fresh
InspectorDOMAgent.

  • inspector/agents/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::didCreateFrontendAndBackend):
(WebCore::InspectorDOMAgent::reset):
(WebCore::InspectorDOMAgent::setDocument):
(WebCore::InspectorDOMAgent::relayoutDocument):

  • inspector/agents/InspectorDOMAgent.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r290046 r290047  
     12022-02-17  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: [Flexbox] Gaps and free space do not have pattern fills when navigating to a page with Web Inspector already open
     4        https://bugs.webkit.org/show_bug.cgi?id=236741
     5
     6        Reviewed by Devin Rousso.
     7
     8        Because calls to `getDocument` actually resets the `InspectorDOMAgent`, we don't want to clear cached layout
     9        information inside `reset`. The cached layout information is in a WeakHashMap, we aren't going to end up keeping
     10        stale references around anyways, and the under most circumstances the map will clean itself up as it is used.
     11        We should, however go ahead and clear the cached layout information when we are forcing a re-layout to collect
     12        the information again for a new document.
     13
     14        Additionally, if a new document is set, we want to trigger a layout just like we did for a fresh
     15        `InspectorDOMAgent`.
     16
     17        * inspector/agents/InspectorDOMAgent.cpp:
     18        (WebCore::InspectorDOMAgent::didCreateFrontendAndBackend):
     19        (WebCore::InspectorDOMAgent::reset):
     20        (WebCore::InspectorDOMAgent::setDocument):
     21        (WebCore::InspectorDOMAgent::relayoutDocument):
     22        * inspector/agents/InspectorDOMAgent.h:
     23
    1242022-02-17  Aditya Keerthi  <akeerthi@apple.com>
    225
  • trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp

    r289698 r290047  
    310310
    311311    // Force a layout so that we can collect additional information from the layout process.
    312     if (m_document)
    313         m_document->updateLayout();
     312    relayoutDocument();
    314313
    315314#if ENABLE(VIDEO)
     
    363362        m_revalidateStyleAttrTask->reset();
    364363    m_document = nullptr;
    365     m_flexibleBoxRendererCachedItemsAtStartOfLine.clear();
    366364
    367365    m_destroyedDetachedNodeIdentifiers.clear();
     
    380378    m_document = document;
    381379
     380    // Force a layout so that we can collect additional information from the layout process.
     381    relayoutDocument();
     382
    382383    if (!m_documentRequested)
    383384        return;
     
    386387    if (!document || !document->parsing())
    387388        m_frontendDispatcher->documentUpdated();
     389}
     390
     391void InspectorDOMAgent::relayoutDocument()
     392{
     393    if (!m_document)
     394        return;
     395
     396    m_flexibleBoxRendererCachedItemsAtStartOfLine.clear();
     397   
     398    m_document->updateLayout();
    388399}
    389400
  • trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h

    r289698 r290047  
    255255    void destroyedNodesTimerFired();
    256256
     257    void relayoutDocument();
     258
    257259    Inspector::InjectedScriptManager& m_injectedScriptManager;
    258260    std::unique_ptr<Inspector::DOMFrontendDispatcher> m_frontendDispatcher;
Note: See TracChangeset for help on using the changeset viewer.