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

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

Issue 2804813002: Hide popups when handling mouse down, mouse wheel, or gesture tap in a WebFrameWidget (Closed)
Patch Set: Addressing comments Created 3 years, 8 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "public/web/WebView.h" 61 #include "public/web/WebView.h"
62 #include "web/ChromeClientImpl.h" 62 #include "web/ChromeClientImpl.h"
63 #include "web/ContextMenuClientImpl.h" 63 #include "web/ContextMenuClientImpl.h"
64 #include "web/EditorClientImpl.h" 64 #include "web/EditorClientImpl.h"
65 #include "web/MediaKeysClientImpl.h" 65 #include "web/MediaKeysClientImpl.h"
66 #include "web/PageWidgetDelegate.h" 66 #include "web/PageWidgetDelegate.h"
67 #include "web/ResizeViewportAnchor.h" 67 #include "web/ResizeViewportAnchor.h"
68 #include "web/SpellCheckerClientImpl.h" 68 #include "web/SpellCheckerClientImpl.h"
69 #include "web/StorageClientImpl.h" 69 #include "web/StorageClientImpl.h"
70 #include "web/WebExport.h" 70 #include "web/WebExport.h"
71 #include "web/WebPagePopupImpl.h"
71 72
72 namespace blink { 73 namespace blink {
73 74
74 class BrowserControls; 75 class BrowserControls;
75 class CompositorAnimationHost; 76 class CompositorAnimationHost;
76 class DevToolsEmulator; 77 class DevToolsEmulator;
77 class Frame; 78 class Frame;
78 class FullscreenController; 79 class FullscreenController;
79 class InspectorOverlay; 80 class InspectorOverlay;
80 class LinkHighlightImpl; 81 class LinkHighlightImpl;
81 class PageOverlay; 82 class PageOverlay;
82 class PageScaleConstraintsSet; 83 class PageScaleConstraintsSet;
83 class PaintLayerCompositor; 84 class PaintLayerCompositor;
84 class UserGestureToken; 85 class UserGestureToken;
85 class WebActiveGestureAnimation; 86 class WebActiveGestureAnimation;
86 class WebDevToolsAgentImpl; 87 class WebDevToolsAgentImpl;
87 class WebElement; 88 class WebElement;
88 class WebInputMethodControllerImpl; 89 class WebInputMethodControllerImpl;
89 class WebLayerTreeView; 90 class WebLayerTreeView;
90 class WebLocalFrame; 91 class WebLocalFrame;
91 class WebLocalFrameImpl; 92 class WebLocalFrameImpl;
92 class CompositorMutatorImpl; 93 class CompositorMutatorImpl;
93 class WebPagePopupImpl;
94 class WebPlugin; 94 class WebPlugin;
95 class WebRemoteFrame; 95 class WebRemoteFrame;
96 class WebSettingsImpl; 96 class WebSettingsImpl;
97 class WebViewScheduler; 97 class WebViewScheduler;
98 98
99 class WEB_EXPORT WebViewImpl final 99 class WEB_EXPORT WebViewImpl final
100 : NON_EXPORTED_BASE(public WebView), 100 : NON_EXPORTED_BASE(public WebView),
101 public RefCounted<WebViewImpl>, 101 public RefCounted<WebViewImpl>,
102 NON_EXPORTED_BASE(public WebGestureCurveTarget), 102 NON_EXPORTED_BASE(public WebGestureCurveTarget),
103 public PageWidgetEventHandler, 103 public PageWidgetEventHandler,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 const WebFloatSize& layout_viewport_delta, 135 const WebFloatSize& layout_viewport_delta,
136 const WebFloatSize& elastic_overscroll_delta, 136 const WebFloatSize& elastic_overscroll_delta,
137 float page_scale_delta, 137 float page_scale_delta,
138 float browser_controls_shown_ratio_delta) override; 138 float browser_controls_shown_ratio_delta) override;
139 void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, 139 void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel,
140 bool has_scrolled_by_touch) override; 140 bool has_scrolled_by_touch) override;
141 void MouseCaptureLost() override; 141 void MouseCaptureLost() override;
142 void SetFocus(bool enable) override; 142 void SetFocus(bool enable) override;
143 WebRange CompositionRange() override; 143 WebRange CompositionRange() override;
144 WebColor BackgroundColor() const override; 144 WebColor BackgroundColor() const override;
145 WebPagePopup* GetPagePopup() const override; 145 WebPagePopupImpl* GetPagePopup() const override;
146 bool SelectionBounds(WebRect& anchor, WebRect& focus) const override; 146 bool SelectionBounds(WebRect& anchor, WebRect& focus) const override;
147 bool SelectionTextDirection(WebTextDirection& start, 147 bool SelectionTextDirection(WebTextDirection& start,
148 WebTextDirection& end) const override; 148 WebTextDirection& end) const override;
149 bool IsSelectionAnchorFirst() const override; 149 bool IsSelectionAnchorFirst() const override;
150 WebRange CaretOrSelectionRange() override; 150 WebRange CaretOrSelectionRange() override;
151 void SetTextDirection(WebTextDirection) override; 151 void SetTextDirection(WebTextDirection) override;
152 bool IsAcceleratedCompositingActive() const override; 152 bool IsAcceleratedCompositingActive() const override;
153 void WillCloseLayerTreeView() override; 153 void WillCloseLayerTreeView() override;
154 void DidAcquirePointerLock() override; 154 void DidAcquirePointerLock() override;
155 void DidNotAcquirePointerLock() override; 155 void DidNotAcquirePointerLock() override;
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 double LastFrameTimeMonotonic() const { return last_frame_time_monotonic_; } 495 double LastFrameTimeMonotonic() const { return last_frame_time_monotonic_; }
496 496
497 ChromeClientImpl& ChromeClient() const { return *chrome_client_impl_.Get(); } 497 ChromeClientImpl& ChromeClient() const { return *chrome_client_impl_.Get(); }
498 498
499 // Returns the currently active WebInputMethodController which is the one 499 // Returns the currently active WebInputMethodController which is the one
500 // corresponding to the focused frame. It will return nullptr if there is no 500 // corresponding to the focused frame. It will return nullptr if there is no
501 // focused frame, or if the there is one but it belongs to a different local 501 // focused frame, or if the there is one but it belongs to a different local
502 // root. 502 // root.
503 WebInputMethodControllerImpl* GetActiveWebInputMethodController() const; 503 WebInputMethodControllerImpl* GetActiveWebInputMethodController() const;
504 504
505 void SetLastHiddenPagePopup(WebPagePopupImpl* page_popup) {
506 last_hidden_page_popup_ = page_popup;
507 }
508
505 private: 509 private:
506 InspectorOverlay* GetInspectorOverlay(); 510 InspectorOverlay* GetInspectorOverlay();
507 511
508 void SetPageScaleFactorAndLocation(float, const FloatPoint&); 512 void SetPageScaleFactorAndLocation(float, const FloatPoint&);
509 void PropagateZoomFactorToLocalFrameRoots(Frame*, float); 513 void PropagateZoomFactorToLocalFrameRoots(Frame*, float);
510 514
511 void ScrollAndRescaleViewports(float scale_factor, 515 void ScrollAndRescaleViewports(float scale_factor,
512 const IntPoint& main_frame_origin, 516 const IntPoint& main_frame_origin,
513 const FloatPoint& visual_viewport_origin); 517 const FloatPoint& visual_viewport_origin);
514 518
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 WebInputEventResult HandleCharEvent(const WebKeyboardEvent&) override; 576 WebInputEventResult HandleCharEvent(const WebKeyboardEvent&) override;
573 577
574 WebInputEventResult HandleSyntheticWheelFromTouchpadPinchEvent( 578 WebInputEventResult HandleSyntheticWheelFromTouchpadPinchEvent(
575 const WebGestureEvent&); 579 const WebGestureEvent&);
576 580
577 WebPlugin* FocusedPluginIfInputMethodSupported(LocalFrame*); 581 WebPlugin* FocusedPluginIfInputMethodSupported(LocalFrame*);
578 582
579 WebGestureEvent CreateGestureScrollEventFromFling(WebInputEvent::Type, 583 WebGestureEvent CreateGestureScrollEventFromFling(WebInputEvent::Type,
580 WebGestureDevice) const; 584 WebGestureDevice) const;
581 585
582 void EnablePopupMouseWheelEventListener(); 586 void EnablePopupMouseWheelEventListener(WebLocalFrameImpl* local_root);
583 void DisablePopupMouseWheelEventListener(); 587 void DisablePopupMouseWheelEventListener();
584 588
585 void CancelPagePopup(); 589 void CancelPagePopup();
586 void UpdatePageOverlays(); 590 void UpdatePageOverlays();
587 591
588 float DeviceScaleFactor() const; 592 float DeviceScaleFactor() const;
589 593
590 void SetRootGraphicsLayer(GraphicsLayer*); 594 void SetRootGraphicsLayer(GraphicsLayer*);
591 void SetRootLayer(WebLayer*); 595 void SetRootLayer(WebLayer*);
592 void AttachCompositorAnimationTimeline(CompositorAnimationTimeline*); 596 void AttachCompositorAnimationTimeline(CompositorAnimationTimeline*);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 718
715 FloatSize elastic_overscroll_; 719 FloatSize elastic_overscroll_;
716 720
717 // This is owned by the LayerTreeHostImpl, and should only be used on the 721 // This is owned by the LayerTreeHostImpl, and should only be used on the
718 // compositor thread. The LayerTreeHostImpl is indirectly owned by this 722 // compositor thread. The LayerTreeHostImpl is indirectly owned by this
719 // class so this pointer should be valid until this class is destructed. 723 // class so this pointer should be valid until this class is destructed.
720 CrossThreadPersistent<CompositorMutatorImpl> mutator_; 724 CrossThreadPersistent<CompositorMutatorImpl> mutator_;
721 725
722 Persistent<EventListener> popup_mouse_wheel_event_listener_; 726 Persistent<EventListener> popup_mouse_wheel_event_listener_;
723 727
728 // The local root whose document has |popup_mouse_wheel_event_listener_|
729 // registered.
730 WeakPersistent<WebLocalFrameImpl> local_root_with_empty_mouse_wheel_listener_;
731
724 WebPageImportanceSignals page_importance_signals_; 732 WebPageImportanceSignals page_importance_signals_;
725 733
726 const std::unique_ptr<WebViewScheduler> scheduler_; 734 const std::unique_ptr<WebViewScheduler> scheduler_;
727 735
728 double last_frame_time_monotonic_; 736 double last_frame_time_monotonic_;
729 737
730 // TODO(lfg): This is used in order to disable compositor visibility while 738 // TODO(lfg): This is used in order to disable compositor visibility while
731 // the page is still visible. This is needed until the WebView and WebWidget 739 // the page is still visible. This is needed until the WebView and WebWidget
732 // split is complete, since in out-of-process iframes the page can be 740 // split is complete, since in out-of-process iframes the page can be
733 // visible, but the WebView should not be used as a widget. 741 // visible, but the WebView should not be used as a widget.
734 bool override_compositor_visibility_; 742 bool override_compositor_visibility_;
735 743
736 Persistent<ResizeViewportAnchor> resize_viewport_anchor_; 744 Persistent<ResizeViewportAnchor> resize_viewport_anchor_;
737 }; 745 };
738 746
739 // We have no ways to check if the specified WebView is an instance of 747 // We have no ways to check if the specified WebView is an instance of
740 // WebViewImpl because WebViewImpl is the only implementation of WebView. 748 // WebViewImpl because WebViewImpl is the only implementation of WebView.
741 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); 749 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true);
742 750
743 } // namespace blink 751 } // namespace blink
744 752
745 #endif 753 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698