Title: [92938] branches/safari-534.51-branch/Source/WebKit2

Diff

Modified: branches/safari-534.51-branch/Source/WebKit2/ChangeLog (92937 => 92938)


--- branches/safari-534.51-branch/Source/WebKit2/ChangeLog	2011-08-12 06:06:20 UTC (rev 92937)
+++ branches/safari-534.51-branch/Source/WebKit2/ChangeLog	2011-08-12 06:08:50 UTC (rev 92938)
@@ -1,5 +1,33 @@
 2011-08-11  Lucas Forschler  <[email protected]>
 
+    Merged 91939
+
+    2011-07-26  Chris Fleizach  <[email protected]>
+
+            REGRESSION (Safari 5.1): _javascript_ dialogs not usable with VoiceOver
+            https://bugs.webkit.org/show_bug.cgi?id=65214
+
+            Reviewed by Anders Carlsson.
+
+            Allow the ability to spin the run loop while WebProcess is waiting for a synchronous reply.
+            This allows it to continue to serve accessibility requests while waiting and basically
+            restores the behavior WK1 was presenting. This patch only enables this mode when accessibility is on.
+
+            * Platform/CoreIPC/Connection.cpp:
+            (CoreIPC::Connection::sendSyncMessage):
+            (CoreIPC::Connection::waitForSyncReply):
+            * Platform/CoreIPC/Connection.h:
+            (CoreIPC::Connection::sendSync):
+            * Platform/RunLoop.h:
+            * Platform/mac/RunLoopMac.mm:
+            (RunLoop::runForDuration):
+            * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+            (WebKit::WebChromeClient::runJavaScriptAlert):
+            (WebKit::WebChromeClient::runJavaScriptConfirm):
+            (WebKit::WebChromeClient::runJavaScriptPrompt):
+
+2011-08-11  Lucas Forschler  <[email protected]>
+
     Merged 91793
 
     2011-07-26  Tim Horton  <[email protected]>

Modified: branches/safari-534.51-branch/Source/WebKit2/Platform/CoreIPC/Connection.cpp (92937 => 92938)


--- branches/safari-534.51-branch/Source/WebKit2/Platform/CoreIPC/Connection.cpp	2011-08-12 06:06:20 UTC (rev 92937)
+++ branches/safari-534.51-branch/Source/WebKit2/Platform/CoreIPC/Connection.cpp	2011-08-12 06:08:50 UTC (rev 92938)
@@ -379,7 +379,7 @@
     return nullptr;
 }
 
-PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uint64_t syncRequestID, PassOwnPtr<ArgumentEncoder> encoder, double timeout)
+PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uint64_t syncRequestID, PassOwnPtr<ArgumentEncoder> encoder, double timeout, unsigned syncSendFlags)
 {
     // We only allow sending sync messages from the client run loop.
     ASSERT(RunLoop::current() == m_clientRunLoop);
@@ -406,7 +406,7 @@
     // Then wait for a reply. Waiting for a reply could involve dispatching incoming sync messages, so
     // keep an extra reference to the connection here in case it's invalidated.
     RefPtr<Connection> protect(this);
-    OwnPtr<ArgumentDecoder> reply = waitForSyncReply(syncRequestID, timeout);
+    OwnPtr<ArgumentDecoder> reply = waitForSyncReply(syncRequestID, timeout, syncSendFlags);
 
     // Finally, pop the pending sync reply information.
     {
@@ -421,7 +421,7 @@
     return reply.release();
 }
 
-PassOwnPtr<ArgumentDecoder> Connection::waitForSyncReply(uint64_t syncRequestID, double timeout)
+PassOwnPtr<ArgumentDecoder> Connection::waitForSyncReply(uint64_t syncRequestID, double timeout, unsigned syncSendFlags)
 {
     if (timeout == DefaultTimeout)
         timeout = m_defaultSyncMessageTimeout;
@@ -462,8 +462,20 @@
 #if PLATFORM(WIN)
         timedOut = !m_syncMessageState->waitWhileDispatchingSentWin32Messages(absoluteTime, m_client->windowsToReceiveSentMessagesWhileWaitingForSyncReply());
 #else
-        timedOut = !m_syncMessageState->wait(absoluteTime);
+
+        // This allows the WebProcess to still serve clients while waiting for the message to return. 
+        // Notably, it can continue to process accessibility requests, which are on the main thread.
+        if (syncSendFlags & SpinRunLoopWhileWaitingForReply) {
+#if PLATFORM(MAC)
+            // FIXME: Although we run forever, any events incoming will cause us to drop out and exit out. This however doesn't
+            // account for a timeout value passed in. Timeout is always NoTimeout in these cases, but that could change.
+            RunLoop::current()->runForDuration(1e10);
+            timeout = currentTime() >= absoluteTime;
 #endif
+        } else
+            timedOut = !m_syncMessageState->wait(absoluteTime);
+#endif
+        
     }
 
     // We timed out.

Modified: branches/safari-534.51-branch/Source/WebKit2/Platform/CoreIPC/Connection.h (92937 => 92938)


--- branches/safari-534.51-branch/Source/WebKit2/Platform/CoreIPC/Connection.h	2011-08-12 06:06:20 UTC (rev 92937)
+++ branches/safari-534.51-branch/Source/WebKit2/Platform/CoreIPC/Connection.h	2011-08-12 06:08:50 UTC (rev 92938)
@@ -67,6 +67,11 @@
     DispatchMessageEvenWhenWaitingForSyncReply = 1 << 0,
 };
 
