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

Changeset 267437 in webkit


Ignore:
Timestamp:
Sep 22, 2020, 2:45:32 PM (6 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Atomic inline-level box with margin is mispositioned
https://bugs.webkit.org/show_bug.cgi?id=216842

Reviewed by Antti Koivisto.

The inline box that an atomic inline-level box generates has the height of the margin box. Therefore the inline box's logical top position
is the position of the top edge of the margin box.
When converting the inline box geometry back to the layout box, we need to offset the top position (border box top edge)
with the value of the used margin before.

  • layout/inlineformatting/InlineFormattingContext.cpp:

(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r267435 r267437  
     12020-09-22  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Atomic inline-level box with margin is mispositioned
     4        https://bugs.webkit.org/show_bug.cgi?id=216842
     5
     6        Reviewed by Antti Koivisto.
     7
     8        The inline box that an atomic inline-level box generates has the height of the margin box. Therefore the inline box's logical top position
     9        is the position of the top edge of the margin box.
     10        When converting the inline box geometry back to the layout box, we need to offset the top position (border box top edge)
     11        with the value of the used margin before.
     12
     13        * layout/inlineformatting/InlineFormattingContext.cpp:
     14        (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
     15
    1162020-09-22  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp

    r267434 r267437  
    445445            }
    446446            auto& boxGeometry = formattingState.boxGeometry(layoutBox);
    447             auto logicalTopLeft = inlineBox->logicalRect().topLeft();
    448 
    449             logicalTopLeft.move({ }, lineBoxVerticalOffset);
     447            auto marginBoxLogicalTopLeft = inlineBox->logicalRect().topLeft();
     448            auto borderBoxLogicalTopLeft = marginBoxLogicalTopLeft + InlineLayoutSize({ }, boxGeometry.marginBefore());
     449
     450            borderBoxLogicalTopLeft.move({ }, lineBoxVerticalOffset);
    450451            if (layoutBox.isInFlowPositioned())
    451                 logicalTopLeft += geometry.inFlowPositionedPositionOffset(layoutBox, horizontalConstraints);
     452                borderBoxLogicalTopLeft += geometry.inFlowPositionedPositionOffset(layoutBox, horizontalConstraints);
    452453
    453454            if (layoutBox.isAtomicInlineLevelBox()) {
    454455                // Atomic inline boxes are all set. Their margin/border/content box geometries are already computed. We just have to position them here.
    455                 boxGeometry.setLogicalTopLeft(toLayoutPoint(logicalTopLeft));
     456                boxGeometry.setLogicalTopLeft(toLayoutPoint(borderBoxLogicalTopLeft));
    456457                continue;
    457458            }
     
    463464            if (!isSpanningInlineBox) {
    464465                // This box showed up on this line the first time.
    465                 boxGeometry.setLogicalTopLeft(toLayoutPoint(logicalTopLeft));
     466                boxGeometry.setLogicalTopLeft(toLayoutPoint(borderBoxLogicalTopLeft));
    466467                boxGeometry.setContentBoxWidth(toLayoutUnit(contentBoxWidth));
    467468                boxGeometry.setContentBoxHeight(toLayoutUnit(inlineBox->logicalHeight()));
     
    469470            }
    470471            // This is a just a simple box geometry for the line spanning inline box. getBoundingClientRect looks into each line boxes (will turn into fragmented boxes).
    471             boxGeometry.setLogicalLeft(std::min(boxGeometry.logicalLeft(), toLayoutUnit(logicalTopLeft.x())));
     472            boxGeometry.setLogicalLeft(std::min(boxGeometry.logicalLeft(), toLayoutUnit(borderBoxLogicalTopLeft.x())));
    472473            boxGeometry.setContentBoxWidth(std::max(toLayoutUnit(contentBoxWidth), boxGeometry.contentBoxWidth()));
    473474            boxGeometry.setContentBoxHeight(boxGeometry.contentBoxHeight() + toLayoutUnit(inlineBox->logicalHeight()));
Note: See TracChangeset for help on using the changeset viewer.