Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (150090 => 150091)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2013-05-14 22:20:51 UTC (rev 150090)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2013-05-14 22:40:20 UTC (rev 150091)
@@ -6198,6 +6198,7 @@
{
if (m_cachedHitTestContentPos != contentPos) {
m_cachedHitTestContentPos = contentPos;
+ m_cachedRectHitTestResults.clear();
m_cachedHitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(m_cachedHitTestContentPos, HitTestRequest::ReadOnly | HitTestRequest::Active);
}
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (150090 => 150091)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2013-05-14 22:20:51 UTC (rev 150090)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2013-05-14 22:40:20 UTC (rev 150091)
@@ -645,6 +645,9 @@
WebCore::IntPoint m_cachedHitTestContentPos;
WebCore::HitTestResult m_cachedHitTestResult;
+ typedef HashMap<RefPtr<WebCore::Document>, ListHashSet<RefPtr<WebCore::Node> > > CachedRectHitTestResults;
+ CachedRectHitTestResults m_cachedRectHitTestResults;
+
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
NotificationManager m_notificationManager;
#endif
Modified: trunk/Source/WebKit/blackberry/ChangeLog (150090 => 150091)
--- trunk/Source/WebKit/blackberry/ChangeLog 2013-05-14 22:20:51 UTC (rev 150090)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2013-05-14 22:40:20 UTC (rev 150091)
@@ -1,3 +1,26 @@
+2013-05-14 Tiancheng Jiang <tiji...@rim.com>
+
+ [BlackBerry] Improve Fatfinger phase.
+ https://bugs.webkit.org/show_bug.cgi?id=107403
+
+ Reviewed by Rob Buis.
+
+ Internally reviewed by Genevieve Mak.
+ BlackBerry PR 324965.
+
+ Cache and reuse intersected nodes as long as hit position has not been
+ changed.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::hitTestResult):
+ * Api/WebPage_p.h:
+ (WebPagePrivate):
+ * WebKitSupport/FatFingers.cpp:
+ (BlackBerry::WebKit::FatFingers::findBestPoint):
+ (BlackBerry::WebKit::FatFingers::findIntersectingRegions):
+ (BlackBerry::WebKit::FatFingers::getNodesFromRect):
+ * WebKitSupport/FatFingers.h:
+
2013-05-14 Andrew Lo <a...@rim.com>
[BlackBerry] Hook up frame render begin/end in PerformanceMonitor
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp (150090 => 150091)
--- trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp 2013-05-14 22:20:51 UTC (rev 150090)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.cpp 2013-05-14 22:40:20 UTC (rev 150091)
@@ -159,8 +159,6 @@
IntRect viewportRect = m_webPage->mainFrame()->view()->visibleContentRect();
m_contentPos = Platform::pointClampedToRect(m_contentPos, viewportRect);
- m_cachedRectHitTestResults.clear();
-
FatFingersResult result(m_contentPos);
// Lets set nodeUnderFatFinger to the result of a point based hit test here. If something
@@ -199,8 +197,6 @@
bool foundOne = findIntersectingRegions(m_webPage->m_mainFrame->document(), intersectingRegions, remainingFingerRegion);
- m_cachedRectHitTestResults.clear();
-
if (!foundOne)
return result;
@@ -314,8 +310,12 @@
// Iterate over the list of nodes (and subrects of nodes where possible), for each saving the
// intersection of the bounding box with the finger rect.
ListHashSet<RefPtr<Node> > intersectedNodes;
- getNodesFromRect(document, frameContentPos, intersectedNodes);
+ if (m_webPage->m_cachedRectHitTestResults.contains(document))
+ intersectedNodes = m_webPage->m_cachedRectHitTestResults.get(document);
+ else
+ getNodesFromRect(document, frameContentPos, intersectedNodes);
+
ListHashSet<RefPtr<Node> >::const_iterator it = intersectedNodes.begin();
ListHashSet<RefPtr<Node> >::const_iterator end = intersectedNodes.end();
for ( ; it != end; ++it) {
@@ -478,7 +478,7 @@
document->renderView()->layer()->hitTest(requestType, result);
intersectedNodes = result.rectBasedTestResult();
- m_cachedRectHitTestResults.add(document, intersectedNodes);
+ m_webPage->m_cachedRectHitTestResults.add(document, intersectedNodes);
}
void FatFingers::setSuccessfulFatFingersResult(FatFingersResult& result, Node* bestNode, const WebCore::IntPoint& adjustedPoint)
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.h (150090 => 150091)
--- trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.h 2013-05-14 22:20:51 UTC (rev 150090)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.h 2013-05-14 22:40:20 UTC (rev 150091)
@@ -72,9 +72,6 @@
typedef std::pair<WebCore::Node*, Platform::IntRectRegion> IntersectingRegion;
- enum CachedResultsStrategy { GetFromRenderTree = 0, GetFromCache };
- typedef HashMap<RefPtr<WebCore::Document>, ListHashSet<RefPtr<WebCore::Node> > > CachedRectHitTestResults;
-
bool checkFingerIntersection(const Platform::IntRectRegion&,
const Platform::IntRectRegion& remainingFingerRegion,
WebCore::Node*,
@@ -105,7 +102,6 @@
WebPagePrivate* m_webPage;
WebCore::IntPoint m_contentPos;
TargetType m_targetType;
- CachedRectHitTestResults m_cachedRectHitTestResults;
};
class FatFingersResult {