diff options
Diffstat (limited to 'WebKit/chromium/src/WebViewImpl.h')
-rw-r--r-- | WebKit/chromium/src/WebViewImpl.h | 236 |
1 files changed, 172 insertions, 64 deletions
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h index 286ac43..0388770 100644 --- a/WebKit/chromium/src/WebViewImpl.h +++ b/WebKit/chromium/src/WebViewImpl.h @@ -31,21 +31,24 @@ #ifndef WebViewImpl_h #define WebViewImpl_h -// FIXME: Remove these relative paths once consumers from glue are removed. -#include "../public/WebNavigationPolicy.h" -#include "../public/WebPoint.h" -#include "../public/WebSize.h" -#include "../public/WebString.h" -#include "../public/WebView.h" +#include "WebNavigationPolicy.h" +#include "WebPoint.h" +#include "WebRect.h" +#include "WebSize.h" +#include "WebString.h" +#include "WebView.h" #include "BackForwardListClientImpl.h" #include "ChromeClientImpl.h" #include "ContextMenuClientImpl.h" #include "DragClientImpl.h" #include "EditorClientImpl.h" +#include "GraphicsContext3D.h" +#include "GraphicsLayer.h" #include "InspectorClientImpl.h" +#include "IntRect.h" +#include "LayerRendererChromium.h" #include "NotificationPresenterImpl.h" - #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> @@ -68,14 +71,19 @@ namespace WebKit { class AutocompletePopupMenuClient; class AutoFillPopupMenuClient; class ContextMenuClientImpl; -class SuggestionsPopupMenuClient; +class DeviceOrientationClientProxy; +class DragScrollTimer; +class SpeechInputClientImpl; class WebAccessibilityObject; +class WebDevToolsAgentClient; class WebDevToolsAgentPrivate; class WebFrameImpl; +class WebImage; class WebKeyboardEvent; class WebMouseEvent; class WebMouseWheelEvent; class WebSettingsImpl; +class WebTouchEvent; class WebViewImpl : public WebView, public RefCounted<WebViewImpl> { public: @@ -85,17 +93,21 @@ public: virtual void resize(const WebSize&); virtual void layout(); virtual void paint(WebCanvas*, const WebRect&); + virtual void themeChanged(); + virtual void composite(bool finish); virtual bool handleInputEvent(const WebInputEvent&); virtual void mouseCaptureLost(); virtual void setFocus(bool enable); - virtual bool handleCompositionEvent(WebCompositionCommand command, - int cursorPosition, - int targetStart, - int targetEnd, - const WebString& text); - virtual bool queryCompositionStatus(bool* enabled, - WebRect* caretRect); + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd); + virtual bool confirmComposition(); + virtual WebTextInputType textInputType(); + virtual WebRect caretOrSelectionBounds(); virtual void setTextDirection(WebTextDirection direction); + virtual bool isAcceleratedCompositingActive() const; // WebView methods: virtual void initializeMainFrame(WebFrameClient*); @@ -110,6 +122,7 @@ public: virtual void setTabKeyCyclesThroughElements(bool value); virtual bool isActive() const; virtual void setIsActive(bool value); + virtual void setDomainRelaxationForbidden(bool, const WebString& scheme); virtual bool dispatchBeforeUnloadEvent(); virtual void dispatchUnloadEvent(); virtual WebFrame* mainFrame(); @@ -119,8 +132,11 @@ public: virtual void setFocusedFrame(WebFrame* frame); virtual void setInitialFocus(bool reverse); virtual void clearFocusedNode(); - virtual int zoomLevel(); - virtual int setZoomLevel(bool textOnly, int zoomLevel); + virtual void scrollFocusedNodeIntoView(); + virtual double zoomLevel(); + virtual double setZoomLevel(bool textOnly, double zoomLevel); + virtual void zoomLimitsChanged(double minimumZoomLevel, + double maximumZoomLevel); virtual void performMediaPlayerAction( const WebMediaPlayerAction& action, const WebPoint& location); @@ -129,12 +145,21 @@ public: const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperation operation); + virtual void dragSourceMovedTo( + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperation operation); virtual void dragSourceSystemDragEnded(); virtual WebDragOperation dragTargetDragEnter( const WebDragData& dragData, int identity, const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed); + virtual WebDragOperation dragTargetDragEnterNew( + int identity, + const WebPoint& clientPoint, + const WebPoint& screenPoint, + WebDragOperationsMask operationsAllowed); virtual WebDragOperation dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, @@ -149,24 +174,31 @@ public: virtual void inspectElementAt(const WebPoint& point); virtual WebString inspectorSettings() const; virtual void setInspectorSettings(const WebString& settings); + virtual bool inspectorSetting(const WebString& key, WebString* value) const; + virtual void setInspectorSetting(const WebString& key, + const WebString& value); virtual WebDevToolsAgent* devToolsAgent(); - virtual void setDevToolsAgent(WebDevToolsAgent*); virtual WebAccessibilityObject accessibilityObject(); - virtual void applyAutofillSuggestions( + // DEPRECATED. + virtual void applyAutoFillSuggestions( const WebNode&, - const WebVector<WebString>& suggestions, - int defaultSuggestionIndex); + const WebVector<WebString>& names, + const WebVector<WebString>& labels, + const WebVector<int>& uniqueIDs, + int separatorIndex); virtual void applyAutoFillSuggestions( const WebNode&, const WebVector<WebString>& names, const WebVector<WebString>& labels, - int defaultSuggestionIndex); + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex); + // DEPRECATED: replacing with applyAutoFillSuggestions. virtual void applyAutocompleteSuggestions( const WebNode&, const WebVector<WebString>& suggestions, int defaultSuggestionIndex); - virtual void hideAutofillPopup(); - virtual void hideSuggestionsPopup(); + virtual void hidePopups(); virtual void setScrollbarColors(unsigned inactiveColor, unsigned activeColor, unsigned trackColor); @@ -175,9 +207,6 @@ public: unsigned inactiveBackgroundColor, unsigned inactiveForegroundColor); virtual void performCustomContextMenuAction(unsigned action); - virtual void addUserScript(const WebString& sourceCode, - bool runAtStart); - virtual void removeAllUserContent(); // WebViewImpl @@ -201,7 +230,7 @@ public: return m_client; } - // Returns the page object associated with this view. This may be null when + // Returns the page object associated with this view. This may be null when // the page is shutting down, but will be valid at all other times. WebCore::Page* page() const { @@ -210,7 +239,7 @@ public: WebCore::RenderTheme* theme() const; - // Returns the main frame associated with this view. This may be null when + // Returns the main frame associated with this view. This may be null when // the page is shutting down, but will be valid at all other times. WebFrameImpl* mainFrameImpl(); @@ -226,23 +255,28 @@ public: void mouseUp(const WebMouseEvent&); void mouseContextMenu(const WebMouseEvent&); void mouseDoubleClick(const WebMouseEvent&); - void mouseWheel(const WebMouseWheelEvent&); + bool mouseWheel(const WebMouseWheelEvent&); bool keyEvent(const WebKeyboardEvent&); bool charEvent(const WebKeyboardEvent&); + bool touchEvent(const WebTouchEvent&); // Handles context menu events orignated via the the keyboard. These - // include the VK_APPS virtual key and the Shift+F10 combine. Code is + // include the VK_APPS virtual key and the Shift+F10 combine. Code is // based on the Webkit function bool WebView::handleContextMenuEvent(WPARAM // wParam, LPARAM lParam) in webkit\webkit\win\WebView.cpp. The only // significant change in this function is the code to convert from a // Keyboard event to the Right Mouse button down event. bool sendContextMenuEvent(const WebKeyboardEvent&); - // Notifies the WebView that a load has been committed. isNewNavigation + // Notifies the WebView that a load has been committed. isNewNavigation // will be true if a new session history item should be created for that // load. void didCommitLoad(bool* isNewNavigation); + // Returns true if popup menus should be rendered by the browser, false if + // they should be rendered by WebKit (which is the default). + static bool useExternalPopupMenus(); + bool contextMenuAllowed() const { return m_contextMenuAllowed; @@ -270,13 +304,14 @@ public: // Start a system drag and drop operation. void startDragging( - const WebPoint& eventPos, const WebDragData& dragData, - WebDragOperationsMask dragSourceOperationMask); + WebDragOperationsMask mask, + const WebImage& dragImage, + const WebPoint& dragImageOffset); - void suggestionsPopupDidHide() + void autoFillPopupDidHide() { - m_suggestionsPopupShowing = false; + m_autoFillPopupShowing = false; } #if ENABLE(NOTIFICATIONS) @@ -288,39 +323,96 @@ public: // was scrolled. bool propagateScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity); - // HACK: currentInputEvent() is for ChromeClientImpl::show(), until we can - // fix WebKit to pass enough information up into ChromeClient::show() so we - // can decide if the window.open event was caused by a middle-mouse click + // Notification that a popup was opened/closed. + void popupOpened(WebCore::PopupContainer* popupContainer); + void popupClosed(WebCore::PopupContainer* popupContainer); + + void hideAutoFillPopup(); + + // Returns the input event we're currently processing. This is used in some + // cases where the WebCore DOM event doesn't have the information we need. static const WebInputEvent* currentInputEvent() { return m_currentInputEvent; } +#if USE(ACCELERATED_COMPOSITING) + bool allowsAcceleratedCompositing(); + void setRootGraphicsLayer(WebCore::PlatformLayer*); + void setRootLayerNeedsDisplay(); + void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect); + void invalidateRootLayerRect(const WebCore::IntRect&); +#endif + + // Returns the onscreen 3D context used by the compositor. This is + // used by the renderer's code to set up resource sharing between + // the compositor's context and subordinate contexts for APIs like + // WebGL. Returns 0 if compositing support is not compiled in. + virtual WebGraphicsContext3D* graphicsContext3D(); + + WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); } + + // Returns true if the event leads to scrolling. + static bool mapKeyCodeForScroll(int keyCode, + WebCore::ScrollDirection* scrollDirection, + WebCore::ScrollGranularity* scrollGranularity); + + // Called by a full frame plugin inside this view to inform it that its + // zoom level has been updated. The plugin should only call this function + // if the zoom change was triggered by the browser, it's only needed in case + // a plugin can update its own zoom, say because of its own UI. + void fullFramePluginZoomLevelChanged(double zoomLevel); + private: friend class WebView; // So WebView::Create can call our constructor friend class WTF::RefCounted<WebViewImpl>; - WebViewImpl(WebViewClient* client); + enum DragAction { + DragEnter, + DragOver + }; + + WebViewImpl(WebViewClient* client, WebDevToolsAgentClient* devToolsClient); ~WebViewImpl(); // Returns true if the event was actually processed. bool keyEventDefault(const WebKeyboardEvent&); + // Returns true if the select popup has consumed the event. + bool selectPopupHandleKeyEvent(const WebKeyboardEvent&); + // Returns true if the autocomple has consumed the event. bool autocompleteHandleKeyEvent(const WebKeyboardEvent&); - // Repaints the suggestions popup. Should be called when the suggestions - // have changed. Note that this should only be called when the suggestions + // Repaints the AutoFill popup. Should be called when the suggestions + // have changed. Note that this should only be called when the AutoFill // popup is showing. - void refreshSuggestionsPopup(); + void refreshAutoFillPopup(); // Returns true if the view was scrolled. bool scrollViewWithKeyboard(int keyCode, int modifiers); + void hideSelectPopup(); + // Converts |pos| from window coordinates to contents coordinates and gets // the HitTestResult for it. WebCore::HitTestResult hitTestResultForWindowPos(const WebCore::IntPoint&); + // Consolidate some common code between starting a drag over a target and + // updating a drag over a target. If we're starting a drag, |isEntering| + // should be true. + WebDragOperation dragTargetDragEnterOrOver(const WebPoint& clientPoint, + const WebPoint& screenPoint, + DragAction); + +#if USE(ACCELERATED_COMPOSITING) + void setIsAcceleratedCompositingActive(bool); + void updateRootLayerContents(const WebCore::IntRect&); + void doComposite(); + void doPixelReadbackToCanvas(WebCanvas*, const WebCore::IntRect&); + void reallocateRenderer(); +#endif + WebViewClient* m_client; BackForwardListClientImpl m_backForwardListClientImpl; @@ -335,7 +427,7 @@ private: WebPoint m_lastMousePosition; OwnPtr<WebCore::Page> m_page; - // This flag is set when a new navigation is detected. It is used to satisfy + // This flag is set when a new navigation is detected. It is used to satisfy // the corresponding argument to WebFrameClient::didCommitProvisionalLoad. bool m_observedNewNavigation; #ifndef NDEBUG @@ -345,7 +437,7 @@ private: #endif // An object that can be used to manipulate m_page->settings() without linking - // against WebCore. This is lazily allocated the first time GetWebSettings() + // against WebCore. This is lazily allocated the first time GetWebSettings() // is called. OwnPtr<WebSettingsImpl> m_webSettings; @@ -361,9 +453,13 @@ private: // dragged by the time a drag is initiated. WebPoint m_lastMouseDownPoint; - // Keeps track of the current zoom level. 0 means no zoom, positive numbers + // Keeps track of the current zoom level. 0 means no zoom, positive numbers // mean zoom in, negative numbers mean zoom out. - int m_zoomLevel; + double m_zoomLevel; + + double m_minimumZoomLevel; + + double m_maximumZoomLevel; bool m_contextMenuAllowed; @@ -391,7 +487,7 @@ private: // copied from the WebDropData object sent from the browser process. int m_dragIdentity; - // Valid when m_dragTargetDispatch is true. Used to override the default + // Valid when m_dragTargetDispatch is true. Used to override the default // browser drop effect with the effects "none" or "copy". enum DragTargetDropEffect { DropEffectDefault = -1, @@ -407,28 +503,17 @@ private: // current drop target in this WebView (the drop target can accept the drop). WebDragOperation m_dragOperation; - // Whether a suggestions popup is currently showing. - bool m_suggestionsPopupShowing; - - // A pointer to the current suggestions popup menu client. This can be - // either an AutoFillPopupMenuClient or an AutocompletePopupMenuClient. We - // do not own this pointer. - SuggestionsPopupMenuClient* m_suggestionsPopupClient; + // Whether an AutoFill popup is currently showing. + bool m_autoFillPopupShowing; // The AutoFill popup client. OwnPtr<AutoFillPopupMenuClient> m_autoFillPopupClient; - // The Autocomplete popup client. - OwnPtr<AutocompletePopupMenuClient> m_autocompletePopupClient; - - // A pointer to the current suggestions popup. We do not own this pointer. - WebCore::PopupContainer* m_suggestionsPopup; - - // The AutoFill suggestions popup. + // The AutoFill popup. RefPtr<WebCore::PopupContainer> m_autoFillPopup; - // The AutoComplete suggestions popup. - RefPtr<WebCore::PopupContainer> m_autocompletePopup; + // The popup associated with a select element. + RefPtr<WebCore::PopupContainer> m_selectPopup; OwnPtr<WebDevToolsAgentPrivate> m_devToolsAgent; @@ -441,12 +526,35 @@ private: // Inspector settings. WebString m_inspectorSettings; + typedef HashMap<WTF::String, WTF::String> SettingsMap; + OwnPtr<SettingsMap> m_inspectorSettingsMap; + OwnPtr<DragScrollTimer> m_dragScrollTimer; + #if ENABLE(NOTIFICATIONS) // The provider of desktop notifications; NotificationPresenterImpl m_notificationPresenter; #endif + // If set, the (plugin) node which has mouse capture. + RefPtr<WebCore::Node> m_mouseCaptureNode; + +#if USE(ACCELERATED_COMPOSITING) + WebCore::IntRect m_rootLayerDirtyRect; + WebCore::IntRect m_rootLayerScrollDamage; + RefPtr<WebCore::LayerRendererChromium> m_layerRenderer; + bool m_isAcceleratedCompositingActive; + bool m_compositorCreationFailed; +#endif static const WebInputEvent* m_currentInputEvent; + +#if ENABLE(INPUT_SPEECH) + OwnPtr<SpeechInputClientImpl> m_speechInputClient; +#endif + // If we attempt to fetch the on-screen GraphicsContext3D before + // the compositor has been turned on, we need to instantiate it + // early. This member holds on to the GC3D in this case. + RefPtr<WebCore::GraphicsContext3D> m_temporaryOnscreenGraphicsContext3D; + OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy; }; } // namespace WebKit |