Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d2957647a0af6c363cf6fe108021a11330d6fc84
      
https://github.com/WebKit/WebKit/commit/d2957647a0af6c363cf6fe108021a11330d6fc84
  Author: Vitor Roriz <vitor.ro...@apple.com>
  Date:   2024-01-23 (Tue, 23 Jan 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/FontPlatformData.h
    M Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp
    M Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm

  Log Message:
  -----------
  Revert "[Cocoa] objectForEqualityCheck() is no longer necessary"
https://bugs.webkit.org/show_bug.cgi?id=263136
rdar://116934547

Reviewed by Cameron McCormack.

This reverts commit dc989b3ef737547949c45f39dc996f0850fe862f.

267312@main [1] broke the following test:
imported/w3c/web-platform-tests/css/css-text/line-break/line-break-anywhere-overrides-uax-behavior-011.html

Before [1] we used to define a derived object from the Fonts we were trying to 
compare,
because we considered that CFEqual() would do a shallow comparison.

Since it is possible to generate two font objects (with different pointers) 
representing
the same font object, a shallow comparison wouldn’t work for us.

[1] states that CFEqual() "now” does a deep comparison, and
the derived object would have no use anymore.

However, at 
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm:
ComplexTextController::collectComplexTextRunsForCharacters:

We observe that the comparisons before and after [1] produce different results,
for the specific test that is failing. More specifically we can reduce it to
the render of “X&#x034F;”:

-> Without [1] the following is never true:
 if (!safeCFEqual(runFontEqualityObject.get(), 
font->platformData().objectForEqualityCheck().get()))

This means that the fonts are considered equal. However:

-> With [1] the following is always true:
 if (!safeCFEqual(runCTFont, font->platformData().ctFont()))

This means that the run’s font, acquired after shaping is not the same as the 
font passed,
so we will try to add it to the fallback font list.

* Source/WebCore/platform/graphics/FontPlatformData.h:
* Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp:
(WebCore::FontPlatformData::objectForEqualityCheck):
(WebCore::FontPlatformData::objectForEqualityCheck const):
* Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to