Commit 796ffe34 authored by W. James MacLean's avatar W. James MacLean Committed by Commit Bot

Diagnostic for issue 882458.

This is a CL with temporary diagnostic code for
https://crbug.com/882458.

This CL will be landed and left in ToT long enough to collect data, and
then reverted quickly, and certainly prior to the next stable branch
cut.

Bug: 882458
Change-Id: I5c5d1f2e26a032f743a86af6f335e6942f97e423
Reviewed-on: https://chromium-review.googlesource.com/1227130Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: James MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591468}
parent d037004f
......@@ -6,18 +6,39 @@
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#if defined(OS_WIN)
#include "base/command_line.h"
#include "content/public/common/content_switches.h"
#endif
namespace content {
CursorManager::CursorManager(RenderWidgetHostViewBase* root)
: view_under_cursor_(root),
root_view_(root),
tooltip_observer_for_testing_(nullptr) {}
#if defined(OS_WIN)
enable_logging_for_test_(false),
#endif
tooltip_observer_for_testing_(nullptr) {
#if defined(OS_WIN)
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kBrowserTest))
enable_logging_for_test_ = true;
#endif
}
CursorManager::~CursorManager() {}
void CursorManager::UpdateCursor(RenderWidgetHostViewBase* view,
const WebCursor& cursor) {
cursor_map_[view] = cursor;
#if defined(OS_WIN)
if (enable_logging_for_test_) {
enable_logging_for_test_ = false;
LOG(ERROR) << "Setting first cursor for view = " << view
<< ", this = " << this;
}
#endif
if (view == view_under_cursor_)
root_view_->DisplayCursor(cursor);
}
......
......@@ -7,6 +7,7 @@
#include <map>
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "content/common/cursors/webcursor.h"
......@@ -69,6 +70,11 @@ class CONTENT_EXPORT CursorManager {
// cursor needs to change.
RenderWidgetHostViewBase* root_view_;
#if defined(OS_WIN)
// Added to help diagnose http://crbug.com/882458. This will be removed before
// the branch promotes to stable.
bool enable_logging_for_test_;
#endif
TooltipObserver* tooltip_observer_for_testing_;
};
......
......@@ -2920,6 +2920,31 @@ class CursorMessageFilter : public content::BrowserMessageFilter {
namespace {
#if defined(OS_WIN)
// Temporary diagnostic code for https://crbug.com/882458.
class CursorUpdateEventLogger
: public content::RenderWidgetHost::InputEventObserver {
public:
CursorUpdateEventLogger() = default;
~CursorUpdateEventLogger() override {}
void OnInputEvent(const blink::WebInputEvent& event) override {
blink::WebInputEvent::Type type = event.GetType();
if (blink::WebInputEvent::IsMouseEventType(type)) {
auto mouse_event = static_cast<const blink::WebMouseEvent&>(event);
auto pos = mouse_event.PositionInWidget();
LOG(INFO) << "EventType = " << blink::WebInputEvent::GetName(type)
<< ", pos = (" << pos.x << "," << pos.y;
} else {
LOG(INFO) << "EventType = " << blink::WebInputEvent::GetName(type);
}
}
private:
DISALLOW_COPY_AND_ASSIGN(CursorUpdateEventLogger);
};
#endif
// Verify that we receive a mouse cursor update message when we mouse over
// a text field contained in an out-of-process iframe.
void CursorUpdateReceivedFromCrossSiteIframeHelper(
......@@ -2931,6 +2956,15 @@ void CursorUpdateReceivedFromCrossSiteIframeHelper(
auto* web_contents = static_cast<WebContentsImpl*>(shell->web_contents());
FrameTreeNode* root = web_contents->GetFrameTree()->root();
#if defined(OS_WIN)
// Install observer to try and see if what event might be triggering an
// unexpected cursor being set. *Hopefully* this observer gets installed
// before any events go through the main frame RenderWidgetHost.
// https://crbug.com/882458
CursorUpdateEventLogger main_frame_event_logger;
root->current_frame_host()->GetRenderWidgetHost()->AddInputEventObserver(
&main_frame_event_logger);
#endif
FrameTreeNode* child_node = root->child_at(0);
EXPECT_NE(shell->web_contents()->GetSiteInstance(),
......@@ -3007,6 +3041,10 @@ void CursorUpdateReceivedFromCrossSiteIframeHelper(
CursorInfo cursor_info;
cursor.GetCursorInfo(&cursor_info);
EXPECT_EQ(cursor_info.type, blink::WebCursorInfo::kTypeIBeam);
#if defined(OS_WIN)
root->current_frame_host()->GetRenderWidgetHost()->RemoveInputEventObserver(
&main_frame_event_logger);
#endif
}
} // namespace
......
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