Changeset 289897 in webkit


Ignore:
Timestamp:
Feb 16, 2022, 9:29:44 AM (4 years ago)
Author:
Alan Bujtas
Message:

[LFC][Integration] LineLayout::firstLineBaseline callers expect physical position
https://bugs.webkit.org/show_bug.cgi?id=236688

Reviewed by Antti Koivisto.

Legacy line layout returns the physical position too, though in a bit obscure manner:

firstRootBox()->logicalTop() + firstLineStyle().metricsOfPrimaryFont().descent(firstRootBox()->baselineType())
where

The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line.
float logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_topLeft.x(); }

  • layout/integration/LayoutIntegrationLine.h:

(WebCore::LayoutIntegration::Line::lineBoxHeight const):
(WebCore::LayoutIntegration::Line::lineBoxWidth const):

  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::firstLinePhysicalBaseline const):
(WebCore::LayoutIntegration::LineLayout::lastLineLogicalBaseline const):
(WebCore::LayoutIntegration::LineLayout::firstLineBaseline const): Deleted.
(WebCore::LayoutIntegration::LineLayout::lastLineBaseline const): Deleted.

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

(WebCore::RenderBlockFlow::firstLineBaseline const):
(WebCore::RenderBlockFlow::inlineBlockBaseline const):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r289896 r289897  
     12022-02-16  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][Integration] LineLayout::firstLineBaseline callers expect physical position
     4        https://bugs.webkit.org/show_bug.cgi?id=236688
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Legacy line layout returns the physical position too, though in a bit obscure manner:
     9
     10          firstRootBox()->logicalTop() + firstLineStyle().metricsOfPrimaryFont().descent(firstRootBox()->baselineType())
     11          where
     12            // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line.
     13            float logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_topLeft.x(); }
     14
     15        * layout/integration/LayoutIntegrationLine.h:
     16        (WebCore::LayoutIntegration::Line::lineBoxHeight const):
     17        (WebCore::LayoutIntegration::Line::lineBoxWidth const):
     18        * layout/integration/LayoutIntegrationLineLayout.cpp:
     19        (WebCore::LayoutIntegration::LineLayout::firstLinePhysicalBaseline const):
     20        (WebCore::LayoutIntegration::LineLayout::lastLineLogicalBaseline const):
     21        (WebCore::LayoutIntegration::LineLayout::firstLineBaseline const): Deleted.
     22        (WebCore::LayoutIntegration::LineLayout::lastLineBaseline const): Deleted.
     23        * layout/integration/LayoutIntegrationLineLayout.h:
     24        * rendering/RenderBlockFlow.cpp:
     25        (WebCore::RenderBlockFlow::firstLineBaseline const):
     26        (WebCore::RenderBlockFlow::inlineBlockBaseline const):
     27
    1282022-02-16  Gavin Phillips  <gavin.p@apple.com>
    229
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h

    r289471 r289897  
    5959    float lineBoxLeft() const { return m_lineBoxRect.x(); }
    6060    float lineBoxRight() const { return m_lineBoxRect.maxX(); }
     61    float lineBoxHeight() const { return m_lineBoxRect.height(); }
     62    float lineBoxWidth() const { return m_lineBoxRect.width(); }
    6163
    6264    float enclosingContentTop() const { return m_enclosingContentTop; }
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r289734 r289897  
    425425}
    426426
    427 LayoutUnit LineLayout::firstLineBaseline() const
     427LayoutUnit LineLayout::firstLinePhysicalBaseline() const
    428428{
    429429    if (!m_inlineContent || m_inlineContent->lines.isEmpty()) {
     
    436436        return LayoutUnit { firstLine.lineBoxTop() + firstLine.baseline() };
    437437
    438     // See LineLayout::lastLineBaseline below for more info.
    439     auto lineLogicalTop = flow().logicalHeight() - firstLine.lineBoxRight();
    440     return LayoutUnit { lineLogicalTop + firstLine.baseline() };
    441 }
    442 
    443 LayoutUnit LineLayout::lastLineBaseline() const
     438    return LayoutUnit { firstLine.lineBoxLeft() + (firstLine.lineBoxWidth() - firstLine.baseline()) };
     439}
     440
     441LayoutUnit LineLayout::lastLineLogicalBaseline() const
    444442{
    445443    if (!m_inlineContent || m_inlineContent->lines.isEmpty()) {
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h

    r288418 r289897  
    8989    size_t lineCount() const;
    9090
    91     LayoutUnit firstLineBaseline() const;
    92     LayoutUnit lastLineBaseline() const;
     91    LayoutUnit firstLinePhysicalBaseline() const;
     92    LayoutUnit lastLineLogicalBaseline() const;
    9393
    9494    void adjustForPagination();
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r289466 r289897  
    29602960#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    29612961    if (modernLineLayout())
    2962         return LayoutUnit { floorToInt(modernLineLayout()->firstLineBaseline()) };
     2962        return LayoutUnit { floorToInt(modernLineLayout()->firstLinePhysicalBaseline()) };
    29632963#endif
    29642964
     
    30113011#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    30123012        else if (modernLineLayout())
    3013             lastBaseline = floorToInt(modernLineLayout()->lastLineBaseline());
     3013            lastBaseline = floorToInt(modernLineLayout()->lastLineLogicalBaseline());
    30143014#endif
    30153015    }
Note: See TracChangeset for help on using the changeset viewer.