[webkit-changes] [WebKit/WebKit] c73158: resolveForDocument() should explicitly set the Fon...

Simon Fraser noreply at github.com
Tue Dec 3 19:55:19 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c731586091b5ad7bf44d6da8e0412c84187a310c
      https://github.com/WebKit/WebKit/commit/c731586091b5ad7bf44d6da8e0412c84187a310c
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-12-03 (Tue, 03 Dec 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/FontCascade.cpp
    M Source/WebCore/platform/graphics/FontCascadeFonts.h
    M Source/WebCore/platform/graphics/FontRanges.cpp
    M Source/WebCore/platform/graphics/FontRanges.h
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/style/StyleResolveForDocument.cpp

  Log Message:
  -----------
  resolveForDocument() should explicitly set the FontCascade on the style
https://bugs.webkit.org/show_bug.cgi?id=284001
rdar://140876951

Reviewed by Alan Baradlay.

Currently, resolveForDocument () does:
  documentStyle.fontCascade().update(&const_cast<Document&>(document).fontSelector())

This updates the FontCascade in situ, which means that that the object shared by existing
RenderStyles, and any newly created styles will be the same even when there is a change
that should have prompted style diffs.

Fix it to set the FontCascade, which invokes `access()` which clones the `m_inheritedData`
when necessary.

Minor tidy up in FontRanges and FontCascadeFonts, and a FIXME in `FontCascade::updateFonts()`
where we should compare the old and new, but `FontCascadeFonts` has no equality operator.

* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::updateFonts const):
* Source/WebCore/platform/graphics/FontCascadeFonts.h:
* Source/WebCore/platform/graphics/FontRanges.cpp:
(WebCore::FontRanges::FontRanges):
* Source/WebCore/platform/graphics/FontRanges.h:
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setFontCascade):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list