Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FloatRect etc. constexpr and adopt nanRect to make it usable for "not-filled" FloatRect purpose #18633

Conversation

Constellation
Copy link
Member

@Constellation Constellation commented Oct 4, 2023

4f828af

Make FloatRect etc. constexpr and adopt nanRect to make it usable for "not-filled" FloatRect purpose
https://bugs.webkit.org/show_bug.cgi?id=262636
rdar://116476334

Reviewed by Justin Michaud and Mark Lam.

Use constexpr in FloatRect and related classes, and add `nanRect` concept to make it usable for "not-filled" FloatRect.
This is useful in subsequent SVG optimization instead of using `std::optional<FloatRect>`.

* Source/WebCore/platform/graphics/FloatPoint.h:
(WebCore::FloatPoint::FloatPoint):
(WebCore::FloatPoint::zero):
(WebCore::FloatPoint::isZero const):
(WebCore::FloatPoint::x const):
(WebCore::FloatPoint::y const):
(WebCore::FloatPoint::scaled const):
(WebCore::FloatPoint::dot const):
(WebCore::FloatPoint::lengthSquared const):
(WebCore::FloatPoint::shrunkTo const):
(WebCore::FloatPoint::expandedTo const):
(WebCore::FloatPoint::transposedPoint const):
(WebCore::operator+):
(WebCore::operator-):
(WebCore::operator*):
(WebCore::FloatPoint::rotate):
* Source/WebCore/platform/graphics/FloatRect.h:
(WebCore::FloatRect::FloatRect):
(WebCore::FloatRect::location const):
(WebCore::FloatRect::size const):
(WebCore::FloatRect::x const):
(WebCore::FloatRect::y const):
(WebCore::FloatRect::maxX const):
(WebCore::FloatRect::maxY const):
(WebCore::FloatRect::width const):
(WebCore::FloatRect::height const):
(WebCore::FloatRect::area const):
(WebCore::FloatRect::isEmpty const):
(WebCore::FloatRect::isZero const):
(WebCore::FloatRect::center const):
(WebCore::FloatRect::minXMinYCorner const):
(WebCore::FloatRect::maxXMinYCorner const):
(WebCore::FloatRect::minXMaxYCorner const):
(WebCore::FloatRect::maxXMaxYCorner const):
(WebCore::FloatRect::contains const):
(WebCore::FloatRect::overlapsYRange const):
(WebCore::FloatRect::overlapsXRange const):
(WebCore::FloatRect::transposedRect const):
(WebCore::operator+):
(WebCore::FloatRect::infiniteRect):
(WebCore::FloatRect::isInfinite const):
(WebCore::FloatRect::smallestRect):
(WebCore::FloatRect::isSmallest const):
(WebCore::FloatRect::nanRect):
(WebCore::FloatRect::isNaN const):
* Source/WebCore/platform/graphics/FloatSize.cpp:
(WebCore::FloatSize::isZero const): Deleted.
* Source/WebCore/platform/graphics/FloatSize.h:
(WebCore::FloatSize::isZero const):
* Tools/TestWebKitAPI/Tests/WebCore/FloatRectTests.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp:
(TestWebKitAPI::TEST):

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

a18d0cb

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug   πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1   πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2   πŸ§ͺ api-gtk
  πŸ›  tv   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim
  πŸ›  watch
βœ… πŸ›  πŸ§ͺ unsafe-merge βœ… πŸ›  watch-sim

@Constellation Constellation self-assigned this Oct 4, 2023
@Constellation Constellation added the Platform Portability improvements and other general platform improvements not driven directly by site bugs. label Oct 4, 2023
@Constellation Constellation requested review from smfr and a team October 4, 2023 18:31
Copy link
Contributor

@justinmichaud justinmichaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

Copy link

@MenloDorian MenloDorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

@Constellation Constellation added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Oct 4, 2023
… "not-filled" FloatRect purpose

https://bugs.webkit.org/show_bug.cgi?id=262636
rdar://116476334

Reviewed by Justin Michaud and Mark Lam.

Use constexpr in FloatRect and related classes, and add `nanRect` concept to make it usable for "not-filled" FloatRect.
This is useful in subsequent SVG optimization instead of using `std::optional<FloatRect>`.

* Source/WebCore/platform/graphics/FloatPoint.h:
(WebCore::FloatPoint::FloatPoint):
(WebCore::FloatPoint::zero):
(WebCore::FloatPoint::isZero const):
(WebCore::FloatPoint::x const):
(WebCore::FloatPoint::y const):
(WebCore::FloatPoint::scaled const):
(WebCore::FloatPoint::dot const):
(WebCore::FloatPoint::lengthSquared const):
(WebCore::FloatPoint::shrunkTo const):
(WebCore::FloatPoint::expandedTo const):
(WebCore::FloatPoint::transposedPoint const):
(WebCore::operator+):
(WebCore::operator-):
(WebCore::operator*):
(WebCore::FloatPoint::rotate):
* Source/WebCore/platform/graphics/FloatRect.h:
(WebCore::FloatRect::FloatRect):
(WebCore::FloatRect::location const):
(WebCore::FloatRect::size const):
(WebCore::FloatRect::x const):
(WebCore::FloatRect::y const):
(WebCore::FloatRect::maxX const):
(WebCore::FloatRect::maxY const):
(WebCore::FloatRect::width const):
(WebCore::FloatRect::height const):
(WebCore::FloatRect::area const):
(WebCore::FloatRect::isEmpty const):
(WebCore::FloatRect::isZero const):
(WebCore::FloatRect::center const):
(WebCore::FloatRect::minXMinYCorner const):
(WebCore::FloatRect::maxXMinYCorner const):
(WebCore::FloatRect::minXMaxYCorner const):
(WebCore::FloatRect::maxXMaxYCorner const):
(WebCore::FloatRect::contains const):
(WebCore::FloatRect::overlapsYRange const):
(WebCore::FloatRect::overlapsXRange const):
(WebCore::FloatRect::transposedRect const):
(WebCore::operator+):
(WebCore::FloatRect::infiniteRect):
(WebCore::FloatRect::isInfinite const):
(WebCore::FloatRect::smallestRect):
(WebCore::FloatRect::isSmallest const):
(WebCore::FloatRect::nanRect):
(WebCore::FloatRect::isNaN const):
* Source/WebCore/platform/graphics/FloatSize.cpp:
(WebCore::FloatSize::isZero const): Deleted.
* Source/WebCore/platform/graphics/FloatSize.h:
(WebCore::FloatSize::isZero const):
* Tools/TestWebKitAPI/Tests/WebCore/FloatRectTests.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/268866@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Make-FloatRect-etc--constexpr-and-adopt-nanRect-to-make-it-usable-for-not-filled-FloatRect-purpose branch from a18d0cb to 4f828af Compare October 4, 2023 19:55
@webkit-commit-queue
Copy link
Collaborator

Committed 268866@main (4f828af): https://commits.webkit.org/268866@main

Reviewed commits have been landed. Closing PR #18633 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 4f828af into WebKit:main Oct 4, 2023
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform Portability improvements and other general platform improvements not driven directly by site bugs.
Projects
None yet
5 participants