2 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include "WebNavigationPolicy.h"
35 #include "platform/WebLayer.h"
36 #include "platform/WebLayerTreeView.h"
37 #include "platform/WebLayerTreeViewClient.h"
38 #include "platform/WebPoint.h"
39 #include "platform/WebRect.h"
40 #include "platform/WebSize.h"
41 #include "platform/WebString.h"
44 #include "ChromeClientImpl.h"
45 #include "ContextMenuClientImpl.h"
46 #include "DragClientImpl.h"
47 #include "EditorClientImpl.h"
48 #include "GraphicsContext3D.h"
49 #include "GraphicsLayer.h"
50 #include "InspectorClientImpl.h"
53 #include "NotificationPresenterImpl.h"
54 #include "PageOverlayList.h"
55 #include "PageWidgetDelegate.h"
56 #include "PlatformGestureCurveTarget.h"
57 #include "UserMediaClientImpl.h"
58 #include <wtf/OwnPtr.h>
59 #include <wtf/RefCounted.h>
62 class ActivePlatformGestureAnimation;
63 class ChromiumDataObject;
67 class GraphicsContext3D;
73 class PagePopupClient;
74 class PlatformGestureCurveTarget;
75 class PlatformKeyboardEvent;
77 class PopupMenuClient;
80 class TextFieldDecorator;
85 class AutocompletePopupMenuClient;
86 class AutofillPopupMenuClient;
87 class BatteryClientImpl;
88 class ContextMenuClientImpl;
89 class DeviceOrientationClientProxy;
90 class DragScrollTimer;
91 class GeolocationClientProxy;
92 class NonCompositedContentHost;
93 class SpeechInputClientImpl;
94 class SpeechRecognitionClientProxy;
95 class UserMediaClientImpl;
96 class WebAccessibilityObject;
97 class WebCompositorImpl;
98 class WebDevToolsAgentClient;
99 class WebDevToolsAgentPrivate;
101 class WebGestureEvent;
102 class WebPagePopupImpl;
104 class WebKeyboardEvent;
106 class WebMouseWheelEvent;
107 class WebSettingsImpl;
110 class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl>, public WebCore::PlatformGestureCurveTarget, public PageWidgetEventHandler {
117 // WebWidget methods:
118 virtual void close();
119 virtual WebSize size() { return m_size; }
120 virtual void willStartLiveResize();
121 virtual void resize(const WebSize&);
122 virtual void willEndLiveResize();
123 virtual void willEnterFullScreen();
124 virtual void didEnterFullScreen();
125 virtual void willExitFullScreen();
126 virtual void didExitFullScreen();
127 virtual void animate(double);
128 virtual void layout(); // Also implements WebLayerTreeViewClient::layout()
129 virtual void paint(WebCanvas*, const WebRect&);
130 virtual void themeChanged();
131 virtual void composite(bool finish);
132 virtual void setNeedsRedraw();
133 virtual bool isInputThrottled() const;
134 virtual bool handleInputEvent(const WebInputEvent&);
135 virtual void mouseCaptureLost();
136 virtual void setFocus(bool enable);
137 virtual bool setComposition(
138 const WebString& text,
139 const WebVector<WebCompositionUnderline>& underlines,
142 virtual bool confirmComposition();
143 virtual bool confirmComposition(const WebString& text);
144 virtual bool compositionRange(size_t* location, size_t* length);
145 virtual WebTextInputType textInputType();
146 virtual bool selectionBounds(WebRect& start, WebRect& end) const;
147 virtual bool caretOrSelectionRange(size_t* location, size_t* length);
148 virtual void setTextDirection(WebTextDirection direction);
149 virtual bool isAcceleratedCompositingActive() const;
150 virtual void didAcquirePointerLock();
151 virtual void didNotAcquirePointerLock();
152 virtual void didLosePointerLock();
153 virtual void didChangeWindowResizerRect();
154 virtual void instrumentBeginFrame();
155 virtual void instrumentCancelFrame();
158 virtual void initializeMainFrame(WebFrameClient*);
159 virtual void setAutofillClient(WebAutofillClient*);
160 virtual void setDevToolsAgentClient(WebDevToolsAgentClient*);
161 virtual void setPermissionClient(WebPermissionClient*);
162 virtual void setSpellCheckClient(WebSpellCheckClient*);
163 virtual void addTextFieldDecoratorClient(WebTextFieldDecoratorClient*) OVERRIDE;
164 virtual WebSettings* settings();
165 virtual WebString pageEncoding() const;
166 virtual void setPageEncoding(const WebString& encoding);
167 virtual bool isTransparent() const;
168 virtual void setIsTransparent(bool value);
169 virtual bool tabsToLinks() const;
170 virtual void setTabsToLinks(bool value);
171 virtual bool tabKeyCyclesThroughElements() const;
172 virtual void setTabKeyCyclesThroughElements(bool value);
173 virtual bool isActive() const;
174 virtual void setIsActive(bool value);
175 virtual void setDomainRelaxationForbidden(bool, const WebString& scheme);
176 virtual bool dispatchBeforeUnloadEvent();
177 virtual void dispatchUnloadEvent();
178 virtual WebFrame* mainFrame();
179 virtual WebFrame* findFrameByName(
180 const WebString& name, WebFrame* relativeToFrame);
181 virtual WebFrame* focusedFrame();
182 virtual void setFocusedFrame(WebFrame* frame);
183 virtual void setInitialFocus(bool reverse);
184 virtual void clearFocusedNode();
185 virtual void scrollFocusedNodeIntoView();
186 virtual void scrollFocusedNodeIntoRect(const WebRect&);
187 virtual double zoomLevel();
188 virtual double setZoomLevel(bool textOnly, double zoomLevel);
189 virtual void zoomLimitsChanged(double minimumZoomLevel,
190 double maximumZoomLevel);
191 virtual float pageScaleFactor() const;
192 virtual bool isPageScaleFactorSet() const;
193 virtual void setPageScaleFactorPreservingScrollOffset(float);
194 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin);
195 virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale);
196 virtual float minimumPageScaleFactor() const;
197 virtual float maximumPageScaleFactor() const;
199 virtual float deviceScaleFactor() const;
200 virtual void setDeviceScaleFactor(float);
201 virtual bool isFixedLayoutModeEnabled() const;
202 virtual void enableFixedLayoutMode(bool enable);
203 virtual WebSize fixedLayoutSize() const;
204 virtual void setFixedLayoutSize(const WebSize&);
205 virtual void enableAutoResizeMode(
206 const WebSize& minSize,
207 const WebSize& maxSize);
208 virtual void disableAutoResizeMode();
209 virtual void performMediaPlayerAction(
210 const WebMediaPlayerAction& action,
211 const WebPoint& location);
212 virtual void performPluginAction(
213 const WebPluginAction&,
215 virtual void copyImageAt(const WebPoint& point);
216 virtual void dragSourceEndedAt(
217 const WebPoint& clientPoint,
218 const WebPoint& screenPoint,
219 WebDragOperation operation);
220 virtual void dragSourceMovedTo(
221 const WebPoint& clientPoint,
222 const WebPoint& screenPoint,
223 WebDragOperation operation);
224 virtual void dragSourceSystemDragEnded();
225 virtual WebDragOperation dragTargetDragEnter(
227 const WebPoint& clientPoint,
228 const WebPoint& screenPoint,
229 WebDragOperationsMask operationsAllowed);
230 virtual WebDragOperation dragTargetDragOver(
231 const WebPoint& clientPoint,
232 const WebPoint& screenPoint,
233 WebDragOperationsMask operationsAllowed);
234 virtual void dragTargetDragLeave();
235 virtual void dragTargetDrop(
236 const WebPoint& clientPoint,
237 const WebPoint& screenPoint);
238 virtual unsigned long createUniqueIdentifierForRequest();
239 virtual void inspectElementAt(const WebPoint& point);
240 virtual WebString inspectorSettings() const;
241 virtual void setInspectorSettings(const WebString& settings);
242 virtual bool inspectorSetting(const WebString& key, WebString* value) const;
243 virtual void setInspectorSetting(const WebString& key,
244 const WebString& value);
245 virtual WebDevToolsAgent* devToolsAgent();
246 virtual WebAccessibilityObject accessibilityObject();
247 virtual void applyAutofillSuggestions(
249 const WebVector<WebString>& names,
250 const WebVector<WebString>& labels,
251 const WebVector<WebString>& icons,
252 const WebVector<int>& itemIDs,
254 virtual void hidePopups();
255 virtual void setScrollbarColors(unsigned inactiveColor,
256 unsigned activeColor,
257 unsigned trackColor);
258 virtual void setSelectionColors(unsigned activeBackgroundColor,
259 unsigned activeForegroundColor,
260 unsigned inactiveBackgroundColor,
261 unsigned inactiveForegroundColor);
262 virtual void performCustomContextMenuAction(unsigned action);
263 virtual void addPageOverlay(WebPageOverlay*, int /* zOrder */);
264 virtual void removePageOverlay(WebPageOverlay*);
265 #if ENABLE(BATTERY_STATUS)
266 virtual void updateBatteryStatus(const WebBatteryStatus&);
268 virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&);
270 // WebLayerTreeViewClient
271 virtual void willBeginFrame();
272 virtual void updateAnimations(double monotonicFrameBeginTime);
273 virtual void applyScrollAndScale(const WebSize&, float);
274 virtual WebGraphicsContext3D* createContext3D();
275 virtual void didRebindGraphicsContext(bool);
276 virtual void didCommit();
277 virtual void didCommitAndDrawFrame();
278 virtual void didCompleteSwapBuffers();
279 virtual void scheduleComposite();
283 void setIgnoreInputEvents(bool newValue);
284 WebDevToolsAgentPrivate* devToolsAgentPrivate() { return m_devToolsAgent.get(); }
286 PageOverlayList* pageOverlays() const { return m_pageOverlays.get(); }
288 void setOverlayLayer(WebCore::GraphicsLayer*);
290 const WebPoint& lastMouseDownPoint() const
292 return m_lastMouseDownPoint;
295 WebCore::Frame* focusedWebCoreFrame() const;
297 // Returns the currently focused Node or null if no node has focus.
298 WebCore::Node* focusedWebCoreNode();
300 static WebViewImpl* fromPage(WebCore::Page*);
302 WebViewClient* client()
307 WebAutofillClient* autofillClient()
309 return m_autofillClient;
312 WebPermissionClient* permissionClient()
314 return m_permissionClient;
317 WebSpellCheckClient* spellCheckClient()
319 return m_spellCheckClient;
322 const Vector<OwnPtr<WebCore::TextFieldDecorator> >& textFieldDecorators() const { return m_textFieldDecorators; }
324 // Returns the page object associated with this view. This may be null when
325 // the page is shutting down, but will be valid at all other times.
326 WebCore::Page* page() const
331 WebCore::RenderTheme* theme() const;
333 // Returns the main frame associated with this view. This may be null when
334 // the page is shutting down, but will be valid at all other times.
335 WebFrameImpl* mainFrameImpl();
337 // History related methods:
338 void observeNewNavigation();
340 // Event related methods:
341 void mouseContextMenu(const WebMouseEvent&);
342 void mouseDoubleClick(const WebMouseEvent&);
343 void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationSec);
345 void numberOfWheelEventHandlersChanged(unsigned);
346 void numberOfTouchEventHandlersChanged(unsigned);
348 // PlatformGestureCurveTarget implementation for wheel fling.
349 virtual void scrollBy(const WebCore::IntPoint&);
351 // Handles context menu events orignated via the the keyboard. These
352 // include the VK_APPS virtual key and the Shift+F10 combine. Code is
353 // based on the Webkit function bool WebView::handleContextMenuEvent(WPARAM
354 // wParam, LPARAM lParam) in webkit\webkit\win\WebView.cpp. The only
355 // significant change in this function is the code to convert from a
356 // Keyboard event to the Right Mouse button down event.
357 bool sendContextMenuEvent(const WebKeyboardEvent&);
359 // Notifies the WebView that a load has been committed. isNewNavigation
360 // will be true if a new session history item should be created for that
361 // load. isNavigationWithinPage will be true if the navigation does
362 // not take the user away from the current page.
363 void didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPage);
365 // Indicates two things:
366 // 1) This view may have a new layout now.
367 // 2) Calling layout() is a no-op.
368 // After calling WebWidget::layout(), expect to get this notification
369 // unless the view did not need a layout.
370 void layoutUpdated(WebFrameImpl*);
372 void didChangeContentsSize();
374 // Returns true if popup menus should be rendered by the browser, false if
375 // they should be rendered by WebKit (which is the default).
376 static bool useExternalPopupMenus();
378 bool contextMenuAllowed() const
380 return m_contextMenuAllowed;
383 bool shouldAutoResize() const
385 return m_shouldAutoResize;
388 WebCore::IntSize minAutoSize() const
390 return m_minAutoSize;
393 WebCore::IntSize maxAutoSize() const
395 return m_maxAutoSize;
398 // Set the disposition for how this webview is to be initially shown.
399 void setInitialNavigationPolicy(WebNavigationPolicy policy)
401 m_initialNavigationPolicy = policy;
403 WebNavigationPolicy initialNavigationPolicy() const
405 return m_initialNavigationPolicy;
408 // Sets the emulated text zoom factor
409 // (may not be 1 in the device metrics emulation mode).
410 void setEmulatedTextZoomFactor(float);
412 // Returns the emulated text zoom factor
413 // (which may not be 1 in the device metrics emulation mode).
414 float emulatedTextZoomFactor() const
416 return m_emulatedTextZoomFactor;
419 // Determines whether a page should e.g. be opened in a background tab.
420 // Returns false if it has no opinion, in which case it doesn't set *policy.
421 static bool navigationPolicyFromMouseEvent(
422 unsigned short button,
427 WebNavigationPolicy*);
429 // Start a system drag and drop operation.
431 const WebDragData& dragData,
432 WebDragOperationsMask mask,
433 const WebImage& dragImage,
434 const WebPoint& dragImageOffset);
436 void autofillPopupDidHide()
438 m_autofillPopupShowing = false;
441 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
442 // Returns the provider of desktop notifications.
443 NotificationPresenterImpl* notificationPresenterImpl();
446 // Tries to scroll a frame or any parent of a frame. Returns true if the view
448 bool propagateScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
450 // Notification that a popup was opened/closed.
451 void popupOpened(WebCore::PopupContainer* popupContainer);
452 void popupClosed(WebCore::PopupContainer* popupContainer);
453 #if ENABLE(PAGE_POPUP)
454 WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView);
455 void closePagePopup(WebCore::PagePopup*);
458 void hideAutofillPopup();
460 // Returns the input event we're currently processing. This is used in some
461 // cases where the WebCore DOM event doesn't have the information we need.
462 static const WebInputEvent* currentInputEvent()
464 return m_currentInputEvent;
467 #if USE(ACCELERATED_COMPOSITING)
468 bool allowsAcceleratedCompositing();
469 bool pageHasRTLStyle() const;
470 void setRootGraphicsLayer(WebCore::GraphicsLayer*);
471 void scheduleCompositingLayerSync();
472 void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
473 void invalidateRootLayerRect(const WebCore::IntRect&);
474 NonCompositedContentHost* nonCompositedContentHost();
475 void setBackgroundColor(const WebCore::Color&);
477 #if ENABLE(REQUEST_ANIMATION_FRAME)
478 void scheduleAnimation();
481 // Returns the onscreen 3D context used by the compositor. This is
482 // used by the renderer's code to set up resource sharing between
483 // the compositor's context and subordinate contexts for APIs like
484 // WebGL. Returns 0 if compositing support is not compiled in or
485 // we could not successfully instantiate a context.
486 virtual WebGraphicsContext3D* graphicsContext3D();
488 virtual WebGraphicsContext3D* sharedGraphicsContext3D();
490 PassOwnPtr<WebGraphicsContext3D> createCompositorGraphicsContext3D();
492 virtual void setVisibilityState(WebPageVisibilityState, bool);
494 WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); }
495 #if ENABLE(PAGE_POPUP)
496 bool hasOpenedPopup() const { return m_selectPopup || m_pagePopup; }
498 bool hasOpenedPopup() const { return m_selectPopup; }
501 // Returns true if the event leads to scrolling.
502 static bool mapKeyCodeForScroll(int keyCode,
503 WebCore::ScrollDirection* scrollDirection,
504 WebCore::ScrollGranularity* scrollGranularity);
506 // Called by a full frame plugin inside this view to inform it that its
507 // zoom level has been updated. The plugin should only call this function
508 // if the zoom change was triggered by the browser, it's only needed in case
509 // a plugin can update its own zoom, say because of its own UI.
510 void fullFramePluginZoomLevelChanged(double zoomLevel);
512 #if ENABLE(GESTURE_EVENTS)
513 void computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType, float& scale, WebPoint& scroll);
516 void loseCompositorContext(int numTimes);
518 void enterFullScreenForElement(WebCore::Element*);
519 void exitFullScreenForElement(WebCore::Element*);
521 // Exposed for the purpose of overriding device metrics.
522 void sendResizeEventAndRepaint();
524 // Exposed for testing purposes.
525 bool hasHorizontalScrollbar();
526 bool hasVerticalScrollbar();
528 // Pointer Lock calls allow a page to capture all mouse events and
529 // disable the system cursor.
530 #if ENABLE(POINTER_LOCK)
531 virtual bool requestPointerLock();
532 virtual void requestPointerUnlock();
533 virtual bool isPointerLocked();
537 bool computePageScaleFactorLimits();
538 float clampPageScaleFactorToLimits(float scale);
539 WebPoint clampOffsetAtScale(const WebPoint& offset, float scale);
541 friend class WebView; // So WebView::Create can call our constructor
542 friend class WTF::RefCounted<WebViewImpl>;
549 WebViewImpl(WebViewClient*);
550 virtual ~WebViewImpl();
552 // Returns true if the event was actually processed.
553 bool keyEventDefault(const WebKeyboardEvent&);
555 // Returns true if the autocomple has consumed the event.
556 bool autocompleteHandleKeyEvent(const WebKeyboardEvent&);
558 // Repaints the Autofill popup. Should be called when the suggestions
559 // have changed. Note that this should only be called when the Autofill
561 void refreshAutofillPopup();
563 // Returns true if the view was scrolled.
564 bool scrollViewWithKeyboard(int keyCode, int modifiers);
566 void hideSelectPopup();
568 // Converts |pos| from window coordinates to contents coordinates and gets
569 // the HitTestResult for it.
570 WebCore::HitTestResult hitTestResultForWindowPos(const WebCore::IntPoint&);
572 // Consolidate some common code between starting a drag over a target and
573 // updating a drag over a target. If we're starting a drag, |isEntering|
575 WebDragOperation dragTargetDragEnterOrOver(const WebPoint& clientPoint,
576 const WebPoint& screenPoint,
579 void configureAutoResizeMode();
581 #if USE(ACCELERATED_COMPOSITING)
582 void setIsAcceleratedCompositingActive(bool);
584 void doPixelReadbackToCanvas(WebCanvas*, const WebCore::IntRect&);
585 void reallocateRenderer();
586 void updateLayerTreeViewport();
589 #if ENABLE(GESTURE_EVENTS)
590 // Returns the bounding box of the block type node touched by the WebRect.
591 WebRect computeBlockBounds(const WebRect&, AutoZoomType);
593 // Helper function: Widens the width of |source| by the specified margins
594 // while keeping it smaller than page width.
595 WebRect widenRectWithinPageBounds(const WebRect& source, int targetMargin, int minimumMargin);
598 #if ENABLE(POINTER_LOCK)
599 void pointerLockMouseEvent(const WebInputEvent&);
602 // PageWidgetEventHandler functions
603 virtual void handleMouseLeave(WebCore::Frame&, const WebMouseEvent&) OVERRIDE;
604 virtual void handleMouseDown(WebCore::Frame&, const WebMouseEvent&) OVERRIDE;
605 virtual void handleMouseUp(WebCore::Frame&, const WebMouseEvent&) OVERRIDE;
606 virtual bool handleGestureEvent(const WebGestureEvent&) OVERRIDE;
607 virtual bool handleKeyEvent(const WebKeyboardEvent&) OVERRIDE;
608 virtual bool handleCharEvent(const WebKeyboardEvent&) OVERRIDE;
610 WebViewClient* m_client;
611 WebAutofillClient* m_autofillClient;
612 WebPermissionClient* m_permissionClient;
613 WebSpellCheckClient* m_spellCheckClient;
614 Vector<OwnPtr<WebCore::TextFieldDecorator> > m_textFieldDecorators;
616 ChromeClientImpl m_chromeClientImpl;
617 ContextMenuClientImpl m_contextMenuClientImpl;
618 DragClientImpl m_dragClientImpl;
619 EditorClientImpl m_editorClientImpl;
620 InspectorClientImpl m_inspectorClientImpl;
623 // If true, automatically resize the render view around its content.
624 bool m_shouldAutoResize;
625 // The lower bound on the size when auto-resizing.
626 WebCore::IntSize m_minAutoSize;
627 // The upper bound on the size when auto-resizing.
628 WebCore::IntSize m_maxAutoSize;
630 OwnPtr<WebCore::Page> m_page;
632 // This flag is set when a new navigation is detected. It is used to satisfy
633 // the corresponding argument to WebFrameClient::didCommitProvisionalLoad.
634 bool m_observedNewNavigation;
636 // Used to assert that the new navigation we observed is the same navigation
637 // when we make use of m_observedNewNavigation.
638 const WebCore::DocumentLoader* m_newNavigationLoader;
641 // An object that can be used to manipulate m_page->settings() without linking
642 // against WebCore. This is lazily allocated the first time GetWebSettings()
644 OwnPtr<WebSettingsImpl> m_webSettings;
646 // A copy of the web drop data object we received from the browser.
647 RefPtr<WebCore::ChromiumDataObject> m_currentDragData;
649 // The point relative to the client area where the mouse was last pressed
650 // down. This is used by the drag client to determine what was under the
651 // mouse when the drag was initiated. We need to track this here in
652 // WebViewImpl since DragClient::startDrag does not pass the position the
653 // mouse was at when the drag was initiated, only the current point, which
654 // can be misleading as it is usually not over the element the user actually
655 // dragged by the time a drag is initiated.
656 WebPoint m_lastMouseDownPoint;
658 // Keeps track of the current zoom level. 0 means no zoom, positive numbers
659 // mean zoom in, negative numbers mean zoom out.
662 double m_minimumZoomLevel;
664 double m_maximumZoomLevel;
666 float m_pageDefinedMinimumPageScaleFactor;
667 float m_pageDefinedMaximumPageScaleFactor;
668 float m_minimumPageScaleFactor;
669 float m_maximumPageScaleFactor;
671 bool m_pageScaleFactorIsSet;
673 bool m_contextMenuAllowed;
675 bool m_doingDragAndDrop;
677 bool m_ignoreInputEvents;
679 // Webkit expects keyPress events to be suppressed if the associated keyDown
680 // event was handled. Safari implements this behavior by peeking out the
681 // associated WM_CHAR event if the keydown was handled. We emulate
682 // this behavior by setting this flag if the keyDown was handled.
683 bool m_suppressNextKeypressEvent;
685 // The policy for how this webview is to be initially shown.
686 WebNavigationPolicy m_initialNavigationPolicy;
688 // Represents whether or not this object should process incoming IME events.
689 bool m_imeAcceptEvents;
691 // The available drag operations (copy, move link...) allowed by the source.
692 WebDragOperation m_operationsAllowed;
694 // The current drag operation as negotiated by the source and destination.
695 // When not equal to DragOperationNone, the drag data can be dropped onto the
696 // current drop target in this WebView (the drop target can accept the drop).
697 WebDragOperation m_dragOperation;
699 // Whether an Autofill popup is currently showing.
700 bool m_autofillPopupShowing;
702 // The Autofill popup client.
703 OwnPtr<AutofillPopupMenuClient> m_autofillPopupClient;
705 // The Autofill popup.
706 RefPtr<WebCore::PopupContainer> m_autofillPopup;
708 // The popup associated with a select element.
709 RefPtr<WebCore::PopupContainer> m_selectPopup;
711 #if ENABLE(PAGE_POPUP)
712 // The popup associated with an input element.
713 WebPagePopupImpl* m_pagePopup;
716 OwnPtr<WebDevToolsAgentPrivate> m_devToolsAgent;
717 OwnPtr<PageOverlayList> m_pageOverlays;
719 // Whether the webview is rendering transparently.
720 bool m_isTransparent;
722 // Whether the user can press tab to focus links.
725 // Inspector settings.
726 WebString m_inspectorSettings;
728 typedef HashMap<WTF::String, WTF::String> SettingsMap;
729 OwnPtr<SettingsMap> m_inspectorSettingsMap;
730 OwnPtr<DragScrollTimer> m_dragScrollTimer;
732 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
733 // The provider of desktop notifications;
734 NotificationPresenterImpl m_notificationPresenter;
737 // If set, the (plugin) node which has mouse capture.
738 RefPtr<WebCore::Node> m_mouseCaptureNode;
740 // If set, the WebView is transitioning to fullscreen for this element.
741 RefPtr<WebCore::Element> m_provisionalFullScreenElement;
743 // If set, the WebView is in fullscreen mode for an element in this frame.
744 RefPtr<WebCore::Frame> m_fullScreenFrame;
745 bool m_isCancelingFullScreen;
747 #if USE(ACCELERATED_COMPOSITING)
748 WebCore::IntRect m_rootLayerScrollDamage;
749 OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;
750 WebLayerTreeView m_layerTreeView;
751 WebLayer m_rootLayer;
752 WebCore::GraphicsLayer* m_rootGraphicsLayer;
753 bool m_isAcceleratedCompositingActive;
754 bool m_compositorCreationFailed;
755 // If true, the graphics context is being restored.
756 bool m_recreatingGraphicsContext;
758 static const WebInputEvent* m_currentInputEvent;
760 #if ENABLE(INPUT_SPEECH)
761 OwnPtr<SpeechInputClientImpl> m_speechInputClient;
763 #if ENABLE(SCRIPTED_SPEECH)
764 OwnPtr<SpeechRecognitionClientProxy> m_speechRecognitionClient;
767 // If we attempt to fetch the on-screen GraphicsContext3D before
768 // the compositor has been turned on, we need to instantiate it
769 // early. This member holds on to the GC3D in this case.
770 OwnPtr<WebGraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
771 OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy;
772 OwnPtr<GeolocationClientProxy> m_geolocationClientProxy;
773 #if ENABLE(BATTERY_STATUS)
774 OwnPtr<BatteryClientImpl> m_batteryClient;
777 float m_emulatedTextZoomFactor;
779 #if ENABLE(MEDIA_STREAM)
780 UserMediaClientImpl m_userMediaClientImpl;
782 OwnPtr<WebCore::ActivePlatformGestureAnimation> m_gestureAnimation;
783 WebPoint m_lastWheelPosition;
784 WebPoint m_lastWheelGlobalPosition;
788 } // namespace WebKit