- Revision
- 148278
- Author
- akl...@apple.com
- Date
- 2013-04-12 08:13:49 -0700 (Fri, 12 Apr 2013)
Log Message
REGRESSION(r145869): Right-click on SWF contents displays the context menu at the wrong place.
<http://webkit.org/b/113836>
<rdar://problem/13587624>
Reviewed by Anders "Wesley Crusher" Carlsson.
Mac plugins expect flipped-Y screen coordinates, while DOM APIs speak in unflipped coordinates,
and we were mixing them up in the window frame caching optimization.
Solve this by having the UIProcess send both flipped and unflipped window frames to the WebProcess.
The flipped frame is passed on to plugins, and the unflipped frame is used for window.screenX/Y etc.
* UIProcess/API/mac/WKView.mm:
(-[WKView _updateWindowAndViewFrames]):
No need to retrieve the window frame here as WebPageProxy::windowAndViewFramesChanged() will
always override it anyway.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::windowAndViewFramesChanged):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::windowRect):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::windowAndViewFramesChanged):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::windowFrameInUnflippedScreenCoordinates):
* WebProcess/WebPage/WebPage.messages.in:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (148277 => 148278)
--- trunk/Source/WebKit2/ChangeLog 2013-04-12 14:05:19 UTC (rev 148277)
+++ trunk/Source/WebKit2/ChangeLog 2013-04-12 15:13:49 UTC (rev 148278)
@@ -1,3 +1,33 @@
+2013-04-12 Andreas Kling <akl...@apple.com>
+
+ REGRESSION(r145869): Right-click on SWF contents displays the context menu at the wrong place.
+ <http://webkit.org/b/113836>
+ <rdar://problem/13587624>
+
+ Reviewed by Anders "Wesley Crusher" Carlsson.
+
+ Mac plugins expect flipped-Y screen coordinates, while DOM APIs speak in unflipped coordinates,
+ and we were mixing them up in the window frame caching optimization.
+
+ Solve this by having the UIProcess send both flipped and unflipped window frames to the WebProcess.
+ The flipped frame is passed on to plugins, and the unflipped frame is used for window.screenX/Y etc.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _updateWindowAndViewFrames]):
+
+ No need to retrieve the window frame here as WebPageProxy::windowAndViewFramesChanged() will
+ always override it anyway.
+
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::windowAndViewFramesChanged):
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::windowRect):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::windowAndViewFramesChanged):
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::windowFrameInUnflippedScreenCoordinates):
+ * WebProcess/WebPage/WebPage.messages.in:
+
2013-04-12 Mikhail Pozdnyakov <mikhail.pozdnya...@intel.com>
[WK2][EFL] WebView: Add callbacks to the WKViewClient to handle page viewport update
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (148277 => 148278)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-04-12 14:05:19 UTC (rev 148277)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-04-12 15:13:49 UTC (rev 148278)
@@ -396,14 +396,10 @@
- (void)_updateWindowAndViewFrames
{
- NSWindow *window = [self window];
- ASSERT(window);
-
- NSRect windowFrameInScreenCoordinates = [window frame];
NSRect viewFrameInWindowCoordinates = [self convertRect:[self frame] toView:nil];
NSPoint accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
- _data->_page->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates, accessibilityPosition);
+ _data->_page->windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
if (_data->_expandsToFitContentViaAutoLayout)
_data->_page->viewExposedRectChanged([self visibleRect]);
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (148277 => 148278)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-04-12 14:05:19 UTC (rev 148277)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-04-12 15:13:49 UTC (rev 148278)
@@ -382,7 +382,7 @@
#if PLATFORM(MAC)
void updateWindowIsVisible(bool windowIsVisible);
- void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
+ void windowAndViewFramesChanged(const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
void viewExposedRectChanged(const WebCore::FloatRect& exposedRect);
void setMainFrameIsScrollable(bool);
Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (148277 => 148278)
--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2013-04-12 14:05:19 UTC (rev 148277)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2013-04-12 15:13:49 UTC (rev 148278)
@@ -138,16 +138,16 @@
process()->send(Messages::WebPage::SetWindowIsVisible(windowIsVisible), m_pageID);
}
-void WebPageProxy::windowAndViewFramesChanged(const FloatRect& windowFrameInScreenCoordinates, const FloatRect& viewFrameInWindowCoordinates, const FloatPoint& accessibilityViewCoordinates)
+void WebPageProxy::windowAndViewFramesChanged(const FloatRect& viewFrameInWindowCoordinates, const FloatPoint& accessibilityViewCoordinates)
{
if (!isValid())
return;
// In case the UI client overrides getWindowFrame(), we call it here to make sure we send the appropriate window frame.
- FloatRect adjustedWindowFrameInScreenCoordinates;
- getWindowFrame(adjustedWindowFrameInScreenCoordinates);
+ FloatRect windowFrameInScreenCoordinates = m_uiClient.windowFrame(this);
+ FloatRect windowFrameInUnflippedScreenCoordinates = m_pageClient->convertToUserSpace(windowFrameInScreenCoordinates);
- process()->send(Messages::WebPage::WindowAndViewFramesChanged(adjustedWindowFrameInScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
+ process()->send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, windowFrameInUnflippedScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
}
void WebPageProxy::viewExposedRectChanged(const FloatRect& exposedRect)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (148277 => 148278)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2013-04-12 14:05:19 UTC (rev 148277)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2013-04-12 15:13:49 UTC (rev 148278)
@@ -114,7 +114,7 @@
{
#if PLATFORM(MAC)
if (m_page->hasCachedWindowFrame())
- return m_page->windowFrameInScreenCoordinates();
+ return m_page->windowFrameInUnflippedScreenCoordinates();
#endif
FloatRect newWindowFrame;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (148277 => 148278)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2013-04-12 14:05:19 UTC (rev 148277)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2013-04-12 15:13:49 UTC (rev 148278)
@@ -2969,9 +2969,10 @@
(*it)->setWindowIsVisible(windowIsVisible);
}
-void WebPage::windowAndViewFramesChanged(const FloatRect& windowFrameInScreenCoordinates, const FloatRect& viewFrameInWindowCoordinates, const FloatPoint& accessibilityViewCoordinates)
+void WebPage::windowAndViewFramesChanged(const FloatRect& windowFrameInScreenCoordinates, const FloatRect& windowFrameInUnflippedScreenCoordinates, const FloatRect& viewFrameInWindowCoordinates, const FloatPoint& accessibilityViewCoordinates)
{
m_windowFrameInScreenCoordinates = windowFrameInScreenCoordinates;
+ m_windowFrameInUnflippedScreenCoordinates = windowFrameInUnflippedScreenCoordinates;
m_viewFrameInWindowCoordinates = viewFrameInWindowCoordinates;
m_accessibilityPosition = accessibilityViewCoordinates;
@@ -2979,7 +2980,7 @@
for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
(*it)->windowAndViewFramesChanged(enclosingIntRect(windowFrameInScreenCoordinates), enclosingIntRect(viewFrameInWindowCoordinates));
- m_hasCachedWindowFrame = !m_windowFrameInScreenCoordinates.isEmpty();
+ m_hasCachedWindowFrame = !m_windowFrameInUnflippedScreenCoordinates.isEmpty();
}
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (148277 => 148278)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2013-04-12 14:05:19 UTC (rev 148277)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2013-04-12 15:13:49 UTC (rev 148278)
@@ -361,6 +361,7 @@
bool windowIsVisible() const { return m_windowIsVisible; }
void updatePluginsActiveAndFocusedState();
const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
+ const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
@@ -757,7 +758,7 @@
void performDictionaryLookupForRange(DictionaryPopupInfo::Type, WebCore::Frame*, WebCore::Range*, NSDictionary *options);
void setWindowIsVisible(bool windowIsVisible);
- void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
+ void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
@@ -885,6 +886,9 @@
// The frame of the containing window in screen coordinates.
WebCore::FloatRect m_windowFrameInScreenCoordinates;
+ // The frame of the containing window in unflipped screen coordinates.
+ WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
+
// The frame of the view in window coordinates.
WebCore::FloatRect m_viewFrameInWindowCoordinates;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (148277 => 148278)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2013-04-12 14:05:19 UTC (rev 148277)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2013-04-12 15:13:49 UTC (rev 148278)
@@ -260,7 +260,7 @@
SendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, String textInput)
SetWindowIsVisible(bool windowIsVisible)
- WindowAndViewFramesChanged(WebCore::FloatRect windowFrameInScreenCoordinates, WebCore::FloatRect viewFrameInWindowCoordinates, WebCore::FloatPoint accessibilityViewCoordinates)
+ WindowAndViewFramesChanged(WebCore::FloatRect windowFrameInScreenCoordinates, WebCore::FloatRect windowFrameInUnflippedScreenCoordinates, WebCore::FloatRect viewFrameInWindowCoordinates, WebCore::FloatPoint accessibilityViewCoordinates)
ViewExposedRectChanged(WebCore::FloatRect exposedRect)
SetMainFrameIsScrollable(bool isScrollable)
RegisterUIProcessAccessibilityTokens(CoreIPC::DataReference elemenToken, CoreIPC::DataReference windowToken)