[BlackBerry] Speed up processing of Selection region generation.
authormifenton@rim.com <mifenton@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 15:53:46 +0000 (15:53 +0000)
committermifenton@rim.com <mifenton@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 15:53:46 +0000 (15:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82766

Reviewed by Rob Buis.

PR 136593.

Re-speed up text selection.  The previous patch had a merge
error causing text selection not to function.  The fix
implemented removed the optimization.  This fixes the error
in the original patch and removes the temporary fix.

Make style updated as suggested by Antonio Gomes.

Reviewed Internally by Gen Mak.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::regionForTextQuads):
(BlackBerry::WebKit::regionRectListContainsPoint):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113987 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp

index 27e4fbf..2558109 100644 (file)
@@ -1,5 +1,27 @@
 2012-04-12  Mike Fenton  <mifenton@rim.com>
 
+        [BlackBerry] Speed up processing of Selection region generation.
+        https://bugs.webkit.org/show_bug.cgi?id=82766
+
+        Reviewed by Rob Buis.
+
+        PR 136593.
+
+        Re-speed up text selection.  The previous patch had a merge
+        error causing text selection not to function.  The fix
+        implemented removed the optimization.  This fixes the error
+        in the original patch and removes the temporary fix.
+
+        Make style updated as suggested by Antonio Gomes.
+
+        Reviewed Internally by Gen Mak.
+
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::regionForTextQuads):
+        (BlackBerry::WebKit::regionRectListContainsPoint):
+
+2012-04-12  Mike Fenton  <mifenton@rim.com>
+
         Pattern matching for hexadecimal should include * as an allowable count.
         https://bugs.webkit.org/show_bug.cgi?id=83779
 
index 501ef68..eaade44 100644 (file)
@@ -135,18 +135,20 @@ void SelectionHandler::regionForTextQuads(Vector<FloatQuad> &quadList, IntRectRe
         // Convert the text quads into a more platform friendy
         // IntRectRegion and adjust for subframes.
         Platform::IntRect selectionBoundingBox;
+        std::vector<Platform::IntRect> adjustedIntRects;
         for (unsigned i = 0; i < quadList.size(); i++) {
             WebCore::IntRect enclosingRect = quadList[i].enclosingBoundingBox();
             enclosingRect.intersect(frameRect);
             enclosingRect.move(framePosition.x(), framePosition.y());
-            region = unionRegions(region, IntRectRegion(enclosingRect));
 
             // Clip to the visible content.
             if (clippingRect.location() != DOMSupport::InvalidPoint)
                 enclosingRect.intersect(clippingRect);
 
+            adjustedIntRects.push_back(enclosingRect);
             selectionBoundingBox = unionOfRects(enclosingRect, selectionBoundingBox);
         }
+        region = IntRectRegion(selectionBoundingBox, adjustedIntRects.size(), adjustedIntRects);
     }
 }
 
@@ -804,7 +806,7 @@ static WebCore::IntPoint referencePoint(const VisiblePosition& position, const W
 
 // Check all rects in the region for a point match. The region is non-banded
 // and non-sorted so all must be checked.
-static bool regionRectListContainsPoint(IntRectRegion& region, WebCore::IntPoint point)
+static bool regionRectListContainsPoint(const IntRectRegion& region, const WebCore::IntPoint& point)
 {
     if (!region.extents().contains(point))
         return false;