Title: [135405] trunk/Source
Revision
135405
Author
allan.jen...@digia.com
Date
2012-11-21 07:45:42 -0800 (Wed, 21 Nov 2012)

Log Message

Source/WebCore: Disambiguate innerNodeFramePoint and mainFramePoint
https://bugs.webkit.org/show_bug.cgi?id=98139

Reviewed by Julien Chaffraix.

Splits the point() method in HitTestResult into two, innerNodeFramePoint and mainFramePoint().
To do this HitTestResult no longer inherits publically from HitTestLocation, which should also
help to later separate the two classes completely.

Many of the call-sites of hitTestResultAtPoint confuses which coordinates the point is in.
These have not have been fixed in this patch, and they should be audited by the individual ports.

* WebCore.exp.in:
* dom/Document.cpp:
(WebCore::Document::nodesFromRect):
* page/EventHandler.cpp:
(WebCore::EventHandler::eventMayStartDrag):
(WebCore::EventHandler::hitTestResultAtPoint):
    Set and maintain pointInMainFrame on the HitTestResult.
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::HitTestResult):
    Construct pointInMainFrame as a copy of pointInInnerNodeFrame. This is correct
    for all hit-tests outside of the recursion in EventHandler::hitTestResultAtPoint.
(WebCore::HitTestResult::operator=):
(WebCore::HitTestResult::innerNodeFrame):
(WebCore::HitTestResult::append):
* rendering/HitTestResult.h:
(WebCore::HitTestLocation::point):
(HitTestResult):
    Inherits protected now from HitTestLocation to avoid exposing the ambiguous
    point() and roundedPoint() methods.
    HitTestResult will be split completely from HitTestLocation in a later patch.
(WebCore::HitTestResult::isRectBasedTest):
(WebCore::HitTestResult::pointInMainFrame):
(WebCore::HitTestResult::roundedPointInMainFrame):
(WebCore::HitTestResult::setPointInMainFrame):
(WebCore::HitTestResult::pointInInnerNodeFrame):
(WebCore::HitTestResult::roundedPointInInnerNodeFrame):
(WebCore::HitTestResult::localPoint):
(WebCore::HitTestResult::setLocalPoint):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTest):

Source/WebKit/chromium: Disambiguate innerNodeFramePoint and mainFramePoint
https://bugs.webkit.org/show_bug.cgi?id=98139

Reviewed by Julien Chaffraix.

* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::mouseDidMoveOverElement):
* src/ContextMenuClientImpl.cpp:
(WebKit::selectMisspelledWord):
(WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::characterIndexForPoint):

Source/WebKit/efl: Disambiguate innerNodeFramePoint and mainFramePoint
https://bugs.webkit.org/show_bug.cgi?id=98139

Reviewed by Julien Chaffraix.

* ewk/ewk_frame.cpp:
(ewk_frame_hit_test_new):

Source/WebKit/gtk: Disambiguate innerNodeFramePoint and mainFramePoint
https://bugs.webkit.org/show_bug.cgi?id=98139

Reviewed by Julien Chaffraix.

Switched to using point in innerNodeFrame. While the use here seems wrong it has been
left functionally unchanged to be fixed by a later patch.

* webkit/webkithittestresult.cpp:
(WebKit::kit):

Source/WebKit/mac: Disambiguate innerNodeFramePoint and mainFramePoint
https://bugs.webkit.org/show_bug.cgi?id=98139

Reviewed by Julien Chaffraix.

Switch to using HitTestResult::innerNodeFrame and HitTestResult::innerNodeFramePoint.

* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::showContextMenu):

Source/WebKit/qt: Disambiguate innerNodeFramePoint and mainFramePoint
https://bugs.webkit.org/show_bug.cgi?id=98139

Reviewed by Julien Chaffraix.

* Api/qwebframe.cpp:
(QWebHitTestResultPrivate::QWebHitTestResultPrivate):
* Api/qwebpage.cpp:
(QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch):

Source/WebKit/win: Disambiguate innerNodeFramePoint and mainFramePoint
https://bugs.webkit.org/show_bug.cgi?id=98139

Reviewed by Julien Chaffraix.

* WebView.cpp:
(WebView::handleContextMenuEvent):

