| OLD | NEW |
| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 class WEB_EXPORT WebViewImpl final | 98 class WEB_EXPORT WebViewImpl final |
| 99 : WTF_NON_EXPORTED_BASE(public WebView), | 99 : WTF_NON_EXPORTED_BASE(public WebView), |
| 100 public RefCounted<WebViewImpl>, | 100 public RefCounted<WebViewImpl>, |
| 101 WTF_NON_EXPORTED_BASE(public WebGestureCurveTarget), | 101 WTF_NON_EXPORTED_BASE(public WebGestureCurveTarget), |
| 102 public PageWidgetEventHandler, | 102 public PageWidgetEventHandler, |
| 103 public WebScheduler::InterventionReporter { | 103 public WebScheduler::InterventionReporter { |
| 104 public: | 104 public: |
| 105 static WebViewImpl* create(WebViewClient*, WebPageVisibilityState); | 105 static WebViewImpl* create(WebViewClient*, WebPageVisibilityState); |
| 106 static HashSet<WebViewImpl*>& allInstances(); | 106 static HashSet<WebViewImpl*>& allInstances(); |
| 107 | 107 |
| 108 class UserGestureNotifier { |
| 109 public: |
| 110 // If a UserGestureIndicator is created for a user gesture since the last |
| 111 // page load and the WebViewImpl's |m_userGestureObserved| is false, the |
| 112 // UserGestureNotifier will notify the client and set |
| 113 // |m_userGestureObserved| to true. |
| 114 UserGestureNotifier(WebViewImpl*); |
| 115 ~UserGestureNotifier(); |
| 116 |
| 117 private: |
| 118 Persistent<WebLocalFrameImpl> m_frame; |
| 119 bool* const m_userGestureObserved; |
| 120 }; |
| 121 |
| 108 // WebWidget methods: | 122 // WebWidget methods: |
| 109 void close() override; | 123 void close() override; |
| 110 WebSize size() override; | 124 WebSize size() override; |
| 111 void resize(const WebSize&) override; | 125 void resize(const WebSize&) override; |
| 112 void resizeVisualViewport(const WebSize&) override; | 126 void resizeVisualViewport(const WebSize&) override; |
| 113 void didEnterFullscreen() override; | 127 void didEnterFullscreen() override; |
| 114 void didExitFullscreen() override; | 128 void didExitFullscreen() override; |
| 115 | 129 |
| 116 void beginFrame(double lastFrameTimeMonotonic) override; | 130 void beginFrame(double lastFrameTimeMonotonic) override; |
| 117 | 131 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 const WebPoint& location) override; | 241 const WebPoint& location) override; |
| 228 void performPluginAction(const WebPluginAction&, const WebPoint&) override; | 242 void performPluginAction(const WebPluginAction&, const WebPoint&) override; |
| 229 void audioStateChanged(bool isAudioPlaying) override; | 243 void audioStateChanged(bool isAudioPlaying) override; |
| 230 WebHitTestResult hitTestResultAt(const WebPoint&) override; | 244 WebHitTestResult hitTestResultAt(const WebPoint&) override; |
| 231 WebHitTestResult hitTestResultForTap(const WebPoint&, | 245 WebHitTestResult hitTestResultForTap(const WebPoint&, |
| 232 const WebSize&) override; | 246 const WebSize&) override; |
| 233 void dragSourceEndedAt(const WebPoint& pointInViewport, | 247 void dragSourceEndedAt(const WebPoint& pointInViewport, |
| 234 const WebPoint& screenPoint, | 248 const WebPoint& screenPoint, |
| 235 WebDragOperation) override; | 249 WebDragOperation) override; |
| 236 void dragSourceSystemDragEnded() override; | 250 void dragSourceSystemDragEnded() override; |
| 237 WebDragOperation dragTargetDragEnter(const WebDragData&, | |
| 238 const WebPoint& pointInViewport, | |
| 239 const WebPoint& screenPoint, | |
| 240 WebDragOperationsMask operationsAllowed, | |
| 241 int modifiers) override; | |
| 242 WebDragOperation dragTargetDragOver(const WebPoint& pointInViewport, | |
| 243 const WebPoint& screenPoint, | |
| 244 WebDragOperationsMask operationsAllowed, | |
| 245 int modifiers) override; | |
| 246 void dragTargetDragLeave() override; | |
| 247 void dragTargetDrop(const WebDragData&, | |
| 248 const WebPoint& pointInViewport, | |
| 249 const WebPoint& screenPoint, | |
| 250 int modifiers) override; | |
| 251 void spellingMarkers(WebVector<uint32_t>* markers) override; | 251 void spellingMarkers(WebVector<uint32_t>* markers) override; |
| 252 void removeSpellingMarkersUnderWords( | 252 void removeSpellingMarkersUnderWords( |
| 253 const WebVector<WebString>& words) override; | 253 const WebVector<WebString>& words) override; |
| 254 unsigned long createUniqueIdentifierForRequest() override; | 254 unsigned long createUniqueIdentifierForRequest() override; |
| 255 void enableDeviceEmulation(const WebDeviceEmulationParams&) override; | 255 void enableDeviceEmulation(const WebDeviceEmulationParams&) override; |
| 256 void disableDeviceEmulation() override; | 256 void disableDeviceEmulation() override; |
| 257 WebAXObject accessibilityObject() override; | 257 WebAXObject accessibilityObject() override; |
| 258 void setSelectionColors(unsigned activeBackgroundColor, | 258 void setSelectionColors(unsigned activeBackgroundColor, |
| 259 unsigned activeForegroundColor, | 259 unsigned activeForegroundColor, |
| 260 unsigned inactiveBackgroundColor, | 260 unsigned inactiveBackgroundColor, |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 // TODO(lfg): Remove once WebViewFrameWidget is deleted. | 532 // TODO(lfg): Remove once WebViewFrameWidget is deleted. |
| 533 void scheduleAnimationForWidget(); | 533 void scheduleAnimationForWidget(); |
| 534 bool getCompositionCharacterBounds(WebVector<WebRect>&) override; | 534 bool getCompositionCharacterBounds(WebVector<WebRect>&) override; |
| 535 void applyReplacementRange(const WebRange&) override; | 535 void applyReplacementRange(const WebRange&) override; |
| 536 | 536 |
| 537 friend class WebView; // So WebView::Create can call our constructor | 537 friend class WebView; // So WebView::Create can call our constructor |
| 538 friend class WebViewFrameWidget; | 538 friend class WebViewFrameWidget; |
| 539 friend class WTF::RefCounted<WebViewImpl>; | 539 friend class WTF::RefCounted<WebViewImpl>; |
| 540 friend void setCurrentInputEventForTest(const WebInputEvent*); | 540 friend void setCurrentInputEventForTest(const WebInputEvent*); |
| 541 | 541 |
| 542 enum DragAction { DragEnter, DragOver }; | |
| 543 | |
| 544 explicit WebViewImpl(WebViewClient*, WebPageVisibilityState); | 542 explicit WebViewImpl(WebViewClient*, WebPageVisibilityState); |
| 545 ~WebViewImpl() override; | 543 ~WebViewImpl() override; |
| 546 | 544 |
| 547 void hideSelectPopup(); | 545 void hideSelectPopup(); |
| 548 | 546 |
| 549 HitTestResult hitTestResultForRootFramePos(const IntPoint&); | 547 HitTestResult hitTestResultForRootFramePos(const IntPoint&); |
| 550 HitTestResult hitTestResultForViewportPos(const IntPoint&); | 548 HitTestResult hitTestResultForViewportPos(const IntPoint&); |
| 551 | 549 |
| 552 // Consolidate some common code between starting a drag over a target and | |
| 553 // updating a drag over a target. If we're starting a drag, |isEntering| | |
| 554 // should be true. | |
| 555 WebDragOperation dragTargetDragEnterOrOver(const WebPoint& pointInViewport, | |
| 556 const WebPoint& screenPoint, | |
| 557 DragAction, | |
| 558 int modifiers); | |
| 559 | |
| 560 void configureAutoResizeMode(); | 550 void configureAutoResizeMode(); |
| 561 | 551 |
| 562 void initializeLayerTreeView(); | 552 void initializeLayerTreeView(); |
| 563 | 553 |
| 564 void setIsAcceleratedCompositingActive(bool); | 554 void setIsAcceleratedCompositingActive(bool); |
| 565 void doComposite(); | 555 void doComposite(); |
| 566 void reallocateRenderer(); | 556 void reallocateRenderer(); |
| 567 void updateLayerTreeViewport(); | 557 void updateLayerTreeViewport(); |
| 568 void updateLayerTreeBackgroundColor(); | 558 void updateLayerTreeBackgroundColor(); |
| 569 void updateDeviceEmulationTransform(); | 559 void updateDeviceEmulationTransform(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 // The upper bound on the size when auto-resizing. | 618 // The upper bound on the size when auto-resizing. |
| 629 IntSize m_maxAutoSize; | 619 IntSize m_maxAutoSize; |
| 630 | 620 |
| 631 Persistent<Page> m_page; | 621 Persistent<Page> m_page; |
| 632 | 622 |
| 633 // An object that can be used to manipulate m_page->settings() without linking | 623 // An object that can be used to manipulate m_page->settings() without linking |
| 634 // against WebCore. This is lazily allocated the first time GetWebSettings() | 624 // against WebCore. This is lazily allocated the first time GetWebSettings() |
| 635 // is called. | 625 // is called. |
| 636 std::unique_ptr<WebSettingsImpl> m_webSettings; | 626 std::unique_ptr<WebSettingsImpl> m_webSettings; |
| 637 | 627 |
| 638 // A copy of the web drop data object we received from the browser. | |
| 639 Persistent<DataObject> m_currentDragData; | |
| 640 | |
| 641 // Keeps track of the current zoom level. 0 means no zoom, positive numbers | 628 // Keeps track of the current zoom level. 0 means no zoom, positive numbers |
| 642 // mean zoom in, negative numbers mean zoom out. | 629 // mean zoom in, negative numbers mean zoom out. |
| 643 double m_zoomLevel; | 630 double m_zoomLevel; |
| 644 | 631 |
| 645 double m_minimumZoomLevel; | 632 double m_minimumZoomLevel; |
| 646 | 633 |
| 647 double m_maximumZoomLevel; | 634 double m_maximumZoomLevel; |
| 648 | 635 |
| 649 // Additional zoom factor used to scale the content by device scale factor. | 636 // Additional zoom factor used to scale the content by device scale factor. |
| 650 double m_zoomFactorForDeviceScaleFactor; | 637 double m_zoomFactorForDeviceScaleFactor; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 675 | 662 |
| 676 // Webkit expects keyPress events to be suppressed if the associated keyDown | 663 // Webkit expects keyPress events to be suppressed if the associated keyDown |
| 677 // event was handled. Safari implements this behavior by peeking out the | 664 // event was handled. Safari implements this behavior by peeking out the |
| 678 // associated WM_CHAR event if the keydown was handled. We emulate | 665 // associated WM_CHAR event if the keydown was handled. We emulate |
| 679 // this behavior by setting this flag if the keyDown was handled. | 666 // this behavior by setting this flag if the keyDown was handled. |
| 680 bool m_suppressNextKeypressEvent; | 667 bool m_suppressNextKeypressEvent; |
| 681 | 668 |
| 682 // Represents whether or not this object should process incoming IME events. | 669 // Represents whether or not this object should process incoming IME events. |
| 683 bool m_imeAcceptEvents; | 670 bool m_imeAcceptEvents; |
| 684 | 671 |
| 685 // The available drag operations (copy, move link...) allowed by the source. | |
| 686 WebDragOperation m_operationsAllowed; | |
| 687 | |
| 688 // The current drag operation as negotiated by the source and destination. | |
| 689 // When not equal to DragOperationNone, the drag data can be dropped onto the | |
| 690 // current drop target in this WebView (the drop target can accept the drop). | |
| 691 WebDragOperation m_dragOperation; | |
| 692 | |
| 693 // The popup associated with an input/select element. | 672 // The popup associated with an input/select element. |
| 694 RefPtr<WebPagePopupImpl> m_pagePopup; | 673 RefPtr<WebPagePopupImpl> m_pagePopup; |
| 695 | 674 |
| 696 Persistent<DevToolsEmulator> m_devToolsEmulator; | 675 Persistent<DevToolsEmulator> m_devToolsEmulator; |
| 697 std::unique_ptr<PageOverlay> m_pageColorOverlay; | 676 std::unique_ptr<PageOverlay> m_pageColorOverlay; |
| 698 | 677 |
| 699 // Whether the webview is rendering transparently. | 678 // Whether the webview is rendering transparently. |
| 700 bool m_isTransparent; | 679 bool m_isTransparent; |
| 701 | 680 |
| 702 // Whether the user can press tab to focus links. | 681 // Whether the user can press tab to focus links. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 Persistent<ResizeViewportAnchor> m_resizeViewportAnchor; | 738 Persistent<ResizeViewportAnchor> m_resizeViewportAnchor; |
| 760 }; | 739 }; |
| 761 | 740 |
| 762 // We have no ways to check if the specified WebView is an instance of | 741 // We have no ways to check if the specified WebView is an instance of |
| 763 // WebViewImpl because WebViewImpl is the only implementation of WebView. | 742 // WebViewImpl because WebViewImpl is the only implementation of WebView. |
| 764 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); | 743 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); |
| 765 | 744 |
| 766 } // namespace blink | 745 } // namespace blink |
| 767 | 746 |
| 768 #endif | 747 #endif |
| OLD | NEW |