Commit a445f5cb authored by danakj's avatar danakj Committed by Commit Bot

Call the BrowserAccessibilityManager from RenderWidgetHostImpl

There's a weird split of responsibility between RenderWidgetHostImpl
and RenderWidgetHostViewBase, both of which are used for all platforms.
This merges some responsibility up to RenderWidgetHostImpl for the
OnRenderFrameMetadataChangedAfterActivation() event.

R=avi@chromium.org

Change-Id: I2349391493b1bb1e71393c5a7bb34e931d650527
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2392620
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804352}
parent 965de005
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "cc/trees/render_frame_metadata.h" #include "cc/trees/render_frame_metadata.h"
#include "components/viz/common/features.h" #include "components/viz/common/features.h"
#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h" #include "content/browser/accessibility/browser_accessibility_state_impl.h"
#include "content/browser/bad_message.h" #include "content/browser/bad_message.h"
#include "content/browser/browser_main_loop.h" #include "content/browser/browser_main_loop.h"
...@@ -3348,23 +3349,27 @@ void RenderWidgetHostImpl::OnRenderFrameMetadataChangedAfterActivation() { ...@@ -3348,23 +3349,27 @@ void RenderWidgetHostImpl::OnRenderFrameMetadataChangedAfterActivation() {
if (auto* touch_emulator = GetExistingTouchEmulator()) if (auto* touch_emulator = GetExistingTouchEmulator())
touch_emulator->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); touch_emulator->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized);
// The value |kNull| is only used to indicate an absence of vertical scroll // TODO(danakj): Can this method be called during WebContents destruction?
// direction and should therefore be ignored.
if (metadata.new_vertical_scroll_direction ==
viz::VerticalScrollDirection::kNull) {
return;
}
// Changes in vertical scroll direction are only propagated for main frames.
// If there is no |owner_delegate|, this is not a main frame.
if (!owner_delegate())
return;
if (!delegate()) if (!delegate())
return; return;
delegate()->OnVerticalScrollDirectionChanged( // The root BrowserAccessibilityManager only is reachable if there's a
metadata.new_vertical_scroll_direction); // delegate() still, ie we're not in shutdown. This can be null in tests.
BrowserAccessibilityManager* accessibility_manager =
GetRootBrowserAccessibilityManager();
if (accessibility_manager)
accessibility_manager->SetPageScaleFactor(metadata.page_scale_factor);
// The value |kNull| is only used to indicate an absence of vertical scroll
// direction and should therefore be ignored.
// Also, changes in vertical scroll direction are only propagated for main
// frames. If there is no |owner_delegate|, this is not a main frame.
if (metadata.new_vertical_scroll_direction !=
viz::VerticalScrollDirection::kNull &&
owner_delegate()) {
delegate()->OnVerticalScrollDirectionChanged(
metadata.new_vertical_scroll_direction);
}
} }
std::vector<viz::SurfaceId> std::vector<viz::SurfaceId>
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "components/viz/common/features.h" #include "components/viz/common/features.h"
#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/compositor/surface_utils.h" #include "content/browser/compositor/surface_utils.h"
#include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/renderer_host/delegated_frame_host.h" #include "content/browser/renderer_host/delegated_frame_host.h"
...@@ -121,11 +120,6 @@ void RenderWidgetHostViewBase::OnRenderFrameMetadataChangedAfterActivation() { ...@@ -121,11 +120,6 @@ void RenderWidgetHostViewBase::OnRenderFrameMetadataChangedAfterActivation() {
const cc::RenderFrameMetadata& metadata = const cc::RenderFrameMetadata& metadata =
host()->render_frame_metadata_provider()->LastRenderFrameMetadata(); host()->render_frame_metadata_provider()->LastRenderFrameMetadata();
BrowserAccessibilityManager* manager =
host()->GetRootBrowserAccessibilityManager();
if (manager)
manager->SetPageScaleFactor(metadata.page_scale_factor);
is_drawing_delegated_ink_trails_ = metadata.has_delegated_ink_metadata; is_drawing_delegated_ink_trails_ = metadata.has_delegated_ink_metadata;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment