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

Side by Side Diff: third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp

Issue 2910233002: Do not fallback to FocusedOrMainFrame() in FocusedLocalFrameInWidget() (Closed)
Patch Set: Addressing dcheng@'s comments 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/WebFrameWidgetBase.h" 5 #include "core/frame/WebFrameWidgetBase.h"
6 6
7 #include "core/dom/UserGestureIndicator.h" 7 #include "core/dom/UserGestureIndicator.h"
8 #include "core/events/WebInputEventConversion.h" 8 #include "core/events/WebInputEventConversion.h"
9 #include "core/exported/WebViewBase.h" 9 #include "core/exported/WebViewBase.h"
10 #include "core/frame/LocalFrameView.h" 10 #include "core/frame/LocalFrameView.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return ToWebLocalFrameBase(LocalRoot())->ViewImpl(); 231 return ToWebLocalFrameBase(LocalRoot())->ViewImpl();
232 } 232 }
233 233
234 Page* WebFrameWidgetBase::GetPage() const { 234 Page* WebFrameWidgetBase::GetPage() const {
235 return View()->GetPage(); 235 return View()->GetPage();
236 } 236 }
237 237
238 void WebFrameWidgetBase::DidAcquirePointerLock() { 238 void WebFrameWidgetBase::DidAcquirePointerLock() {
239 GetPage()->GetPointerLockController().DidAcquirePointerLock(); 239 GetPage()->GetPointerLockController().DidAcquirePointerLock();
240 240
241 LocalFrame* focusedFrame = FocusedLocalFrameInWidget(); 241 LocalFrame* focusedFrame = FocusedLocalFrame();
242 if (focusedFrame) { 242 if (focusedFrame) {
243 focusedFrame->GetEventHandler().ReleaseMousePointerCapture(); 243 focusedFrame->GetEventHandler().ReleaseMousePointerCapture();
244 } 244 }
245 } 245 }
246 246
247 void WebFrameWidgetBase::DidNotAcquirePointerLock() { 247 void WebFrameWidgetBase::DidNotAcquirePointerLock() {
248 GetPage()->GetPointerLockController().DidNotAcquirePointerLock(); 248 GetPage()->GetPointerLockController().DidNotAcquirePointerLock();
249 } 249 }
250 250
251 void WebFrameWidgetBase::DidLosePointerLock() { 251 void WebFrameWidgetBase::DidLosePointerLock() {
252 pointer_lock_gesture_token_.Clear(); 252 pointer_lock_gesture_token_.Clear();
253 GetPage()->GetPointerLockController().DidLosePointerLock(); 253 GetPage()->GetPointerLockController().DidLosePointerLock();
254 } 254 }
255 255
256 // TODO(665924): Remove direct dispatches of mouse events from 256 // TODO(665924): Remove direct dispatches of mouse events from
257 // PointerLockController, instead passing them through EventHandler. 257 // PointerLockController, instead passing them through EventHandler.
258 void WebFrameWidgetBase::PointerLockMouseEvent( 258 void WebFrameWidgetBase::PointerLockMouseEvent(
259 const WebCoalescedInputEvent& coalesced_event) { 259 const WebCoalescedInputEvent& coalesced_event) {
260 const WebInputEvent& input_event = coalesced_event.Event(); 260 const WebInputEvent& input_event = coalesced_event.Event();
261 const WebMouseEvent& mouse_event = 261 const WebMouseEvent& mouse_event =
262 static_cast<const WebMouseEvent&>(input_event); 262 static_cast<const WebMouseEvent&>(input_event);
263 WebMouseEvent transformed_event = TransformWebMouseEvent( 263 WebMouseEvent transformed_event = TransformWebMouseEvent(
264 ToWebLocalFrameBase(LocalRoot())->GetFrameView(), mouse_event); 264 ToWebLocalFrameBase(LocalRoot())->GetFrameView(), mouse_event);
265 265
266 LocalFrame* focusedFrame = FocusedLocalFrameInWidget(); 266 LocalFrame* focusedFrame = FocusedLocalFrame();
267 if (focusedFrame) { 267 if (focusedFrame) {
268 focusedFrame->GetEventHandler().ProcessPendingPointerCaptureForPointerLock( 268 focusedFrame->GetEventHandler().ProcessPendingPointerCaptureForPointerLock(
269 transformed_event); 269 transformed_event);
270 } 270 }
271 271
272 std::unique_ptr<UserGestureIndicator> gesture_indicator; 272 std::unique_ptr<UserGestureIndicator> gesture_indicator;
273 AtomicString event_type; 273 AtomicString event_type;
274 switch (input_event.GetType()) { 274 switch (input_event.GetType()) {
275 case WebInputEvent::kMouseDown: 275 case WebInputEvent::kMouseDown:
276 event_type = EventTypeNames::mousedown; 276 event_type = EventTypeNames::mousedown;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 { 310 {
311 ContextMenuAllowedScope scope; 311 ContextMenuAllowedScope scope;
312 if (LocalFrame* focused_frame = 312 if (LocalFrame* focused_frame =
313 GetPage()->GetFocusController().FocusedFrame()) { 313 GetPage()->GetFocusController().FocusedFrame()) {
314 focused_frame->GetEventHandler().ShowNonLocatedContextMenu(nullptr, 314 focused_frame->GetEventHandler().ShowNonLocatedContextMenu(nullptr,
315 source_type); 315 source_type);
316 } 316 }
317 } 317 }
318 } 318 }
319 319
320 LocalFrame* WebFrameWidgetBase::FocusedLocalFrameInWidget() const { 320 LocalFrame* WebFrameWidgetBase::FocusedLocalFrame() const {
321 LocalFrame* frame = GetPage()->GetFocusController().FocusedFrame(); 321 LocalFrame* frame = GetPage()->GetFocusController().FocusedFrame();
322 return (frame && frame->LocalFrameRoot() == ToCoreFrame(LocalRoot())) 322 return (frame && frame->LocalFrameRoot() == ToCoreFrame(LocalRoot()))
323 ? frame 323 ? frame
324 : nullptr; 324 : nullptr;
325 } 325 }
326 326
327 } // namespace blink 327 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698