Source/WebKit2: Disambiguate innerNodeFramePoint and mainFramePoint
https://bugs.webkit.org/show_bug.cgi?id=98139

Reviewed by Julien Chaffraix.

Switch to using HitTestResult::innerNodeFrame and HitTestResult::innerNodeFramePoint.

* WebProcess/WebPage/WebContextMenu.cpp:
(WebKit::WebContextMenu::show):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::characterIndexForPoint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135404 => 135405)


--- trunk/Source/WebCore/ChangeLog	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebCore/ChangeLog	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1,3 +1,48 @@
+2012-11-21  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        Disambiguate innerNodeFramePoint and mainFramePoint
+        https://bugs.webkit.org/show_bug.cgi?id=98139
+
+        Reviewed by Julien Chaffraix.
+
+        Splits the point() method in HitTestResult into two, innerNodeFramePoint and mainFramePoint().
+        To do this HitTestResult no longer inherits publically from HitTestLocation, which should also
+        help to later separate the two classes completely.
+
+        Many of the call-sites of hitTestResultAtPoint confuses which coordinates the point is in.
+        These have not have been fixed in this patch, and they should be audited by the individual ports.
+
+        * WebCore.exp.in:
+        * dom/Document.cpp:
+        (WebCore::Document::nodesFromRect):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::eventMayStartDrag):
+        (WebCore::EventHandler::hitTestResultAtPoint):
+            Set and maintain pointInMainFrame on the HitTestResult.
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::HitTestResult):
+            Construct pointInMainFrame as a copy of pointInInnerNodeFrame. This is correct
+            for all hit-tests outside of the recursion in EventHandler::hitTestResultAtPoint.
+        (WebCore::HitTestResult::operator=):
+        (WebCore::HitTestResult::innerNodeFrame):
+        (WebCore::HitTestResult::append):
+        * rendering/HitTestResult.h:
+        (WebCore::HitTestLocation::point):
+        (HitTestResult):
+            Inherits protected now from HitTestLocation to avoid exposing the ambiguous
+            point() and roundedPoint() methods. 
+            HitTestResult will be split completely from HitTestLocation in a later patch.
+        (WebCore::HitTestResult::isRectBasedTest):
+        (WebCore::HitTestResult::pointInMainFrame):
+        (WebCore::HitTestResult::roundedPointInMainFrame):
+        (WebCore::HitTestResult::setPointInMainFrame):
+        (WebCore::HitTestResult::pointInInnerNodeFrame):
+        (WebCore::HitTestResult::roundedPointInInnerNodeFrame):
+        (WebCore::HitTestResult::localPoint):
+        (WebCore::HitTestResult::setLocalPoint):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hitTest):
+
 2012-11-21  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r135383.

Modified: trunk/Source/WebCore/WebCore.exp.in (135404 => 135405)


--- trunk/Source/WebCore/WebCore.exp.in	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1176,6 +1176,7 @@
 __ZNK7WebCore13HitTestResult11targetFrameEv
 __ZNK7WebCore13HitTestResult11textContentEv
 __ZNK7WebCore13HitTestResult14absolutePDFURLEv
+__ZNK7WebCore13HitTestResult14innerNodeFrameEv
 __ZNK7WebCore13HitTestResult15absoluteLinkURLEv
 __ZNK7WebCore13HitTestResult15spellingToolTipERNS_13TextDirectionE
 __ZNK7WebCore13HitTestResult16absoluteImageURLEv

Modified: trunk/Source/WebCore/dom/Document.cpp (135404 => 135405)


--- trunk/Source/WebCore/dom/Document.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1389,7 +1389,7 @@
     // When ignoreClipping is false, this method returns null for coordinates outside of the viewport.
     if (ignoreClipping)
         type |= HitTestRequest::IgnoreClipping;
-    else if (!frameView->visibleContentRect().intersects(HitTestResult::rectForPoint(point, topPadding, rightPadding, bottomPadding, leftPadding)))
+    else if (!frameView->visibleContentRect().intersects(HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, leftPadding)))
         return 0;
     if (allowShadowContent)
         type |= HitTestRequest::AllowShadowContent;

Modified: trunk/Source/WebCore/page/EventHandler.cpp (135404 => 135405)


