Changeset 269817 in webkit


Ignore:
Timestamp:
Nov 14, 2020 7:26:56 AM (3 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Display runs generated by boxes should have border box geometries
https://bugs.webkit.org/show_bug.cgi?id=218932

Reviewed by Antti Koivisto.

Layout::Runs/InlineBoxes have margin box geometries, but the Display::Runs should preserve border box instead.
This is mostly interesting in the context of negative vertical margins where such margin values could make the run "empty".

  • layout/integration/LayoutIntegrationInlineContentBuilder.cpp:

(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const):

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::constructContent):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269816 r269817  
     12020-11-14  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Display runs generated by boxes should have border box geometries
     4        https://bugs.webkit.org/show_bug.cgi?id=218932
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Layout::Runs/InlineBoxes have margin box geometries, but the Display::Runs should preserve border box instead.
     9        This is mostly interesting in the context of negative vertical margins where such margin values could make the run "empty".
     10
     11        * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
     12        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const):
     13        * layout/integration/LayoutIntegrationLineLayout.cpp:
     14        (WebCore::LayoutIntegration::LineLayout::constructContent):
     15
    1162020-11-14  Zalan Bujtas  <zalan@apple.com>
    217
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp

    r269773 r269817  
    211211
    212212    auto createDisplayBoxRun = [&](auto& lineRun) {
     213        auto& layoutBox = lineRun.layoutBox();
    213214        auto lineIndex = lineRun.lineIndex();
    214215        auto& line = lines[lineIndex];
     
    216217        // FIXME: Shouldn't we just leave them be relative to the line box?
    217218        auto runRect = FloatRect { lineRun.logicalRect() };
    218         runRect.moveBy({ line.logicalLeft(), line.logicalTop() });
     219        // Line runs are margin box based, let's convert them to border box.
     220        auto& geometry = m_layoutState.geometryForBox(layoutBox);
     221        runRect.moveBy({ line.logicalLeft() + std::max(geometry.marginStart(), 0_lu), line.logicalTop() + geometry.marginBefore() });
     222        runRect.setSize({ geometry.borderBoxWidth(), geometry.borderBoxHeight() });
    219223        if (lineLevelVisualAdjustmentsForRuns[lineIndex].needsIntegralPosition)
    220224            runRect.setY(roundToInt(runRect.y()));
    221225        // FIXME: Add support for non-text ink overflow.
    222226        // FIXME: Add support for cases when the run is after ellipsis.
    223         inlineContent.runs.append({ lineIndex, lineRun.layoutBox(), runRect, runRect, { }, { } });
     227        inlineContent.runs.append({ lineIndex, layoutBox, runRect, runRect, { }, { } });
    224228    };
    225229
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r269770 r269817  
    155155            continue;
    156156
    157         auto& runRect = run.rect();
    158157        auto& renderer = downcast<RenderBox>(m_boxTree.rendererForLayoutBox(layoutBox));
    159         auto& boxGeometry = m_layoutState.geometryForBox(layoutBox);
    160         auto borderBoxLocation = FloatPoint { runRect.x() + std::max(boxGeometry.marginStart(), 0_lu), runRect.y() + boxGeometry.marginBefore() };
    161         renderer.setLocation(flooredLayoutPoint(borderBoxLocation));
     158        renderer.setLocation(flooredLayoutPoint(run.rect().location()));
    162159    }
    163160
Note: See TracChangeset for help on using the changeset viewer.