[webkit-changes] [WebKit/WebKit] 9b974f: [WebCore] Use Markable instead of std::variant in ...

Tadeu Zagallo noreply at github.com
Mon Feb 20 13:39:22 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9b974f716f8653005fa2c35c2fbe5b5ba0dddcda
      https://github.com/WebKit/WebKit/commit/9b974f716f8653005fa2c35c2fbe5b5ba0dddcda
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M Source/WebCore/platform/text/TextFlags.cpp
    M Source/WebCore/platform/text/TextFlags.h

  Log Message:
  -----------
  [WebCore] Use Markable instead of std::variant in FontVariantAlternates
https://bugs.webkit.org/show_bug.cgi?id=252485
rdar://105596793

Reviewed by Simon Fraser.

`FontVariantAlternates` used an `std::variant` to store either `FontVariantAlternatesValues`
or a no-op class, so it was effectively using it as an optional. By using Markable, we
reduce the size of `FontVariantAlternates` from 80 to 72 bytes, consequently reducing
`StyleInheritedData` to fit the next size class down (256 bytes).

* Source/WebCore/platform/text/TextFlags.cpp:
(WebCore::add):
* Source/WebCore/platform/text/TextFlags.h:
(WebCore::FontVariantAlternatesValues::MarkableTraits::isEmptyValue):
(WebCore::FontVariantAlternatesValues::MarkableTraits::emptyValue):
(WebCore::FontVariantAlternates::operator== const):
(WebCore::FontVariantAlternates::isNormal const):
(WebCore::FontVariantAlternates::values const):
(WebCore::FontVariantAlternates::valuesRef):
(WebCore::FontVariantAlternates::setValues):
(WebCore::FontVariantAlternates::Normal):
(WebCore::FontVariantAlternatesNormal::operator== const): Deleted.
(WebCore::FontVariantAlternatesNormal::operator!= const): Deleted.

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




More information about the webkit-changes mailing list