--- trunk/Source/WebCore/page/EventHandler.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -787,7 +787,7 @@
     HitTestResult result(view->windowToContents(event.position()));
     m_frame->contentRenderer()->hitTest(request, result);
     DragState state;
-    return result.innerNode() && page->dragController()->draggableNode(m_frame, result.innerNode(), roundedIntPoint(result.point()), state);
+    return result.innerNode() && page->dragController()->draggableNode(m_frame, result.innerNode(), result.roundedPointInInnerNodeFrame(), state);
 }
 
 void EventHandler::updateSelectionForMouseDrag()
@@ -1140,7 +1140,8 @@
         hitType |= HitTestRequest::IgnoreClipping;
     if (allowShadowContent)
         hitType |= HitTestRequest::AllowShadowContent;
-    m_frame->contentRenderer()->hitTest(HitTestRequest(hitType), result);
+    HitTestRequest request(hitType);
+    m_frame->contentRenderer()->hitTest(request, result);
 
     while (true) {
         Node* n = result.innerNode();
@@ -1157,7 +1158,8 @@
         LayoutPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(), 
             result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop());
         HitTestResult widgetHitTestResult(widgetPoint, padding.height(), padding.width(), padding.height(), padding.width());
-        frame->contentRenderer()->hitTest(HitTestRequest(hitType), widgetHitTestResult);
+        widgetHitTestResult.setPointInMainFrame(result.pointInMainFrame());
+        frame->contentRenderer()->hitTest(request, widgetHitTestResult);
         result = widgetHitTestResult;
 
         if (testScrollbars == ShouldHitTestScrollbars) {

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (135404 => 135405)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -197,19 +197,23 @@
 {
 }
 
-HitTestResult::HitTestResult(const LayoutPoint& point) : HitTestLocation(point)
+HitTestResult::HitTestResult(const LayoutPoint& point)
+    : HitTestLocation(point)
+    , m_pointInMainFrame(point)
     , m_isOverWidget(false)
 {
 }
 
 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
     : HitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding)
+    , m_pointInMainFrame(centerPoint)
     , m_isOverWidget(false)
 {
 }
 
 HitTestResult::HitTestResult(const HitTestLocation& other)
     : HitTestLocation(other)
+    , m_pointInMainFrame(point())
     , m_isOverWidget(false)
 {
 }
@@ -218,6 +222,7 @@
     : HitTestLocation(other)
     , m_innerNode(other.innerNode())
     , m_innerNonSharedNode(other.innerNonSharedNode())
+    , m_pointInMainFrame(other.m_pointInMainFrame)
     , m_localPoint(other.localPoint())
     , m_innerURLElement(other.URLElement())
     , m_scrollbar(other.scrollbar())
@@ -236,6 +241,7 @@
     HitTestLocation::operator=(other);
     m_innerNode = other.innerNode();
     m_innerNonSharedNode = other.innerNonSharedNode();
+    m_pointInMainFrame = other.m_pointInMainFrame;
     m_localPoint = other.localPoint();
     m_innerURLElement = other.URLElement();
     m_scrollbar = other.scrollbar();
@@ -279,6 +285,15 @@
     m_scrollbar = s;
 }
 
+Frame* HitTestResult::innerNodeFrame() const
+{
+    if (m_innerNonSharedNode)
+        return m_innerNonSharedNode->document()->frame();
+    if (m_innerNode)
+        return m_innerNode->document()->frame();
+    return 0;
+}
+
 Frame* HitTestResult::targetFrame() const
 {
     if (!m_innerURLElement)
@@ -746,6 +761,7 @@
         m_innerNode = other.innerNode();
         m_innerNonSharedNode = other.innerNonSharedNode();
         m_localPoint = other.localPoint();
+        m_pointInMainFrame = other.m_pointInMainFrame;
         m_innerURLElement = other.URLElement();
         m_scrollbar = other.scrollbar();
         m_isOverWidget = other.isOverWidget();

Modified: trunk/Source/WebCore/rendering/HitTestResult.h (135404 => 135405)


--- trunk/Source/WebCore/rendering/HitTestResult.h	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebCore/rendering/HitTestResult.h	2012-11-21 15:45:42 UTC (rev 135405)
@@ -60,7 +60,7 @@
     ~HitTestLocation();
     HitTestLocation& operator=(const HitTestLocation&);
 
-    LayoutPoint point() const { return m_point; }
+    const LayoutPoint& point() const { return m_point; }
     IntPoint roundedPoint() const { return roundedIntPoint(m_point); }
 
     RenderRegion* region() const { return m_region; }
@@ -100,7 +100,8 @@
     bool m_isRectilinear;
 };
 