+enum SyncMessageSendFlags {
+    // Will allow events to continue being handled while waiting for the synch reply.
+    SpinRunLoopWhileWaitingForReply = 1 << 0,
+};
+    
 #define MESSAGE_CHECK_BASE(assertion, connection) do \
     if (!(assertion)) { \
         ASSERT(assertion); \
@@ -153,7 +158,7 @@
     static const int NoTimeout = -1;
 
     template<typename T> bool send(const T& message, uint64_t destinationID, unsigned messageSendFlags = 0);
-    template<typename T> bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout = DefaultTimeout);
+    template<typename T> bool sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout = DefaultTimeout, unsigned syncSendFlags = 0);
     template<typename T> bool waitForAndDispatchImmediately(uint64_t destinationID, double timeout);
 
     PassOwnPtr<ArgumentEncoder> createSyncMessageArgumentEncoder(uint64_t destinationID, uint64_t& syncRequestID);
@@ -215,8 +220,8 @@
     
     PassOwnPtr<ArgumentDecoder> waitForMessage(MessageID, uint64_t destinationID, double timeout);
     
-    PassOwnPtr<ArgumentDecoder> sendSyncMessage(MessageID, uint64_t syncRequestID, PassOwnPtr<ArgumentEncoder>, double timeout);
-    PassOwnPtr<ArgumentDecoder> waitForSyncReply(uint64_t syncRequestID, double timeout);
+    PassOwnPtr<ArgumentDecoder> sendSyncMessage(MessageID, uint64_t syncRequestID, PassOwnPtr<ArgumentEncoder>, double timeout, unsigned syncSendFlags = 0);
+    PassOwnPtr<ArgumentDecoder> waitForSyncReply(uint64_t syncRequestID, double timeout, unsigned syncSendFlags);
 
     // Called on the connection work queue.
     void processIncomingMessage(MessageID, PassOwnPtr<ArgumentDecoder>);
@@ -361,7 +366,7 @@
     return sendMessage(MessageID(T::messageID), argumentEncoder.release(), messageSendFlags);
 }
 
