Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 035afb7932796efbe52c82c55242711cd739ed61
      
https://github.com/WebKit/WebKit/commit/035afb7932796efbe52c82c55242711cd739ed61
  Author: Simon Fraser <simon.fra...@apple.com>
  Date:   2024-12-10 (Tue, 10 Dec 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/platform/graphics/FontCascadeDescription.cpp
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyleInlines.h
    A Source/WebCore/rendering/style/StyleFontData.cpp
    A Source/WebCore/rendering/style/StyleFontData.h
    M Source/WebCore/rendering/style/StyleInheritedData.cpp
    M Source/WebCore/rendering/style/StyleInheritedData.h

  Log Message:
  -----------
  Introduce StyleFontData to store the FontCascade object
https://bugs.webkit.org/show_bug.cgi?id=267252
rdar://120688639

Reviewed by Cameron McCormack.

FontCascade::operator== shows up on profiles under RenderStyle::diff() in the 
Design subtest
of MotionMark, which is animating the `color` property on many elements. 
`color` and
`fontCascade` are both members of `StyleInheritedData`, so we end up copying 
and comparing
`StyleInheritedData` a lot.

But FontCascade is large (232 bytes) and expensive to compare, so we can 
optimize by moving
it into its own ref-counted class that `StyleInheritedData` can own via a 
`DataRef`. This
approach was chosen, rather than making `FontCascade` directly ref-counted, 
because it's
used on the stack in various places.

Now RenderStyle can test for `fontData` pointer equality in various places 
before doing more
expensive checks.

* LayoutTests/TestExpectations:
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/FontCascadeDescription.cpp:
(WebCore::operator<<):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::hashForTextAutosizing const):
(WebCore::RenderStyle::equalForTextAutosizing const):
(WebCore::RenderStyle::changeRequiresLayout const):
(WebCore::RenderStyle::conservativelyCollectChangedAnimatableProperties const):
(WebCore::RenderStyle::fontCascade const):
(WebCore::RenderStyle::metricsOfPrimaryFont const):
(WebCore::RenderStyle::fontDescription const):
(WebCore::RenderStyle::setFontCascade):
(WebCore::RenderStyle::setFontDescription):
(WebCore::RenderStyle::setLetterSpacing):
(WebCore::RenderStyle::setWordSpacing):
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::letterSpacing const):
(WebCore::RenderStyle::wordSpacing const):
* Source/WebCore/rendering/style/StyleFontData.cpp: Added.
(WebCore::StyleFontData::StyleFontData):
(WebCore::StyleFontData::copy const):
(WebCore::StyleFontData::operator== const):
(WebCore::StyleFontData::dumpDifferences const):
* Source/WebCore/rendering/style/StyleFontData.h: Added.
(WebCore::StyleFontData::create):
* Source/WebCore/rendering/style/StyleInheritedData.cpp:
(WebCore::StyleInheritedData::StyleInheritedData):
(WebCore::StyleInheritedData::nonFastPathInheritedEqual const):
(WebCore::StyleInheritedData::dumpDifferences const):
* Source/WebCore/rendering/style/StyleInheritedData.h:

Canonical link: https://commits.webkit.org/287648@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