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

Changeset 285904 in webkit


Ignore:
Timestamp:
Nov 16, 2021, 5:26:57 PM (5 years ago)
Author:
Nikos Mouchtaris
Message:

Rename TextDecoration to TextDecorationLine
https://bugs.webkit.org/show_bug.cgi?id=232729

Reviewed by Myles C. Maxfield.

Source/WebCore:

Split up patch by Tim Nguyen: https://bugs.webkit.org/show_bug.cgi?id=230083. This patch
renames enum TextDecoration to TextDecorationLine, to be more in line with the current spec.

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::hasUnderline const):

  • accessibility/atk/WebKitAccessibleInterfaceText.cpp:

(getAttributeSetForAccessibilityObject):

  • accessibility/mac/WebAccessibilityObjectWrapperBase.mm:

(AXAttributeStringSetStyle):

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(AXAttributeStringSetStyle):

  • animation/CSSPropertyAnimation.cpp:

(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::renderTextDecorationLineFlagsToCSSValue):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
(WebCore::renderTextDecorationFlagsToCSSValue): Deleted.

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::operator OptionSet<TextDecorationLine> const):
(WebCore::CSSPrimitiveValue::operator OptionSet<TextDecoration> const): Deleted.

  • editing/Editor.cpp:

(WebCore::Editor::fontAttributesAtSelectionStart):

  • editing/cocoa/HTMLConverter.mm:

(WebCore::editingAttributedString):

  • rendering/StyledMarkedText.cpp:

(WebCore::resolveStyleForMarkedText):

  • rendering/TextDecorationPainter.cpp:

(WebCore::TextDecorationPainter::TextDecorationPainter):
(WebCore::TextDecorationPainter::paintTextDecoration):
(WebCore::collectStylesForRenderer):
(WebCore::TextDecorationPainter::textDecorationsInEffectForStyle):
(WebCore::TextDecorationPainter::stylesForRenderer):

  • rendering/TextDecorationPainter.h:
  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::textDecorationsInEffect const):
(WebCore::RenderStyle::textDecoration const):
(WebCore::RenderStyle::addToTextDecorationsInEffect):
(WebCore::RenderStyle::setTextDecorationsInEffect):
(WebCore::RenderStyle::setTextDecoration):
(WebCore::RenderStyle::initialTextDecoration):

  • rendering/style/RenderStyleConstants.cpp:

(WebCore::operator<<):

  • rendering/style/RenderStyleConstants.h:
  • rendering/svg/SVGInlineTextBox.cpp:

(WebCore::SVGInlineTextBox::paint):
(WebCore::positionOffsetForDecoration):
(WebCore::thicknessForDecoration):
(WebCore::SVGInlineTextBox::paintDecoration):
(WebCore::SVGInlineTextBox::paintDecorationWithStyle):

  • rendering/svg/SVGInlineTextBox.h:
  • style/InlineTextBoxStyle.cpp:

(WebCore::minLogicalTopForTextDecorationLine):
(WebCore::maxLogicalBottomForTextDecorationLine):
(WebCore::enclosingRendererWithTextDecoration):
(WebCore::computeUnderlineOffset):
(WebCore::visualOverflowForDecorations):

  • style/StyleBuilderConverter.h:

(WebCore::Style::BuilderConverter::convertTextDecoration):

Source/WebKitLegacy/mac:

  • WebView/WebView.mm:

(-[WebView updateTextTouchBar]):

