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

Changeset 246475 in webkit


Ignore:
Timestamp:
Jun 16, 2019, 12:28:14 PM (7 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Use the borderBox rect consistently to size the inline box.
https://bugs.webkit.org/show_bug.cgi?id=198899

Reviewed by Antti Koivisto.
<rdar://problem/51781969>

Use the margin box height (when applicable) to adjust the line height and use the borderBox rect (or font size) height to size the inline box.

  • layout/displaytree/DisplayBox.h:

(WebCore::Display::Box::borderBoxHeight const):
(WebCore::Display::Box::marginBoxHeight const):

  • layout/inlineformatting/InlineLine.cpp:

(WebCore::Layout::Line::appendInlineContainerStart):
(WebCore::Layout::Line::appendTextContent):
(WebCore::Layout::Line::appendNonReplacedInlineBox):
(WebCore::Layout::Line::inlineItemContentHeight const):
(WebCore::Layout::Line::inlineItemHeight const): Deleted.

  • layout/inlineformatting/InlineLine.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246471 r246475  
     12019-06-16  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Use the borderBox rect consistently to size the inline box.
     4        https://bugs.webkit.org/show_bug.cgi?id=198899
     5
     6        Reviewed by Antti Koivisto.
     7        <rdar://problem/51781969>
     8
     9        Use the margin box height (when applicable) to adjust the line height and use the borderBox rect (or font size) height to size the inline box.
     10
     11        * layout/displaytree/DisplayBox.h:
     12        (WebCore::Display::Box::borderBoxHeight const):
     13        (WebCore::Display::Box::marginBoxHeight const):
     14        * layout/inlineformatting/InlineLine.cpp:
     15        (WebCore::Layout::Line::appendInlineContainerStart):
     16        (WebCore::Layout::Line::appendTextContent):
     17        (WebCore::Layout::Line::appendNonReplacedInlineBox):
     18        (WebCore::Layout::Line::inlineItemContentHeight const):
     19        (WebCore::Layout::Line::inlineItemHeight const): Deleted.
     20        * layout/inlineformatting/InlineLine.h:
     21
    1222019-06-15  Simon Fraser  <simon.fraser@apple.com>
    223
  • trunk/Source/WebCore/layout/displaytree/DisplayBox.h

    r245776 r246475  
    120120    LayoutUnit paddingBoxWidth() const { return paddingLeft().valueOr(0) + contentBoxWidth() + paddingRight().valueOr(0); }
    121121
     122    LayoutUnit borderBoxHeight() const { return borderTop() + paddingBoxHeight() + borderBottom(); }
    122123    LayoutUnit borderBoxWidth() const { return borderLeft() + paddingBoxWidth() + borderRight(); }
     124    LayoutUnit marginBoxHeight() const { return marginBefore() + borderBoxHeight() + marginAfter(); }
    123125    LayoutUnit marginBoxWidth() const { return marginStart() + borderBoxWidth() + marginEnd(); }
    124126
  • trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp

    r246457 r246475  
    178178
    179179    if (!m_skipVerticalAligment) {
    180         auto logicalHeight = inlineItemHeight(inlineItem);
     180        auto logicalHeight = inlineItemContentHeight(inlineItem);
    181181        adjustBaselineAndLineHeight(inlineItem, logicalHeight);
    182182        logicalRect.setHeight(logicalHeight);
     
    225225    logicalRect.setWidth(logicalWidth);
    226226    if (!m_skipVerticalAligment)
    227         logicalRect.setHeight(inlineItemHeight(inlineItem));
     227        logicalRect.setHeight(inlineItemContentHeight(inlineItem));
    228228
    229229    auto textContext = Content::Run::TextContext { inlineItem.start(), inlineItem.isCollapsed() ? 1 : inlineItem.length() };
     
    245245    logicalRect.setWidth(logicalWidth);
    246246    if (!m_skipVerticalAligment) {
    247         auto logicalHeight = inlineItemHeight(inlineItem);
    248         adjustBaselineAndLineHeight(inlineItem, logicalHeight);
    249         logicalRect.setHeight(logicalHeight);
     247        adjustBaselineAndLineHeight(inlineItem, displayBox.marginBoxHeight());
     248        logicalRect.setHeight(inlineItemContentHeight(inlineItem));
    250249    }
    251250
     
    321320}
    322321
    323 LayoutUnit Line::inlineItemHeight(const InlineItem& inlineItem) const
     322LayoutUnit Line::inlineItemContentHeight(const InlineItem& inlineItem) const
    324323{
    325324    ASSERT(!m_skipVerticalAligment);
     
    333332
    334333    if (layoutBox.isFloatingPositioned())
    335         return displayBox.marginBox().height();
     334        return displayBox.borderBoxHeight();
    336335
    337336    if (layoutBox.isReplaced())
    338         return displayBox.height();
     337        return displayBox.borderBoxHeight();
    339338
    340339    if (inlineItem.isContainerStart() || inlineItem.isContainerEnd())
     
    342341
    343342    // Non-replaced inline box (e.g. inline-block)
    344     return displayBox.marginBox().height();
     343    return displayBox.borderBoxHeight();
    345344}
    346345
  • trunk/Source/WebCore/layout/inlineformatting/InlineLine.h

    r246457 r246475  
    123123
    124124    void adjustBaselineAndLineHeight(const InlineItem&, LayoutUnit runHeight);
    125     LayoutUnit inlineItemHeight(const InlineItem&) const;
     125    LayoutUnit inlineItemContentHeight(const InlineItem&) const;
    126126    bool isVisuallyEmpty() const;
    127127
Note: See TracChangeset for help on using the changeset viewer.