Title: [245660] trunk/Source/WebKit
Revision
245660
Author
timothy_hor...@apple.com
Date
2019-05-22 17:07:22 -0700 (Wed, 22 May 2019)

Log Message

REGRESSION (r240552): PDF contents are not exposed to Accessibility (VO, etc.)
https://bugs.webkit.org/show_bug.cgi?id=198146
<rdar://problem/50698533>

Reviewed by Simon Fraser.

* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::updateMockAccessibilityElementAfterCommittingLoad):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
(WebKit::WebPage::updateMockAccessibilityElementAfterCommittingLoad):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
(-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
(-[WKAccessibilityWebPageObjectBase setWebPage:]):
(-[WKAccessibilityWebPageObjectBase setHasMainFramePlugin:]):
In r240552, we changed to only defer to the main frame PluginView's
accessibility tree if the cached "has a plugin" bit is true. That bit
was only updated in WebPage::platformInitialize, which is long before
we've actually loaded anything or have any clue if we're going to have
a plugin.

Instead, push updates every time we commit a load, which coincides
with when we make other decisions based on having a plugin or not.
Also, just use the existence of a PluginDocument to make the decision,
instead of actually digging in to see if there's a PluginView, since
PluginView comes in asynchronously.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (245659 => 245660)


--- trunk/Source/WebKit/ChangeLog	2019-05-22 23:46:28 UTC (rev 245659)
+++ trunk/Source/WebKit/ChangeLog	2019-05-23 00:07:22 UTC (rev 245660)
@@ -1,3 +1,34 @@
+2019-05-22  Tim Horton  <timothy_hor...@apple.com>
+
+        REGRESSION (r240552): PDF contents are not exposed to Accessibility (VO, etc.)
+        https://bugs.webkit.org/show_bug.cgi?id=198146
+        <rdar://problem/50698533>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+        (WebKit::WebPage::updateMockAccessibilityElementAfterCommittingLoad):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didCommitLoad):
+        (WebKit::WebPage::updateMockAccessibilityElementAfterCommittingLoad):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
+        * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
+        (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
+        (-[WKAccessibilityWebPageObjectBase setWebPage:]):
+        (-[WKAccessibilityWebPageObjectBase setHasMainFramePlugin:]):
+        In r240552, we changed to only defer to the main frame PluginView's
+        accessibility tree if the cached "has a plugin" bit is true. That bit
+        was only updated in WebPage::platformInitialize, which is long before
+        we've actually loaded anything or have any clue if we're going to have
+        a plugin.
+
+        Instead, push updates every time we commit a load, which coincides
+        with when we make other decisions based on having a plugin or not.
+        Also, just use the existence of a PluginDocument to make the decision,
+        instead of actually digging in to see if there's a PluginView, since
+        PluginView comes in asynchronously.
+
 2019-05-22  Ryosuke Niwa  <rn...@webkit.org>
 
         Crash in WebFrame::jsContext() when m_coreFrame is null

Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (245659 => 245660)


--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2019-05-22 23:46:28 UTC (rev 245659)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2019-05-23 00:07:22 UTC (rev 245660)
@@ -30,6 +30,7 @@
 #import "LoadParameters.h"
 #import "PluginView.h"
 #import "RemoteObjectRegistry.h"
+#import "WKAccessibilityWebPageObjectBase.h"
 #import "WebPageProxyMessages.h"
 #import "WebPaymentCoordinator.h"
 #import <WebCore/DictionaryLookup.h>
@@ -224,6 +225,12 @@
 {
     m_remoteObjectRegistry = makeWeakPtr(registry);
 }
+
+void WebPage::updateMockAccessibilityElementAfterCommittingLoad()
+{
+    auto* document = mainFrame()->document();
+    [m_mockAccessibilityElement setHasMainFramePlugin:document ? document->isPluginDocument() : false];
+}
     
 } // namespace WebKit
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (245659 => 245660)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-22 23:46:28 UTC (rev 245659)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-23 00:07:22 UTC (rev 245660)
@@ -5763,6 +5763,8 @@
     WebProcess::singleton().updateActivePages();
 
     updateMainFrameScrollOffsetPinning();
+
+    updateMockAccessibilityElementAfterCommittingLoad();
 }
 
 void WebPage::didFinishDocumentLoad(WebFrame& frame)
@@ -6727,6 +6729,12 @@
     send(Messages::WebPageProxy::ConfigureLoggingChannel(channelName, state, level));
 }
 
+#if !PLATFORM(COCOA)
+void WebPage::updateMockAccessibilityElementAfterCommittingLoad()
+{
+}
+#endif
+
 } // namespace WebKit
 
 #undef RELEASE_LOG_IF_ALLOWED

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (245659 => 245660)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-05-22 23:46:28 UTC (rev 245659)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-05-23 00:07:22 UTC (rev 245660)
@@ -1586,6 +1586,8 @@
 
     bool shouldDispatchUpdateAfterFocusingElement(const WebCore::Element&) const;
 
+    void updateMockAccessibilityElementAfterCommittingLoad();
+
     uint64_t m_pageID;
 
     std::unique_ptr<WebCore::Page> m_page;

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h (245659 => 245660)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h	2019-05-22 23:46:28 UTC (rev 245659)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h	2019-05-23 00:07:22 UTC (rev 245660)
@@ -34,11 +34,12 @@
     WebKit::WebPage* m_page;
     uint64_t m_pageID;
     id m_parent;
-    bool m_hasPlugin;
+    bool m_hasMainFramePlugin;
 }
 
 - (void)setWebPage:(WebKit::WebPage*)page;
 - (void)setRemoteParent:(id)parent;
+- (void)setHasMainFramePlugin:(bool)hasPlugin;
 
 - (id)accessibilityRootObjectWrapper;
 - (id)accessibilityFocusedUIElement;

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm (245659 => 245660)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm	2019-05-22 23:46:28 UTC (rev 245659)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm	2019-05-23 00:07:22 UTC (rev 245660)
@@ -120,7 +120,7 @@
     if (!WebCore::AXObjectCache::accessibilityEnabled())
         WebCore::AXObjectCache::enableAccessibility();
 
-    if (m_hasPlugin)
+    if (m_hasMainFramePlugin)
         return self.accessibilityPluginObject;
 
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
@@ -141,16 +141,23 @@
 - (void)setWebPage:(WebKit::WebPage*)page
 {
     m_page = page;
-    
+
     if (page) {
         m_pageID = page->pageID();
-        m_hasPlugin = page->accessibilityObjectForMainFramePlugin();
+
+        auto* frame = page->mainFrame();
+        m_hasMainFramePlugin = frame && frame->document() ? frame->document()->isPluginDocument() : false;
     } else {
         m_pageID = 0;
-        m_hasPlugin = false;
+        m_hasMainFramePlugin = false;
     }
 }
 
+- (void)setHasMainFramePlugin:(bool)hasPlugin
+{
+    m_hasMainFramePlugin = hasPlugin;
+}
+
 - (void)setRemoteParent:(id)parent
 {
     if (parent != m_parent) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to