Changeset 295450 in webkit


Ignore:
Timestamp:
Jun 10, 2022 5:26:02 AM (2 years ago)
Author:
Alan Bujtas
Message:

minLogicalTopForTextDecorationLine/maxLogicalBottomForTextDecorationLine should return the min/max value
https://bugs.webkit.org/show_bug.cgi?id=241474

Reviewed by Antti Koivisto.

This improves readability and also a preparation for making decoration visual overflow work with IFC.

  • Source/WebCore/style/InlineTextBoxStyle.cpp:

(WebCore::minLogicalTopForTextDecorationLine):
(WebCore::maxLogicalBottomForTextDecorationLine):
(WebCore::computeUnderlineOffset):

Canonical link: https://commits.webkit.org/251456@main

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/style/InlineTextBoxStyle.cpp

    r295444 r295450  
    4949}
    5050
    51 static void minLogicalTopForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float& minLogicalTop, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecorationLine)
    52 {
     51static float minLogicalTopForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalTop, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecorationLine)
     52{
     53    auto minLogicalTop = textRunLogicalTop;
    5354    for (auto run = lineBox->firstLeafBox(); run; run.traverseNextOnLine()) {
    5455        if (run->renderer().isOutOfFlowPositioned())
     
    6465            minLogicalTop = std::min<float>(minLogicalTop, run->logicalTop());
    6566    }
    66 }
    67 
    68 static void maxLogicalBottomForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float& maxLogicalBottom, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecorationLine)
    69 {
     67    return minLogicalTop;
     68}
     69
     70static float maxLogicalBottomForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalBottom, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecorationLine)
     71{
     72    auto maxLogicalBottom = textRunLogicalBottom;
    7073    for (auto run = lineBox->firstLeafBox(); run; run.traverseNextOnLine()) {
    7174        if (run->renderer().isOutOfFlowPositioned())
     
    8184            maxLogicalBottom = std::max<float>(maxLogicalBottom, run->logicalBottom());
    8285    }
     86    return maxLogicalBottom;
    8387}
    8488
     
    141145        float offset;
    142146        if (context.renderer->style().isFlippedLinesWritingMode()) {
    143             offset = context.textRunLogicalTop;
    144             minLogicalTopForTextDecorationLine(context.lineBox, offset, decorationRenderer, TextDecorationLine::Underline);
    145             offset = context.textRunLogicalTop - offset;
     147            auto minLogicalTop = minLogicalTopForTextDecorationLine(context.lineBox, context.textRunLogicalTop, decorationRenderer, TextDecorationLine::Underline);
     148            offset = context.textRunLogicalTop - minLogicalTop;
    146149        } else {
    147             offset = context.textRunLogicalBottom;
    148             maxLogicalBottomForTextDecorationLine(context.lineBox, offset, decorationRenderer, TextDecorationLine::Underline);
     150            offset = maxLogicalBottomForTextDecorationLine(context.lineBox, context.textRunLogicalBottom, decorationRenderer, TextDecorationLine::Underline);
    149151            offset -= context.textRunLogicalBottom;
    150152        }
Note: See TracChangeset for help on using the changeset viewer.