[webkit-changes] [WebKit/WebKit] ba2673: [IFC] Add fast path for simple text only content

Alan Baradlay noreply at github.com
Fri Aug 11 07:07:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ba2673dfb45810f934a068d2e1f765ad78f7e3b5
      https://github.com/WebKit/WebKit/commit/ba2673dfb45810f934a068d2e1f765ad78f7e3b5
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-08-11 (Fri, 11 Aug 2023)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/layout/formattingContexts/inline/AbstractLineBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.h
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingState.h
    M Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLine.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h
    A Source/WebCore/layout/formattingContexts/inline/TextOnlyLineBuilder.cpp
    A Source/WebCore/layout/formattingContexts/inline/TextOnlyLineBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.h

  Log Message:
  -----------
  [IFC] Add fast path for simple text only content
https://bugs.webkit.org/show_bug.cgi?id=259900

Reviewed by Antti Koivisto.

This patch adds a fast path for simple, text-only inline content.

1. Introduce a base class for line builders (AbstractLineBuilder)
2. Move shared types (LineInput etc) from LineBuilder to AbstractLineBuilder.h
3. Implement TextOnlyLineBuilder (This is really just a subset of LineBuilder with simplified state machine/logic)

This improves PerformanceTests/Layout/line-layout.html by ~55%.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::ContinuousContent::appendTextContent):
* Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h:
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::isRootStyleEligibleForSimplifiedTextOnlyInlineLayout):
(WebCore::Layout::InlineFormattingContext::layoutInFlowAndFloatContent):
(WebCore::Layout::InlineFormattingContext::textOnlyLineLayout):
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::createDisplayContentForLine):
(WebCore::Layout::InlineFormattingContext::resetGeometryForClampedContent):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h:
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::InlineFormattingGeometry::logicalTopForNextLine const):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.h:
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingState.h:
(WebCore::Layout::InlineFormattingState::setIsNonBidiTextAndForcedLineBreakOnlyContent):
(WebCore::Layout::InlineFormattingState::isNonBidiTextAndForcedLineBreakOnlyContent const):
* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::InlineItemsBuilder::collectInlineItems):
(WebCore::Layout::InlineItemsBuilder::handleTextContent):
(WebCore::Layout::InlineItemsBuilder::handleInlineBoxStart):
(WebCore::Layout::InlineItemsBuilder::handleInlineBoxEnd):
(WebCore::Layout::InlineItemsBuilder::handleInlineLevelBox):
* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::LineBoxBuilder):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.h:
(WebCore::Layout::LineBoxBuilder::isFirstLine const):
(WebCore::Layout::LineBoxBuilder::lineLayoutResult const):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineCandidate::InlineContent::appendInlineItem):
(WebCore::Layout::LineBuilder::layoutInlineContent):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineLayoutTypes.h: Added.
* Source/WebCore/layout/formattingContexts/inline/TextOnlyLineBuilder.cpp: Added.
(WebCore::Layout::inlineTextItemWidth):
(WebCore::Layout::placedInlineItemEnd):
(WebCore::Layout::isLastLineWithInlineContent):
(WebCore::Layout::appendInlineTextItem):
(WebCore::Layout::consumeTrailingLineBreakIfApplicable):
(WebCore::Layout::TextOnlyLineBuilder::TextOnlyLineBuilder):
(WebCore::Layout::TextOnlyLineBuilder::layoutInlineContent):
(WebCore::Layout::TextOnlyLineBuilder::initialize):
(WebCore::Layout::TextOnlyLineBuilder::placeInlineTextContent):
(WebCore::Layout::TextOnlyLineBuilder::placeNonWrappingInlineTextContent):
(WebCore::Layout::TextOnlyLineBuilder::handleInlineTextContent):
(WebCore::Layout::TextOnlyLineBuilder::handleLineEnding):
(WebCore::Layout::TextOnlyLineBuilder::horizontalAlignmentOffset const):
(WebCore::Layout::TextOnlyLineBuilder::rebuildLine):
(WebCore::Layout::TextOnlyLineBuilder::root const):
* Source/WebCore/layout/formattingContexts/inline/TextOnlyLineBuilder.h: Added.
(WebCore::Layout::TextOnlyLineBuilder::TextOnlyLineBuilder):
(WebCore::Layout::TextOnlyLineBuilder::isFirstFormattedLine const):
(WebCore::Layout::TextOnlyLineBuilder::intrinsicWidthMode const):
(WebCore::Layout::TextOnlyLineBuilder::isInIntrinsicWidthMode const):
(WebCore::Layout::TextOnlyLineBuilder::formattingContext const):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::build):
(WebCore::Layout::InlineDisplayContentBuilder::processNonBidiContent):
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
(WebCore::Layout::InlineDisplayContentBuilder::processFloatBoxes):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::InlineDisplayLineBuilder::collectEnclosingLineGeometry const):
(WebCore::Layout::InlineDisplayLineBuilder::build const):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.h:

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




More information about the webkit-changes mailing list