Title: [134253] trunk/Source/WebCore
- Revision
- 134253
- Author
- [email protected]
- Date
- 2012-11-12 10:13:09 -0800 (Mon, 12 Nov 2012)
Log Message
hitTestResultAtPoint does two hit-tests if called on non main frame
https://bugs.webkit.org/show_bug.cgi?id=101915
Reviewed by Antonio Gomes.
Always redirect hitTestResultAtPoint to the main-frame. This used to being
done on every result that hit anything, which caused running the expensive
hit-tests multiple times in almost all cases.
* page/EventHandler.cpp:
(WebCore::EventHandler::hitTestResultAtPoint):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (134252 => 134253)
--- trunk/Source/WebCore/ChangeLog 2012-11-12 18:06:32 UTC (rev 134252)
+++ trunk/Source/WebCore/ChangeLog 2012-11-12 18:13:09 UTC (rev 134253)
@@ -1,3 +1,17 @@
+2012-11-12 Allan Sandfeld Jensen <[email protected]>
+
+ hitTestResultAtPoint does two hit-tests if called on non main frame
+ https://bugs.webkit.org/show_bug.cgi?id=101915
+
+ Reviewed by Antonio Gomes.
+
+ Always redirect hitTestResultAtPoint to the main-frame. This used to being
+ done on every result that hit anything, which caused running the expensive
+ hit-tests multiple times in almost all cases.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::hitTestResultAtPoint):
+
2012-11-12 Kentaro Hara <[email protected]>
[V8][JSC] ScriptProfileNode::callUID needs not to be [Custom]
Modified: trunk/Source/WebCore/page/EventHandler.cpp (134252 => 134253)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-11-12 18:06:32 UTC (rev 134252)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-11-12 18:13:09 UTC (rev 134253)
@@ -1114,9 +1114,23 @@
return page->dragController()->delegateDragSourceAction(view->contentsToRootView(m_mouseDownPos));
}
#endif // ENABLE(DRAG_SUPPORT)
-
+
HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding)
{
+ // We always send hitTestResultAtPoint to the main frame if we have one,
+ // otherwise we might hit areas that are obscured by higher frames.
+ if (Page* page = m_frame->page()) {
+ Frame* mainFrame = page->mainFrame();
+ if (m_frame != mainFrame) {
+ FrameView* frameView = m_frame->view();
+ FrameView* mainView = mainFrame->view();
+ if (frameView && mainView) {
+ IntPoint mainFramePoint = mainView->rootViewToContents(frameView->contentsToRootView(roundedIntPoint(point)));
+ return mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping, testScrollbars, hitType, padding);
+ }
+ }
+ }
+
HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width());
if (!m_frame->contentRenderer())
@@ -1151,21 +1165,6 @@
result.setScrollbar(eventScrollbar);
}
}
-
- // If our HitTestResult is not visible, then we started hit testing too far down the frame chain.
- // Another hit test at the main frame level should get us the correct visible result.
- Frame* resultFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : 0;
- if (Page* page = m_frame->page()) {
- Frame* mainFrame = page->mainFrame();
- if (m_frame != mainFrame && resultFrame && resultFrame != mainFrame) {
- FrameView* resultView = resultFrame->view();
- FrameView* mainView = mainFrame->view();
- if (resultView && mainView) {
- IntPoint mainFramePoint = mainView->rootViewToContents(resultView->contentsToRootView(roundedIntPoint(result.point())));
- result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping, testScrollbars, hitType, padding);
- }
- }
- }
if (!allowShadowContent)
result.setToNonShadowAncestor();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes