Changeset 285904 in webkit
- Timestamp:
- Nov 16, 2021, 5:26:57 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 22 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/accessibility/AccessibilityRenderObject.cpp (modified) (1 diff)
-
WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp (modified) (1 diff)
-
WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm (modified) (1 diff)
-
WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (modified) (1 diff)
-
WebCore/animation/CSSPropertyAnimation.cpp (modified) (1 diff)
-
WebCore/css/CSSComputedStyleDeclaration.cpp (modified) (4 diffs)
-
WebCore/css/CSSPrimitiveValueMappings.h (modified) (2 diffs)
-
WebCore/editing/Editor.cpp (modified) (1 diff)
-
WebCore/editing/cocoa/HTMLConverter.mm (modified) (1 diff)
-
WebCore/rendering/StyledMarkedText.cpp (modified) (1 diff)
-
WebCore/rendering/TextDecorationPainter.cpp (modified) (8 diffs)
-
WebCore/rendering/TextDecorationPainter.h (modified) (2 diffs)
-
WebCore/rendering/style/RenderStyle.h (modified) (3 diffs)
-
WebCore/rendering/style/RenderStyleConstants.cpp (modified) (1 diff)
-
WebCore/rendering/style/RenderStyleConstants.h (modified) (2 diffs)
-
WebCore/rendering/svg/SVGInlineTextBox.cpp (modified) (6 diffs)
-
WebCore/rendering/svg/SVGInlineTextBox.h (modified) (1 diff)
-
WebCore/style/InlineTextBoxStyle.cpp (modified) (7 diffs)
-
WebCore/style/StyleBuilderConverter.h (modified) (2 diffs)
-
WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
WebKitLegacy/mac/WebView/WebView.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r285898 r285904 1 2021-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 1 67 2021-11-16 Devin Rousso <drousso@apple.com> 2 68 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r285389 r285904 3859 3859 return false; 3860 3860 3861 return m_renderer->style().textDecorationsInEffect().contains(TextDecoration ::Underline);3861 return m_renderer->style().textDecorationsInEffect().contains(TextDecorationLine::Underline); 3862 3862 } 3863 3863 -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
r284857 r285904 165 165 } 166 166 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"); 168 168 169 169 result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STYLE), style->fontCascade().italic() ? "italic" : "normal"); 170 170 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"); 172 172 173 173 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 592 592 593 593 auto decor = style.textDecorationsInEffect(); 594 if (decor & TextDecoration ::Underline)594 if (decor & TextDecorationLine::Underline) 595 595 AXAttributeStringSetNumber(attrString, UIAccessibilityTokenUnderline, @YES, range); 596 596 -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r285872 r285904 880 880 // set underline and strikethrough 881 881 auto decor = style.textDecorationsInEffect(); 882 if (!(decor & TextDecoration ::Underline)) {882 if (!(decor & TextDecorationLine::Underline)) { 883 883 [attrString removeAttribute:NSAccessibilityUnderlineTextAttribute range:range]; 884 884 [attrString removeAttribute:NSAccessibilityUnderlineColorTextAttribute range:range]; 885 885 } 886 887 if (!(decor & TextDecoration::LineThrough)) { 886 if (!(decor & TextDecorationLine::LineThrough)) { 888 887 [attrString removeAttribute:NSAccessibilityStrikethroughTextAttribute range:range]; 889 888 [attrString removeAttribute:NSAccessibilityStrikethroughColorTextAttribute range:range]; 890 889 } 891 890 892 if (decor & TextDecoration ::Underline || decor & TextDecoration::LineThrough) {891 if (decor & TextDecorationLine::Underline || decor & TextDecorationLine::LineThrough) { 893 892 // FIXME: Should the underline style be reported here? 894 893 auto decorationStyles = TextDecorationPainter::stylesForRenderer(*renderer, decor); 895 894 896 if (decor & TextDecoration ::Underline) {895 if (decor & TextDecorationLine::Underline) { 897 896 AXAttributeStringSetNumber(attrString, NSAccessibilityUnderlineTextAttribute, @YES, range); 898 897 AXAttributeStringSetColor(attrString, NSAccessibilityUnderlineColorTextAttribute, cocoaColor(decorationStyles.underlineColor).get(), range); 899 898 } 900 901 if (decor & TextDecoration ::LineThrough) {899 900 if (decor & TextDecorationLine::LineThrough) { 902 901 AXAttributeStringSetNumber(attrString, NSAccessibilityStrikethroughTextAttribute, @YES, range); 903 902 AXAttributeStringSetColor(attrString, NSAccessibilityStrikethroughColorTextAttribute, cocoaColor(decorationStyles.linethroughColor).get(), range); -
trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp
r285822 r285904 2747 2747 new DiscretePropertyWrapper<TableLayoutType>(CSSPropertyTableLayout, &RenderStyle::tableLayout, &RenderStyle::setTableLayout), 2748 2748 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), 2750 2750 new DiscretePropertyWrapper<TextDecorationStyle>(CSSPropertyTextDecorationStyle, &RenderStyle::textDecorationStyle, &RenderStyle::setTextDecorationStyle), 2751 2751 new DiscretePropertyWrapper<const Color&>(CSSPropertyWebkitTextEmphasisColor, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor), -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r285822 r285904 1614 1614 } 1615 1615 1616 static Ref<CSSValue> renderTextDecoration FlagsToCSSValue(OptionSet<TextDecoration> textDecoration)1616 static Ref<CSSValue> renderTextDecorationLineFlagsToCSSValue(OptionSet<TextDecorationLine> textDecorationLine) 1617 1617 { 1618 1618 auto& cssValuePool = CSSValuePool::singleton(); 1619 1619 // Blink value is ignored. 1620 1620 auto list = CSSValueList::createSpaceSeparated(); 1621 if (textDecoration & TextDecoration::Underline)1621 if (textDecorationLine & TextDecorationLine::Underline) 1622 1622 list->append(cssValuePool.createIdentifierValue(CSSValueUnderline)); 1623 if (textDecoration & TextDecoration::Overline)1623 if (textDecorationLine & TextDecorationLine::Overline) 1624 1624 list->append(cssValuePool.createIdentifierValue(CSSValueOverline)); 1625 if (textDecoration & TextDecoration::LineThrough)1625 if (textDecorationLine & TextDecorationLine::LineThrough) 1626 1626 list->append(cssValuePool.createIdentifierValue(CSSValueLineThrough)); 1627 1627 … … 3292 3292 return cssValuePool.createValue(style.textAlign()); 3293 3293 case CSSPropertyTextDecoration: 3294 return renderTextDecoration FlagsToCSSValue(style.textDecoration());3294 return renderTextDecorationLineFlagsToCSSValue(style.textDecoration()); 3295 3295 #if ENABLE(CSS3_TEXT) 3296 3296 case CSSPropertyWebkitTextAlignLast: … … 3302 3302 return getCSSPropertyValuesForShorthandProperties(webkitTextDecorationShorthand()); 3303 3303 case CSSPropertyTextDecorationLine: 3304 return renderTextDecoration FlagsToCSSValue(style.textDecoration());3304 return renderTextDecorationLineFlagsToCSSValue(style.textDecoration()); 3305 3305 case CSSPropertyTextDecorationStyle: 3306 3306 return renderTextDecorationStyleFlagsToCSSValue(style.textDecorationStyle()); … … 3318 3318 return textDecorationThicknessToCSSValue(style.textDecorationThickness()); 3319 3319 case CSSPropertyWebkitTextDecorationsInEffect: 3320 return renderTextDecoration FlagsToCSSValue(style.textDecorationsInEffect());3320 return renderTextDecorationLineFlagsToCSSValue(style.textDecorationsInEffect()); 3321 3321 case CSSPropertyWebkitTextFillColor: 3322 3322 return currentColorOrValidColor(&style, style.textFillColor()); -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r285615 r285904 2413 2413 #endif // CSS3_TEXT 2414 2414 2415 template<> inline CSSPrimitiveValue::operator OptionSet<TextDecoration >() const2415 template<> inline CSSPrimitiveValue::operator OptionSet<TextDecorationLine>() const 2416 2416 { 2417 2417 ASSERT(isValueID()); … … 2419 2419 switch (m_value.valueID) { 2420 2420 case CSSValueNone: 2421 return OptionSet<TextDecoration > { };2421 return OptionSet<TextDecorationLine> { }; 2422 2422 case CSSValueUnderline: 2423 return TextDecoration ::Underline;2423 return TextDecorationLine::Underline; 2424 2424 case CSSValueOverline: 2425 return TextDecoration ::Overline;2425 return TextDecorationLine::Overline; 2426 2426 case CSSValueLineThrough: 2427 return TextDecoration ::LineThrough;2427 return TextDecorationLine::LineThrough; 2428 2428 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> { }; 2436 2436 } 2437 2437 -
trunk/Source/WebCore/editing/Editor.cpp
r285655 r285904 4099 4099 } else { 4100 4100 auto decoration = style->textDecorationsInEffect(); 4101 if (decoration & TextDecoration ::LineThrough)4101 if (decoration & TextDecorationLine::LineThrough) 4102 4102 attributes.hasStrikeThrough = true; 4103 if (decoration & TextDecoration ::Underline)4103 if (decoration & TextDecorationLine::Underline) 4104 4104 attributes.hasUnderline = true; 4105 4105 } -
trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm
r285373 r285904 2381 2381 continue; 2382 2382 auto& style = renderer->style(); 2383 if (style.textDecorationsInEffect() & TextDecoration ::Underline)2383 if (style.textDecorationsInEffect() & TextDecorationLine::Underline) 2384 2384 [attrs setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName]; 2385 if (style.textDecorationsInEffect() & TextDecoration ::LineThrough)2385 if (style.textDecorationsInEffect() & TextDecorationLine::LineThrough) 2386 2386 [attrs setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName]; 2387 2387 if (auto font = style.fontCascade().primaryFont().getCTFont()) -
trunk/Source/WebCore/rendering/StyledMarkedText.cpp
r284080 r285904 58 58 auto decorations = renderStyle->textDecorationsInEffect(); 59 59 60 if (decorations.contains(TextDecoration ::Underline)) {60 if (decorations.contains(TextDecorationLine::Underline)) { 61 61 style.textDecorationStyles.underlineColor = color; 62 62 style.textDecorationStyles.underlineStyle = decorationStyle; 63 63 } 64 if (decorations.contains(TextDecoration ::Overline)) {64 if (decorations.contains(TextDecorationLine::Overline)) { 65 65 style.textDecorationStyles.overlineColor = color; 66 66 style.textDecorationStyles.overlineStyle = decorationStyle; 67 67 } 68 if (decorations.contains(TextDecoration ::LineThrough)) {68 if (decorations.contains(TextDecorationLine::LineThrough)) { 69 69 style.textDecorationStyles.linethroughColor = color; 70 70 style.textDecorationStyles.linethroughStyle = decorationStyle; -
trunk/Source/WebCore/rendering/TextDecorationPainter.cpp
r285567 r285904 191 191 } 192 192 193 TextDecorationPainter::TextDecorationPainter(GraphicsContext& context, OptionSet<TextDecoration > decorations, const RenderText& renderer, bool isFirstLine, const FontCascade& font, std::optional<Styles> styles)193 TextDecorationPainter::TextDecorationPainter(GraphicsContext& context, OptionSet<TextDecorationLine> decorations, const RenderText& renderer, bool isFirstLine, const FontCascade& font, std::optional<Styles> styles) 194 194 : m_context { context } 195 195 , m_decorations { decorations } … … 208 208 FloatPoint localOrigin = boxOrigin; 209 209 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) { 211 211 m_context.setStrokeColor(color); 212 212 … … 215 215 if (style == TextDecorationStyle::Wavy) 216 216 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) { 218 218 if ((m_lineStyle.textDecorationSkipInk() == TextDecorationSkipInk::Auto || m_lineStyle.textDecorationSkipInk() == TextDecorationSkipInk::All) && m_isHorizontal) { 219 219 if (!m_context.paintingDisabled()) { … … 230 230 } 231 231 } else { 232 ASSERT(decoration == TextDecoration ::LineThrough);232 ASSERT(decoration == TextDecorationLine::LineThrough); 233 233 m_context.drawLineForText(rect, m_isPrinting, style == TextDecorationStyle::Double, strokeStyle); 234 234 } 235 235 }; 236 236 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()); 240 240 241 241 float extraOffset = 0; … … 278 278 279 279 // These decorations should match the visual overflows computed in visualOverflowForDecorations(). 280 if (m_decorations.contains(TextDecoration ::Underline)) {280 if (m_decorations.contains(TextDecorationLine::Underline)) { 281 281 float textDecorationBaseFontSize = 16; 282 282 auto defaultGap = m_lineStyle.computedFontSize() / textDecorationBaseFontSize; … … 285 285 FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness)); 286 286 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)) { 290 290 float wavyOffset = m_styles.overlineStyle == TextDecorationStyle::Wavy ? m_wavyOffset : 0; 291 291 FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness)); 292 292 float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(m_lineStyle.computedFontSize(), fontMetrics); 293 293 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)) { 297 297 FloatRect rect(localOrigin, FloatSize(m_width, textDecorationThickness)); 298 298 float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(m_lineStyle.computedFontSize(), fontMetrics); 299 299 auto center = 2 * fontMetrics.floatAscent() / 3 + autoTextDecorationThickness / 2; 300 300 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); 302 302 } 303 303 } while (shadow); … … 309 309 } 310 310 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) {311 static 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) { 314 314 auto color = TextDecorationPainter::decorationColor(style); 315 315 auto decorationStyle = style.textDecorationStyle(); 316 316 317 if (decorations.contains(TextDecoration ::Underline)) {318 remainingDecorations.remove(TextDecoration ::Underline);317 if (decorations.contains(TextDecorationLine::Underline)) { 318 remainingDecorations.remove(TextDecorationLine::Underline); 319 319 result.underlineColor = color; 320 320 result.underlineStyle = decorationStyle; 321 321 } 322 if (decorations.contains(TextDecoration ::Overline)) {323 remainingDecorations.remove(TextDecoration ::Overline);322 if (decorations.contains(TextDecorationLine::Overline)) { 323 remainingDecorations.remove(TextDecorationLine::Overline); 324 324 result.overlineColor = color; 325 325 result.overlineStyle = decorationStyle; 326 326 } 327 if (decorations.contains(TextDecoration ::LineThrough)) {328 remainingDecorations.remove(TextDecoration ::LineThrough);327 if (decorations.contains(TextDecorationLine::LineThrough)) { 328 remainingDecorations.remove(TextDecorationLine::LineThrough); 329 329 result.linethroughColor = color; 330 330 result.linethroughStyle = decorationStyle; … … 369 369 } 370 370 371 OptionSet<TextDecoration > TextDecorationPainter::textDecorationsInEffectForStyle(const TextDecorationPainter::Styles& style)372 { 373 OptionSet<TextDecoration > decorations;371 OptionSet<TextDecorationLine> TextDecorationPainter::textDecorationsInEffectForStyle(const TextDecorationPainter::Styles& style) 372 { 373 OptionSet<TextDecorationLine> decorations; 374 374 if (style.underlineColor.isValid()) 375 decorations.add(TextDecoration ::Underline);375 decorations.add(TextDecorationLine::Underline); 376 376 if (style.overlineColor.isValid()) 377 decorations.add(TextDecoration ::Overline);377 decorations.add(TextDecorationLine::Overline); 378 378 if (style.linethroughColor.isValid()) 379 decorations.add(TextDecoration ::LineThrough);379 decorations.add(TextDecorationLine::LineThrough); 380 380 return decorations; 381 381 }; 382 382 383 auto TextDecorationPainter::stylesForRenderer(const RenderObject& renderer, OptionSet<TextDecoration > requestedDecorations, bool firstLineStyle, PseudoId pseudoId) -> Styles383 auto TextDecorationPainter::stylesForRenderer(const RenderObject& renderer, OptionSet<TextDecorationLine> requestedDecorations, bool firstLineStyle, PseudoId pseudoId) -> Styles 384 384 { 385 385 Styles result; -
trunk/Source/WebCore/rendering/TextDecorationPainter.h
r283464 r285904 45 45 public: 46 46 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); 48 48 49 49 void setTextBox(InlineIterator::TextBoxIterator textBox) { m_textBox = textBox; } … … 67 67 }; 68 68 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); 71 71 72 72 private: 73 73 GraphicsContext& m_context; 74 OptionSet<TextDecoration > m_decorations;74 OptionSet<TextDecorationLine> m_decorations; 75 75 float m_wavyOffset; 76 76 float m_width { 0 }; -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r285885 r285904 372 372 TextAlignMode textAlign() const { return static_cast<TextAlignMode>(m_inheritedFlags.textAlign); } 373 373 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); } 376 376 TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(m_rareNonInheritedData->textDecorationStyle); } 377 377 TextDecorationSkipInk textDecorationSkipInk() const { return static_cast<TextDecorationSkipInk>(m_rareInheritedData->textDecorationSkipInk); } … … 985 985 void setTextAlign(TextAlignMode v) { m_inheritedFlags.textAlign = static_cast<unsigned>(v); } 986 986 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()); } 990 990 void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(m_rareNonInheritedData, textDecorationStyle, static_cast<unsigned>(v)); } 991 991 void setTextDecorationSkipInk(TextDecorationSkipInk skipInk) { SET_VAR(m_rareInheritedData, textDecorationSkipInk, static_cast<unsigned>(skipInk)); } … … 1614 1614 static Length initialLineHeight() { return Length(-100.0f, LengthType::Percent); } 1615 1615 static TextAlignMode initialTextAlign() { return TextAlignMode::Start; } 1616 static OptionSet<TextDecoration > initialTextDecoration() { return OptionSet<TextDecoration> { }; }1616 static OptionSet<TextDecorationLine> initialTextDecoration() { return OptionSet<TextDecorationLine> { }; } 1617 1617 static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyle::Solid; } 1618 1618 static TextDecorationSkipInk initialTextDecorationSkipInk() { return TextDecorationSkipInk::Auto; } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp
r285615 r285904 1047 1047 } 1048 1048 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;1049 TextStream& 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; 1057 1057 } 1058 1058 return ts; -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r285615 r285904 741 741 742 742 static const size_t TextDecorationBits = 4; 743 enum class TextDecoration : uint8_t {743 enum class TextDecorationLine : uint8_t { 744 744 None = 0, 745 745 Underline = 1 << 0, … … 1334 1334 WTF::TextStream& operator<<(WTF::TextStream&, TextAlignMode); 1335 1335 WTF::TextStream& operator<<(WTF::TextStream&, TextCombine); 1336 WTF::TextStream& operator<<(WTF::TextStream&, TextDecoration );1336 WTF::TextStream& operator<<(WTF::TextStream&, TextDecorationLine); 1337 1337 WTF::TextStream& operator<<(WTF::TextStream&, TextDecorationSkipInk); 1338 1338 WTF::TextStream& operator<<(WTF::TextStream&, TextDecorationStyle); -
trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
r283851 r285904 296 296 // 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. 297 297 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); 302 302 303 303 auto paintOrder = RenderStyle::paintTypesForPaintOrder(style.paintOrder()); … … 324 324 325 325 // 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); 328 328 329 329 setPaintingResourceMode({ }); … … 439 439 } 440 440 441 static inline float positionOffsetForDecoration(OptionSet<TextDecoration > decoration, const FontMetrics& fontMetrics, float thickness)441 static inline float positionOffsetForDecoration(OptionSet<TextDecorationLine> decoration, const FontMetrics& fontMetrics, float thickness) 442 442 { 443 443 // FIXME: For SVG Fonts we need to use the attributes defined in the <font-face> if specified. 444 444 // Compatible with Batik/Opera. 445 if (decoration == TextDecoration ::Underline)445 if (decoration == TextDecorationLine::Underline) 446 446 return fontMetrics.floatAscent() + thickness * 1.5f; 447 if (decoration == TextDecoration ::Overline)447 if (decoration == TextDecorationLine::Overline) 448 448 return thickness; 449 if (decoration == TextDecoration ::LineThrough)449 if (decoration == TextDecorationLine::LineThrough) 450 450 return fontMetrics.floatAscent() * 5 / 8.0f; 451 451 … … 454 454 } 455 455 456 static inline float thicknessForDecoration(OptionSet<TextDecoration >, const FontCascade& font)456 static inline float thicknessForDecoration(OptionSet<TextDecorationLine>, const FontCascade& font) 457 457 { 458 458 // FIXME: For SVG Fonts we need to use the attributes defined in the <font-face> if specified. … … 478 478 } 479 479 480 void SVGInlineTextBox::paintDecoration(GraphicsContext& context, OptionSet<TextDecoration > decoration, const SVGTextFragment& fragment)480 void SVGInlineTextBox::paintDecoration(GraphicsContext& context, OptionSet<TextDecorationLine> decoration, const SVGTextFragment& fragment) 481 481 { 482 482 if (renderer().style().textDecorationsInEffect().isEmpty()) … … 506 506 } 507 507 508 void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext& context, OptionSet<TextDecoration > decoration, const SVGTextFragment& fragment, RenderBoxModelObject& decorationRenderer)508 void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext& context, OptionSet<TextDecorationLine> decoration, const SVGTextFragment& fragment, RenderBoxModelObject& decorationRenderer) 509 509 { 510 510 ASSERT(!m_paintingResource); -
trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h
r283851 r285904 84 84 void restoreGraphicsContextAfterTextPainting(GraphicsContext*&); 85 85 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); 88 88 void paintTextWithShadows(GraphicsContext&, const RenderStyle&, TextRun&, const SVGTextFragment&, unsigned startPosition, unsigned endPosition); 89 89 void paintText(GraphicsContext&, const RenderStyle&, const RenderStyle& selectionStyle, const SVGTextFragment&, bool hasSelection, bool paintSelectedTextOnly); -
trunk/Source/WebCore/style/InlineTextBoxStyle.cpp
r283464 r285904 50 50 } 51 51 52 static void minLogicalTopForTextDecorationLine(const InlineIterator::LineIterator& line, float& minLogicalTop, const RenderElement* decorationRenderer, OptionSet<TextDecoration > textDecoration)52 static void minLogicalTopForTextDecorationLine(const InlineIterator::LineIterator& line, float& minLogicalTop, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecoration) 53 53 { 54 54 for (auto run = line->firstRun(); run; run.traverseNextOnLine()) { … … 67 67 } 68 68 69 static void maxLogicalBottomForTextDecorationLine(const InlineIterator::LineIterator& line, float& maxLogicalBottom, const RenderElement* decorationRenderer, OptionSet<TextDecoration > textDecoration)69 static void maxLogicalBottomForTextDecorationLine(const InlineIterator::LineIterator& line, float& maxLogicalBottom, const RenderElement* decorationRenderer, OptionSet<TextDecorationLine> textDecoration) 70 70 { 71 71 for (auto run = line->firstRun(); run; run.traverseNextOnLine()) { … … 84 84 } 85 85 86 static const RenderElement* enclosingRendererWithTextDecoration(const RenderText& renderer, OptionSet<TextDecoration > textDecoration, bool firstLine)86 static const RenderElement* enclosingRendererWithTextDecoration(const RenderText& renderer, OptionSet<TextDecorationLine> textDecoration, bool firstLine) 87 87 { 88 88 const RenderElement* current = renderer.parent(); … … 136 136 // Position underline relative to the bottom edge of the lowest element's content box. 137 137 auto line = textRun->line(); 138 auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), TextDecoration ::Underline, line->isFirst());138 auto* decorationRenderer = enclosingRendererWithTextDecoration(textRun->renderer(), TextDecorationLine::Underline, line->isFirst()); 139 139 140 140 float offset; 141 141 if (textRun->renderer().style().isFlippedLinesWritingMode()) { 142 142 offset = textRun->logicalTop(); 143 minLogicalTopForTextDecorationLine(line, offset, decorationRenderer, TextDecoration ::Underline);143 minLogicalTopForTextDecorationLine(line, offset, decorationRenderer, TextDecorationLine::Underline); 144 144 offset = textRun->logicalTop() - offset; 145 145 } else { 146 146 offset = textRun->logicalBottom(); 147 maxLogicalBottomForTextDecorationLine(line, offset, decorationRenderer, TextDecoration ::Underline);147 maxLogicalBottomForTextDecorationLine(line, offset, decorationRenderer, TextDecorationLine::Underline); 148 148 offset -= textRun->logicalBottom(); 149 149 } … … 191 191 // These metrics must match where underlines get drawn. 192 192 // 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) { 194 194 // Compensate for the integral ceiling in GraphicsContext::computeLineBoundsAndAntialiasingModeForText() 195 195 int underlineOffset = 1; … … 205 205 } 206 206 } 207 if (decoration & TextDecoration ::Overline) {207 if (decoration & TextDecorationLine::Overline) { 208 208 FloatRect rect(FloatPoint(), FloatSize(1, strokeThickness)); 209 209 float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(lineStyle.computedFontSize(), lineStyle.fontMetrics()); … … 218 218 overflowResult.extendBottom(rect.maxY() - height); 219 219 } 220 if (decoration & TextDecoration ::LineThrough) {220 if (decoration & TextDecorationLine::LineThrough) { 221 221 FloatRect rect(FloatPoint(), FloatSize(1, strokeThickness)); 222 222 float autoTextDecorationThickness = TextDecorationThickness::createWithAuto().resolve(lineStyle.computedFontSize(), lineStyle.fontMetrics()); -
trunk/Source/WebCore/style/StyleBuilderConverter.h
r285822 r285904 80 80 static LengthPoint convertPosition(BuilderState&, const CSSValue&); 81 81 static LengthPoint convertPositionOrAuto(BuilderState&, const CSSValue&); 82 static OptionSet<TextDecoration > convertTextDecoration(BuilderState&, const CSSValue&);82 static OptionSet<TextDecorationLine> convertTextDecoration(BuilderState&, const CSSValue&); 83 83 template<typename T> static T convertNumber(BuilderState&, const CSSValue&); 84 84 template<typename T> static T convertNumberOrAuto(BuilderState&, const CSSValue&); … … 430 430 } 431 431 432 inline OptionSet<TextDecoration > BuilderConverter::convertTextDecoration(BuilderState&, const CSSValue& value)432 inline OptionSet<TextDecorationLine> BuilderConverter::convertTextDecoration(BuilderState&, const CSSValue& value) 433 433 { 434 434 auto result = RenderStyle::initialTextDecoration(); -
trunk/Source/WebKitLegacy/mac/ChangeLog
r285640 r285904 1 2021-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 1 11 2021-11-11 Nikolaos Mouchtaris <nmouchtaris@apple.com> 2 12 -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r285637 r285904 9510 9510 [_private->_textTouchBarItemController setTextIsUnderlined:value.contains("underline")]; 9511 9511 } else 9512 [_private->_textTouchBarItemController setTextIsUnderlined:style->textDecorationsInEffect().contains(TextDecoration ::Underline)];9512 [_private->_textTouchBarItemController setTextIsUnderlined:style->textDecorationsInEffect().contains(TextDecorationLine::Underline)]; 9513 9513 9514 9514 Color textColor = style->visitedDependentColor(CSSPropertyColor);
Note:
See TracChangeset
for help on using the changeset viewer.