Commit 391420ff authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

Remove obsolete DevTools pinch emulation workaround

DevToolsEmulator::HandleInputEvent handles the case of a gesture pinch
being handled on the main thread. Since touchscreen gesture pinch
events are all handled on the compositor thread, this workaround is no
longer needed.

Bug: 787924, 734201
Change-Id: I3499c1129b0ee529a8d218a652c69e258fa93fc0
Reviewed-on: https://chromium-review.googlesource.com/1073401Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562006}
parent c4b2a374
......@@ -1969,9 +1969,6 @@ WebInputEventResult WebViewImpl::HandleInputEvent(
input_event.GetType() != WebInputEvent::kPointerCancel)
return WebInputEventResult::kHandledSuppressed;
if (dev_tools_emulator_->HandleInputEvent(input_event))
return WebInputEventResult::kHandledSuppressed;
if (WebDevToolsAgentImpl* devtools = MainFrameDevToolsAgentImpl()) {
if (devtools->HandleInputEvent(input_event))
return WebInputEventResult::kHandledSuppressed;
......
......@@ -501,48 +501,4 @@ void DevToolsEmulator::SetScriptExecutionDisabled(
script_execution_disabled_ ? false : embedder_script_enabled_);
}
bool DevToolsEmulator::HandleInputEvent(const WebInputEvent& input_event) {
Page* page = web_view_->GetPage();
if (!page)
return false;
if (!touch_event_emulation_enabled_ ||
!WebInputEvent::IsPinchGestureEventType(input_event.GetType())) {
return false;
}
// FIXME: This workaround is required for touch emulation on Mac, where
// compositor-side pinch handling is not enabled. See http://crbug.com/138003.
// TODO(lukasza): https://crbug.com/734201: Add OOPIF support.
LocalFrameView* frame_view = page->DeprecatedLocalMainFrame()->View();
WebGestureEvent scaled_event = TransformWebGestureEvent(
frame_view, static_cast<const WebGestureEvent&>(input_event));
float page_scale_factor = page->PageScaleFactor();
if (scaled_event.GetType() == WebInputEvent::kGesturePinchBegin) {
WebFloatPoint gesture_position = scaled_event.PositionInRootFrame();
last_pinch_anchor_css_ = std::make_unique<IntPoint>(
RoundedIntPoint(gesture_position + frame_view->GetScrollOffset()));
last_pinch_anchor_dip_ =
std::make_unique<IntPoint>(FlooredIntPoint(gesture_position));
last_pinch_anchor_dip_->Scale(page_scale_factor, page_scale_factor);
}
if (scaled_event.GetType() == WebInputEvent::kGesturePinchUpdate &&
last_pinch_anchor_css_) {
float new_page_scale_factor = page_scale_factor * scaled_event.PinchScale();
IntPoint anchor_css(*last_pinch_anchor_dip_.get());
anchor_css.Scale(1.f / new_page_scale_factor, 1.f / new_page_scale_factor);
web_view_->SetPageScaleFactor(new_page_scale_factor);
// TODO(lukasza): https://crbug.com/734201: Add OOPIF support.
if (web_view_->MainFrame()->IsWebLocalFrame()) {
web_view_->MainFrame()->ToWebLocalFrame()->SetScrollOffset(
ToIntSize(*last_pinch_anchor_css_.get() - ToIntSize(anchor_css)));
}
}
if (scaled_event.GetType() == WebInputEvent::kGesturePinchEnd) {
last_pinch_anchor_css_.reset();
last_pinch_anchor_dip_.reset();
}
return true;
}
} // namespace blink
......@@ -17,10 +17,8 @@
namespace blink {
class IntPoint;
class IntRect;
class TransformationMatrix;
class WebInputEvent;
class WebViewImpl;
class CORE_EXPORT DevToolsEmulator final
......@@ -53,7 +51,6 @@ class CORE_EXPORT DevToolsEmulator final
void ResetViewport();
bool ResizeIsDeviceSizeChange();
void SetTouchEventEmulationEnabled(bool, int max_touch_points);
bool HandleInputEvent(const WebInputEvent&);
void SetScriptExecutionDisabled(bool);
// Notify the DevToolsEmulator about a scroll or scale change of the main
......@@ -112,8 +109,6 @@ class CORE_EXPORT DevToolsEmulator final
bool double_tap_to_zoom_enabled_;
bool original_device_supports_touch_;
int original_max_touch_points_;
std::unique_ptr<IntPoint> last_pinch_anchor_css_;
std::unique_ptr<IntPoint> last_pinch_anchor_dip_;
bool embedder_script_enabled_;
bool script_execution_disabled_;
......
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