Commit d8195de5 authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Revert "Scroll support for hosted dialogs in VR"

This reverts commit 480d1516.

Reason for revert: Suspected cause of Nougat Phone Tester failures:
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Nougat%20Phone%20Tester/6164

Original change's description:
> Scroll support for hosted dialogs in VR
> 
> Now that VR supports html <select>, we should send scroll events
> to dialogs.
> 
> Bug: 836292
> Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr
> Change-Id: I45d44af2069e21bedd0662d3f26ab6c89ff82288
> Reviewed-on: https://chromium-review.googlesource.com/1028584
> Commit-Queue: Amirhossein Simjour <asimjour@chromium.org>
> Reviewed-by: Ian Vollick <vollick@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#555454}

TBR=vollick@chromium.org,bshe@chromium.org,asimjour@chromium.org

Change-Id: I09843e204345ef1d42a17320e5bc05c386fc8eaa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 836292
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr
Reviewed-on: https://chromium-review.googlesource.com/1041048Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555595}
parent 54f91257
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/android/vr/vr_shell_delegate.h" #include "chrome/browser/android/vr/vr_shell_delegate.h"
#include "third_party/blink/public/platform/web_gesture_event.h"
#include "third_party/blink/public/platform/web_mouse_event.h" #include "third_party/blink/public/platform/web_mouse_event.h"
using base::android::JavaParamRef; using base::android::JavaParamRef;
...@@ -31,8 +30,39 @@ void VrDialog::SetSize(int width, int height) { ...@@ -31,8 +30,39 @@ void VrDialog::SetSize(int width, int height) {
width_ = width; width_ = width;
height_ = height; height_ = height;
} }
void VrDialog::OnContentEnter(const gfx::PointF& normalized_hit_point) {}
void VrDialog::SendGestureToTarget( void VrDialog::OnContentLeave() {}
void VrDialog::OnContentMove(const gfx::PointF& normalized_hit_point) {
SendGestureToDialog(
MakeMouseEvent(blink::WebInputEvent::kMouseMove, normalized_hit_point));
}
void VrDialog::OnContentDown(const gfx::PointF& normalized_hit_point) {
SendGestureToDialog(
MakeMouseEvent(blink::WebInputEvent::kMouseDown, normalized_hit_point));
}
void VrDialog::OnContentUp(const gfx::PointF& normalized_hit_point) {
SendGestureToDialog(
MakeMouseEvent(blink::WebInputEvent::kMouseUp, normalized_hit_point));
}
void VrDialog::OnContentFlingCancel(
std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) {}
void VrDialog::OnContentScrollBegin(
std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) {}
void VrDialog::OnContentScrollUpdate(
std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) {}
void VrDialog::OnContentScrollEnd(
std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) {}
void VrDialog::SendGestureToDialog(
std::unique_ptr<blink::WebInputEvent> event) { std::unique_ptr<blink::WebInputEvent> event) {
if (!event || !dialog_) if (!event || !dialog_)
return; return;
...@@ -61,10 +91,4 @@ std::unique_ptr<blink::WebMouseEvent> VrDialog::MakeMouseEvent( ...@@ -61,10 +91,4 @@ std::unique_ptr<blink::WebMouseEvent> VrDialog::MakeMouseEvent(
return mouse_event; return mouse_event;
} }
void VrDialog::UpdateGesture(const gfx::PointF& normalized_content_hit_point,
blink::WebGestureEvent& gesture) {
gesture.SetPositionInWidget(
ScalePoint(normalized_content_hit_point, width_, height_));
}
} // namespace vr } // namespace vr
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
using base::android::JavaParamRef; using base::android::JavaParamRef;
namespace vr { namespace vr {
// TODO(bshe): refactor content_input_delegate and vr_dialog so the common
// code can be shared in a more clear way (https://crbug.com/838925).
class VrDialog : public ContentInputDelegate { class VrDialog : public ContentInputDelegate {
public: public:
VrDialog(int width, int height); VrDialog(int width, int height);
...@@ -38,14 +36,24 @@ class VrDialog : public ContentInputDelegate { ...@@ -38,14 +36,24 @@ class VrDialog : public ContentInputDelegate {
ContentInputForwarder* dialog_ = nullptr; ContentInputForwarder* dialog_ = nullptr;
// ContentInputDelegate. // ContentInputDelegate.
void SendGestureToTarget( void OnContentEnter(const gfx::PointF& normalized_hit_point) override;
std::unique_ptr<blink::WebInputEvent> event) override; void OnContentLeave() override;
void UpdateGesture(const gfx::PointF& normalized_content_hit_point, void OnContentMove(const gfx::PointF& normalized_hit_point) override;
blink::WebGestureEvent& gesture) override; void OnContentDown(const gfx::PointF& normalized_hit_point) override;
void OnContentUp(const gfx::PointF& normalized_hit_point) override;
void OnContentFlingCancel(std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) override;
void OnContentScrollBegin(std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) override;
void OnContentScrollUpdate(std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) override;
void OnContentScrollEnd(std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) override;
void SendGestureToDialog(std::unique_ptr<blink::WebInputEvent> event);
std::unique_ptr<blink::WebMouseEvent> MakeMouseEvent( std::unique_ptr<blink::WebMouseEvent> MakeMouseEvent(
blink::WebInputEvent::Type type, blink::WebInputEvent::Type type,
const gfx::PointF& normalized_web_content_location) override; const gfx::PointF& normalized_web_content_location);
int width_; int width_;
int height_; int height_;
......
...@@ -27,7 +27,7 @@ ContentInputDelegate::~ContentInputDelegate() = default; ...@@ -27,7 +27,7 @@ ContentInputDelegate::~ContentInputDelegate() = default;
void ContentInputDelegate::OnContentEnter( void ContentInputDelegate::OnContentEnter(
const gfx::PointF& normalized_hit_point) { const gfx::PointF& normalized_hit_point) {
SendGestureToTarget( SendGestureToContent(
MakeMouseEvent(blink::WebInputEvent::kMouseEnter, normalized_hit_point)); MakeMouseEvent(blink::WebInputEvent::kMouseEnter, normalized_hit_point));
} }
...@@ -37,25 +37,25 @@ void ContentInputDelegate::OnContentLeave() { ...@@ -37,25 +37,25 @@ void ContentInputDelegate::OnContentLeave() {
// Layout. Sending a mouse leave event at 0,0 will result continuous // Layout. Sending a mouse leave event at 0,0 will result continuous
// MouseMove events sent to the content if the content keeps relayout itself. // MouseMove events sent to the content if the content keeps relayout itself.
// See crbug.com/762573 for details. // See crbug.com/762573 for details.
SendGestureToTarget( SendGestureToContent(
MakeMouseEvent(blink::WebInputEvent::kMouseLeave, kOutOfBoundsPoint)); MakeMouseEvent(blink::WebInputEvent::kMouseLeave, kOutOfBoundsPoint));
} }
void ContentInputDelegate::OnContentMove( void ContentInputDelegate::OnContentMove(
const gfx::PointF& normalized_hit_point) { const gfx::PointF& normalized_hit_point) {
SendGestureToTarget( SendGestureToContent(
MakeMouseEvent(blink::WebInputEvent::kMouseMove, normalized_hit_point)); MakeMouseEvent(blink::WebInputEvent::kMouseMove, normalized_hit_point));
} }
void ContentInputDelegate::OnContentDown( void ContentInputDelegate::OnContentDown(
const gfx::PointF& normalized_hit_point) { const gfx::PointF& normalized_hit_point) {
SendGestureToTarget( SendGestureToContent(
MakeMouseEvent(blink::WebInputEvent::kMouseDown, normalized_hit_point)); MakeMouseEvent(blink::WebInputEvent::kMouseDown, normalized_hit_point));
} }
void ContentInputDelegate::OnContentUp( void ContentInputDelegate::OnContentUp(
const gfx::PointF& normalized_hit_point) { const gfx::PointF& normalized_hit_point) {
SendGestureToTarget( SendGestureToContent(
MakeMouseEvent(blink::WebInputEvent::kMouseUp, normalized_hit_point)); MakeMouseEvent(blink::WebInputEvent::kMouseUp, normalized_hit_point));
} }
...@@ -87,28 +87,28 @@ void ContentInputDelegate::OnContentFlingCancel( ...@@ -87,28 +87,28 @@ void ContentInputDelegate::OnContentFlingCancel(
std::unique_ptr<blink::WebGestureEvent> gesture, std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) { const gfx::PointF& normalized_hit_point) {
UpdateGesture(normalized_hit_point, *gesture); UpdateGesture(normalized_hit_point, *gesture);
SendGestureToTarget(std::move(gesture)); SendGestureToContent(std::move(gesture));
} }
void ContentInputDelegate::OnContentScrollBegin( void ContentInputDelegate::OnContentScrollBegin(
std::unique_ptr<blink::WebGestureEvent> gesture, std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) { const gfx::PointF& normalized_hit_point) {
UpdateGesture(normalized_hit_point, *gesture); UpdateGesture(normalized_hit_point, *gesture);
SendGestureToTarget(std::move(gesture)); SendGestureToContent(std::move(gesture));
} }
void ContentInputDelegate::OnContentScrollUpdate( void ContentInputDelegate::OnContentScrollUpdate(
std::unique_ptr<blink::WebGestureEvent> gesture, std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) { const gfx::PointF& normalized_hit_point) {
UpdateGesture(normalized_hit_point, *gesture); UpdateGesture(normalized_hit_point, *gesture);
SendGestureToTarget(std::move(gesture)); SendGestureToContent(std::move(gesture));
} }
void ContentInputDelegate::OnContentScrollEnd( void ContentInputDelegate::OnContentScrollEnd(
std::unique_ptr<blink::WebGestureEvent> gesture, std::unique_ptr<blink::WebGestureEvent> gesture,
const gfx::PointF& normalized_hit_point) { const gfx::PointF& normalized_hit_point) {
UpdateGesture(normalized_hit_point, *gesture); UpdateGesture(normalized_hit_point, *gesture);
SendGestureToTarget(std::move(gesture)); SendGestureToContent(std::move(gesture));
} }
void ContentInputDelegate::OnSwapContents(int new_content_id) { void ContentInputDelegate::OnSwapContents(int new_content_id) {
...@@ -123,7 +123,7 @@ void ContentInputDelegate::UpdateGesture( ...@@ -123,7 +123,7 @@ void ContentInputDelegate::UpdateGesture(
content_tex_css_height_)); content_tex_css_height_));
} }
void ContentInputDelegate::SendGestureToTarget( void ContentInputDelegate::SendGestureToContent(
std::unique_ptr<blink::WebInputEvent> event) { std::unique_ptr<blink::WebInputEvent> event) {
if (!event || !content_ || ContentGestureIsLocked(event->GetType())) if (!event || !content_ || ContentGestureIsLocked(event->GetType()))
return; return;
......
...@@ -108,20 +108,18 @@ class ContentInputDelegate { ...@@ -108,20 +108,18 @@ class ContentInputDelegate {
void ClearTextInputState(); void ClearTextInputState();
protected:
virtual void UpdateGesture(const gfx::PointF& normalized_content_hit_point,
blink::WebGestureEvent& gesture);
virtual void SendGestureToTarget(std::unique_ptr<blink::WebInputEvent> event);
virtual std::unique_ptr<blink::WebMouseEvent> MakeMouseEvent(
blink::WebInputEvent::Type type,
const gfx::PointF& normalized_web_content_location);
private: private:
enum TextRequestState { enum TextRequestState {
kNoPendingRequest, kNoPendingRequest,
kRequested, kRequested,
kResponseReceived, kResponseReceived,
}; };
void UpdateGesture(const gfx::PointF& normalized_content_hit_point,
blink::WebGestureEvent& gesture);
void SendGestureToContent(std::unique_ptr<blink::WebInputEvent> event);
std::unique_ptr<blink::WebMouseEvent> MakeMouseEvent(
blink::WebInputEvent::Type type,
const gfx::PointF& normalized_web_content_location);
bool ContentGestureIsLocked(blink::WebInputEvent::Type type); bool ContentGestureIsLocked(blink::WebInputEvent::Type type);
void OnWebInputTextChanged(const base::string16& text); void OnWebInputTextChanged(const base::string16& text);
......
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