Title: [295458] trunk/Source/WebCore/style/InlineTextBoxStyle.cpp
Revision
295458
Author
za...@apple.com
Date
2022-06-10 11:50:09 -0700 (Fri, 10 Jun 2022)

Log Message

Remove redundant OptionSet<TextDecorationLine> in InlineTextBoxStyle functions
https://bugs.webkit.org/show_bug.cgi?id=241499

Reviewed by Antti Koivisto.

* Source/WebCore/style/InlineTextBoxStyle.cpp:
(WebCore::minLogicalTopForTextDecorationLine):
(WebCore::maxLogicalBottomForTextDecorationLine):
(WebCore::enclosingRendererWithTextDecoration):
(WebCore::textRunLogicalOffsetFromLineBottom):

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (295457 => 295458)


--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 18:19:56 UTC (rev 295457)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2022-06-10 18:50:09 UTC (rev 295458)
@@ -48,7 +48,7 @@
     return false;
 }
 
-static float minLogicalTopForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalTop, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecorationLine)
+static float minLogicalTopForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalTop, const RenderElement* decorationRenderer)
 {
     auto minLogicalTop = textRunLogicalTop;
     for (auto run = lineBox->firstLeafBox(); run; run.traverseNextOnLine()) {
@@ -55,7 +55,7 @@
         if (run->renderer().isOutOfFlowPositioned())
             continue; // Positioned placeholders don't affect calculations.
 
-        if (!(run->style().textDecorationsInEffect() & textDecorationLine))
+        if (!run->style().textDecorationsInEffect().contains(TextDecorationLine::Underline))
             continue; // If the text decoration isn't in effect on the child, then it must be outside of |decorationRenderer|'s hierarchy.
 
         if (decorationRenderer && decorationRenderer->isRenderInline() && !isAncestorAndWithinBlock(downcast<RenderInline>(*decorationRenderer), &run->renderer()))
@@ -67,7 +67,7 @@
     return minLogicalTop;
 }
 
-static float maxLogicalBottomForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalBottom, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecorationLine)
+static float maxLogicalBottomForTextDecorationLine(const InlineIterator::LineBoxIterator& lineBox, float textRunLogicalBottom, const RenderElement* decorationRenderer)
 {
     auto maxLogicalBottom = textRunLogicalBottom;
     for (auto run = lineBox->firstLeafBox(); run; run.traverseNextOnLine()) {
@@ -74,7 +74,7 @@
         if (run->renderer().isOutOfFlowPositioned())
             continue; // Positioned placeholders don't affect calculations.
 
-        if (!(run->style().textDecorationsInEffect() & textDecorationLine))
+        if (!run->style().textDecorationsInEffect().contains(TextDecorationLine::Underline))
             continue; // If the text decoration isn't in effect on the child, then it must be outside of |decorationRenderer|'s hierarchy.
 
         if (decorationRenderer && decorationRenderer->isRenderInline() && !isAncestorAndWithinBlock(downcast<RenderInline>(*decorationRenderer), &run->renderer()))
@@ -86,7 +86,7 @@
     return maxLogicalBottom;
 }
 
-static const RenderElement* enclosingRendererWithTextDecoration(const RenderText& renderer, OptionSet<TextDecorationLine> textDecorationLine, bool firstLine)
+static const RenderElement* enclosingRendererWithTextDecoration(const RenderText& renderer, bool firstLine)
 {
     const RenderElement* current = renderer.parent();
     do {
@@ -96,7 +96,7 @@
             return nullptr;
 
         const RenderStyle& styleToUse = firstLine ? current->firstLineStyle() : current->style();
-        if (styleToUse.textDecorationLine() & textDecorationLine)
+        if (styleToUse.textDecorationLine().contains(TextDecorationLine::Underline))
             return current;
         current = current->parent();
     } while (current && (!current->element() || (!is<HTMLAnchorElement>(*current->element()) && !current->element()->hasTagName(HTMLNames::fontTag))));
@@ -107,12 +107,12 @@
 float textRunLogicalOffsetFromLineBottom(const InlineIterator::TextBoxIterator& textRun)
 {
     float offset = 0.f;
-    auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), TextDecorationLine::Underline, textRun->lineBox()->isFirst());
+    auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), textRun->lineBox()->isFirst());
     if (textRun->renderer().style().isFlippedLinesWritingMode()) {
-        auto minLogicalTop = minLogicalTopForTextDecorationLine(textRun->lineBox(), textRun->logicalTop(), decorationRenderer, TextDecorationLine::Underline);
+        auto minLogicalTop = minLogicalTopForTextDecorationLine(textRun->lineBox(), textRun->logicalTop(), decorationRenderer);
         offset = textRun->logicalTop() - minLogicalTop;
     } else {
-        offset = maxLogicalBottomForTextDecorationLine(textRun->lineBox(), textRun->logicalBottom(), decorationRenderer, TextDecorationLine::Underline);
+        offset = maxLogicalBottomForTextDecorationLine(textRun->lineBox(), textRun->logicalBottom(), decorationRenderer);
         offset -= textRun->logicalBottom();
     }
     return offset;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to