[webkit-changes] [WebKit/WebKit] 33c8b3: [IFC] Let's try to reuse previously computed break...

Alan Baradlay noreply at github.com
Mon Mar 11 19:42:08 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 33c8b3c4ff3918d16adda3d5800f2c926152bc9b
      https://github.com/WebKit/WebKit/commit/33c8b3c4ff3918d16adda3d5800f2c926152bc9b
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2024-03-11 (Mon, 11 Mar 2024)

  Changed paths:
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/layout/LayoutState.cpp
    M Source/WebCore/layout/LayoutState.h
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h
    A Source/WebCore/layout/formattingContexts/inline/text/TextBreakingPositionCache.cpp
    A Source/WebCore/layout/formattingContexts/inline/text/TextBreakingPositionCache.h
    A Source/WebCore/layout/formattingContexts/inline/text/TextBreakingPositionContext.h
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
    M Source/WebCore/page/MemoryRelease.cpp

  Log Message:
  -----------
  [IFC] Let's try to reuse previously computed breaking positions in text content
https://bugs.webkit.org/show_bug.cgi?id=270492

Reviewed by Antti Koivisto.

This patch adds support for a compact, breaking position cache across content mutation.
1. Cache gets populated when the content goes away
2. Cache content stays around across document loads (within the same security origin)
3. Cache gets utilized when an already "seen" content re-appears on the page.

Many high ranking pages have dynamic behavior where content gets removed (from DOM)
and reinserted right away in the very same form during initial page load.

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/LayoutState.cpp:
(WebCore::Layout::LayoutState::LayoutState):
* Source/WebCore/layout/LayoutState.h:
(WebCore::Layout::LayoutState::securityOrigin const):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutFloatContentOnly):
(WebCore::Layout::InlineFormattingContext::rebuildInlineItemListIfNeeded):
* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::InlineItemsBuilder::InlineItemsBuilder):
(WebCore::Layout::InlineItemsBuilder::handleTextContentFromBreakingPositionsCache):
(WebCore::Layout::InlineItemsBuilder::handleTextContent):
(WebCore::Layout::InlineItemsBuilder::populateBreakingPositionCache):
* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/text/TextBreakingPositionCache.cpp: Added.
(WebCore::Layout::TextBreakingPositionCache::singleton):
(WebCore::Layout::TextBreakingPositionCache::TextBreakingPositionCache):
(WebCore::Layout::TextBreakingPositionCache::evict):
(WebCore::Layout::TextBreakingPositionCache::set):
(WebCore::Layout::TextBreakingPositionCache::get const):
(WebCore::Layout::TextBreakingPositionCache::clear):
(WebCore::Layout::TextBreakingPositionContext::TextBreakingPositionContext):
(WebCore::Layout::add):
* Source/WebCore/layout/formattingContexts/inline/text/TextBreakingPositionCache.h: Added.
(WebCore::Layout::TextBreakingPositionContextHash::hash):
(WebCore::Layout::TextBreakingPositionContextHash::equal):
(WTF::HashTraits<WebCore::Layout::TextBreakingPositionContext>::constructDeletedValue):
(WTF::HashTraits<WebCore::Layout::TextBreakingPositionContext>::isDeletedValue):
(WTF::HashTraits<WebCore::Layout::TextBreakingPositionContext>::emptyValue):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::~LineLayout):
  In cases when content is mutated in a way that it is eligible for partial layout but then mutated again in a not-yet-supported way, we can't populate the cache anymore as the inline item list may not match with the "associated" InlineTextBox content anymore.

(WebCore::LayoutIntegration::LineLayout::releaseCaches):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.h:

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