Location:
trunk/Source
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r285898 r285904  
     12021-11-16  Nikolaos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        Rename TextDecoration to TextDecorationLine
     4        https://bugs.webkit.org/show_bug.cgi?id=232729
     5
     6        Reviewed by Myles C. Maxfield.
     7
     8        Split up patch by Tim Nguyen: https://bugs.webkit.org/show_bug.cgi?id=230083. This patch
     9        renames enum TextDecoration to TextDecorationLine, to be more in line with the current spec.
     10
     11        * accessibility/AccessibilityRenderObject.cpp:
     12        (WebCore::AccessibilityRenderObject::hasUnderline const):
     13        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
     14        (getAttributeSetForAccessibilityObject):
     15        * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
     16        (AXAttributeStringSetStyle):
     17        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     18        (AXAttributeStringSetStyle):
     19        * animation/CSSPropertyAnimation.cpp:
     20        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     21        * css/CSSComputedStyleDeclaration.cpp:
     22        (WebCore::renderTextDecorationLineFlagsToCSSValue):
     23        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
     24        (WebCore::renderTextDecorationFlagsToCSSValue): Deleted.
     25        * css/CSSPrimitiveValueMappings.h:
     26        (WebCore::CSSPrimitiveValue::operator OptionSet<TextDecorationLine> const):
     27        (WebCore::CSSPrimitiveValue::operator OptionSet<TextDecoration> const): Deleted.
     28        * editing/Editor.cpp:
     29        (WebCore::Editor::fontAttributesAtSelectionStart):
     30        * editing/cocoa/HTMLConverter.mm:
     31        (WebCore::editingAttributedString):
     32        * rendering/StyledMarkedText.cpp:
     33        (WebCore::resolveStyleForMarkedText):
     34        * rendering/TextDecorationPainter.cpp:
     35        (WebCore::TextDecorationPainter::TextDecorationPainter):
     36        (WebCore::TextDecorationPainter::paintTextDecoration):
     37        (WebCore::collectStylesForRenderer):
     38        (WebCore::TextDecorationPainter::textDecorationsInEffectForStyle):
     39        (WebCore::TextDecorationPainter::stylesForRenderer):
     40        * rendering/TextDecorationPainter.h:
     41        * rendering/style/RenderStyle.h:
     42        (WebCore::RenderStyle::textDecorationsInEffect const):
     43        (WebCore::RenderStyle::textDecoration const):
     44        (WebCore::RenderStyle::addToTextDecorationsInEffect):
     45        (WebCore::RenderStyle::setTextDecorationsInEffect):
     46        (WebCore::RenderStyle::setTextDecoration):
     47        (WebCore::RenderStyle::initialTextDecoration):
     48        * rendering/style/RenderStyleConstants.cpp:
     49        (WebCore::operator<<):
     50        * rendering/style/RenderStyleConstants.h:
     51        * rendering/svg/SVGInlineTextBox.cpp:
     52        (WebCore::SVGInlineTextBox::paint):
     53        (WebCore::positionOffsetForDecoration):
     54        (WebCore::thicknessForDecoration):
     55        (WebCore::SVGInlineTextBox::paintDecoration):
     56        (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
     57        * rendering/svg/SVGInlineTextBox.h:
     58        * style/InlineTextBoxStyle.cpp:
     59        (WebCore::minLogicalTopForTextDecorationLine):
     60        (WebCore::maxLogicalBottomForTextDecorationLine):
     61        (WebCore::enclosingRendererWithTextDecoration):
     62        (WebCore::computeUnderlineOffset):
     63        (WebCore::visualOverflowForDecorations):
     64        * style/StyleBuilderConverter.h:
     65        (WebCore::Style::BuilderConverter::convertTextDecoration):
     66
    1672021-11-16  Devin Rousso  <drousso@apple.com>
    268
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r285389 r285904  
    38593859        return false;
    38603860   
    3861     return m_renderer->style().textDecorationsInEffect().contains(TextDecoration::Underline);
     3861    return m_renderer->style().textDecorationsInEffect().contains(TextDecorationLine::Underline);
    38623862}
    38633863
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp

    r284857 r285904  
    165165    }
    166166
    167     result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_UNDERLINE), (style->textDecoration() & TextDecoration::Underline) ? "single" : "none");
     167    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_UNDERLINE), (style->textDecoration() & TextDecorationLine::Underline) ? "single" : "none");
    168168
    169169    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STYLE), style->fontCascade().italic() ? "italic" : "normal");
    170170
    171     result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STRIKETHROUGH), (style->textDecoration() & TextDecoration::LineThrough) ? "true" : "false");
     171    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STRIKETHROUGH), (style->textDecoration() & TextDecorationLine::LineThrough) ? "true" : "false");
    172172
    173173    result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INVISIBLE), (style->visibility() == Visibility::Hidden) ? "true" : "false");
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm

    r282448 r285904  
    592592
    593593    auto decor = style.textDecorationsInEffect();
    594     if (decor & TextDecoration::Underline)
     594    if (decor & TextDecorationLine::Underline)
    595595        AXAttributeStringSetNumber(attrString, UIAccessibilityTokenUnderline, @YES, range);
    596596
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r285872 r285904  
    880880    // set underline and strikethrough
    881881    auto decor = style.textDecorationsInEffect();
    882     if (!(decor & TextDecoration::Underline)) {
     882    if (!(decor & TextDecorationLine::Underline)) {
    883883        [attrString removeAttribute:NSAccessibilityUnderlineTextAttribute range:range];
    884884        [attrString removeAttribute:NSAccessibilityUnderlineColorTextAttribute range:range];
    885885    }
    886    
    887     if (!(decor & TextDecoration::LineThrough)) {
     886    if (!(decor & TextDecorationLine::LineThrough)) {
    888887        [attrString removeAttribute:NSAccessibilityStrikethroughTextAttribute range:range];
    889888        [attrString removeAttribute:NSAccessibilityStrikethroughColorTextAttribute range:range];
    890889    }
    891890
    892     if (decor & TextDecoration::Underline || decor & TextDecoration::LineThrough) {
     891    if (decor & TextDecorationLine::Underline || decor & TextDecorationLine::LineThrough) {
    893892        // FIXME: Should the underline style be reported here?
    894893        auto decorationStyles = TextDecorationPainter::stylesForRenderer(*renderer, decor);
    895894
    896         if (decor & TextDecoration::Underline) {
     895        if (decor & TextDecorationLine::Underline) {
    897896            AXAttributeStringSetNumber(attrString, NSAccessibilityUnderlineTextAttribute, @YES, range);
    898897            AXAttributeStringSetColor(attrString, NSAccessibilityUnderlineColorTextAttribute, cocoaColor(decorationStyles.underlineColor).get(), range);
    899898        }
    900        
    901         if (decor & TextDecoration::LineThrough) {
     899
     900        if (decor & TextDecorationLine::LineThrough) {
    902901            AXAttributeStringSetNumber(attrString, NSAccessibilityStrikethroughTextAttribute, @YES, range);
    903902            AXAttributeStringSetColor(attrString, NSAccessibilityStrikethroughColorTextAttribute, cocoaColor(decorationStyles.linethroughColor).get(), range);
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r285822 r285904  
    27472747        new DiscretePropertyWrapper<TableLayoutType>(CSSPropertyTableLayout, &RenderStyle::tableLayout, &RenderStyle::setTableLayout),
    27482748        new DiscretePropertyWrapper<TextAlignMode>(CSSPropertyTextAlign, &RenderStyle::textAlign, &RenderStyle::setTextAlign),
    2749         new DiscretePropertyWrapper<OptionSet<TextDecoration>>(CSSPropertyTextDecorationLine, &RenderStyle::textDecoration, &RenderStyle::setTextDecoration),
     2749        new DiscretePropertyWrapper<OptionSet<TextDecorationLine>>(CSSPropertyTextDecorationLine, &RenderStyle::textDecoration, &RenderStyle::setTextDecoration),
    27502750        new DiscretePropertyWrapper<TextDecorationStyle>(CSSPropertyTextDecorationStyle, &RenderStyle::textDecorationStyle, &RenderStyle::setTextDecorationStyle),
    27512751        new DiscretePropertyWrapper<const Color&>(CSSPropertyWebkitTextEmphasisColor, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor),
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r285822 r285904  
    16141614}
    16151615
    1616 static Ref<CSSValue> renderTextDecorationFlagsToCSSValue(OptionSet<TextDecoration> textDecoration)
     1616static Ref<CSSValue> renderTextDecorationLineFlagsToCSSValue(OptionSet<TextDecorationLine> textDecorationLine)
    16171617{
    16181618    auto& cssValuePool = CSSValuePool::singleton();
    16191619    // Blink value is ignored.
    16201620    auto list = CSSValueList::createSpaceSeparated();
    1621     if (textDecoration & TextDecoration::Underline)
     1621    if (textDecorationLine & TextDecorationLine::Underline)
    16221622        list->append(cssValuePool.createIdentifierValue(CSSValueUnderline));
    1623     if (textDecoration & TextDecoration::Overline)
     1623    if (textDecorationLine & TextDecorationLine::Overline)
    16241624        list->append(cssValuePool.createIdentifierValue(CSSValueOverline));
    1625     if (textDecoration & TextDecoration::LineThrough)
     1625    if (textDecorationLine & TextDecorationLine::LineThrough)
    16261626        list->append(cssValuePool.createIdentifierValue(CSSValueLineThrough));
    16271627
     
    32923292            return cssValuePool.createValue(style.textAlign());
    32933293        case CSSPropertyTextDecoration:
    3294             return renderTextDecorationFlagsToCSSValue(style.textDecoration());
     3294            return renderTextDecorationLineFlagsToCSSValue(style.textDecoration());
    32953295#if ENABLE(CSS3_TEXT)
    32963296        case CSSPropertyWebkitTextAlignLast:
     
    33023302            return getCSSPropertyValuesForShorthandProperties(webkitTextDecorationShorthand());
    33033303        case CSSPropertyTextDecorationLine:
    3304             return renderTextDecorationFlagsToCSSValue(style.textDecoration());
     3304            return renderTextDecorationLineFlagsToCSSValue(style.textDecoration());
    33053305        case CSSPropertyTextDecorationStyle:
    33063306            return renderTextDecorationStyleFlagsToCSSValue(style.textDecorationStyle());
     
    33183318            return textDecorationThicknessToCSSValue(style.textDecorationThickness());
    33193319        case CSSPropertyWebkitTextDecorationsInEffect:
    3320             return renderTextDecorationFlagsToCSSValue(style.textDecorationsInEffect());
     3320            return renderTextDecorationLineFlagsToCSSValue(style.textDecorationsInEffect());
    33213321        case CSSPropertyWebkitTextFillColor:
    33223322            return currentColorOrValidColor(&style, style.textFillColor());
  • trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h

    r285615 r285904  
    24132413#endif // CSS3_TEXT
    24142414
    2415 template<> inline CSSPrimitiveValue::operator OptionSet<TextDecoration>() const
     2415template<> inline CSSPrimitiveValue::operator OptionSet<TextDecorationLine>() const
    24162416{
    24172417    ASSERT(isValueID());
     
    24192419    switch (m_value.valueID) {
    24202420    case CSSValueNone:
    2421         return OptionSet<TextDecoration> { };
     2421        return OptionSet<TextDecorationLine> { };
    24222422    case CSSValueUnderline:
    2423         return TextDecoration::Underline;
     2423        return TextDecorationLine::Underline;
    24242424    case CSSValueOverline:
    2425         return TextDecoration::Overline;
     2425        return TextDecorationLine::Overline;
    24262426    case CSSValueLineThrough:
    2427         return TextDecoration::LineThrough;
     2427        return TextDecorationLine::LineThrough;
    24282428    case CSSValueBlink:
    2429         return TextDecoration::Blink;
    2430     default:
    2431         break;
    2432     }
    2433 
    2434     ASSERT_NOT_REACHED();
    2435     return OptionSet<TextDecoration> { };
     2429        return TextDecorationLine::Blink;
     2430    default:
     2431        break;
     2432    }
     2433
     2434    ASSERT_NOT_REACHED();
     2435    return OptionSet<TextDecorationLine> { };
    24362436}
    24372437
  • trunk/Source/WebCore/editing/Editor.cpp

    r285655 r285904  
    40994099    } else {
    41004100        auto decoration = style->textDecorationsInEffect();
    4101         if (decoration & TextDecoration::LineThrough)
     4101        if (decoration & TextDecorationLine::LineThrough)
    41024102            attributes.hasStrikeThrough = true;
    4103         if (decoration & TextDecoration::Underline)
     4103        if (decoration & TextDecorationLine::Underline)
    41044104            attributes.hasUnderline = true;
    41054105    }
  • trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm

    r285373 r285904  
    23812381            continue;
    23822382        auto& style = renderer->style();
    2383         if (style.textDecorationsInEffect() & TextDecoration::Underline)
     2383        if (style.textDecorationsInEffect() & TextDecorationLine::Underline)
    23842384            [attrs setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
    2385         if (style.textDecorationsInEffect() & TextDecoration::LineThrough)
     2385        if (style.textDecorationsInEffect() & TextDecorationLine::LineThrough)
    23862386            [attrs setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
    23872387        if (auto font = style.fontCascade().primaryFont().getCTFont())
  • trunk/Source/WebCore/rendering/StyledMarkedText.cpp

    r284080 r285904  
    5858            auto decorations = renderStyle->textDecorationsInEffect();
    5959
    60             if (decorations.contains(TextDecoration::Underline)) {
     60            if (decorations.contains(TextDecorationLine::Underline)) {
    6161                style.textDecorationStyles.underlineColor = color;
    6262                style.textDecorationStyles.underlineStyle = decorationStyle;
    6363            }
    64             if (decorations.contains(TextDecoration::Overline)) {
     64            if (decorations.contains(TextDecorationLine::Overline)) {
    6565                style.textDecorationStyles.overlineColor = color;
    6666                style.textDecorationStyles.overlineStyle = decorationStyle;
    6767            }
    68             if (decorations.contains(TextDecoration::LineThrough)) {
     68            if (decorations.contains(TextDecorationLine::LineThrough)) {
    6969                style.textDecorationStyles.linethroughColor = color;
    7070                style.textDecorationStyles.linethroughStyle = decorationStyle;
  • trunk/Source/WebCore/rendering/TextDecorationPainter.cpp

    r285567 r285904  
    191191}
    192192
    193 TextDecorationPainter::TextDecorationPainter(GraphicsContext& context, OptionSet<TextDecoration> decorations, const RenderText& renderer, bool isFirstLine, const FontCascade& font, std::optional<Styles> styles)
     193TextDecorationPainter::TextDecorationPainter(GraphicsContext& context, OptionSet<TextDecorationLine> decorations, const RenderText& renderer, bool isFirstLine, const FontCascade& font, std::optional<Styles> styles)
    194194    : m_context { context }
    195195    , m_decorations { decorations }
     
    208208    FloatPoint localOrigin = boxOrigin;
    209209
    210     auto paintDecoration = [&] (TextDecoration decoration, TextDecorationStyle style, const Color& color, const FloatRect& rect) {
     210    auto paintDecoration = [&] (TextDecorationLine decoration, TextDecorationStyle style, const Color& color, const FloatRect& rect) {
    211211        m_context.setStrokeColor(color);
    212212
     
    215215        if (style == TextDecorationStyle::Wavy)
    216216            strokeWavyTextDecoration(m_context, rect, m_lineStyle.computedFontPixelSize());
    217         else if (decoration == TextDecoration::Underline || decoration == TextDecoration::Overline) {
     217        else if (decoration == TextDecorationLine::Underline || decoration == TextDecorationLine::Overline) {
    218218            if ((m_lineStyle.textDecorationSkipInk() == TextDecorationSkipInk::Auto || m_lineStyle.textDecorationSkipInk() == TextDecorationSkipInk::All) && m_isHorizontal) {
    219219                if (!m_context.paintingDisabled()) {
     
    230230            }
    231231        } else {
    232             ASSERT(decoration == TextDecoration::LineThrough);
     232            ASSERT(decoration == TextDecorationLine::LineThrough);
    233233            m_context.drawLineForText(rect, m_isPrinting, style == TextDecorationStyle::Double, strokeStyle);
    234234        }
    235235    };
    236236
    237     bool areLinesOpaque = !m_isPrinting && (!m_decorations.contains(TextDecoration::Underline) || m_styles.underlineColor.isOpaque())
    238         && (!m_decorations.contains(TextDecoration::Overline) || m_styles.overlineColor.isOpaque())
    239         && (!m_decorations.contains(TextDecoration::LineThrough) || m_styles.linethroughColor.isOpaque());
     237    bool areLinesOpaque = !m_isPrinting && (!m_decorations.contains(TextDecorationLine::Underline) || m_styles.underlineColor.isOpaque())
     238        && (!m_decorations.contains(TextDecorationLine::Overline) || m_styles.overlineColor.isOpaque())
     239        && (!m_decorations.contains(TextDecorationLine::LineThrough) || m_styles.linethroughColor.isOpaque());
    240240
    241241    float extraOffset = 0;
     
    278278
    279279        // These decorations should match the visual overflows computed in visualOverflowForDecorations().
    280         if (m_decorations.contains(TextDecoration::Underline)) {
     280        if (m_decorations.contains(TextDecorationLine::Underline)) {
    281281            float textDecorationBaseFontSize = 16;
    282282            auto defaultGap = m_lineStyle.computedFontSize() / textDecorationBaseFontSize;
     
    285285            FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness));
    286286            rect.move(0, offset + wavyOffset);
    287             paintDecoration(TextDecoration::Underline, m_styles.underlineStyle, m_styles.underlineColor, rect);
    288         }
    289         if (m_decorations.contains(TextDecoration::Overline)) {
     287            paintDecoration(TextDecorationLine::Underline, m_styles.underlineStyle, m_styles.underlineColor, rect);
     288        }
     289        if (m_decorations.contains(TextDecorationLine::Overline)) {
    290290            float wavyOffset = m_styles.overlineStyle == TextDecorationStyle::Wavy ? m_wavyOffset : 0;
    291291            FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness));
    292292            float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(m_lineStyle.computedFontSize(), fontMetrics);
    293293            rect.move(0, autoTextDecorationThickness - textDecorationThickness - wavyOffset);
    294             paintDecoration(TextDecoration::Overline, m_styles.overlineStyle, m_styles.overlineColor, rect);
    295         }
    296         if (m_decorations.contains(TextDecoration::LineThrough)) {
     294            paintDecoration(TextDecorationLine::Overline, m_styles.overlineStyle, m_styles.overlineColor, rect);
     295        }
     296        if (m_decorations.contains(TextDecorationLine::LineThrough)) {
    297297            FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness));
    298298            float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(m_lineStyle.computedFontSize(), fontMetrics);
    299299            auto center = 2 * fontMetrics.floatAscent() / 3 + autoTextDecorationThickness / 2;
    300300            rect.move(0, center - textDecorationThickness / 2);
    301             paintDecoration(TextDecoration::LineThrough, m_styles.linethroughStyle, m_styles.linethroughColor, rect);
     301            paintDecoration(TextDecorationLine::LineThrough, m_styles.linethroughStyle, m_styles.linethroughColor, rect);
    302302        }
    303303    } while (shadow);
     
    309309}
    310310
    311 static void collectStylesForRenderer(TextDecorationPainter::Styles& result, const RenderObject& renderer, OptionSet<TextDecoration> remainingDecorations, bool firstLineStyle, PseudoId pseudoId)
    312 {
    313     auto extractDecorations = [&] (const RenderStyle& style, OptionSet<TextDecoration> decorations) {
     311static void collectStylesForRenderer(TextDecorationPainter::Styles& result, const RenderObject& renderer, OptionSet<TextDecorationLine> remainingDecorations, bool firstLineStyle, PseudoId pseudoId)
     312{
     313    auto extractDecorations = [&] (const RenderStyle& style, OptionSet<TextDecorationLine> decorations) {
    314314        auto color = TextDecorationPainter::decorationColor(style);
    315315        auto decorationStyle = style.textDecorationStyle();
    316316
    317         if (decorations.contains(TextDecoration::Underline)) {
    318             remainingDecorations.remove(TextDecoration::Underline);
     317        if (decorations.contains(TextDecorationLine::Underline)) {
     318            remainingDecorations.remove(TextDecorationLine::Underline);
    319319            result.underlineColor = color;
    320320            result.underlineStyle = decorationStyle;
    321321        }
    322         if (decorations.contains(TextDecoration::Overline)) {
    323             remainingDecorations.remove(TextDecoration::Overline);
     322        if (decorations.contains(TextDecorationLine::Overline)) {
     323            remainingDecorations.remove(TextDecorationLine::Overline);
    324324            result.overlineColor = color;
    325325            result.overlineStyle = decorationStyle;
    326326        }
    327         if (decorations.contains(TextDecoration::LineThrough)) {
    328             remainingDecorations.remove(TextDecoration::LineThrough);
     327        if (decorations.contains(TextDecorationLine::LineThrough)) {
     328            remainingDecorations.remove(TextDecorationLine::LineThrough);
    329329            result.linethroughColor = color;
    330330            result.linethroughStyle = decorationStyle;
     
    369369}
    370370
    371 OptionSet<TextDecoration> TextDecorationPainter::textDecorationsInEffectForStyle(const TextDecorationPainter::Styles& style)
    372 {
    373     OptionSet<TextDecoration> decorations;
     371OptionSet<TextDecorationLine> TextDecorationPainter::textDecorationsInEffectForStyle(const TextDecorationPainter::Styles& style)
     372{
     373    OptionSet<TextDecorationLine> decorations;
    374374    if (style.underlineColor.isValid())
    375         decorations.add(TextDecoration::Underline);
     375        decorations.add(TextDecorationLine::Underline);
    376376    if (style.overlineColor.isValid())
    377         decorations.add(TextDecoration::Overline);
     377        decorations.add(TextDecorationLine::Overline);
    378378    if (style.linethroughColor.isValid())
    379         decorations.add(TextDecoration::LineThrough);
     379        decorations.add(TextDecorationLine::LineThrough);
    380380    return decorations;
    381381};
    382382
    383 auto TextDecorationPainter::stylesForRenderer(const RenderObject& renderer, OptionSet<TextDecoration> requestedDecorations, bool firstLineStyle, PseudoId pseudoId) -> Styles
     383auto TextDecorationPainter::stylesForRenderer(const RenderObject& renderer, OptionSet<TextDecorationLine> requestedDecorations, bool firstLineStyle, PseudoId pseudoId) -> Styles
    384384{
    385385    Styles result;
  • trunk/Source/WebCore/rendering/TextDecorationPainter.h

    r283464 r285904  
    4545public:
    4646    struct Styles;
    47     TextDecorationPainter(GraphicsContext&, OptionSet<TextDecoration> decorations, const RenderText&, bool isFirstLine, const FontCascade&, std::optional<Styles> = std::nullopt);
     47    TextDecorationPainter(GraphicsContext&, OptionSet<TextDecorationLine> decorations, const RenderText&, bool isFirstLine, const FontCascade&, std::optional<Styles> = std::nullopt);
    4848   
    4949    void setTextBox(InlineIterator::TextBoxIterator textBox) { m_textBox = textBox; }
     
    6767    };
    6868    static Color decorationColor(const RenderStyle&);
    69     static OptionSet<TextDecoration> textDecorationsInEffectForStyle(const Styles&);
    70     static Styles stylesForRenderer(const RenderObject&, OptionSet<TextDecoration> requestedDecorations, bool firstLineStyle = false, PseudoId = PseudoId::None);
     69    static OptionSet<TextDecorationLine> textDecorationsInEffectForStyle(const Styles&);
     70    static Styles stylesForRenderer(const RenderObject&, OptionSet<TextDecorationLine> requestedDecorations, bool firstLineStyle = false, PseudoId = PseudoId::None);
    7171
    7272private:
    7373    GraphicsContext& m_context;
    74     OptionSet<TextDecoration> m_decorations;
     74    OptionSet<TextDecorationLine> m_decorations;
    7575    float m_wavyOffset;
    7676    float m_width { 0 };
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r285885 r285904  
    372372    TextAlignMode textAlign() const { return static_cast<TextAlignMode>(m_inheritedFlags.textAlign); }
    373373    TextTransform textTransform() const { return static_cast<TextTransform>(m_inheritedFlags.textTransform); }
    374     OptionSet<TextDecoration> textDecorationsInEffect() const { return OptionSet<TextDecoration>::fromRaw(m_inheritedFlags.textDecorations); }
    375     OptionSet<TextDecoration> textDecoration() const { return OptionSet<TextDecoration>::fromRaw(m_visualData->textDecoration); }
     374    OptionSet<TextDecorationLine> textDecorationsInEffect() const { return OptionSet<TextDecorationLine>::fromRaw(m_inheritedFlags.textDecorations); }
     375    OptionSet<TextDecorationLine> textDecoration() const { return OptionSet<TextDecorationLine>::fromRaw(m_visualData->textDecoration); }
    376376    TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(m_rareNonInheritedData->textDecorationStyle); }
    377377    TextDecorationSkipInk textDecorationSkipInk() const { return static_cast<TextDecorationSkipInk>(m_rareInheritedData->textDecorationSkipInk); }
     
    985985    void setTextAlign(TextAlignMode v) { m_inheritedFlags.textAlign = static_cast<unsigned>(v); }
    986986    void setTextTransform(TextTransform v) { m_inheritedFlags.textTransform = static_cast<unsigned>(v); }
    987     void addToTextDecorationsInEffect(OptionSet<TextDecoration> v) { m_inheritedFlags.textDecorations |= static_cast<unsigned>(v.toRaw()); }
    988     void setTextDecorationsInEffect(OptionSet<TextDecoration> v) { m_inheritedFlags.textDecorations = v.toRaw(); }
    989     void setTextDecoration(OptionSet<TextDecoration> v) { SET_VAR(m_visualData, textDecoration, v.toRaw()); }
     987    void addToTextDecorationsInEffect(OptionSet<TextDecorationLine> v) { m_inheritedFlags.textDecorations |= static_cast<unsigned>(v.toRaw()); }
     988    void setTextDecorationsInEffect(OptionSet<TextDecorationLine> v) { m_inheritedFlags.textDecorations = v.toRaw(); }
     989    void setTextDecoration(OptionSet<TextDecorationLine> v) { SET_VAR(m_visualData, textDecoration, v.toRaw()); }
    990990    void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(m_rareNonInheritedData, textDecorationStyle, static_cast<unsigned>(v)); }
    991991    void setTextDecorationSkipInk(TextDecorationSkipInk skipInk) { SET_VAR(m_rareInheritedData, textDecorationSkipInk, static_cast<unsigned>(skipInk)); }
     
    16141614    static Length initialLineHeight() { return Length(-100.0f, LengthType::Percent); }
    16151615    static TextAlignMode initialTextAlign() { return TextAlignMode::Start; }
    1616     static OptionSet<TextDecoration> initialTextDecoration() { return OptionSet<TextDecoration> { }; }
     1616    static OptionSet<TextDecorationLine> initialTextDecoration() { return OptionSet<TextDecorationLine> { }; }
    16171617    static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyle::Solid; }
    16181618    static TextDecorationSkipInk initialTextDecorationSkipInk() { return TextDecorationSkipInk::Auto; }
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp

    r285615 r285904  
    10471047}
    10481048
    1049 TextStream& operator<<(TextStream& ts, TextDecoration textDecoration)
    1050 {
    1051     switch (textDecoration) {
    1052     case TextDecoration::None: ts << "none"; break;
    1053     case TextDecoration::Underline: ts << "underline"; break;
    1054     case TextDecoration::Overline: ts << "overline"; break;
    1055     case TextDecoration::LineThrough: ts << "line-through"; break;
    1056     case TextDecoration::Blink: ts << "blink"; break;
     1049TextStream& operator<<(TextStream& ts, TextDecorationLine line)
     1050{
     1051    switch (line) {
     1052    case TextDecorationLine::None: ts << "none"; break;
     1053    case TextDecorationLine::Underline: ts << "underline"; break;
     1054    case TextDecorationLine::Overline: ts << "overline"; break;
     1055    case TextDecorationLine::LineThrough: ts << "line-through"; break;
     1056    case TextDecorationLine::Blink: ts << "blink"; break;
    10571057    }
    10581058    return ts;
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r285615 r285904  
    741741
    742742static const size_t TextDecorationBits = 4;
    743 enum class TextDecoration : uint8_t {
     743enum class TextDecorationLine : uint8_t {
    744744    None          = 0,
    745745    Underline     = 1 << 0,
     
    13341334WTF::TextStream& operator<<(WTF::TextStream&, TextAlignMode);
    13351335WTF::TextStream& operator<<(WTF::TextStream&, TextCombine);
    1336 WTF::TextStream& operator<<(WTF::TextStream&, TextDecoration);
     1336WTF::TextStream& operator<<(WTF::TextStream&, TextDecorationLine);
    13371337WTF::TextStream& operator<<(WTF::TextStream&, TextDecorationSkipInk);
    13381338WTF::TextStream& operator<<(WTF::TextStream&, TextDecorationStyle);
  • trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp

    r283851 r285904  
    296296        // Spec: All text decorations except line-through should be drawn before the text is filled and stroked; thus, the text is rendered on top of these decorations.
    297297        auto decorations = style.textDecorationsInEffect();
    298         if (decorations & TextDecoration::Underline)
    299             paintDecoration(paintInfo.context(), TextDecoration::Underline, fragment);
    300         if (decorations & TextDecoration::Overline)
    301             paintDecoration(paintInfo.context(), TextDecoration::Overline, fragment);
     298        if (decorations & TextDecorationLine::Underline)
     299            paintDecoration(paintInfo.context(), TextDecorationLine::Underline, fragment);
     300        if (decorations & TextDecorationLine::Overline)
     301            paintDecoration(paintInfo.context(), TextDecorationLine::Overline, fragment);
    302302
    303303        auto paintOrder = RenderStyle::paintTypesForPaintOrder(style.paintOrder());
     
    324324
    325325        // Spec: Line-through should be drawn after the text is filled and stroked; thus, the line-through is rendered on top of the text.
    326         if (decorations & TextDecoration::LineThrough)
    327             paintDecoration(paintInfo.context(), TextDecoration::LineThrough, fragment);
     326        if (decorations & TextDecorationLine::LineThrough)
     327            paintDecoration(paintInfo.context(), TextDecorationLine::LineThrough, fragment);
    328328
    329329        setPaintingResourceMode({ });
     
    439439}
    440440
    441 static inline float positionOffsetForDecoration(OptionSet<TextDecoration> decoration, const FontMetrics& fontMetrics, float thickness)
     441static inline float positionOffsetForDecoration(OptionSet<TextDecorationLine> decoration, const FontMetrics& fontMetrics, float thickness)
    442442{
    443443    // FIXME: For SVG Fonts we need to use the attributes defined in the <font-face> if specified.
    444444    // Compatible with Batik/Opera.
    445     if (decoration == TextDecoration::Underline)
     445    if (decoration == TextDecorationLine::Underline)
    446446        return fontMetrics.floatAscent() + thickness * 1.5f;
    447     if (decoration == TextDecoration::Overline)
     447    if (decoration == TextDecorationLine::Overline)
    448448        return thickness;
    449     if (decoration == TextDecoration::LineThrough)
     449    if (decoration == TextDecorationLine::LineThrough)
    450450        return fontMetrics.floatAscent() * 5 / 8.0f;
    451451
     
    454454}
    455455
    456 static inline float thicknessForDecoration(OptionSet<TextDecoration>, const FontCascade& font)
     456static inline float thicknessForDecoration(OptionSet<TextDecorationLine>, const FontCascade& font)
    457457{
    458458    // FIXME: For SVG Fonts we need to use the attributes defined in the <font-face> if specified.
     
    478478}
    479479
    480 void SVGInlineTextBox::paintDecoration(GraphicsContext& context, OptionSet<TextDecoration> decoration, const SVGTextFragment& fragment)
     480void SVGInlineTextBox::paintDecoration(GraphicsContext& context, OptionSet<TextDecorationLine> decoration, const SVGTextFragment& fragment)
    481481{
    482482    if (renderer().style().textDecorationsInEffect().isEmpty())
     
    506506}
    507507
    508 void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext& context, OptionSet<TextDecoration> decoration, const SVGTextFragment& fragment, RenderBoxModelObject& decorationRenderer)
     508void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext& context, OptionSet<TextDecorationLine> decoration, const SVGTextFragment& fragment, RenderBoxModelObject& decorationRenderer)
    509509{
    510510    ASSERT(!m_paintingResource);
  • trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h

    r283851 r285904  
    8484    void restoreGraphicsContextAfterTextPainting(GraphicsContext*&);
    8585
    86     void paintDecoration(GraphicsContext&, OptionSet<TextDecoration>, const SVGTextFragment&);
    87     void paintDecorationWithStyle(GraphicsContext&, OptionSet<TextDecoration>, const SVGTextFragment&, RenderBoxModelObject& decorationRenderer);
     86    void paintDecoration(GraphicsContext&, OptionSet<TextDecorationLine>, const SVGTextFragment&);
     87    void paintDecorationWithStyle(GraphicsContext&, OptionSet<TextDecorationLine>, const SVGTextFragment&, RenderBoxModelObject& decorationRenderer);
    8888    void paintTextWithShadows(GraphicsContext&, const RenderStyle&, TextRun&, const SVGTextFragment&, unsigned startPosition, unsigned endPosition);
    8989    void paintText(GraphicsContext&, const RenderStyle&, const RenderStyle& selectionStyle, const SVGTextFragment&, bool hasSelection, bool paintSelectedTextOnly);
  • trunk/Source/WebCore/style/InlineTextBoxStyle.cpp

    r283464 r285904  
    5050}
    5151
    52 static void minLogicalTopForTextDecorationLine(const InlineIterator::LineIterator& line, float& minLogicalTop, const RenderElement* decorationRenderer, OptionSet<TextDecoration> textDecoration)
     52static void minLogicalTopForTextDecorationLine(const InlineIterator::LineIterator& line, float& minLogicalTop, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecoration)
    5353{
    5454    for (auto run = line->firstRun(); run; run.traverseNextOnLine()) {
     
    6767}
    6868
    69 static void maxLogicalBottomForTextDecorationLine(const InlineIterator::LineIterator& line, float& maxLogicalBottom, const RenderElement* decorationRenderer, OptionSet<TextDecoration> textDecoration)
     69static void maxLogicalBottomForTextDecorationLine(const InlineIterator::LineIterator& line, float& maxLogicalBottom, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecoration)
    7070{
    7171    for (auto run = line->firstRun(); run; run.traverseNextOnLine()) {
     
    8484}
    8585
    86 static const RenderElement* enclosingRendererWithTextDecoration(const RenderText& renderer, OptionSet<TextDecoration> textDecoration, bool firstLine)
     86static const RenderElement* enclosingRendererWithTextDecoration(const RenderText& renderer, OptionSet<TextDecorationLine> textDecoration, bool firstLine)
    8787{
    8888    const RenderElement* current = renderer.parent();
     
    136136        // Position underline relative to the bottom edge of the lowest element's content box.
    137137        auto line = textRun->line();
    138         auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), TextDecoration::Underline, line->isFirst());
     138        auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), TextDecorationLine::Underline, line->isFirst());
    139139       
    140140        float offset;
    141141        if (textRun->renderer().style().isFlippedLinesWritingMode()) {
    142142            offset = textRun->logicalTop();
    143             minLogicalTopForTextDecorationLine(line, offset, decorationRenderer, TextDecoration::Underline);
     143            minLogicalTopForTextDecorationLine(line, offset, decorationRenderer, TextDecorationLine::Underline);
    144144            offset = textRun->logicalTop() - offset;
    145145        } else {
    146146            offset = textRun->logicalBottom();
    147             maxLogicalBottomForTextDecorationLine(line, offset, decorationRenderer, TextDecoration::Underline);
     147            maxLogicalBottomForTextDecorationLine(line, offset, decorationRenderer, TextDecorationLine::Underline);
    148148            offset -= textRun->logicalBottom();
    149149        }
     
    191191    // These metrics must match where underlines get drawn.
    192192    // FIXME: Share the code in TextDecorationPainter::paintTextDecoration() so we can just query it for the painted geometry.
    193     if (decoration & TextDecoration::Underline) {
     193    if (decoration & TextDecorationLine::Underline) {
    194194        // Compensate for the integral ceiling in GraphicsContext::computeLineBoundsAndAntialiasingModeForText()
    195195        int underlineOffset = 1;
     
    205205        }
    206206    }
    207     if (decoration & TextDecoration::Overline) {
     207    if (decoration & TextDecorationLine::Overline) {
    208208        FloatRect rect(FloatPoint(), FloatSize(1, strokeThickness));
    209209        float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(lineStyle.computedFontSize(), lineStyle.fontMetrics());
     
    218218        overflowResult.extendBottom(rect.maxY() - height);
    219219    }
    220     if (decoration & TextDecoration::LineThrough) {
     220    if (decoration & TextDecorationLine::LineThrough) {
    221221        FloatRect rect(FloatPoint(), FloatSize(1, strokeThickness));
    222222        float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(lineStyle.computedFontSize(), lineStyle.fontMetrics());
  • trunk/Source/WebCore/style/StyleBuilderConverter.h

    r285822 r285904  
    8080    static LengthPoint convertPosition(BuilderState&, const CSSValue&);
    8181    static LengthPoint convertPositionOrAuto(BuilderState&, const CSSValue&);
    82     static OptionSet<TextDecoration> convertTextDecoration(BuilderState&, const CSSValue&);
     82    static OptionSet<TextDecorationLine> convertTextDecoration(BuilderState&, const CSSValue&);
    8383    template<typename T> static T convertNumber(BuilderState&, const CSSValue&);
    8484    template<typename T> static T convertNumberOrAuto(BuilderState&, const CSSValue&);
     
    430430}
    431431
    432 inline OptionSet<TextDecoration> BuilderConverter::convertTextDecoration(BuilderState&, const CSSValue& value)
     432inline OptionSet<TextDecorationLine> BuilderConverter::convertTextDecoration(BuilderState&, const CSSValue& value)
    433433{
    434434    auto result = RenderStyle::initialTextDecoration();
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r285640 r285904  
     12021-11-16  Nikolaos Mouchtaris  <nmouchtaris@apple.com>
     2
     3        Rename TextDecoration to TextDecorationLine
     4        https://bugs.webkit.org/show_bug.cgi?id=232729
     5
     6        Reviewed by Myles C. Maxfield.
     7
     8        * WebView/WebView.mm:
     9        (-[WebView updateTextTouchBar]):
     10
    1112021-11-11  Nikolaos Mouchtaris  <nmouchtaris@apple.com>
    212
  • trunk/Source/WebKitLegacy/mac/WebView/WebView.mm

    r285637 r285904  
    95109510                    [_private->_textTouchBarItemController setTextIsUnderlined:value.contains("underline")];
    95119511                } else
    9512                     [_private->_textTouchBarItemController setTextIsUnderlined:style->textDecorationsInEffect().contains(TextDecoration::Underline)];
     9512                    [_private->_textTouchBarItemController setTextIsUnderlined:style->textDecorationsInEffect().contains(TextDecorationLine::Underline)];
    95139513
    95149514                Color textColor = style->visitedDependentColor(CSSPropertyColor);
Note: See TracChangeset for help on using the changeset viewer.