DocumentContext gives empty rects for blank lines.
Created attachment 450110 [details] Patch
Comment on attachment 450110 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=450110&action=review > 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?
Comment on attachment 450110 [details] 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; } ```
Created attachment 450178 [details] Patch
Comment on attachment 450178 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=450178&action=review > Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:489 > + auto documentRect = CGRectFromJSONEncodedDOMRectJSValue([webView objectByEvaluatingJavaScript:@"text.getBoundingClientRect().toJSON()"]); > + documentRect.origin.x += (documentRect.size.width / 2) - (glyphWidth * 2); > + documentRect.origin.y += (documentRect.size.height / 2) - (glyphWidth * 2); > + documentRect.size.width = glyphWidth; > + documentRect.size.height = glyphWidth; You never use documentRect so you can delete all of this
Created attachment 450188 [details] Patch
Created attachment 450201 [details] Patch for landing
Committed r288721 (246514@main): <https://commits.webkit.org/246514@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 450201 [details].
<rdar://problem/88169210>