[webkit-reviews] review granted: [Bug 235695] DocumentContext gives empty rects for blank lines. : [Attachment 450110] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 27 09:22:25 PST 2022


Wenson Hsieh <wenson_hsieh at apple.com> has granted Megan Gardner
<megan_gardner at apple.com>'s request for review:
Bug 235695: DocumentContext gives empty rects for blank lines.
https://bugs.webkit.org/show_bug.cgi?id=235695

Attachment 450110: Patch

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




--- Comment #3 from Wenson Hsieh <wenson_hsieh at apple.com> ---
Comment on attachment 450110
  --> https://bugs.webkit.org/attachment.cgi?id=450110
Patch

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

This should be API-testable (there are existing examples in
DocumentEditingContext.mm)

>> Source/WebCore/platform/graphics/GeometryUtilities.cpp:108
>> +FloatRect unionRectIfNonZero(const Vector<FloatRect>& rects)
> 
> This looks the same as `unionRectIgnoringZeroRects`!
> 
> Maybe just add a new method for `const Vector<IntRect>&` and give it the same
name as the existing method?

Indeed!

Could also consider consolidating both into a template function and letting
type deduction do it's thing:

```
template <typename RectType>
RectType unionRectIgnoringZeroRects(const Vector<RectType>& rects)
{
    RectType result;
    for (auto& rect : rects)
	result.uniteIfNonZero(rect);
    return result;
}
```


More information about the webkit-reviews mailing list