Commit 3c4b1fc8 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Move a few methods from WebViewFrameWidget into base.

Move ApplyViewportChanges into base. It still calls WebViewImpl via
a friend class private method call because this seems relatively
complex code that is contained only in the view.

Move RunPaintBenchmark into WebFrameWidgetBase and protect with a
ForMainFrame.

Move RecordManipulationTypeCounts into WebFrameWidgetBase and protect
with a ForMainFrame.

BUG=1097816

Change-Id: If4cd9b9cd080d244c67e9319eb512e4fe9dd6809
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536901
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828405}
parent 08aac71a
......@@ -3496,29 +3496,6 @@ void WebViewImpl::ApplyViewportChanges(const ApplyViewportChangesArgs& args) {
MainFrameImpl()->GetFrame()->GetEventHandler().MarkHoverStateDirty();
}
void WebViewImpl::RecordManipulationTypeCounts(cc::ManipulationInfo info) {
if (!MainFrameImpl())
return;
if ((info & cc::kManipulationInfoWheel) == cc::kManipulationInfoWheel) {
UseCounter::Count(MainFrameImpl()->GetDocument(),
WebFeature::kScrollByWheel);
}
if ((info & cc::kManipulationInfoTouch) == cc::kManipulationInfoTouch) {
UseCounter::Count(MainFrameImpl()->GetDocument(),
WebFeature::kScrollByTouch);
}
if ((info & cc::kManipulationInfoPinchZoom) ==
cc::kManipulationInfoPinchZoom) {
UseCounter::Count(MainFrameImpl()->GetDocument(), WebFeature::kPinchZoom);
}
if ((info & cc::kManipulationInfoPrecisionTouchPad) ==
cc::kManipulationInfoPrecisionTouchPad) {
UseCounter::Count(MainFrameImpl()->GetDocument(),
WebFeature::kScrollByPrecisionTouchPad);
}
}
Node* WebViewImpl::FindNodeFromScrollableCompositorElementId(
cc::ElementId element_id) const {
if (!GetPage())
......@@ -3638,11 +3615,4 @@ void WebViewImpl::SetDeviceColorSpaceForTesting(
web_widget_->SetDeviceColorSpaceForTesting(color_space);
}
void WebViewImpl::RunPaintBenchmark(int repeat_count,
cc::PaintBenchmarkResult& result) {
DCHECK(MainFrameImpl());
if (auto* frame_view = MainFrameImpl()->GetFrameView())
frame_view->RunPaintBenchmark(repeat_count, result);
}
} // namespace blink
......@@ -479,8 +479,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// Called when keyboard focus switches to an anchor with the given URL.
void SetKeyboardFocusURL(const KURL&);
void RunPaintBenchmark(int repeat_count, cc::PaintBenchmarkResult& result);
// Asks the browser process to activate this web view.
void Focus();
......@@ -496,6 +494,10 @@ class CORE_EXPORT WebViewImpl final : public WebView,
void SetWindowRect(const gfx::Rect& bounds);
// TODO(crbug.com/1149992): This is called from the associated widget and this
// code should eventually move out of WebView into somewhere else.
void ApplyViewportChanges(const ApplyViewportChangesArgs& args);
// This method is used for testing.
// Resizes the unscaled (page scale = 1.0) visual viewport. Normally the
// unscaled visual viewport is the same size as the main frame. The passed
......@@ -527,8 +529,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// These are temporary methods to allow WebViewFrameWidget to delegate to
// WebViewImpl. We expect to eventually move these out.
void ThemeChanged();
void ApplyViewportChanges(const ApplyViewportChangesArgs& args);
void RecordManipulationTypeCounts(cc::ManipulationInfo info);
void MouseCaptureLost();
void SetFocus(bool enable) override;
......
......@@ -1518,6 +1518,38 @@ void WebFrameWidgetBase::EndCommitCompositorFrame(
commit_compositor_frame_start_time_.reset();
}
void WebFrameWidgetBase::ApplyViewportChanges(
const ApplyViewportChangesArgs& args) {
// Viewport changes only change the main frame.
if (!ForMainFrame())
return;
View()->ApplyViewportChanges(args);
}
void WebFrameWidgetBase::RecordManipulationTypeCounts(
cc::ManipulationInfo info) {
// Manipulation counts are only recorded for the main frame.
if (!ForMainFrame())
return;
if ((info & cc::kManipulationInfoWheel) == cc::kManipulationInfoWheel) {
UseCounter::Count(LocalRootImpl()->GetDocument(),
WebFeature::kScrollByWheel);
}
if ((info & cc::kManipulationInfoTouch) == cc::kManipulationInfoTouch) {
UseCounter::Count(LocalRootImpl()->GetDocument(),
WebFeature::kScrollByTouch);
}
if ((info & cc::kManipulationInfoPinchZoom) ==
cc::kManipulationInfoPinchZoom) {
UseCounter::Count(LocalRootImpl()->GetDocument(), WebFeature::kPinchZoom);
}
if ((info & cc::kManipulationInfoPrecisionTouchPad) ==
cc::kManipulationInfoPrecisionTouchPad) {
UseCounter::Count(LocalRootImpl()->GetDocument(),
WebFeature::kScrollByPrecisionTouchPad);
}
}
void WebFrameWidgetBase::RecordDispatchRafAlignedInputTime(
base::TimeTicks raf_aligned_input_start_time) {
if (LocalRootImpl()) {
......@@ -3129,6 +3161,14 @@ void WebFrameWidgetBase::WasShown(bool was_evicted) {
}
}
void WebFrameWidgetBase::RunPaintBenchmark(int repeat_count,
cc::PaintBenchmarkResult& result) {
if (!ForMainFrame())
return;
if (auto* frame_view = LocalRootImpl()->GetFrameView())
frame_view->RunPaintBenchmark(repeat_count, result);
}
void WebFrameWidgetBase::NotifyInputObservers(
const WebCoalescedInputEvent& coalesced_event) {
LocalFrame* frame = FocusedLocalFrameInWidget();
......
......@@ -364,6 +364,8 @@ class CORE_EXPORT WebFrameWidgetBase
void BeginMainFrame(base::TimeTicks last_frame_time) override;
void BeginCommitCompositorFrame() override;
void EndCommitCompositorFrame(base::TimeTicks commit_start_time) override;
void ApplyViewportChanges(const cc::ApplyViewportChangesArgs& args) override;
void RecordManipulationTypeCounts(cc::ManipulationInfo info) override;
void RecordDispatchRafAlignedInputTime(
base::TimeTicks raf_aligned_input_start_time) override;
void SetSuppressFrameRequestsWorkaroundFor704763Only(bool) override;
......@@ -415,6 +417,8 @@ class CORE_EXPORT WebFrameWidgetBase
override;
void WasHidden() override;
void WasShown(bool was_evicted) override;
void RunPaintBenchmark(int repeat_count,
cc::PaintBenchmarkResult& result) override;
KURL GetURLForDebugTrace() override;
float GetTestingDeviceScaleFactorOverride() override;
......
......@@ -92,16 +92,6 @@ void WebViewFrameWidget::Resize(const gfx::Size& size) {
web_view_->Resize(size);
}
void WebViewFrameWidget::ApplyViewportChanges(
const ApplyViewportChangesArgs& args) {
web_view_->ApplyViewportChanges(args);
}
void WebViewFrameWidget::RecordManipulationTypeCounts(
cc::ManipulationInfo info) {
web_view_->RecordManipulationTypeCounts(info);
}
void WebViewFrameWidget::MouseCaptureLost() {
mouse_capture_element_ = nullptr;
web_view_->MouseCaptureLost();
......@@ -409,11 +399,6 @@ void WebViewFrameWidget::SetDeviceColorSpaceForTesting(
widget_base_->UpdateScreenInfo(info);
}
void WebViewFrameWidget::RunPaintBenchmark(int repeat_count,
cc::PaintBenchmarkResult& result) {
web_view_->RunPaintBenchmark(repeat_count, result);
}
void WebViewFrameWidget::SetWindowRectSynchronouslyForTesting(
const gfx::Rect& new_window_rect) {
SetWindowRectSynchronously(new_window_rect);
......
......@@ -89,11 +89,7 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
bool ShouldHandleImeEvents() override;
// WidgetBaseClient overrides:
void ApplyViewportChanges(const cc::ApplyViewportChangesArgs& args) override;
void RecordManipulationTypeCounts(cc::ManipulationInfo info) override;
void FocusChanged(bool enabled) override;
void RunPaintBenchmark(int repeat_count,
cc::PaintBenchmarkResult& result) override;
void SetIsNestedMainFrameWidget(bool is_nested);
void DidAutoResize(const gfx::Size& size);
......
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