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

Changeset 268815 in webkit


Ignore:
Timestamp:
Oct 21, 2020, 12:19:36 PM (6 years ago)
Author:
Alan Bujtas
Message:

[LFC][Integration] Ascent and descent are rounded to integral position
https://bugs.webkit.org/show_bug.cgi?id=218036

Reviewed by Antti Koivisto.

In this patch, we round ascent/descent vertical position values to integral to match legacy behavior.

  • layout/inlineformatting/InlineFormattingContextGeometry.cpp:

(WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):

  • layout/inlineformatting/InlineLineBox.cpp:

(WebCore::Layout::LineBox::InlineLevelBox::setBaseline):
(WebCore::Layout::LineBox::InlineLevelBox::setDescent):
(WebCore::Layout::LineBox::InlineLevelBox::setLayoutBounds):

  • layout/inlineformatting/InlineLineBox.h:

(WebCore::Layout::LineBox::InlineLevelBox::setBaseline): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::setDescent): Deleted.
(WebCore::Layout::LineBox::InlineLevelBox::setLayoutBounds): Deleted.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r268814 r268815  
     12020-10-21  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][Integration] Ascent and descent are rounded to integral position
     4        https://bugs.webkit.org/show_bug.cgi?id=218036
     5
     6        Reviewed by Antti Koivisto.
     7
     8        In this patch, we round ascent/descent vertical position values to integral to match legacy behavior.
     9
     10        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
     11        (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
     12        * layout/inlineformatting/InlineLineBox.cpp:
     13        (WebCore::Layout::LineBox::InlineLevelBox::setBaseline):
     14        (WebCore::Layout::LineBox::InlineLevelBox::setDescent):
     15        (WebCore::Layout::LineBox::InlineLevelBox::setLayoutBounds):
     16        * layout/inlineformatting/InlineLineBox.h:
     17        (WebCore::Layout::LineBox::InlineLevelBox::setBaseline): Deleted.
     18        (WebCore::Layout::LineBox::InlineLevelBox::setDescent): Deleted.
     19        (WebCore::Layout::LineBox::InlineLevelBox::setLayoutBounds): Deleted.
     20
    1212020-10-21  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp

    r268658 r268815  
    261261            auto& inlineLevelBoxGeometry = formattingContext().geometryForBox(layoutBox);
    262262            auto logicalHeight = inlineLevelBoxGeometry.marginBoxHeight();
    263             auto baseline = logicalHeight;
     263            auto ascent = logicalHeight;
    264264            if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) {
    265265                auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox));
    266266                auto& lastLine = formattingState.lines().last();
    267267                auto inlineBlockBaseline = lastLine.logicalTop() + lastLine.baseline();
    268                 baseline = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderTop() + inlineLevelBoxGeometry.paddingTop().valueOr(0) + inlineBlockBaseline;
     268                ascent = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderTop() + inlineLevelBoxGeometry.paddingTop().valueOr(0) + inlineBlockBaseline;
    269269            }
    270270            auto atomicInlineLevelBox = LineBox::InlineLevelBox::createAtomicInlineLevelBox(layoutBox, logicalLeft, { run.logicalWidth(), logicalHeight });
    271             atomicInlineLevelBox->setBaseline(baseline);
    272             atomicInlineLevelBox->setLayoutBounds(LineBox::InlineLevelBox::LayoutBounds { baseline, { } });
     271            atomicInlineLevelBox->setBaseline(ascent);
     272            atomicInlineLevelBox->setLayoutBounds(LineBox::InlineLevelBox::LayoutBounds { ascent, { } });
    273273            if (logicalHeight)
    274274                atomicInlineLevelBox->setIsNonEmpty();
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp

    r268654 r268815  
    3838    , m_type(type)
    3939{
     40}
     41
     42void LineBox::InlineLevelBox::setBaseline(InlineLayoutUnit baseline)
     43{
     44    // FIXME: Remove legacy rounding.
     45    m_baseline = roundToInt(baseline);
     46}
     47
     48void LineBox::InlineLevelBox::setDescent(InlineLayoutUnit descent)
     49{
     50    // FIXME: Remove legacy rounding.
     51    m_descent = roundToInt(descent);
     52}
     53
     54void LineBox::InlineLevelBox::setLayoutBounds(const LayoutBounds& layoutBounds)
     55{
     56    // FIXME: Remove legacy rounding.
     57    m_layoutBounds = { InlineLayoutUnit(roundToInt(layoutBounds.ascent)), InlineLayoutUnit(roundToInt(layoutBounds.descent)) };
    4058}
    4159
  • trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h

    r268642 r268815  
    103103        void setLogicalWidth(InlineLayoutUnit logicalWidth) { m_logicalRect.setWidth(logicalWidth); }
    104104        void setLogicalHeight(InlineLayoutUnit logicalHeight) { m_logicalRect.setHeight(logicalHeight); }
    105         void setBaseline(InlineLayoutUnit baseline) { m_baseline = baseline; }
    106         void setDescent(InlineLayoutUnit descent) { m_descent = descent; }
     105        void setBaseline(InlineLayoutUnit);
     106        void setDescent(InlineLayoutUnit);
    107107
    108108        // See https://www.w3.org/TR/css-inline-3/#layout-bounds
     
    113113            InlineLayoutUnit descent { 0 };
    114114        };
    115         void setLayoutBounds(const LayoutBounds& layoutBounds) { m_layoutBounds = layoutBounds; }
     115        void setLayoutBounds(const LayoutBounds&);
    116116        LayoutBounds layoutBounds() const { return m_layoutBounds; }
    117117
Note: See TracChangeset for help on using the changeset viewer.