-class HitTestResult : public HitTestLocation {
+// FIXME: HitTestResult should not be a HitTestLocation, but instead have a HitTestLocation. See https://bugs.webkit.org/show_bug.cgi?id=101590
+class HitTestResult : protected HitTestLocation {
 public:
     typedef ListHashSet<RefPtr<Node> > NodeSet;
 
@@ -115,18 +116,33 @@
 
     Node* innerNode() const { return m_innerNode.get(); }
     Node* innerNonSharedNode() const { return m_innerNonSharedNode.get(); }
-    LayoutPoint localPoint() const { return m_localPoint; }
     Element* URLElement() const { return m_innerURLElement.get(); }
     Scrollbar* scrollbar() const { return m_scrollbar.get(); }
     bool isOverWidget() const { return m_isOverWidget; }
 
+    // Forwarded from HitTestLocation
+    bool isRectBasedTest() const { return HitTestLocation::isRectBasedTest(); }
+
+    // The hit-tested point in the coordinates of the main frame.
+    const LayoutPoint& pointInMainFrame() const { return m_pointInMainFrame; }
+    IntPoint roundedPointInMainFrame() const { return roundedIntPoint(pointInMainFrame()); }
+    void setPointInMainFrame(const LayoutPoint& p) { m_pointInMainFrame = p; }
+
+    // The hit-tested point in the coordinates of the innerNode frame, the frame containing innerNode.
+    const LayoutPoint& pointInInnerNodeFrame() const { return HitTestLocation::point(); }
+    IntPoint roundedPointInInnerNodeFrame() const { return roundedIntPoint(pointInInnerNodeFrame()); }
+    Frame* innerNodeFrame() const;
+
+    // The hit-tested point in the coordinates of the inner node.
+    const LayoutPoint& localPoint() const { return m_localPoint; }
+    void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; }
+
     void setToNonShadowAncestor();
 
     const HitTestLocation& hitTestLocation() const { return *this; }
 
     void setInnerNode(Node*);
     void setInnerNonSharedNode(Node*);
-    void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; }
     void setURLElement(Element*);
     void setScrollbar(Scrollbar*);
     void setIsOverWidget(bool b) { m_isOverWidget = b; }
@@ -185,6 +201,7 @@
 
     RefPtr<Node> m_innerNode;
     RefPtr<Node> m_innerNonSharedNode;
+    LayoutPoint m_pointInMainFrame; // The hit-tested point in main-frame coordinates.
     LayoutPoint m_localPoint; // A point in the local coordinate space of m_innerNonSharedNode's renderer. Allows us to efficiently
                               // determine where inside the renderer we hit on subsequent operations.
     RefPtr<Element> m_innerURLElement;

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (135404 => 135405)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -3642,7 +3642,7 @@
         // return ourselves. We do this so mouse events continue getting delivered after a drag has 
         // exited the WebView, and so hit testing over a scrollbar hits the content document.
         if ((request.active() || request.release()) && isRootLayer()) {
-            renderer()->updateHitTestResult(result, toRenderView(renderer())->flipForWritingMode(result.point()));
+            renderer()->updateHitTestResult(result, toRenderView(renderer())->flipForWritingMode(hitTestLocation.point()));
             insideLayer = this;
         }
     }

Modified: trunk/Source/WebKit/chromium/ChangeLog (135404 => 135405)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1,3 +1,18 @@
+2012-11-21  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        Disambiguate innerNodeFramePoint and mainFramePoint
+        https://bugs.webkit.org/show_bug.cgi?id=98139
+
+        Reviewed by Julien Chaffraix.
+
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::mouseDidMoveOverElement):
+        * src/ContextMenuClientImpl.cpp:
+        (WebKit::selectMisspelledWord):
+        (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::characterIndexForPoint):
+
 2012-11-21  W. James MacLean  <wjmacl...@chromium.org>
 
         [chromium] Link highlight should display for at least 100ms, and fadeout on GestureTap/Longpress.

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (135404 => 135405)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -600,7 +600,7 @@
             Widget* widget = toRenderWidget(object)->widget();
             if (widget && widget->isPluginContainer()) {
                 WebPluginContainerImpl* plugin = static_cast<WebPluginContainerImpl*>(widget);
-                url = ""
+                url = ""
             }
         }
     }

