Make the PDF plug-in accessible.
Makes the PDF plug-in accessible on all supported platforms by building an
accessibility tree for the PDF content and grafting it on as a subtree of
the accessibility tree for the embedding page.
It exposes all of the text of the PDF, including full support for computing
the bounding box of any arbitrary text range. Using heuristics, automatically
groups the text runs into paragraphs and marks some of them as headings if
their font size is larger than the average for the page.
I wrote a browser test for this, to be reviewed in a follow-up changelist.
Currently the coordinates don't update if the user zooms. I want to fix that
by using a transformation matrix after this change lands -
http://crrev.com/2047873002 - but scrolling works fine.
Future work might include incremental loading and support for links and maybe
even fill-in forms.
Depends on:
http://crrev.com/1953053002
http://crrev.com/2058453002
http://crrev.com/2050973003
http://crrev.com/2055903002
BUG=54724
Review-Url: https://codereview.chromium.org/2055953002
Cr-Commit-Position: refs/heads/master@{#402122}
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index db38291..c31c306 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -139,7 +139,7 @@
class PermissionDispatcher;
class PresentationDispatcher;
class PushMessagingDispatcher;
-class RendererAccessibility;
+class RenderAccessibilityImpl;
class RendererCdmManager;
class RendererMediaPlayerManager;
class RendererMediaSessionManager;
@@ -286,8 +286,8 @@
return accessibility_mode_;
}
- RendererAccessibility* renderer_accessibility() {
- return renderer_accessibility_;
+ RenderAccessibilityImpl* render_accessibility() {
+ return render_accessibility_;
}
void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
@@ -298,7 +298,7 @@
void FocusedNodeChanged(const blink::WebNode& node);
// TODO(dmazzoni): the only reason this is here is to plumb it through to
- // RendererAccessibility. It should use the RenderFrameObserver method, once
+ // RenderAccessibilityImpl. It should use the RenderFrameObserver method, once
// blink has a separate accessibility tree per frame.
void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
@@ -386,6 +386,7 @@
// RenderFrame implementation:
RenderView* GetRenderView() override;
+ RenderAccessibility* GetRenderAccessibility() override;
int GetRoutingID() override;
blink::WebLocalFrame* GetWebFrame() override;
WebPreferences& GetWebkitPreferences() override;
@@ -698,13 +699,13 @@
private:
friend class RenderFrameImplTest;
friend class RenderFrameObserver;
- friend class RendererAccessibilityTest;
+ friend class RenderAccessibilityImplTest;
friend class TestRenderFrame;
FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
- FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
+ FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest,
AccessibilityMessagesQueueWhileSwappedOut);
// A wrapper class used as the callback for JavaScript executed
@@ -1238,7 +1239,7 @@
// Only valid if |accessibility_mode_| is anything other than
// AccessibilityModeOff.
- RendererAccessibility* renderer_accessibility_;
+ RenderAccessibilityImpl* render_accessibility_;
std::unique_ptr<PermissionDispatcher> permission_client_;