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

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

Issue 2860673002: Change all test cases to use WebViewBase instead of WebViewImpl. (Closed)
Patch Set: Address code review comments. Created 3 years, 7 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 class WebSettingsImpl; 95 class WebSettingsImpl;
96 class WebViewScheduler; 96 class WebViewScheduler;
97 97
98 class WEB_EXPORT WebViewImpl final 98 class WEB_EXPORT WebViewImpl final
99 : NON_EXPORTED_BASE(public WebViewBase), 99 : NON_EXPORTED_BASE(public WebViewBase),
100 NON_EXPORTED_BASE(public WebGestureCurveTarget), 100 NON_EXPORTED_BASE(public WebGestureCurveTarget),
101 public PageWidgetEventHandler, 101 public PageWidgetEventHandler,
102 public WebScheduler::InterventionReporter, 102 public WebScheduler::InterventionReporter,
103 public WebViewScheduler::WebViewSchedulerSettings { 103 public WebViewScheduler::WebViewSchedulerSettings {
104 public: 104 public:
105 static WebViewImpl* Create(WebViewClient*, WebPageVisibilityState); 105 static WebViewBase* Create(WebViewClient*, WebPageVisibilityState);
106 106
107 // WebWidget methods: 107 // WebWidget methods:
108 void Close() override; 108 void Close() override;
109 WebSize Size() override; 109 WebSize Size() override;
110 void Resize(const WebSize&) override; 110 void Resize(const WebSize&) override;
111 void ResizeVisualViewport(const WebSize&) override; 111 void ResizeVisualViewport(const WebSize&) override;
112 void DidEnterFullscreen() override; 112 void DidEnterFullscreen() override;
113 void DidExitFullscreen() override; 113 void DidExitFullscreen() override;
114 114
115 void SetSuppressFrameRequestsWorkaroundFor704763Only(bool) override; 115 void SetSuppressFrameRequestsWorkaroundFor704763Only(bool) override;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 void InvalidateRect(const IntRect&) override; 268 void InvalidateRect(const IntRect&) override;
269 269
270 void SetBaseBackgroundColor(WebColor) override; 270 void SetBaseBackgroundColor(WebColor) override;
271 void SetBaseBackgroundColorOverride(WebColor) override; 271 void SetBaseBackgroundColorOverride(WebColor) override;
272 void ClearBaseBackgroundColorOverride() override; 272 void ClearBaseBackgroundColorOverride() override;
273 void SetBackgroundColorOverride(WebColor) override; 273 void SetBackgroundColorOverride(WebColor) override;
274 void ClearBackgroundColorOverride() override; 274 void ClearBackgroundColorOverride() override;
275 void SetZoomFactorOverride(float) override; 275 void SetZoomFactorOverride(float) override;
276 void SetCompositorDeviceScaleFactorOverride(float) override; 276 void SetCompositorDeviceScaleFactorOverride(float) override;
277 void SetDeviceEmulationTransform(const TransformationMatrix&) override; 277 void SetDeviceEmulationTransform(const TransformationMatrix&) override;
278 TransformationMatrix GetDeviceEmulationTransformForTesting() const; 278 TransformationMatrix GetDeviceEmulationTransformForTesting() const override;
279 279
280 Color BaseBackgroundColor() const override; 280 Color BaseBackgroundColor() const override;
281 bool BackgroundColorOverrideEnabled() const override { 281 bool BackgroundColorOverrideEnabled() const override {
282 return background_color_override_enabled_; 282 return background_color_override_enabled_;
283 } 283 }
284 WebColor BackgroundColorOverride() const override { 284 WebColor BackgroundColorOverride() const override {
285 return background_color_override_; 285 return background_color_override_;
286 } 286 }
287 287
288 Frame* FocusedCoreFrame() const override; 288 Frame* FocusedCoreFrame() const override;
289 289
290 // Returns the currently focused Element or null if no element has focus. 290 // Returns the currently focused Element or null if no element has focus.
291 Element* FocusedElement() const; 291 Element* FocusedElement() const override;
292 292
293 static WebViewImpl* FromPage(Page*); 293 static WebViewBase* FromPage(Page*);
294 294
295 WebViewClient* Client() override { return client_; } 295 WebViewClient* Client() override { return client_; }
296 296
297 WebSpellCheckClient* SpellCheckClient() override { 297 WebSpellCheckClient* SpellCheckClient() override {
298 return spell_check_client_; 298 return spell_check_client_;
299 } 299 }
300 300
301 // Returns the page object associated with this view. This may be null when 301 // Returns the page object associated with this view. This may be null when
302 // the page is shutting down, but will be valid at all other times. 302 // the page is shutting down, but will be valid at all other times.
303 Page* GetPage() const override { return page_.Get(); } 303 Page* GetPage() const override { return page_.Get(); }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 PagePopup* OpenPagePopup(PagePopupClient*) override; 373 PagePopup* OpenPagePopup(PagePopupClient*) override;
374 void ClosePagePopup(PagePopup*) override; 374 void ClosePagePopup(PagePopup*) override;
375 void CleanupPagePopup() override; 375 void CleanupPagePopup() override;
376 LocalDOMWindow* PagePopupWindow() const override; 376 LocalDOMWindow* PagePopupWindow() const override;
377 377
378 // Returns the input event we're currently processing. This is used in some 378 // Returns the input event we're currently processing. This is used in some
379 // cases where the WebCore DOM event doesn't have the information we need. 379 // cases where the WebCore DOM event doesn't have the information we need.
380 static const WebInputEvent* CurrentInputEvent() { 380 static const WebInputEvent* CurrentInputEvent() {
381 return current_input_event_; 381 return current_input_event_;
382 } 382 }
383 void SetCurrentInputEventForTest(const WebInputEvent* event) override {
384 current_input_event_ = event;
385 }
383 386
384 GraphicsLayer* RootGraphicsLayer() override; 387 GraphicsLayer* RootGraphicsLayer() override;
385 void RegisterViewportLayersWithCompositor() override; 388 void RegisterViewportLayersWithCompositor() override;
386 PaintLayerCompositor* Compositor() const override; 389 PaintLayerCompositor* Compositor() const override;
387 CompositorAnimationTimeline* LinkHighlightsTimeline() const override { 390 CompositorAnimationTimeline* LinkHighlightsTimeline() const override {
388 return link_highlights_timeline_.get(); 391 return link_highlights_timeline_.get();
389 } 392 }
390 393
391 WebViewScheduler* Scheduler() const override; 394 WebViewScheduler* Scheduler() const override;
392 void SetVisibilityState(WebPageVisibilityState, bool) override; 395 void SetVisibilityState(WebPageVisibilityState, bool) override;
393 396
394 bool HasOpenedPopup() const override { return page_popup_.Get(); } 397 bool HasOpenedPopup() const override { return page_popup_.Get(); }
395 398
396 // Called by a full frame plugin inside this view to inform it that its 399 // Called by a full frame plugin inside this view to inform it that its
397 // zoom level has been updated. The plugin should only call this function 400 // zoom level has been updated. The plugin should only call this function
398 // if the zoom change was triggered by the browser, it's only needed in case 401 // if the zoom change was triggered by the browser, it's only needed in case
399 // a plugin can update its own zoom, say because of its own UI. 402 // a plugin can update its own zoom, say because of its own UI.
400 void FullFramePluginZoomLevelChanged(double zoom_level); 403 void FullFramePluginZoomLevelChanged(double zoom_level);
401 404
402 void ComputeScaleAndScrollForBlockRect( 405 void ComputeScaleAndScrollForBlockRect(
403 const WebPoint& hit_point, 406 const WebPoint& hit_point,
404 const WebRect& block_rect, 407 const WebRect& block_rect,
405 float padding, 408 float padding,
406 float default_scale_when_already_legible, 409 float default_scale_when_already_legible,
407 float& scale, 410 float& scale,
408 WebPoint& scroll); 411 WebPoint& scroll) override;
409 Node* BestTapNode(const GestureEventWithHitTestResults& targeted_tap_event); 412 Node* BestTapNode(
413 const GestureEventWithHitTestResults& targeted_tap_event) override;
410 void EnableTapHighlightAtPoint( 414 void EnableTapHighlightAtPoint(
411 const GestureEventWithHitTestResults& targeted_tap_event); 415 const GestureEventWithHitTestResults& targeted_tap_event) override;
412 void EnableTapHighlights(HeapVector<Member<Node>>&); 416 void EnableTapHighlights(HeapVector<Member<Node>>&) override;
413 void ComputeScaleAndScrollForFocusedNode(Node* focused_node, 417 void ComputeScaleAndScrollForFocusedNode(Node* focused_node,
414 bool zoom_in_to_legible_scale, 418 bool zoom_in_to_legible_scale,
415 float& scale, 419 float& scale,
416 IntPoint& scroll, 420 IntPoint& scroll,
417 bool& need_animation); 421 bool& need_animation) override;
418 422
419 void AnimateDoubleTapZoom(const IntPoint&); 423 void AnimateDoubleTapZoom(const IntPoint&) override;
420 424
421 void ResolveTapDisambiguation(double timestamp_seconds, 425 void ResolveTapDisambiguation(double timestamp_seconds,
422 WebPoint tap_viewport_offset, 426 WebPoint tap_viewport_offset,
423 bool is_long_press) override; 427 bool is_long_press) override;
424 428
425 void EnableFakePageScaleAnimationForTesting(bool); 429 void EnableFakePageScaleAnimationForTesting(bool) override;
426 bool FakeDoubleTapAnimationPendingForTesting() const { 430 bool FakeDoubleTapAnimationPendingForTesting() const override {
427 return double_tap_zoom_pending_; 431 return double_tap_zoom_pending_;
428 } 432 }
429 IntPoint FakePageScaleAnimationTargetPositionForTesting() const { 433 IntPoint FakePageScaleAnimationTargetPositionForTesting() const override {
430 return fake_page_scale_animation_target_position_; 434 return fake_page_scale_animation_target_position_;
431 } 435 }
432 float FakePageScaleAnimationPageScaleForTesting() const { 436 float FakePageScaleAnimationPageScaleForTesting() const override {
433 return fake_page_scale_animation_page_scale_factor_; 437 return fake_page_scale_animation_page_scale_factor_;
434 } 438 }
435 bool FakePageScaleAnimationUseAnchorForTesting() const { 439 bool FakePageScaleAnimationUseAnchorForTesting() const override {
436 return fake_page_scale_animation_use_anchor_; 440 return fake_page_scale_animation_use_anchor_;
437 } 441 }
438 442
439 void EnterFullscreen(LocalFrame&) override; 443 void EnterFullscreen(LocalFrame&) override;
440 void ExitFullscreen(LocalFrame&) override; 444 void ExitFullscreen(LocalFrame&) override;
441 void FullscreenElementChanged(Element*, Element*) override; 445 void FullscreenElementChanged(Element*, Element*) override;
442 446
443 // Exposed for the purpose of overriding device metrics. 447 // Exposed for the purpose of overriding device metrics.
444 void SendResizeEventAndRepaint(); 448 void SendResizeEventAndRepaint();
445 449
446 // Exposed for testing purposes. 450 // Exposed for testing purposes.
447 bool HasHorizontalScrollbar(); 451 bool HasHorizontalScrollbar() override;
448 bool HasVerticalScrollbar(); 452 bool HasVerticalScrollbar() override;
449 453
450 // Exposed for tests. 454 // Exposed for tests.
451 unsigned NumLinkHighlights() { return link_highlights_.size(); } 455 unsigned NumLinkHighlights() override { return link_highlights_.size(); }
452 LinkHighlightImpl* GetLinkHighlight(int i) { 456 LinkHighlightImpl* GetLinkHighlight(int i) override {
453 return link_highlights_[i].get(); 457 return link_highlights_[i].get();
454 } 458 }
455 459
456 WebSettingsImpl* SettingsImpl() override; 460 WebSettingsImpl* SettingsImpl() override;
457 461
458 // Returns the bounding box of the block type node touched by the WebPoint. 462 // Returns the bounding box of the block type node touched by the WebPoint.
459 WebRect ComputeBlockBound(const WebPoint&, bool ignore_clipping); 463 WebRect ComputeBlockBound(const WebPoint&, bool ignore_clipping) override;
460 464
461 WebLayerTreeView* LayerTreeView() const override { return layer_tree_view_; } 465 WebLayerTreeView* LayerTreeView() const override { return layer_tree_view_; }
462 CompositorAnimationHost* AnimationHost() const override { 466 CompositorAnimationHost* AnimationHost() const override {
463 return animation_host_.get(); 467 return animation_host_.get();
464 } 468 }
465 469
466 bool MatchesHeuristicsForGpuRasterizationForTesting() const { 470 bool MatchesHeuristicsForGpuRasterizationForTesting() const override {
467 return matches_heuristics_for_gpu_rasterization_; 471 return matches_heuristics_for_gpu_rasterization_;
468 } 472 }
469 473
470 void UpdateBrowserControlsState(WebBrowserControlsState constraint, 474 void UpdateBrowserControlsState(WebBrowserControlsState constraint,
471 WebBrowserControlsState current, 475 WebBrowserControlsState current,
472 bool animate) override; 476 bool animate) override;
473 477
474 BrowserControls& GetBrowserControls(); 478 BrowserControls& GetBrowserControls() override;
475 // Called anytime browser controls layout height or content offset have 479 // Called anytime browser controls layout height or content offset have
476 // changed. 480 // changed.
477 void DidUpdateBrowserControls() override; 481 void DidUpdateBrowserControls() override;
478 482
479 void ForceNextWebGLContextCreationToFail() override; 483 void ForceNextWebGLContextCreationToFail() override;
480 void ForceNextDrawingBufferCreationToFail() override; 484 void ForceNextDrawingBufferCreationToFail() override;
481 485
482 CompositorWorkerProxyClient* CreateCompositorWorkerProxyClient() override; 486 CompositorWorkerProxyClient* CreateCompositorWorkerProxyClient() override;
483 AnimationWorkletProxyClient* CreateAnimationWorkletProxyClient() override; 487 AnimationWorkletProxyClient* CreateAnimationWorkletProxyClient() override;
484 488
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 536
533 // TODO(lfg): Remove once WebViewFrameWidget is deleted. 537 // TODO(lfg): Remove once WebViewFrameWidget is deleted.
534 void ScheduleAnimationForWidget() override; 538 void ScheduleAnimationForWidget() override;
535 bool GetCompositionCharacterBounds(WebVector<WebRect>&) override; 539 bool GetCompositionCharacterBounds(WebVector<WebRect>&) override;
536 540
537 void UpdateBaseBackgroundColor(); 541 void UpdateBaseBackgroundColor();
538 542
539 friend class WebView; // So WebView::Create can call our constructor 543 friend class WebView; // So WebView::Create can call our constructor
540 friend class WebViewFrameWidget; 544 friend class WebViewFrameWidget;
541 friend class WTF::RefCounted<WebViewImpl>; 545 friend class WTF::RefCounted<WebViewImpl>;
542 friend void SetCurrentInputEventForTest(const WebInputEvent*);
543 546
544 explicit WebViewImpl(WebViewClient*, WebPageVisibilityState); 547 explicit WebViewImpl(WebViewClient*, WebPageVisibilityState);
545 ~WebViewImpl() override; 548 ~WebViewImpl() override;
546 549
547 void HideSelectPopup(); 550 void HideSelectPopup();
548 551
549 HitTestResult HitTestResultForRootFramePos(const IntPoint&); 552 HitTestResult HitTestResultForRootFramePos(const IntPoint&);
550 HitTestResult HitTestResultForViewportPos(const IntPoint&); 553 HitTestResult HitTestResultForViewportPos(const IntPoint&);
551 554
552 void ConfigureAutoResizeMode(); 555 void ConfigureAutoResizeMode();
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 Persistent<ResizeViewportAnchor> resize_viewport_anchor_; 749 Persistent<ResizeViewportAnchor> resize_viewport_anchor_;
747 }; 750 };
748 751
749 // We have no ways to check if the specified WebView is an instance of 752 // We have no ways to check if the specified WebView is an instance of
750 // WebViewImpl because WebViewImpl is the only implementation of WebView. 753 // WebViewImpl because WebViewImpl is the only implementation of WebView.
751 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); 754 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true);
752 755
753 } // namespace blink 756 } // namespace blink
754 757
755 #endif 758 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698