Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 02d04382a054cfe1edcb38c58ba1c1d7795eeefb
      
https://github.com/WebKit/WebKit/commit/02d04382a054cfe1edcb38c58ba1c1d7795eeefb
  Author: Vitor Roriz <vitor.ro...@apple.com>
  Date:   2025-08-28 (Thu, 28 Aug 2025)

  Changed paths:
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/RenderStyleInlines.h
    M Source/WebCore/rendering/style/RenderStyleSetters.h
    M Source/WebCore/rendering/style/StyleInheritedData.cpp
    M Source/WebCore/rendering/style/StyleInheritedData.h
    M Source/WebCore/rendering/style/StyleMiscNonInheritedData.cpp
    M Source/WebCore/rendering/style/StyleMiscNonInheritedData.h
    M Source/WebCore/style/values/text-decoration/StyleTextDecorationLine.cpp
    M Source/WebCore/style/values/text-decoration/StyleTextDecorationLine.h

  Log Message:
  -----------
  Refactoring TextDecorationLine to fit in 5 bits
https://bugs.webkit.org/show_bug.cgi?id=297940
rdar://159236131

Reviewed by Sammy Gill.

At https://commits.webkit.org/299142@main we have refactored TextDecorationLine
into a strong type. However, it increased its size to 2 bytes and it had to be
moved out from RenderStyle Flags.

We have now refactored it, packing its content within 5 bits, so we can move
it back to RenderStyle flags where it used to be.

We are representing TextDecorationLine in 5 bits.
1 bit is used for defining the Type (SingleValue or Flags)
4 bits are used for defining the Value
Values for SingleValue: None, SpellingError, GrammarError
Values for Flags: Any combination of Underline, Overline, LineThrough, Blink
Therefore, we are packing its content with the following layout:
Bits 7-5: Reserved
Bit 4: Type (SingleValue or Flags)
Bits 3-0: When Type=1 (Underline=0x1, Overline=0x2, LineThrough=0x4, Blink=0x8)
         : When Type=0 (None = 0, SpellingError = 1, GrammarError = 2)

* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::RenderStyle):
(WebCore::RenderStyle::NonInheritedFlags::copyNonInheritedFrom):
(WebCore::RenderStyle::changeAffectsVisualOverflow const):
(WebCore::miscDataChangeRequiresRepaint):
(WebCore::RenderStyle::changeRequiresRepaint const):
(WebCore::RenderStyle::changeRequiresRepaintIfText const):
(WebCore::RenderStyle::conservativelyCollectChangedAnimatableProperties const):
(WebCore::RenderStyle::NonInheritedFlags::dumpDifferences const):
(WebCore::RenderStyle::InheritedFlags::dumpDifferences const):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::textDecorationLine const):
(WebCore::RenderStyle::textDecorationLineInEffect const):
* Source/WebCore/rendering/style/RenderStyleSetters.h:
(WebCore::RenderStyle::addToTextDecorationLineInEffect):
(WebCore::RenderStyle::setTextDecorationLine):
(WebCore::RenderStyle::setTextDecorationLineInEffect):
* Source/WebCore/rendering/style/StyleInheritedData.cpp:
(WebCore::StyleInheritedData::StyleInheritedData):
(WebCore::StyleInheritedData::nonFastPathInheritedEqual const):
(WebCore::StyleInheritedData::dumpDifferences const):
* Source/WebCore/rendering/style/StyleInheritedData.h:
* Source/WebCore/rendering/style/StyleMiscNonInheritedData.cpp:
(WebCore::StyleMiscNonInheritedData::StyleMiscNonInheritedData):
(WebCore::StyleMiscNonInheritedData::operator== const):
(WebCore::StyleMiscNonInheritedData::dumpDifferences const):
* Source/WebCore/rendering/style/StyleMiscNonInheritedData.h:
* Source/WebCore/style/values/text-decoration/StyleTextDecorationLine.cpp:
(WebCore::Style::TextDecorationLine::addOrReplaceIfNotNone):
(WebCore::Style::operator<<):
* Source/WebCore/style/values/text-decoration/StyleTextDecorationLine.h:
(WebCore::Style::TextDecorationLine::TextDecorationLine):
(WebCore::Style::TextDecorationLine::type const):
(WebCore::Style::TextDecorationLine::isNone const):
(WebCore::Style::TextDecorationLine::isSpellingError const):
(WebCore::Style::TextDecorationLine::isGrammarError const):
(WebCore::Style::TextDecorationLine::isFlags const):
(WebCore::Style::TextDecorationLine::hasUnderline const):
(WebCore::Style::TextDecorationLine::hasOverline const):
(WebCore::Style::TextDecorationLine::hasLineThrough const):
(WebCore::Style::TextDecorationLine::hasBlink const):
(WebCore::Style::TextDecorationLine::containsAny const):
(WebCore::Style::TextDecorationLine::contains const):
(WebCore::Style::TextDecorationLine::remove):
(WebCore::Style::TextDecorationLine::switchOn const):
(WebCore::Style::TextDecorationLine::toRaw const):
(WebCore::Style::TextDecorationLine::operator== const):
(WebCore::Style::TextDecorationLine::rawValue const):
(WebCore::Style::TextDecorationLine::packFlags):
(WebCore::Style::TextDecorationLine::packFlag):
(WebCore::Style::TextDecorationLine::unpackFlags const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to