[webkit-changes] [WebKit/WebKit] 4f3c53: Implement Path::definitelyEqual()

Simon Fraser noreply at github.com
Wed Aug 28 17:13:20 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4f3c53d350112f5964409a79f655bd3cfc05390b
      https://github.com/WebKit/WebKit/commit/4f3c53d350112f5964409a79f655bd3cfc05390b
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-08-28 (Wed, 28 Aug 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/Path.cpp
    M Source/WebCore/platform/graphics/Path.h
    M Source/WebCore/platform/graphics/PathImpl.h
    M Source/WebCore/platform/graphics/PathStream.cpp
    M Source/WebCore/platform/graphics/PathStream.h
    M Source/WebCore/platform/graphics/cairo/PathCairo.cpp
    M Source/WebCore/platform/graphics/cairo/PathCairo.h
    M Source/WebCore/platform/graphics/cg/PathCG.cpp
    M Source/WebCore/platform/graphics/cg/PathCG.h
    M Source/WebCore/platform/graphics/skia/PathSkia.cpp
    M Source/WebCore/platform/graphics/skia/PathSkia.h
    M Tools/TestWebKitAPI/CMakeLists.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebCore/PathTests.cpp

  Log Message:
  -----------
  Implement Path::definitelyEqual()
https://bugs.webkit.org/show_bug.cgi?id=278751
rdar://134817798

Reviewed by Cameron McCormack and Nikolas Zimmermann.

Implement `Path::definitelyEqual()` which will return true if two paths are known to contain
equivalent data. It may return false in some cases for equivalent paths, for example
if one contains a platform path, and one contains a PathStream.

`Path::definitelyEqual()` has to take care to handle the three states of the variant
on both sides.

PathCG and PathSkia can test for platform path equality. PathCairo cannot.

Also implement Path::singleRect() and Path::singleRoundedRect() which will be used
in future.

Add some API tests to exercise Path::definitelyEqual() for various Path states.

* Source/WebCore/platform/graphics/Path.cpp:
(WebCore::Path::definitelyEqual const):
(WebCore::Path::ensureImplForTesting):
(WebCore::Path::singleRect const):
(WebCore::Path::singleRoundedRect const):
* Source/WebCore/platform/graphics/Path.h:
* Source/WebCore/platform/graphics/PathImpl.h:
(WebCore::PathImpl::singleRect const):
(WebCore::PathImpl::singleRoundedRect const):
* Source/WebCore/platform/graphics/PathStream.cpp:
(WebCore::PathStream::definitelyEqual const):
(WebCore::PathStream::singleRect const):
(WebCore::PathStream::singleRoundedRect const):
* Source/WebCore/platform/graphics/PathStream.h:
* Source/WebCore/platform/graphics/cairo/PathCairo.cpp:
(WebCore::PathCairo::definitelyEqual const):
* Source/WebCore/platform/graphics/cairo/PathCairo.h:
* Source/WebCore/platform/graphics/cg/PathCG.cpp:
(WebCore::PathCG::definitelyEqual const):
* Source/WebCore/platform/graphics/cg/PathCG.h:
* Source/WebCore/platform/graphics/skia/PathSkia.cpp:
(WebCore::PathSkia::definitelyEqual const):
* Source/WebCore/platform/graphics/skia/PathSkia.h:
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/PathTests.cpp: Added.
(TestWebKitAPI::TEST(Path, DefinitelyEqual)):
(TestWebKitAPI::TEST(Path, DefinitelyNotEqual)):

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