Modified: trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp (135404 => 135405)


--- trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -120,7 +120,7 @@
 
     // Selection is empty, so change the selection to the word under the cursor.
     HitTestResult hitTestResult = selectedFrame->eventHandler()->
-        hitTestResultAtPoint(selectedFrame->page()->contextMenuController()->hitTestResult().point(), true);
+        hitTestResultAtPoint(selectedFrame->page()->contextMenuController()->hitTestResult().pointInInnerNodeFrame(), true);
     Node* innerNode = hitTestResult.innerNode();
     VisiblePosition pos(innerNode->renderer()->positionForPoint(
         hitTestResult.localPoint()));
@@ -155,10 +155,10 @@
         return 0;
 
     HitTestResult r = m_webView->page()->contextMenuController()->hitTestResult();
-    Frame* selectedFrame = r.innerNonSharedNode()->document()->frame();
+    Frame* selectedFrame = r.innerNodeFrame();
 
     WebContextMenuData data;
-    data.mousePosition = selectedFrame->view()->contentsToWindow(r.roundedPoint());
+    data.mousePosition = selectedFrame->view()->contentsToWindow(r.roundedPointInInnerNodeFrame());
 
     // Compute edit flags.
     data.editFlags = WebContextMenuData::CanDoNone;

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (135404 => 135405)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1184,7 +1184,7 @@
 
     IntPoint point = frame()->view()->windowToContents(webPoint);
     HitTestResult result = frame()->eventHandler()->hitTestResultAtPoint(point, false);
-    RefPtr<Range> range = frame()->rangeForPoint(result.roundedPoint());
+    RefPtr<Range> range = frame()->rangeForPoint(result.roundedPointInInnerNodeFrame());
     if (!range)
         return notFound;
 

Modified: trunk/Source/WebKit/efl/ChangeLog (135404 => 135405)


--- trunk/Source/WebKit/efl/ChangeLog	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1,3 +1,13 @@
+2012-11-21  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        Disambiguate innerNodeFramePoint and mainFramePoint 
+        https://bugs.webkit.org/show_bug.cgi?id=98139
+
+        Reviewed by Julien Chaffraix.
+
+        * ewk/ewk_frame.cpp:
+        (ewk_frame_hit_test_new):
+
 2012-11-20  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r135295.

Modified: trunk/Source/WebKit/efl/ewk/ewk_frame.cpp (135404 => 135405)


--- trunk/Source/WebKit/efl/ewk/ewk_frame.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/efl/ewk/ewk_frame.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -702,8 +702,9 @@
         return 0;
 
     Ewk_Hit_Test* hitTest = new Ewk_Hit_Test;
-    hitTest->x = result.point().x();
-    hitTest->y = result.point().y();
+    // FIXME: This should probably use pointInMainFrame, if it is to match the documentation of ewk_hit_test.
+    hitTest->x = result.pointInInnerNodeFrame().x();
+    hitTest->y = result.pointInInnerNodeFrame().y();
 #if 0
     // FIXME
     hitTest->bounding_box.x = result.boundingBox().x();

Modified: trunk/Source/WebKit/gtk/ChangeLog (135404 => 135405)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1,3 +1,16 @@
+2012-11-21  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        Disambiguate innerNodeFramePoint and mainFramePoint
+        https://bugs.webkit.org/show_bug.cgi?id=98139
+
+        Reviewed by Julien Chaffraix.
+
+        Switched to using point in innerNodeFrame. While the use here seems wrong it has been
+        left functionally unchanged to be fixed by a later patch.
+
+        * webkit/webkithittestresult.cpp:
+        (WebKit::kit):
+
 2012-11-20  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r135295.

Modified: trunk/Source/WebKit/gtk/webkit/webkithittestresult.cpp (135404 => 135405)


--- trunk/Source/WebKit/gtk/webkit/webkithittestresult.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/gtk/webkit/webkithittestresult.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -315,12 +315,15 @@
     if (result.innerNonSharedNode())
         node = kit(result.innerNonSharedNode());
 
