Changeset 269818 in webkit


Ignore:
Timestamp:
Nov 14, 2020 9:38:37 AM (3 years ago)
Author:
Alan Bujtas
Message:

[LFC][Integration] Use the physical size when setting the pre-computed width/height on ReplacedBox
https://bugs.webkit.org/show_bug.cgi?id=218915

Reviewed by Antti Koivisto.

This is where the logical vs. physical coordinate flip happens on the integration level.

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::updateReplacedDimensions):
(WebCore::LayoutIntegration::LineLayout::updateInlineBlockDimensions):

  • layout/integration/LayoutIntegrationLineLayout.h:
  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::layoutModernLines):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269817 r269818  
     12020-11-14  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][Integration] Use the physical size when setting the pre-computed width/height on ReplacedBox
     4        https://bugs.webkit.org/show_bug.cgi?id=218915
     5
     6        Reviewed by Antti Koivisto.
     7
     8        This is where the logical vs. physical coordinate flip happens on the integration level.
     9
     10        * layout/integration/LayoutIntegrationLineLayout.cpp:
     11        (WebCore::LayoutIntegration::LineLayout::updateReplacedDimensions):
     12        (WebCore::LayoutIntegration::LineLayout::updateInlineBlockDimensions):
     13        * layout/integration/LayoutIntegrationLineLayout.h:
     14        * rendering/RenderBlockFlow.cpp:
     15        (WebCore::RenderBlockFlow::layoutModernLines):
     16
    1172020-11-14  Zalan Bujtas  <zalan@apple.com>
    218
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r269817 r269818  
    111111void LineLayout::updateReplacedDimensions(const RenderBox& replaced)
    112112{
    113     auto& layoutBox = m_boxTree.layoutBoxForRenderer(replaced);
     113    updateLayoutBoxDimensions(replaced);
     114}
     115
     116void LineLayout::updateInlineBlockDimensions(const RenderBlock& inlineBlock)
     117{
     118    updateLayoutBoxDimensions(inlineBlock);
     119}
     120
     121void LineLayout::updateLayoutBoxDimensions(const RenderBox& replacedOrInlineBlock)
     122{
     123    auto& layoutBox = m_boxTree.layoutBoxForRenderer(replacedOrInlineBlock);
     124    // Internally both replaced and inline-box content use replaced boxes.
    114125    auto& replacedBox = downcast<Layout::ReplacedBox>(layoutBox);
    115126
    116     replacedBox.setContentSizeForIntegration({ replaced.contentLogicalWidth(), replaced.contentLogicalHeight() });
    117 
    118     auto baseline = replaced.baselinePosition(AlphabeticBaseline, false /* firstLine */, HorizontalLine, PositionOnContainingLine);
     127    // Always use the physical size here for inline level boxes (this is where the logical vs. physical coords flip happens).
     128    replacedBox.setContentSizeForIntegration({ replacedOrInlineBlock.contentWidth(), replacedOrInlineBlock.contentHeight() });
     129
     130    auto baseline = replacedOrInlineBlock.baselinePosition(AlphabeticBaseline, false /* firstLine */, HorizontalLine, PositionOnContainingLine);
    119131    replacedBox.setBaseline(baseline);
    120132}
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h

    r269726 r269818  
    6565
    6666    void updateReplacedDimensions(const RenderBox&);
     67    void updateInlineBlockDimensions(const RenderBlock&);
    6768    void updateStyle(const RenderBoxModelObject&);
    6869    void layout();
     
    102103    void constructContent();
    103104    InlineContent& ensureInlineContent();
     105    void updateLayoutBoxDimensions(const RenderBox&);
    104106
    105107    RenderBlockFlow& flow() { return m_boxTree.flow(); }
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r269693 r269818  
    36223622            auto& block = downcast<RenderBlock>(renderer);
    36233623            block.layoutIfNeeded();
    3624             // FIXME: Taking the same path as replaced for now.
    3625             layoutFormattingContextLineLayout.updateReplacedDimensions(block);
     3624            ASSERT(block.style().display() == DisplayType::InlineBlock);
     3625            layoutFormattingContextLineLayout.updateInlineBlockDimensions(block);
    36263626            continue;
    36273627        }
Note: See TracChangeset for help on using the changeset viewer.