Diff
Modified: trunk/Source/WebKit2/ChangeLog (109003 => 109004)
--- trunk/Source/WebKit2/ChangeLog 2012-02-27 17:57:55 UTC (rev 109003)
+++ trunk/Source/WebKit2/ChangeLog 2012-02-27 18:00:23 UTC (rev 109004)
@@ -1,3 +1,22 @@
+2012-02-27 Dan Bernstein <m...@apple.com>
+
+ <rdar://problem/9557598> REGRESSION (WebKit2): Non-activating links sometimes don’t work
+ https://bugs.webkit.org/show_bug.cgi?id=79607
+
+ Reviewed by Adele Peterson.
+
+ Test: TestWebKitAPI/Tests/mac/AcceptsFirstMouse.mm
+
+ This was caused by not mapping the mouse event coordinates from window coordinates to
+ document coordinates.
+
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::performDictionaryLookupAtLocation): Convert the point to main frame
+ coordinates when performing the hit test.
+ (WebKit::WebPage::shouldDelayWindowOrderingEvent): Convert the point to the main or focused
+ frame coordinates when perfomring the hit test.
+ (WebKit::WebPage::acceptsFirstMouse): Ditto.
+
2012-02-27 Timothy Hatcher <timo...@apple.com>
Add WKInspector API to know when the Web Inspector is the frontmost window.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (109003 => 109004)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2012-02-27 17:57:55 UTC (rev 109003)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2012-02-27 18:00:23 UTC (rev 109004)
@@ -440,7 +440,7 @@
// Find the frame the point is over.
IntPoint point = roundedIntPoint(floatPoint);
- HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(point, false);
+ HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(point), false);
frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController()->focusedOrMainFrame();
IntPoint translatedPoint = frame->view()->windowToContents(point);
@@ -687,7 +687,7 @@
if (!frame)
return;
- HitTestResult hitResult = frame->eventHandler()->hitTestResultAtPoint(event.position(), true);
+ HitTestResult hitResult = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(event.position()), true);
if (hitResult.isSelected())
result = frame->eventHandler()->eventMayStartDrag(platform(event));
}
@@ -699,7 +699,7 @@
if (!frame)
return;
- HitTestResult hitResult = frame->eventHandler()->hitTestResultAtPoint(event.position(), true);
+ HitTestResult hitResult = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(event.position()), true);
frame->eventHandler()->setActivationEventNumber(eventNumber);
if (hitResult.isSelected())
result = frame->eventHandler()->eventMayStartDrag(platform(event));
Modified: trunk/Tools/ChangeLog (109003 => 109004)
--- trunk/Tools/ChangeLog 2012-02-27 17:57:55 UTC (rev 109003)
+++ trunk/Tools/ChangeLog 2012-02-27 18:00:23 UTC (rev 109004)
@@ -1,3 +1,18 @@
+2012-02-27 Dan Bernstein <m...@apple.com>
+
+ Added a test for <rdar://problem/9557598> REGRESSION (WebKit2): Non-activating links sometimes don’t work
+ https://bugs.webkit.org/show_bug.cgi?id=79607
+
+ Reviewed by Adele Peterson.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added new files.
+ * TestWebKitAPI/Tests/mac/AcceptsFirstMouse.mm: Added.
+ (TestWebKitAPI::AcceptsFirstMouse::url):
+ (TestWebKitAPI::AcceptsFirstMouse::didLoadURL):
+ (TestWebKitAPI::AcceptsFirstMouse::runTest):
+ (TestWebKitAPI::TEST_F):
+ * TestWebKitAPI/Tests/mac/acceptsFirstMouse.html: Added.
+
2012-02-27 Carlos Garcia Campos <cgar...@igalia.com>
Unreviewed. Fix make distcheck.
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (109003 => 109004)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2012-02-27 17:57:55 UTC (rev 109003)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2012-02-27 18:00:23 UTC (rev 109004)
@@ -28,6 +28,8 @@
33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
37200B9213A16230007A4FAD /* VectorReverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37200B9113A16230007A4FAD /* VectorReverse.cpp */; };
3722C8691461E03E00C45D00 /* RenderedImageFromDOMRange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */; };
+ 379028B614FABD92007E6B43 /* AcceptsFirstMouse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */; };
+ 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
3799AD3A14120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */; };
37A6895F148A9B50005100FA /* SubresourceErrorCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */; };
37DC678D140D7C5000ABCCDB /* DOMRangeOfString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */; };
@@ -150,6 +152,7 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
+ 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */,
33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */,
1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
C07E6CB213FD73930038B22B /* devicePixelRatio.html in Copy Resources */,
@@ -192,6 +195,8 @@
33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; };
37200B9113A16230007A4FAD /* VectorReverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VectorReverse.cpp; path = WTF/VectorReverse.cpp; sourceTree = "<group>"; };
3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; };
+ 379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AcceptsFirstMouse.mm; sourceTree = "<group>"; };
+ 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = acceptsFirstMouse.html; sourceTree = "<group>"; };
3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringByEvaluatingJavaScriptFromString.mm; sourceTree = "<group>"; };
37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SubresourceErrorCrash.mm; sourceTree = "<group>"; };
37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMRangeOfString.mm; sourceTree = "<group>"; };
@@ -564,6 +569,7 @@
isa = PBXGroup;
children = (
C07E6CB013FD737C0038B22B /* Resources */,
+ 379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */,
37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */,
C07E6CAE13FD67650038B22B /* DynamicDeviceScaleFactor.mm */,
939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */,
@@ -579,8 +585,9 @@
C07E6CB013FD737C0038B22B /* Resources */ = {
isa = PBXGroup;
children = (
+ 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */,
+ C07E6CB113FD738A0038B22B /* devicePixelRatio.html */,
37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */,
- C07E6CB113FD738A0038B22B /* devicePixelRatio.html */,
);
name = Resources;
sourceTree = "<group>";
@@ -772,6 +779,7 @@
93F7E86C14DC8E4D00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames.cpp in Sources */,
BC22D31514DC689800FFB1DD /* UserMessage.cpp in Sources */,
E490296814E2E3A4002BEDD1 /* TypingStyleCrash.mm in Sources */,
+ 379028B614FABD92007E6B43 /* AcceptsFirstMouse.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Added: trunk/Tools/TestWebKitAPI/Tests/mac/AcceptsFirstMouse.mm (0 => 109004)
--- trunk/Tools/TestWebKitAPI/Tests/mac/AcceptsFirstMouse.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/AcceptsFirstMouse.mm 2012-02-27 18:00:23 UTC (rev 109004)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitAgnosticTest.h"
+
+#include <wtf/RetainPtr.h>
+
+@interface NSApplication (TestWebKitAPINSApplicationDetails)
+- (void)_setCurrentEvent:(NSEvent *)event;
+@end
+
+namespace TestWebKitAPI {
+
+class AcceptsFirstMouse : public WebKitAgnosticTest {
+public:
+ template <typename View> void runTest(View);
+
+ // WebKitAgnosticTest
+ virtual NSURL *url() const { return [[NSBundle mainBundle] URLForResource:@"acceptsFirstMouse" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; }
+ virtual void didLoadURL(WebView *webView) { runTest(webView); }
+ virtual void didLoadURL(WKView *wkView) { runTest(wkView); }
+};
+
+template <typename View>
+void AcceptsFirstMouse::runTest(View view)
+{
+ RetainPtr<NSWindow> window(AdoptNS, [[NSWindow alloc] initWithContentRect:view.frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+ [window.get().contentView addSubview:view];
+
+ CGFloat viewHeight = view.bounds.size.height;
+
+ NSPoint pointInsideSelection = NSMakePoint(50, viewHeight - 50);
+ NSEvent *mouseEventInsideSelection = [NSEvent mouseEventWithType:NSLeftMouseDown location:pointInsideSelection modifierFlags:0 timestamp:0 windowNumber:window.get().windowNumber context:nil eventNumber:0 clickCount:1 pressure:1];
+ EXPECT_TRUE([[view hitTest:pointInsideSelection] acceptsFirstMouse:mouseEventInsideSelection]);
+
+ NSPoint pointOutsideSelection = NSMakePoint(50, viewHeight - 150);
+ NSEvent *mouseEventOutsideSelection = [NSEvent mouseEventWithType:NSLeftMouseDown location:pointOutsideSelection modifierFlags:0 timestamp:0 windowNumber:window.get().windowNumber context:nil eventNumber:0 clickCount:1 pressure:1];
+ EXPECT_FALSE([[view hitTest:pointInsideSelection] acceptsFirstMouse:mouseEventOutsideSelection]);
+}
+
+TEST_F(AcceptsFirstMouse, WebKit)
+{
+ // Ensure that [NSApp currentEvent] is not a previously-simulated spacebar key press, since this
+ // causes the scrollBy() in the test to perform a smooth scroll.
+ [NSApp _setCurrentEvent:nil];
+ runWebKit1Test();
+}
+
+TEST_F(AcceptsFirstMouse, WebKit2)
+{
+ runWebKit2Test();
+}
+
+} // namespace TestWebKitAPI
Added: trunk/Tools/TestWebKitAPI/Tests/mac/acceptsFirstMouse.html (0 => 109004)
--- trunk/Tools/TestWebKitAPI/Tests/mac/acceptsFirstMouse.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/acceptsFirstMouse.html 2012-02-27 18:00:23 UTC (rev 109004)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html style="height: 200%;">
+<head>
+ <style>
+ img.selectable {
+ width: 100px;
+ height: 100px;
+ display: block;
+ background-color: gray;
+ }
+ </style>
+</head>
+<body style="margin: 0;">
+ <img class="selectable">
+ <img class="selectable" id="target">
+ <img class="selectable">
+ <script>
+ var target = document.getElementById("target");
+ getSelection().setBaseAndExtent(target, 0, target, 1);
+ scrollBy(0, 100);
+ </script>
+</body>
+</html>