Title: [111259] trunk/Source/WebKit/blackberry
Revision
111259
Author
[email protected]
Date
2012-03-19 15:17:27 -0700 (Mon, 19 Mar 2012)

Log Message

[BlackBerry] speed up text selection for large selections
https://bugs.webkit.org/show_bug.cgi?id=81536

When selecting large disjoint areas of text the cost
of calculating the IntRectRegion union becomes very
expensive. Simply placing all of the text quads into
the IntRectRegion is faster despite the larger memory
footprint and the additional calculations at render
time.

Patch by Tyler Abbott <[email protected]> on 2012-03-19
Reviewed by Rob Buis.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::getConsolidatedRegionOfTextQuadsForSelection):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (111258 => 111259)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-03-19 22:16:48 UTC (rev 111258)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-03-19 22:17:27 UTC (rev 111259)
@@ -1,3 +1,20 @@
+2012-03-19  Tyler Abbott  <[email protected]>
+
+        [BlackBerry] speed up text selection for large selections
+        https://bugs.webkit.org/show_bug.cgi?id=81536
+
+        When selecting large disjoint areas of text the cost
+        of calculating the IntRectRegion union becomes very
+        expensive. Simply placing all of the text quads into
+        the IntRectRegion is faster despite the larger memory
+        footprint and the additional calculations at render
+        time.
+
+        Reviewed by Rob Buis.
+
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::getConsolidatedRegionOfTextQuadsForSelection):
+
 2012-03-19  Mike Lattanzio  <[email protected]>
 
         [BlackBerry] Use BlackBerry::Platform::DeviceInfo to generate UserAgent

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (111258 => 111259)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-03-19 22:16:48 UTC (rev 111258)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-03-19 22:17:27 UTC (rev 111259)
@@ -112,15 +112,18 @@
         // framePosition is in main frame coordinates.
         WebCore::IntPoint framePosition = m_webPage->frameOffset(m_webPage->focusedOrMainFrame());
 
-        // The ranges rect list is based on render elements and may include multiple adjacent rects.
-        // Use IntRectRegion to consolidate these rects into bands as well as a container to pass
-        // to the client.
+        // Convert the text quads into a more platform friendy
+        // IntRectRegion and adjust for subframes.
+        std::vector<Platform::IntRect> adjustedIntRects;
+        Platform::IntRect selectionBoundingBox;
         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));
+            adjustedIntRects.push_back(enclosingRect);
+            selectionBoundingBox = unionOfRects(enclosingRect, selectionBoundingBox);
         }
+        region = IntRectRegion(selectionBoundingBox, adjustedIntRects.size(), adjustedIntRects);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to