Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2951053005: Add Mojo API for Blink hit testing (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 2132
2133 bool WebViewImpl::HasVerticalScrollbar() { 2133 bool WebViewImpl::HasVerticalScrollbar() {
2134 return MainFrameImpl() 2134 return MainFrameImpl()
2135 ->GetFrameView() 2135 ->GetFrameView()
2136 ->LayoutViewportScrollableArea() 2136 ->LayoutViewportScrollableArea()
2137 ->VerticalScrollbar(); 2137 ->VerticalScrollbar();
2138 } 2138 }
2139 2139
2140 const WebInputEvent* WebViewImpl::current_input_event_ = nullptr; 2140 const WebInputEvent* WebViewImpl::current_input_event_ = nullptr;
2141 2141
2142 WebFrame* WebViewImpl::HitTestFrameAt(const WebFloatPoint& point) {
2143 if (!MainFrameImpl())
2144 return nullptr;
2145
2146 HitTestResult hit_test_result =
2147 MainFrameImpl()->GetFrame()->GetEventHandler().HitTestResultAtPoint(
2148 LayoutPoint((FloatPoint)point));
2149 Frame* target_frame = nullptr;
2150 Node* target_node = hit_test_result.InnerNode();
2151 if (target_node->IsFrameOwnerElement())
2152 target_frame = ToHTMLFrameOwnerElement(target_node)->ContentFrame();
2153 else
2154 target_frame = target_node->GetDocument().GetFrame();
2155 return WebFrame::FromFrame(target_frame);
2156 }
2157
2142 WebInputEventResult WebViewImpl::HandleInputEvent( 2158 WebInputEventResult WebViewImpl::HandleInputEvent(
2143 const WebCoalescedInputEvent& coalesced_event) { 2159 const WebCoalescedInputEvent& coalesced_event) {
2144 const WebInputEvent& input_event = coalesced_event.Event(); 2160 const WebInputEvent& input_event = coalesced_event.Event();
2145 // TODO(dcheng): The fact that this is getting called when there is no local 2161 // TODO(dcheng): The fact that this is getting called when there is no local
2146 // main frame is problematic and probably indicates a bug in the input event 2162 // main frame is problematic and probably indicates a bug in the input event
2147 // routing code. 2163 // routing code.
2148 if (!MainFrameImpl()) 2164 if (!MainFrameImpl())
2149 return WebInputEventResult::kNotHandled; 2165 return WebInputEventResult::kNotHandled;
2150 2166
2151 GetPage()->GetVisualViewport().StartTrackingPinchStats(); 2167 GetPage()->GetVisualViewport().StartTrackingPinchStats();
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
4129 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) 4145 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame())
4130 return nullptr; 4146 return nullptr;
4131 return focused_frame; 4147 return focused_frame;
4132 } 4148 }
4133 4149
4134 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { 4150 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const {
4135 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; 4151 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr;
4136 } 4152 }
4137 4153
4138 } // namespace blink 4154 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698