- Revision
- 151541
- Author
- [email protected]
- Date
- 2013-06-13 01:23:58 -0700 (Thu, 13 Jun 2013)
Log Message
[EFL][WK2] Wrong context menu and popup menu positions when scroll is applied
https://bugs.webkit.org/show_bug.cgi?id=116610
Patch by Michał Pakuła vel Rutka <[email protected]> on 2013-06-13
Reviewed by Noam Rosenthal.
Source/WebKit2:
WebKit2 EFL uses fixed layout - because of this ScrollView::contentsToWindow, does
not take scroll into account, as it is meant to be handled by UI application.
When popup and context menu are created, after calling contentsToWindow their position
are not adjusted to page scroll.
Added two functions to EwkView and WKView, converting contents position to user viewport
coordinates, to adjust popup and context menu positions.
* UIProcess/API/C/CoordinatedGraphics/WKView.cpp:
(WKViewContentsToUserViewport):
* UIProcess/API/C/CoordinatedGraphics/WKView.h:
* UIProcess/API/efl/EwkView.cpp:
(EwkView::showContextMenu):
(EwkView::requestPopupMenu):
* UIProcess/CoordinatedGraphics/WebView.cpp:
(WebKit::WebView::contentsToUserViewport):
* UIProcess/CoordinatedGraphics/WebView.h:
Tools:
Remove unnecessary code adjusting context menu position to webview position.
Now position is calculcated in EwkView.
* MiniBrowser/efl/main.c:
(on_context_menu_show):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (151540 => 151541)
--- trunk/Source/WebKit2/ChangeLog 2013-06-13 07:52:16 UTC (rev 151540)
+++ trunk/Source/WebKit2/ChangeLog 2013-06-13 08:23:58 UTC (rev 151541)
@@ -1,3 +1,27 @@
+2013-06-13 Michał Pakuła vel Rutka <[email protected]>
+
+ [EFL][WK2] Wrong context menu and popup menu positions when scroll is applied
+ https://bugs.webkit.org/show_bug.cgi?id=116610
+
+ Reviewed by Noam Rosenthal.
+
+ WebKit2 EFL uses fixed layout - because of this ScrollView::contentsToWindow, does
+ not take scroll into account, as it is meant to be handled by UI application.
+ When popup and context menu are created, after calling contentsToWindow their position
+ are not adjusted to page scroll.
+ Added two functions to EwkView and WKView, converting contents position to user viewport
+ coordinates, to adjust popup and context menu positions.
+
+ * UIProcess/API/C/CoordinatedGraphics/WKView.cpp:
+ (WKViewContentsToUserViewport):
+ * UIProcess/API/C/CoordinatedGraphics/WKView.h:
+ * UIProcess/API/efl/EwkView.cpp:
+ (EwkView::showContextMenu):
+ (EwkView::requestPopupMenu):
+ * UIProcess/CoordinatedGraphics/WebView.cpp:
+ (WebKit::WebView::contentsToUserViewport):
+ * UIProcess/CoordinatedGraphics/WebView.h:
+
2013-06-12 Anders Carlsson <[email protected]>
Remove the notion of inactive plug-ins
Modified: trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp (151540 => 151541)
--- trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp 2013-06-13 07:52:16 UTC (rev 151540)
+++ trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp 2013-06-13 08:23:58 UTC (rev 151541)
@@ -112,6 +112,12 @@
return WKPointMake(result.x(), result.y());
}
+WKPoint WKViewContentsToUserViewport(WKViewRef viewRef, WKPoint point)
+{
+ WebCore::IntPoint result = toImpl(viewRef)->contentsToUserViewport(toIntPoint(point));
+ return WKPointMake(result.x(), result.y());
+}
+
void WKViewPaintToCurrentGLContext(WKViewRef viewRef)
{
toImpl(viewRef)->paintToCurrentGLContext();
Modified: trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h (151540 => 151541)
--- trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h 2013-06-13 07:52:16 UTC (rev 151540)
+++ trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h 2013-06-13 08:23:58 UTC (rev 151541)
@@ -80,6 +80,7 @@
WK_EXPORT void WKViewSetUserViewportTranslation(WKViewRef, double tx, double ty);
WK_EXPORT WKPoint WKViewUserViewportToContents(WKViewRef, WKPoint);
WK_EXPORT WKPoint WKViewUserViewportToScene(WKViewRef, WKPoint);
+WK_EXPORT WKPoint WKViewContentsToUserViewport(WKViewRef, WKPoint);
WK_EXPORT void WKViewPaintToCurrentGLContext(WKViewRef);
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp (151540 => 151541)
--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp 2013-06-13 07:52:16 UTC (rev 151540)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp 2013-06-13 08:23:58 UTC (rev 151541)
@@ -853,6 +853,8 @@
m_contextMenu = EwkContextMenu::create(this, items);
+ position = WKViewContentsToUserViewport(wkView(), position);
+
sd->api->context_menu_show(sd, position.x, position.y, m_contextMenu.get());
}
@@ -888,8 +890,10 @@
m_popupMenu = EwkPopupMenu::create(this, popupMenuListener, items, selectedIndex);
+ WKPoint popupMenuPosition = WKViewContentsToUserViewport(wkView(), rect.origin);
+
Eina_Rectangle einaRect;
- EINA_RECTANGLE_SET(&einaRect, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+ EINA_RECTANGLE_SET(&einaRect, popupMenuPosition.x, popupMenuPosition.y, rect.size.width, rect.size.height);
sd->api->popup_menu_show(sd, einaRect, static_cast<Ewk_Text_Direction>(textDirection), pageScaleFactor, m_popupMenu.get());
}
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp (151540 => 151541)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp 2013-06-13 07:52:16 UTC (rev 151540)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp 2013-06-13 08:23:58 UTC (rev 151541)
@@ -120,6 +120,11 @@
return m_userViewportTransform.mapPoint(point);
}
+IntPoint WebView::contentsToUserViewport(const IntPoint& point) const
+{
+ return transformToScene().mapPoint(point);
+}
+
void WebView::paintToCurrentGLContext()
{
CoordinatedGraphicsScene* scene = coordinatedGraphicsScene();
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h (151540 => 151541)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h 2013-06-13 07:52:16 UTC (rev 151540)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h 2013-06-13 08:23:58 UTC (rev 151541)
@@ -72,6 +72,7 @@
void setUserViewportTranslation(double tx, double ty);
WebCore::IntPoint userViewportToContents(const WebCore::IntPoint&) const;
WebCore::IntPoint userViewportToScene(const WebCore::IntPoint&) const;
+ WebCore::IntPoint contentsToUserViewport(const WebCore::IntPoint&) const;
void paintToCurrentGLContext();
Modified: trunk/Tools/ChangeLog (151540 => 151541)
--- trunk/Tools/ChangeLog 2013-06-13 07:52:16 UTC (rev 151540)
+++ trunk/Tools/ChangeLog 2013-06-13 08:23:58 UTC (rev 151541)
@@ -1,3 +1,16 @@
+2013-06-13 Michał Pakuła vel Rutka <[email protected]>
+
+ [EFL][WK2] Wrong context menu and popup menu positions when scroll is applied
+ https://bugs.webkit.org/show_bug.cgi?id=116610
+
+ Reviewed by Noam Rosenthal.
+
+ Remove unnecessary code adjusting context menu position to webview position.
+ Now position is calculcated in EwkView.
+
+ * MiniBrowser/efl/main.c:
+ (on_context_menu_show):
+
2013-06-12 Roger Fong <[email protected]>
Unreviewed. Turn on WinEWS test now that AppleWin port uses new-run-webkit-tests.
Modified: trunk/Tools/MiniBrowser/efl/main.c (151540 => 151541)
--- trunk/Tools/MiniBrowser/efl/main.c 2013-06-13 07:52:16 UTC (rev 151540)
+++ trunk/Tools/MiniBrowser/efl/main.c 2013-06-13 08:23:58 UTC (rev 151541)
@@ -1350,11 +1350,6 @@
context_menu_populate(window->context_menu.elm_menu, menu, NULL);
- Evas_Coord ewk_x, ewk_y;
- evas_object_geometry_get(window->ewk_view, &ewk_x, &ewk_y, NULL, NULL);
- x += ewk_x;
- y += ewk_y;
-
info("Showing context menu at (%d, %d).", x, y);
elm_menu_move(window->context_menu.elm_menu, x, y);
evas_object_show(window->context_menu.elm_menu);