⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286786 in webkit


Ignore:
Timestamp:
Dec 9, 2021, 10:33:19 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Add support for empty bidi inline boxes
https://bugs.webkit.org/show_bug.cgi?id=233896

Reviewed by Antti Koivisto.

Inline boxes with decoration only should also produce associated display boxes.

  • layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:

(WebCore::Layout::createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack):
(WebCore::Layout::InlineDisplayContentBuilder::ensureDisplayBoxForContainer):
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r286785 r286786  
     12021-12-09  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Add support for empty bidi inline boxes
     4        https://bugs.webkit.org/show_bug.cgi?id=233896
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Inline boxes with decoration only should also produce associated display boxes.
     9
     10        * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
     11        (WebCore::Layout::createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack):
     12        (WebCore::Layout::InlineDisplayContentBuilder::ensureDisplayBoxForContainer):
     13        (WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
     14
    1152021-12-09  J Pascoe  <j_pascoe@apple.com>
    216
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp

    r286784 r286786  
    364364};
    365365
     366static inline DisplayBoxNode& createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack(const ContainerBox& containerBox, size_t displayBoxIndex, DisplayBoxNode& parentDisplayBoxNode, AncestorStack& ancestorStack)
     367{
     368    parentDisplayBoxNode.appendChild(displayBoxIndex);
     369    auto& displayBoxNode = *parentDisplayBoxNode.children.last();
     370    ancestorStack.push(displayBoxNode, containerBox);
     371    return displayBoxNode;
     372}
     373
    366374DisplayBoxNode& InlineDisplayContentBuilder::ensureDisplayBoxForContainer(const ContainerBox& containerBox, AncestorStack& ancestorStack, DisplayBoxes& boxes)
    367375{
     
    371379    auto& enclosingDisplayBoxNodeForContainer = ensureDisplayBoxForContainer(containerBox.parent(), ancestorStack, boxes);
    372380    boxes.append({ m_lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, containerBox, UBIDI_DEFAULT_LTR, { }, { }, { }, { }, true, { } });
    373 
    374     enclosingDisplayBoxNodeForContainer.appendChild(boxes.size() - 1);
    375     auto& displayBoxNodeForContainer = *enclosingDisplayBoxNodeForContainer.children.last();
    376     ancestorStack.push(displayBoxNodeForContainer, containerBox);
    377     return displayBoxNodeForContainer;
     381    return createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack(containerBox, boxes.size() - 1, enclosingDisplayBoxNodeForContainer, ancestorStack);
    378382}
    379383
     
    455459            auto& layoutBox = lineRun.layoutBox();
    456460
    457             auto isContentRun = !lineRun.isInlineBoxStart() && !lineRun.isLineSpanningInlineBoxStart() && !lineRun.isInlineBoxEnd() && !lineRun.isWordBreakOpportunity();
    458             if (!isContentRun) {
    459                 // FIXME: Add support for inline boxes with no content.
     461            auto needsDisplayBox = !lineRun.isInlineBoxEnd() && !lineRun.isWordBreakOpportunity();
     462            if (!needsDisplayBox)
    460463                continue;
    461             }
    462464
    463465            auto visualRectRelativeToRoot = [&](auto logicallRect) {
     
    472474                appendTextDisplayBox(lineRun, visualRect, boxes);
    473475                contentRightInVisualOrder += visualRect.width();
    474             } else if (lineRun.isSoftLineBreak()) {
     476                parentDisplayBoxNode.appendChild(boxes.size() - 1);
     477                continue;
     478            }
     479            if (lineRun.isSoftLineBreak()) {
    475480                ASSERT(!visualRectRelativeToRoot(lineBox.logicalRectForTextRun(lineRun)).width());
    476481                appendSoftLineBreakDisplayBox(lineRun, visualRectRelativeToRoot(lineBox.logicalRectForTextRun(lineRun)), boxes);
    477             } else if (lineRun.isHardLineBreak()) {
     482                parentDisplayBoxNode.appendChild(boxes.size() - 1);
     483                continue;
     484            }
     485            if (lineRun.isHardLineBreak()) {
    478486                ASSERT(!visualRectRelativeToRoot(lineBox.logicalRectForLineBreakBox(layoutBox)).width());
    479487                appendHardLineBreakDisplayBox(lineRun, visualRectRelativeToRoot(lineBox.logicalRectForLineBreakBox(layoutBox)), boxes);
    480             } else if (lineRun.isBox()) {
     488                parentDisplayBoxNode.appendChild(boxes.size() - 1);
     489                continue;
     490            }
     491            if (lineRun.isBox()) {
    481492                auto& boxGeometry = formattingState().boxGeometry(layoutBox);
    482493                auto visualRect = visualRectRelativeToRoot(lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, boxGeometry));
     
    484495                appendAtomicInlineLevelDisplayBox(lineRun, visualRect, boxes);
    485496                contentRightInVisualOrder += boxGeometry.marginStart() + visualRect.width() + boxGeometry.marginEnd();
    486             }
    487             parentDisplayBoxNode.appendChild(boxes.size() - 1);
     497                parentDisplayBoxNode.appendChild(boxes.size() - 1);
     498                continue;
     499            }
     500            if (lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart()) {
     501                boxes.append({ m_lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, layoutBox, UBIDI_DEFAULT_LTR, { }, { }, { }, { }, true, { } });
     502                createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack(downcast<ContainerBox>(layoutBox), boxes.size() - 1, parentDisplayBoxNode, ancestorStack);
     503                continue;
     504            }
     505            ASSERT_NOT_REACHED();
    488506        }
    489507    };
Note: See TracChangeset for help on using the changeset viewer.