[webkit-reviews] review granted: [Bug 227186] Remove redundant HitTestLocation(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding) : [Attachment 431819] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Jun 20 13:15:14 PDT 2021
Sam Weinig <sam at webkit.org> has granted zalan <zalan at apple.com>'s request for
review:
Bug 227186: Remove redundant HitTestLocation(const LayoutPoint& centerPoint,
unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned
leftPadding)
https://bugs.webkit.org/show_bug.cgi?id=227186
Attachment 431819: Patch
https://bugs.webkit.org/attachment.cgi?id=431819&action=review
--- Comment #3 from Sam Weinig <sam at webkit.org> ---
Comment on attachment 431819
--> https://bugs.webkit.org/attachment.cgi?id=431819
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=431819&action=review
> Source/WebCore/testing/Internals.cpp:2323
> + auto hitTestResult = HitTestResult { };
> + auto size = LayoutSize { leftPadding + rightPadding, topPadding +
bottomPadding };
> + if (size.isEmpty())
> + hitTestResult = HitTestResult { point };
> + else {
> + auto adjustedPosition = LayoutPoint { flooredIntPoint(point) };
> + adjustedPosition -= LayoutSize { leftPadding, topPadding };
> + hitTestResult = HitTestResult { LayoutRect { adjustedPosition, size
} };
> + }
I would usually do this using a lambda so that hitTestResult is not assigned
twice.
Can the two adjustedPosition lines be written as one line?
auto adjustedPosition = LayoutPoint { flooredIntPoint(point) } - LayoutSize {
leftPadding, topPadding };
?
More information about the webkit-reviews
mailing list