[webkit-reviews] review granted: [Bug 226697] Factor selection clamping into a type : [Attachment 430690] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 6 12:32:41 PDT 2021


Sam Weinig <sam at webkit.org> has granted Antti Koivisto <koivisto at iki.fi>'s
request for review:
Bug 226697: Factor selection clamping into a type
https://bugs.webkit.org/show_bug.cgi?id=226697

Attachment 430690: patch

https://bugs.webkit.org/attachment.cgi?id=430690&action=review




--- Comment #4 from Sam Weinig <sam at webkit.org> ---
Comment on attachment 430690
  --> https://bugs.webkit.org/attachment.cgi?id=430690
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=430690&action=review

> Source/WebCore/rendering/TextBoxSelectableRange.h:39
> +	   auto clampedOffset = std::max(std::min(offset, start + length),
start) - start;

I think you can write this as:

auto clampedOffset = std::clamp(offset, start, start + length) - start;

(though  `- start` is kind of confusing, I do realize this is existing code you
ar moving.).


More information about the webkit-reviews mailing list