Title: [200280] trunk/Source/WebKit2
Revision
200280
Author
[email protected]
Date
2016-04-29 20:21:14 -0700 (Fri, 29 Apr 2016)

Log Message

Web Automation: add SPI to mark an existing NSEvent as synthesized for automation
https://bugs.webkit.org/show_bug.cgi?id=157221
<rdar://problem/26019356>

Reviewed by Timothy Hatcher.

In cases where an NSEvent is duplicated, clients need to re-mark an NSEvent
as synthesized for automation if the original NSEvent was marked as such.

* UIProcess/API/Cocoa/_WKAutomationSession.h:
* UIProcess/API/Cocoa/_WKAutomationSession.mm:
(-[_WKAutomationSession markEventAsSynthesizedForAutomation:]):
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Cocoa/WebAutomationSessionCocoa.mm:
(WebKit::WebAutomationSession::sendSynthesizedEventsToPage):
(WebKit::WebAutomationSession::markEventAsSynthesizedForAutomation):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (200279 => 200280)


--- trunk/Source/WebKit2/ChangeLog	2016-04-30 02:55:01 UTC (rev 200279)
+++ trunk/Source/WebKit2/ChangeLog	2016-04-30 03:21:14 UTC (rev 200280)
@@ -1,5 +1,24 @@
 2016-04-29  Brian Burg  <[email protected]>
 
+        Web Automation: add SPI to mark an existing NSEvent as synthesized for automation
+        https://bugs.webkit.org/show_bug.cgi?id=157221
+        <rdar://problem/26019356>
+
+        Reviewed by Timothy Hatcher.
+
+        In cases where an NSEvent is duplicated, clients need to re-mark an NSEvent
+        as synthesized for automation if the original NSEvent was marked as such.
+
+        * UIProcess/API/Cocoa/_WKAutomationSession.h:
+        * UIProcess/API/Cocoa/_WKAutomationSession.mm:
+        (-[_WKAutomationSession markEventAsSynthesizedForAutomation:]):
+        * UIProcess/Automation/WebAutomationSession.h:
+        * UIProcess/Cocoa/WebAutomationSessionCocoa.mm:
+        (WebKit::WebAutomationSession::sendSynthesizedEventsToPage):
+        (WebKit::WebAutomationSession::markEventAsSynthesizedForAutomation):
+
+2016-04-29  Brian Burg  <[email protected]>
+
         Web Automation: use a magic eventNumber as a fallback for detecting NSEvents synthesized for automation
         https://bugs.webkit.org/show_bug.cgi?id=157222
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSession.h (200279 => 200280)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSession.h	2016-04-30 02:55:01 UTC (rev 200279)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSession.h	2016-04-30 03:21:14 UTC (rev 200280)
@@ -42,6 +42,7 @@
 
 #if !TARGET_OS_IPHONE
 - (BOOL)wasEventSynthesizedForAutomation:(NSEvent *)event;
+- (void)markEventAsSynthesizedForAutomation:(NSEvent *)event;
 #endif
 
 @end

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSession.mm (200279 => 200280)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSession.mm	2016-04-30 02:55:01 UTC (rev 200279)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSession.mm	2016-04-30 03:21:14 UTC (rev 200280)
@@ -88,6 +88,11 @@
 {
     return _session->wasEventSynthesizedForAutomation(event);
 }
+
+- (void)markEventAsSynthesizedForAutomation:(NSEvent *)event
+{
+    _session->markEventAsSynthesizedForAutomation(event);
+}
 #endif
 
 #pragma mark WKObject protocol implementation

Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h (200279 => 200280)


--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h	2016-04-30 02:55:01 UTC (rev 200279)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h	2016-04-30 03:21:14 UTC (rev 200280)
@@ -122,6 +122,7 @@
     void deleteAllCookies(Inspector::ErrorString&, const String& browsingContextHandle, Ref<DeleteAllCookiesCallback>&&) override;
 #if USE(APPKIT)
     bool wasEventSynthesizedForAutomation(NSEvent *);
+    void markEventAsSynthesizedForAutomation(NSEvent *);
 #endif
 
 private:

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm (200279 => 200280)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm	2016-04-30 02:55:01 UTC (rev 200279)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebAutomationSessionCocoa.mm	2016-04-30 03:21:14 UTC (rev 200280)
@@ -51,11 +51,16 @@
     NSWindow *window = page.platformWindow();
 
     for (NSEvent *event in eventsToSend) {
-        objc_setAssociatedObject(event, &synthesizedAutomationEventAssociatedObjectKey, m_sessionIdentifier, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+        markEventAsSynthesizedForAutomation(event);
         [window sendEvent:event];
     }
 }
 
+void WebAutomationSession::markEventAsSynthesizedForAutomation(NSEvent *event)
+{
+    objc_setAssociatedObject(event, &synthesizedAutomationEventAssociatedObjectKey, m_sessionIdentifier, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
 bool WebAutomationSession::wasEventSynthesizedForAutomation(NSEvent *event)
 {
     NSString *senderSessionIdentifier = objc_getAssociatedObject(event, &synthesizedAutomationEventAssociatedObjectKey);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to