Bug 75220

Summary: Find indicators overlap when a match spans multiple text boxes
Product: WebKit Reporter: mitz
Component: WebKit2Assignee: mitz
Status: RESOLVED FIXED    
Severity: Normal CC: darin, rniwa
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
If find indicators for individual text boxes would overlap, use a single find indicator encompassing all text boxes darin: review+

Description mitz 2011-12-25 20:49:34 PST
Find indicators overlap when a match spans multiple text boxes
Comment 1 mitz 2011-12-25 20:57:21 PST
Created attachment 120522 [details]
If find indicators for individual text boxes would overlap, use a single find indicator encompassing all text boxes
Comment 2 Darin Adler 2011-12-25 21:00:40 PST
Comment on attachment 120522 [details]
If find indicators for individual text boxes would overlap, use a single find indicator encompassing all text boxes

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

> Source/WebCore/ChangeLog:8
> +        * WebCore.exp.in: Exported new unionRect(const Vector<FloatRect>&) and exisitng

Typo: exisitng

> Source/WebCore/platform/graphics/FloatRect.h:243
> +FloatRect unionRect(const Vector<FloatRect>&);

Wish there was a generic way to make this take any collection with begin/end instead of just a Vector specifically.

> Source/WebKit2/UIProcess/FindIndicator.cpp:90
> +static bool findIndicatorsForTextRectsOverlap(const Vector<WebCore::FloatRect>& textRects)

No need for WebCore:: prefix here.

> Source/WebKit2/UIProcess/FindIndicator.cpp:108
> +        for (size_t j = indicatorRects.size(); j; ) {
> +            --j;
> +            if (indicatorRect.intersects(indicatorRects[j]))
> +                return true;
> +        }

Is there any way to mitigate the n^2 nature of this algorithm?
Comment 3 mitz 2011-12-25 21:21:49 PST
(In reply to comment #2)
> (From update of attachment 120522 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=120522&action=review
> 
> > Source/WebCore/ChangeLog:8
> > +        * WebCore.exp.in: Exported new unionRect(const Vector<FloatRect>&) and exisitng
> 
> Typo: exisitng

Fixed.

> > Source/WebKit2/UIProcess/FindIndicator.cpp:90
> > +static bool findIndicatorsForTextRectsOverlap(const Vector<WebCore::FloatRect>& textRects)
> 
> No need for WebCore:: prefix here.

Fixed.

> 
> > Source/WebKit2/UIProcess/FindIndicator.cpp:108
> > +        for (size_t j = indicatorRects.size(); j; ) {
> > +            --j;
> > +            if (indicatorRect.intersects(indicatorRects[j]))
> > +                return true;
> > +        }
> 
> Is there any way to mitigate the n^2 nature of this algorithm?

Sadly, I don’t know the answer.

Thanks for the review!

Landed in <http://trac.webkit.org/r103677>.
Comment 4 Alexey Proskuryakov 2011-12-25 21:23:48 PST
*** Bug 69816 has been marked as a duplicate of this bug. ***
Comment 5 mitz 2012-04-11 09:54:42 PDT
<rdar://problem/11215218>