-template<typename T> bool Connection::sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout)
+template<typename T> bool Connection::sendSync(const T& message, const typename T::Reply& reply, uint64_t destinationID, double timeout, unsigned syncSendFlags)
 {
     uint64_t syncRequestID = 0;
     OwnPtr<ArgumentEncoder> argumentEncoder = createSyncMessageArgumentEncoder(destinationID, syncRequestID);
@@ -370,7 +375,7 @@
     argumentEncoder->encode(message);
 
     // Now send the message and wait for a reply.
-    OwnPtr<ArgumentDecoder> replyDecoder = sendSyncMessage(MessageID(T::messageID), syncRequestID, argumentEncoder.release(), timeout);
+    OwnPtr<ArgumentDecoder> replyDecoder = sendSyncMessage(MessageID(T::messageID), syncRequestID, argumentEncoder.release(), timeout, syncSendFlags);
     if (!replyDecoder)
         return false;
 

Modified: branches/safari-534.51-branch/Source/WebKit2/Platform/RunLoop.h (92937 => 92938)


--- branches/safari-534.51-branch/Source/WebKit2/Platform/RunLoop.h	2011-08-12 06:06:20 UTC (rev 92937)
+++ branches/safari-534.51-branch/Source/WebKit2/Platform/RunLoop.h	2011-08-12 06:08:50 UTC (rev 92938)
@@ -68,6 +68,10 @@
     static void run();
     void stop();
 
+#if PLATFORM(MAC)
+    void runForDuration(double duration);
+#endif
+    
     class TimerBase {
         friend class RunLoop;
     public:

Modified: branches/safari-534.51-branch/Source/WebKit2/Platform/mac/RunLoopMac.mm (92937 => 92938)


--- branches/safari-534.51-branch/Source/WebKit2/Platform/mac/RunLoopMac.mm	2011-08-12 06:06:20 UTC (rev 92937)
+++ branches/safari-534.51-branch/Source/WebKit2/Platform/mac/RunLoopMac.mm	2011-08-12 06:08:50 UTC (rev 92938)
@@ -67,6 +67,11 @@
     }        
 }
 
+void RunLoop::runForDuration(double duration)
+{
+    CFRunLoopRunInMode(kCFRunLoopDefaultMode, duration, true);
+}
+
 void RunLoop::stop()
 {
     ASSERT(m_runLoop == CFRunLoopGetCurrent());

Modified: branches/safari-534.51-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (92937 => 92938)


--- branches/safari-534.51-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-08-12 06:06:20 UTC (rev 92937)
+++ branches/safari-534.51-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-08-12 06:08:50 UTC (rev 92938)
@@ -44,6 +44,7 @@
 #include "WebPreferencesStore.h"
 #include "WebProcess.h"
 #include "WebSearchPopupMenu.h"
+#include <WebCore/AXObjectCache.h>
 #include <WebCore/DatabaseTracker.h>
 #include <WebCore/FileChooser.h>
 #include <WebCore/Frame.h>
@@ -311,7 +312,8 @@
     // Notify the bundle client.
     m_page->injectedBundleUIClient().willRunJavaScriptAlert(m_page, alertText, webFrame);
 
-    WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), m_page->pageID());
+    unsigned syncSendFlags = (WebCore::AXObjectCache::accessibilityEnabled()) ? CoreIPC::SpinRunLoopWhileWaitingForReply : 0;
+    WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptAlert(webFrame->frameID(), alertText), Messages::WebPageProxy::RunJavaScriptAlert::Reply(), m_page->pageID(), CoreIPC::Connection::DefaultTimeout, syncSendFlags);
 }
 
 bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message)
@@ -321,8 +323,9 @@
     // Notify the bundle client.
     m_page->injectedBundleUIClient().willRunJavaScriptConfirm(m_page, message, webFrame);
 
+    unsigned syncSendFlags = (WebCore::AXObjectCache::accessibilityEnabled()) ? CoreIPC::SpinRunLoopWhileWaitingForReply : 0;
     bool result = false;
-    if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result), m_page->pageID()))
+    if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptConfirm(webFrame->frameID(), message), Messages::WebPageProxy::RunJavaScriptConfirm::Reply(result), m_page->pageID(), CoreIPC::Connection::DefaultTimeout, syncSendFlags))
         return false;
 
     return result;
@@ -335,7 +338,8 @@
     // Notify the bundle client.
     m_page->injectedBundleUIClient().willRunJavaScriptPrompt(m_page, message, defaultValue, webFrame);
 
-    if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), m_page->pageID()))
+    unsigned syncSendFlags = (WebCore::AXObjectCache::accessibilityEnabled()) ? CoreIPC::SpinRunLoopWhileWaitingForReply : 0;
+    if (!WebProcess::shared().connection()->sendSync(Messages::WebPageProxy::RunJavaScriptPrompt(webFrame->frameID(), message, defaultValue), Messages::WebPageProxy::RunJavaScriptPrompt::Reply(result), m_page->pageID(), CoreIPC::Connection::DefaultTimeout, syncSendFlags))
         return false;
 
     return !result.isNull();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to