+    // FIXME: This should probably use innerNodeFrame, as targetFrame is the potentially different frame the link opens in.
     targetFrame = result.targetFrame();
     if (targetFrame && targetFrame->view()) {
         // Convert document coords to widget coords.
-        point = targetFrame->view()->contentsToWindow(result.roundedPoint());
-    } else
-        point = result.roundedPoint();
+        point = targetFrame->view()->contentsToWindow(result.roundedPointInInnerNodeFrame());
+    } else {
+        // FIXME: This should probably use roundedPointInMainFrame and translate from the mainframe.
+        point = result.roundedPointInInnerNodeFrame();
+    }
 
     return WEBKIT_HIT_TEST_RESULT(g_object_new(WEBKIT_TYPE_HIT_TEST_RESULT,
                                                "link-uri", linkURI.get(),

Modified: trunk/Source/WebKit/mac/ChangeLog (135404 => 135405)


--- trunk/Source/WebKit/mac/ChangeLog	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1,3 +1,15 @@
+2012-11-21  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        Disambiguate innerNodeFramePoint and mainFramePoint
+        https://bugs.webkit.org/show_bug.cgi?id=98139
+
+        Reviewed by Julien Chaffraix.
+
+        Switch to using HitTestResult::innerNodeFrame and HitTestResult::innerNodeFramePoint.
+
+        * WebCoreSupport/WebContextMenuClient.mm:
+        (WebContextMenuClient::showContextMenu):
+
 2012-11-20  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r135295.

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm (135404 => 135405)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm	2012-11-21 15:45:42 UTC (rev 135405)
@@ -356,17 +356,14 @@
     if (!page)
         return;
     ContextMenuController* controller = page->contextMenuController();
-    Node* node = controller->hitTestResult().innerNonSharedNode();
-    if (!node)
-        return;
-    Frame* frame = node->document()->frame();
+    Frame* frame = controller->hitTestResult().innerNodeFrame();
     if (!frame)
         return;
     FrameView* frameView = frame->view();
     if (!frameView)
         return;
 
-    IntPoint point = frameView->contentsToWindow(controller->hitTestResult().roundedPoint());
+    IntPoint point = frameView->contentsToWindow(controller->hitTestResult().roundedPointInInnerNodeFrame());
     NSView* view = frameView->documentView();
     NSPoint nsScreenPoint = [view convertPoint:point toView:nil];
     // Show the contextual menu for this event.

Modified: trunk/Source/WebKit/qt/Api/qwebframe.cpp (135404 => 135405)


--- trunk/Source/WebKit/qt/Api/qwebframe.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/qt/Api/qwebframe.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1598,7 +1598,8 @@
 {
     if (!hitTest.innerNode())
         return;
-    pos = hitTest.roundedPoint();
+    // FIXME: This should probably use roundedPointInMainFrame if it is to match the documentation of QWebHitTestResult.
+    pos = hitTest.roundedPointInInnerNodeFrame();
     WebCore::TextDirection dir;
     title = hitTest.title(dir);
     linkText = hitTest.textContent();

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (135404 => 135405)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1582,7 +1582,7 @@
     FrameView* view = document->frame()->view();
 
     // Touch rect in contents coordinates.
-    IntRect touchRect(HitTestResult::rectForPoint(view->windowToContents(IntPoint(x, y)), m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding));
+    IntRect touchRect(HitTestLocation::rectForPoint(view->windowToContents(IntPoint(x, y)), m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding));
 
     // Iterate over the list of nodes hit looking for the one whose bounding area
     // has largest intersection with the touch area (point + padding).

Modified: trunk/Source/WebKit/qt/ChangeLog (135404 => 135405)


--- trunk/Source/WebKit/qt/ChangeLog	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1,3 +1,15 @@
+2012-11-21  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        Disambiguate innerNodeFramePoint and mainFramePoint
+        https://bugs.webkit.org/show_bug.cgi?id=98139
+
+        Reviewed by Julien Chaffraix.
+
+        * Api/qwebframe.cpp:
+        (QWebHitTestResultPrivate::QWebHitTestResultPrivate):
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch):
+
 2012-11-20  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r135295.

Modified: trunk/Source/WebKit/win/ChangeLog (135404 => 135405)


--- trunk/Source/WebKit/win/ChangeLog	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/win/ChangeLog	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1,3 +1,13 @@
+2012-11-21  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        Disambiguate innerNodeFramePoint and mainFramePoint
+        https://bugs.webkit.org/show_bug.cgi?id=98139
+
+        Reviewed by Julien Chaffraix.
+
+        * WebView.cpp:
+        (WebView::handleContextMenuEvent):
+
 2012-11-20  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r135295.

Modified: trunk/Source/WebKit/win/WebView.cpp (135404 => 135405)


--- trunk/Source/WebKit/win/WebView.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit/win/WebView.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1350,11 +1350,7 @@
     if (!coreMenu)
         return false;
 
-    Node* node = contextMenuController->hitTestResult().innerNonSharedNode();
-    if (!node)
-        return false;
-
-    Frame* frame = node->document()->frame();
+    Frame* frame = contextMenuController->hitTestResult().innerNodeFrame();
     if (!frame)
         return false;
 
@@ -1362,7 +1358,7 @@
     if (!view)
         return false;
 
-    POINT point(view->contentsToWindow(contextMenuController->hitTestResult().roundedPoint()));
+    POINT point(view->contentsToWindow(contextMenuController->hitTestResult().roundedPointInInnerNodeFrame()));
 
     // Translate the point to screen coordinates
     if (!::ClientToScreen(m_viewWindow, &point))

Modified: trunk/Source/WebKit2/ChangeLog (135404 => 135405)


--- trunk/Source/WebKit2/ChangeLog	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-21 15:45:42 UTC (rev 135405)
@@ -1,3 +1,17 @@
+2012-11-21  Allan Sandfeld Jensen  <allan.jen...@digia.com>
+
+        Disambiguate innerNodeFramePoint and mainFramePoint
+        https://bugs.webkit.org/show_bug.cgi?id=98139
+
+        Reviewed by Julien Chaffraix.
+
+        Switch to using HitTestResult::innerNodeFrame and HitTestResult::innerNodeFramePoint.
+
+        * WebProcess/WebPage/WebContextMenu.cpp:
+        (WebKit::WebContextMenu::show):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::characterIndexForPoint):
+
 2012-11-21  Simon Hausmann  <simon.hausm...@digia.com>
 
         Unreviewed Qt/Windows build fix.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp (135404 => 135405)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp	2012-11-21 15:45:42 UTC (rev 135405)
@@ -59,10 +59,7 @@
     ContextMenu* menu = controller->contextMenu();
     if (!menu)
         return;
-    Node* node = controller->hitTestResult().innerNonSharedNode();
-    if (!node)
-        return;
-    Frame* frame = node->document()->frame();
+    Frame* frame = controller->hitTestResult().innerNodeFrame();
     if (!frame)
         return;
     FrameView* view = frame->view();
@@ -86,7 +83,7 @@
 
     // Mark the WebPage has having a shown context menu then notify the UIProcess.
     m_page->contextMenuShowing();
-    m_page->send(Messages::WebPageProxy::ShowContextMenu(view->contentsToWindow(controller->hitTestResult().roundedPoint()), webHitTestResultData, proposedMenu, InjectedBundleUserMessageEncoder(userData.get())));
+    m_page->send(Messages::WebPageProxy::ShowContextMenu(view->contentsToWindow(controller->hitTestResult().roundedPointInInnerNodeFrame()), webHitTestResultData, proposedMenu, InjectedBundleUserMessageEncoder(userData.get())));
 }
 
 void WebContextMenu::itemSelected(const WebContextMenuItemData& item)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (135404 => 135405)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2012-11-21 15:30:56 UTC (rev 135404)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2012-11-21 15:45:42 UTC (rev 135405)
@@ -384,9 +384,9 @@
         return;
 
     HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(point, false);
-    frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame();
+    frame = result.innerNonSharedNode() ? result.innerNodeFrame() : m_page->focusController()->focusedOrMainFrame();
     
-    RefPtr<Range> range = frame->rangeForPoint(result.roundedPoint());
+    RefPtr<Range> range = frame->rangeForPoint(result.roundedPointInInnerNodeFrame());
     if (!range)
         return;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to