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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "web/PageOverlayList.h" | 54 #include "web/PageOverlayList.h" |
55 #include "web/PageScaleConstraintsSet.h" | 55 #include "web/PageScaleConstraintsSet.h" |
56 #include "web/PageWidgetDelegate.h" | 56 #include "web/PageWidgetDelegate.h" |
57 #include "web/SpellCheckerClientImpl.h" | 57 #include "web/SpellCheckerClientImpl.h" |
58 #include "web/StorageClientImpl.h" | 58 #include "web/StorageClientImpl.h" |
59 #include "wtf/OwnPtr.h" | 59 #include "wtf/OwnPtr.h" |
60 #include "wtf/RefCounted.h" | 60 #include "wtf/RefCounted.h" |
61 #include "wtf/Vector.h" | 61 #include "wtf/Vector.h" |
62 | 62 |
63 namespace blink { | 63 namespace blink { |
| 64 |
64 class DataObject; | 65 class DataObject; |
65 class Frame; | 66 class Frame; |
| 67 class FullscreenController; |
| 68 class LinkHighlight; |
| 69 class PopupContainer; |
66 class RenderLayerCompositor; | 70 class RenderLayerCompositor; |
67 class UserGestureToken; | 71 class UserGestureToken; |
68 } | |
69 | |
70 namespace blink { | |
71 class LinkHighlight; | |
72 class PopupContainer; | |
73 class WebActiveGestureAnimation; | 72 class WebActiveGestureAnimation; |
74 class WebDevToolsAgentPrivate; | 73 class WebDevToolsAgentPrivate; |
75 class WebLocalFrameImpl; | 74 class WebLocalFrameImpl; |
76 class WebImage; | 75 class WebImage; |
77 class WebPagePopupImpl; | 76 class WebPagePopupImpl; |
78 class WebPlugin; | 77 class WebPlugin; |
79 class WebSettingsImpl; | 78 class WebSettingsImpl; |
80 class FullscreenController; | |
81 | 79 |
82 class WebViewImpl FINAL : public WebView | 80 class WebViewImpl FINAL : public WebView |
83 , public RefCounted<WebViewImpl> | 81 , public RefCounted<WebViewImpl> |
84 , public WebGestureCurveTarget | 82 , public WebGestureCurveTarget |
85 , public blink::PagePopupDriver | 83 , public PagePopupDriver |
86 , public PageWidgetEventHandler { | 84 , public PageWidgetEventHandler { |
87 public: | 85 public: |
88 static WebViewImpl* create(WebViewClient*); | 86 static WebViewImpl* create(WebViewClient*); |
89 | 87 |
90 // WebWidget methods: | 88 // WebWidget methods: |
91 virtual void close() OVERRIDE; | 89 virtual void close() OVERRIDE; |
92 virtual WebSize size() OVERRIDE; | 90 virtual WebSize size() OVERRIDE; |
93 virtual void willStartLiveResize() OVERRIDE; | 91 virtual void willStartLiveResize() OVERRIDE; |
94 virtual void resize(const WebSize&) OVERRIDE; | 92 virtual void resize(const WebSize&) OVERRIDE; |
95 virtual void resizePinchViewport(const WebSize&) OVERRIDE; | 93 virtual void resizePinchViewport(const WebSize&) OVERRIDE; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 virtual void setShowPaintRects(bool) OVERRIDE; | 251 virtual void setShowPaintRects(bool) OVERRIDE; |
254 void setShowDebugBorders(bool); | 252 void setShowDebugBorders(bool); |
255 virtual void setShowFPSCounter(bool) OVERRIDE; | 253 virtual void setShowFPSCounter(bool) OVERRIDE; |
256 virtual void setContinuousPaintingEnabled(bool) OVERRIDE; | 254 virtual void setContinuousPaintingEnabled(bool) OVERRIDE; |
257 virtual void setShowScrollBottleneckRects(bool) OVERRIDE; | 255 virtual void setShowScrollBottleneckRects(bool) OVERRIDE; |
258 virtual void getSelectionRootBounds(WebRect& bounds) const OVERRIDE; | 256 virtual void getSelectionRootBounds(WebRect& bounds) const OVERRIDE; |
259 virtual void acceptLanguagesChanged() OVERRIDE; | 257 virtual void acceptLanguagesChanged() OVERRIDE; |
260 | 258 |
261 // WebViewImpl | 259 // WebViewImpl |
262 | 260 |
263 blink::HitTestResult coreHitTestResultAt(const WebPoint&); | 261 HitTestResult coreHitTestResultAt(const WebPoint&); |
264 void suppressInvalidations(bool enable); | 262 void suppressInvalidations(bool enable); |
265 void invalidateRect(const blink::IntRect&); | 263 void invalidateRect(const IntRect&); |
266 | 264 |
267 void setIgnoreInputEvents(bool newValue); | 265 void setIgnoreInputEvents(bool newValue); |
268 void setBackgroundColorOverride(WebColor); | 266 void setBackgroundColorOverride(WebColor); |
269 void setZoomFactorOverride(float); | 267 void setZoomFactorOverride(float); |
270 WebDevToolsAgentPrivate* devToolsAgentPrivate() { return m_devToolsAgent.get
(); } | 268 WebDevToolsAgentPrivate* devToolsAgentPrivate() { return m_devToolsAgent.get
(); } |
271 | 269 |
272 blink::Color baseBackgroundColor() const { return m_baseBackgroundColor; } | 270 Color baseBackgroundColor() const { return m_baseBackgroundColor; } |
273 | 271 |
274 PageOverlayList* pageOverlays() const { return m_pageOverlays.get(); } | 272 PageOverlayList* pageOverlays() const { return m_pageOverlays.get(); } |
275 | 273 |
276 void setOverlayLayer(blink::GraphicsLayer*); | 274 void setOverlayLayer(GraphicsLayer*); |
277 | 275 |
278 const WebPoint& lastMouseDownPoint() const | 276 const WebPoint& lastMouseDownPoint() const |
279 { | 277 { |
280 return m_lastMouseDownPoint; | 278 return m_lastMouseDownPoint; |
281 } | 279 } |
282 | 280 |
283 blink::Frame* focusedWebCoreFrame() const; | 281 Frame* focusedWebCoreFrame() const; |
284 | 282 |
285 // Returns the currently focused Element or null if no element has focus. | 283 // Returns the currently focused Element or null if no element has focus. |
286 blink::Element* focusedElement() const; | 284 Element* focusedElement() const; |
287 | 285 |
288 static WebViewImpl* fromPage(blink::Page*); | 286 static WebViewImpl* fromPage(Page*); |
289 | 287 |
290 WebViewClient* client() | 288 WebViewClient* client() |
291 { | 289 { |
292 return m_client; | 290 return m_client; |
293 } | 291 } |
294 | 292 |
295 WebAutofillClient* autofillClient() | 293 WebAutofillClient* autofillClient() |
296 { | 294 { |
297 return m_autofillClient; | 295 return m_autofillClient; |
298 } | 296 } |
299 | 297 |
300 WebSpellCheckClient* spellCheckClient() | 298 WebSpellCheckClient* spellCheckClient() |
301 { | 299 { |
302 return m_spellCheckClient; | 300 return m_spellCheckClient; |
303 } | 301 } |
304 | 302 |
305 // Returns the page object associated with this view. This may be null when | 303 // Returns the page object associated with this view. This may be null when |
306 // the page is shutting down, but will be valid at all other times. | 304 // the page is shutting down, but will be valid at all other times. |
307 blink::Page* page() const | 305 Page* page() const |
308 { | 306 { |
309 return m_page.get(); | 307 return m_page.get(); |
310 } | 308 } |
311 | 309 |
312 // Returns the main frame associated with this view. This may be null when | 310 // Returns the main frame associated with this view. This may be null when |
313 // the page is shutting down, but will be valid at all other times. | 311 // the page is shutting down, but will be valid at all other times. |
314 WebLocalFrameImpl* mainFrameImpl(); | 312 WebLocalFrameImpl* mainFrameImpl(); |
315 | 313 |
316 // FIXME: Temporary method to accommodate out-of-process frame ancestors; | 314 // FIXME: Temporary method to accommodate out-of-process frame ancestors; |
317 // will be removed when there can be multiple WebWidgets for a single page. | 315 // will be removed when there can be multiple WebWidgets for a single page. |
318 WebLocalFrameImpl* localFrameRootTemporary() const; | 316 WebLocalFrameImpl* localFrameRootTemporary() const; |
319 | 317 |
320 // Event related methods: | 318 // Event related methods: |
321 void mouseContextMenu(const WebMouseEvent&); | 319 void mouseContextMenu(const WebMouseEvent&); |
322 void mouseDoubleClick(const WebMouseEvent&); | 320 void mouseDoubleClick(const WebMouseEvent&); |
323 | 321 |
324 bool detectContentOnTouch(const WebPoint&); | 322 bool detectContentOnTouch(const WebPoint&); |
325 bool startPageScaleAnimation(const blink::IntPoint& targetPosition, bool use
Anchor, float newScale, double durationInSeconds); | 323 bool startPageScaleAnimation(const IntPoint& targetPosition, bool useAnchor,
float newScale, double durationInSeconds); |
326 | 324 |
327 void hasTouchEventHandlers(bool); | 325 void hasTouchEventHandlers(bool); |
328 | 326 |
329 // WebGestureCurveTarget implementation for fling. | 327 // WebGestureCurveTarget implementation for fling. |
330 virtual bool scrollBy(const WebFloatSize& delta, const WebFloatSize& velocit
y) OVERRIDE; | 328 virtual bool scrollBy(const WebFloatSize& delta, const WebFloatSize& velocit
y) OVERRIDE; |
331 | 329 |
332 // Handles context menu events orignated via the the keyboard. These | 330 // Handles context menu events orignated via the the keyboard. These |
333 // include the VK_APPS virtual key and the Shift+F10 combine. Code is | 331 // include the VK_APPS virtual key and the Shift+F10 combine. Code is |
334 // based on the Webkit function bool WebView::handleContextMenuEvent(WPARAM | 332 // based on the Webkit function bool WebView::handleContextMenuEvent(WPARAM |
335 // wParam, LPARAM lParam) in webkit\webkit\win\WebView.cpp. The only | 333 // wParam, LPARAM lParam) in webkit\webkit\win\WebView.cpp. The only |
336 // significant change in this function is the code to convert from a | 334 // significant change in this function is the code to convert from a |
337 // Keyboard event to the Right Mouse button down event. | 335 // Keyboard event to the Right Mouse button down event. |
338 bool sendContextMenuEvent(const WebKeyboardEvent&); | 336 bool sendContextMenuEvent(const WebKeyboardEvent&); |
339 | 337 |
340 void showContextMenuAtPoint(float x, float y, PassRefPtr<blink::ContextMenuP
rovider>); | 338 void showContextMenuAtPoint(float x, float y, PassRefPtr<ContextMenuProvider
>); |
341 | 339 |
342 // Notifies the WebView that a load has been committed. isNewNavigation | 340 // Notifies the WebView that a load has been committed. isNewNavigation |
343 // will be true if a new session history item should be created for that | 341 // will be true if a new session history item should be created for that |
344 // load. isNavigationWithinPage will be true if the navigation does | 342 // load. isNavigationWithinPage will be true if the navigation does |
345 // not take the user away from the current page. | 343 // not take the user away from the current page. |
346 void didCommitLoad(bool isNewNavigation, bool isNavigationWithinPage); | 344 void didCommitLoad(bool isNewNavigation, bool isNavigationWithinPage); |
347 | 345 |
348 // Indicates two things: | 346 // Indicates two things: |
349 // 1) This view may have a new layout now. | 347 // 1) This view may have a new layout now. |
350 // 2) Calling layout() is a no-op. | 348 // 2) Calling layout() is a no-op. |
(...skipping 13 matching lines...) Expand all Loading... |
364 bool contextMenuAllowed() const | 362 bool contextMenuAllowed() const |
365 { | 363 { |
366 return m_contextMenuAllowed; | 364 return m_contextMenuAllowed; |
367 } | 365 } |
368 | 366 |
369 bool shouldAutoResize() const | 367 bool shouldAutoResize() const |
370 { | 368 { |
371 return m_shouldAutoResize; | 369 return m_shouldAutoResize; |
372 } | 370 } |
373 | 371 |
374 blink::IntSize minAutoSize() const | 372 IntSize minAutoSize() const |
375 { | 373 { |
376 return m_minAutoSize; | 374 return m_minAutoSize; |
377 } | 375 } |
378 | 376 |
379 blink::IntSize maxAutoSize() const | 377 IntSize maxAutoSize() const |
380 { | 378 { |
381 return m_maxAutoSize; | 379 return m_maxAutoSize; |
382 } | 380 } |
383 | 381 |
384 void updateMainFrameLayoutSize(); | 382 void updateMainFrameLayoutSize(); |
385 void updatePageDefinedViewportConstraints(const blink::ViewportDescription&)
; | 383 void updatePageDefinedViewportConstraints(const ViewportDescription&); |
386 | 384 |
387 // Start a system drag and drop operation. | 385 // Start a system drag and drop operation. |
388 void startDragging( | 386 void startDragging( |
389 blink::LocalFrame*, | 387 LocalFrame*, |
390 const WebDragData& dragData, | 388 const WebDragData& dragData, |
391 WebDragOperationsMask mask, | 389 WebDragOperationsMask mask, |
392 const WebImage& dragImage, | 390 const WebImage& dragImage, |
393 const WebPoint& dragImageOffset); | 391 const WebPoint& dragImageOffset); |
394 | 392 |
395 // Notification that a popup was opened/closed. | 393 // Notification that a popup was opened/closed. |
396 void popupOpened(PopupContainer*); | 394 void popupOpened(PopupContainer*); |
397 void popupClosed(PopupContainer*); | 395 void popupClosed(PopupContainer*); |
398 // PagePopupDriver functions. | 396 // PagePopupDriver functions. |
399 virtual blink::PagePopup* openPagePopup(blink::PagePopupClient*, const blink
::IntRect& originBoundsInRootView) OVERRIDE; | 397 virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect& originBoun
dsInRootView) OVERRIDE; |
400 virtual void closePagePopup(blink::PagePopup*) OVERRIDE; | 398 virtual void closePagePopup(PagePopup*) OVERRIDE; |
401 | 399 |
402 // Returns the input event we're currently processing. This is used in some | 400 // Returns the input event we're currently processing. This is used in some |
403 // cases where the WebCore DOM event doesn't have the information we need. | 401 // cases where the WebCore DOM event doesn't have the information we need. |
404 static const WebInputEvent* currentInputEvent() | 402 static const WebInputEvent* currentInputEvent() |
405 { | 403 { |
406 return m_currentInputEvent; | 404 return m_currentInputEvent; |
407 } | 405 } |
408 | 406 |
409 blink::GraphicsLayer* rootGraphicsLayer(); | 407 GraphicsLayer* rootGraphicsLayer(); |
410 void setRootGraphicsLayer(blink::GraphicsLayer*); | 408 void setRootGraphicsLayer(GraphicsLayer*); |
411 void scheduleCompositingLayerSync(); | 409 void scheduleCompositingLayerSync(); |
412 void scrollRootLayer(); | 410 void scrollRootLayer(); |
413 blink::GraphicsLayerFactory* graphicsLayerFactory() const; | 411 GraphicsLayerFactory* graphicsLayerFactory() const; |
414 blink::RenderLayerCompositor* compositor() const; | 412 RenderLayerCompositor* compositor() const; |
415 void registerForAnimations(WebLayer*); | 413 void registerForAnimations(WebLayer*); |
416 void scheduleAnimation(); | 414 void scheduleAnimation(); |
417 | 415 |
418 virtual void setVisibilityState(WebPageVisibilityState, bool) OVERRIDE; | 416 virtual void setVisibilityState(WebPageVisibilityState, bool) OVERRIDE; |
419 | 417 |
420 PopupContainer* selectPopup() const { return m_selectPopup.get(); } | 418 PopupContainer* selectPopup() const { return m_selectPopup.get(); } |
421 bool hasOpenedPopup() const { return m_selectPopup || m_pagePopup; } | 419 bool hasOpenedPopup() const { return m_selectPopup || m_pagePopup; } |
422 | 420 |
423 // Returns true if the event leads to scrolling. | 421 // Returns true if the event leads to scrolling. |
424 static bool mapKeyCodeForScroll(int keyCode, | 422 static bool mapKeyCodeForScroll( |
425 blink::ScrollDirection* scrollDirection, | 423 int keyCode, |
426 blink::ScrollGranularity* scrollGranularity); | 424 ScrollDirection*, |
| 425 ScrollGranularity*); |
427 | 426 |
428 // Called by a full frame plugin inside this view to inform it that its | 427 // Called by a full frame plugin inside this view to inform it that its |
429 // zoom level has been updated. The plugin should only call this function | 428 // zoom level has been updated. The plugin should only call this function |
430 // if the zoom change was triggered by the browser, it's only needed in case | 429 // if the zoom change was triggered by the browser, it's only needed in case |
431 // a plugin can update its own zoom, say because of its own UI. | 430 // a plugin can update its own zoom, say because of its own UI. |
432 void fullFramePluginZoomLevelChanged(double zoomLevel); | 431 void fullFramePluginZoomLevelChanged(double zoomLevel); |
433 | 432 |
434 void computeScaleAndScrollForBlockRect(const WebPoint& hitPoint, const WebRe
ct& blockRect, float padding, float defaultScaleWhenAlreadyLegible, float& scale
, WebPoint& scroll); | 433 void computeScaleAndScrollForBlockRect(const WebPoint& hitPoint, const WebRe
ct& blockRect, float padding, float defaultScaleWhenAlreadyLegible, float& scale
, WebPoint& scroll); |
435 blink::Node* bestTapNode(const blink::PlatformGestureEvent& tapEvent); | 434 Node* bestTapNode(const PlatformGestureEvent& tapEvent); |
436 void enableTapHighlightAtPoint(const blink::PlatformGestureEvent& tapEvent); | 435 void enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent); |
437 void enableTapHighlights(WillBeHeapVector<RawPtrWillBeMember<blink::Node> >&
); | 436 void enableTapHighlights(WillBeHeapVector<RawPtrWillBeMember<Node> >&); |
438 void computeScaleAndScrollForFocusedNode(blink::Node* focusedNode, float& sc
ale, blink::IntPoint& scroll, bool& needAnimation); | 437 void computeScaleAndScrollForFocusedNode(Node* focusedNode, float& scale, In
tPoint& scroll, bool& needAnimation); |
439 | 438 |
440 void animateDoubleTapZoom(const blink::IntPoint&); | 439 void animateDoubleTapZoom(const IntPoint&); |
441 | 440 |
442 void enableFakePageScaleAnimationForTesting(bool); | 441 void enableFakePageScaleAnimationForTesting(bool); |
443 bool fakeDoubleTapAnimationPendingForTesting() const { return m_doubleTapZoo
mPending; } | 442 bool fakeDoubleTapAnimationPendingForTesting() const { return m_doubleTapZoo
mPending; } |
444 blink::IntPoint fakePageScaleAnimationTargetPositionForTesting() const { ret
urn m_fakePageScaleAnimationTargetPosition; } | 443 IntPoint fakePageScaleAnimationTargetPositionForTesting() const { return m_f
akePageScaleAnimationTargetPosition; } |
445 float fakePageScaleAnimationPageScaleForTesting() const { return m_fakePageS
caleAnimationPageScaleFactor; } | 444 float fakePageScaleAnimationPageScaleForTesting() const { return m_fakePageS
caleAnimationPageScaleFactor; } |
446 bool fakePageScaleAnimationUseAnchorForTesting() const { return m_fakePageSc
aleAnimationUseAnchor; } | 445 bool fakePageScaleAnimationUseAnchorForTesting() const { return m_fakePageSc
aleAnimationUseAnchor; } |
447 | 446 |
448 void enterFullScreenForElement(blink::Element*); | 447 void enterFullScreenForElement(Element*); |
449 void exitFullScreenForElement(blink::Element*); | 448 void exitFullScreenForElement(Element*); |
450 | 449 |
451 void clearCompositedSelectionBounds(); | 450 void clearCompositedSelectionBounds(); |
452 | 451 |
453 // Exposed for the purpose of overriding device metrics. | 452 // Exposed for the purpose of overriding device metrics. |
454 void sendResizeEventAndRepaint(); | 453 void sendResizeEventAndRepaint(); |
455 | 454 |
456 // Exposed for testing purposes. | 455 // Exposed for testing purposes. |
457 bool hasHorizontalScrollbar(); | 456 bool hasHorizontalScrollbar(); |
458 bool hasVerticalScrollbar(); | 457 bool hasVerticalScrollbar(); |
459 | 458 |
460 // Pointer Lock calls allow a page to capture all mouse events and | 459 // Pointer Lock calls allow a page to capture all mouse events and |
461 // disable the system cursor. | 460 // disable the system cursor. |
462 bool requestPointerLock(); | 461 bool requestPointerLock(); |
463 void requestPointerUnlock(); | 462 void requestPointerUnlock(); |
464 bool isPointerLocked(); | 463 bool isPointerLocked(); |
465 | 464 |
466 // Heuristic-based function for determining if we should disable workarounds | 465 // Heuristic-based function for determining if we should disable workarounds |
467 // for viewing websites that are not optimized for mobile devices. | 466 // for viewing websites that are not optimized for mobile devices. |
468 bool shouldDisableDesktopWorkarounds(); | 467 bool shouldDisableDesktopWorkarounds(); |
469 | 468 |
470 // Exposed for tests. | 469 // Exposed for tests. |
471 unsigned numLinkHighlights() { return m_linkHighlights.size(); } | 470 unsigned numLinkHighlights() { return m_linkHighlights.size(); } |
472 LinkHighlight* linkHighlight(int i) { return m_linkHighlights[i].get(); } | 471 LinkHighlight* linkHighlight(int i) { return m_linkHighlights[i].get(); } |
473 | 472 |
474 WebSettingsImpl* settingsImpl(); | 473 WebSettingsImpl* settingsImpl(); |
475 | 474 |
476 // Returns the bounding box of the block type node touched by the WebRect. | 475 // Returns the bounding box of the block type node touched by the WebRect. |
477 WebRect computeBlockBounds(const WebRect&, bool ignoreClipping); | 476 WebRect computeBlockBounds(const WebRect&, bool ignoreClipping); |
478 | 477 |
479 blink::IntPoint clampOffsetAtScale(const blink::IntPoint& offset, float scal
e); | 478 IntPoint clampOffsetAtScale(const IntPoint& offset, float scale); |
480 | 479 |
481 // Exposed for tests. | 480 // Exposed for tests. |
482 WebVector<WebCompositionUnderline> compositionUnderlines() const; | 481 WebVector<WebCompositionUnderline> compositionUnderlines() const; |
483 | 482 |
484 WebLayerTreeView* layerTreeView() const { return m_layerTreeView; } | 483 WebLayerTreeView* layerTreeView() const { return m_layerTreeView; } |
485 | 484 |
486 bool pinchVirtualViewportEnabled() const; | 485 bool pinchVirtualViewportEnabled() const; |
487 | 486 |
488 bool matchesHeuristicsForGpuRasterizationForTesting() const { return m_match
esHeuristicsForGpuRasterization; } | 487 bool matchesHeuristicsForGpuRasterizationForTesting() const { return m_match
esHeuristicsForGpuRasterization; } |
489 | 488 |
490 private: | 489 private: |
491 // TODO(bokan): Remains for legacy pinch. Remove once it's gone. Made privat
e to | 490 // TODO(bokan): Remains for legacy pinch. Remove once it's gone. Made privat
e to |
492 // prevent external usage | 491 // prevent external usage |
493 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin) O
VERRIDE; | 492 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin) O
VERRIDE; |
494 | 493 |
495 float legibleScale() const; | 494 float legibleScale() const; |
496 void refreshPageScaleFactorAfterLayout(); | 495 void refreshPageScaleFactorAfterLayout(); |
497 void resumeTreeViewCommits(); | 496 void resumeTreeViewCommits(); |
498 void setUserAgentPageScaleConstraints(blink::PageScaleConstraints newConstra
ints); | 497 void setUserAgentPageScaleConstraints(PageScaleConstraints newConstraints); |
499 float clampPageScaleFactorToLimits(float) const; | 498 float clampPageScaleFactorToLimits(float) const; |
500 blink::IntSize contentsSize() const; | 499 IntSize contentsSize() const; |
501 | 500 |
502 void resetSavedScrollAndScaleState(); | 501 void resetSavedScrollAndScaleState(); |
503 | 502 |
504 void updateMainFrameScrollPosition(const blink::IntPoint& scrollPosition, bo
ol programmaticScroll); | 503 void updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool prog
rammaticScroll); |
505 | 504 |
506 void performResize(); | 505 void performResize(); |
507 | 506 |
508 friend class WebView; // So WebView::Create can call our constructor | 507 friend class WebView; // So WebView::Create can call our constructor |
509 friend class WTF::RefCounted<WebViewImpl>; | 508 friend class WTF::RefCounted<WebViewImpl>; |
510 friend void setCurrentInputEventForTest(const WebInputEvent*); | 509 friend void setCurrentInputEventForTest(const WebInputEvent*); |
511 | 510 |
512 enum DragAction { | 511 enum DragAction { |
513 DragEnter, | 512 DragEnter, |
514 DragOver | 513 DragOver |
(...skipping 12 matching lines...) Expand all Loading... |
527 | 526 |
528 bool confirmComposition(const WebString& text, ConfirmCompositionBehavior); | 527 bool confirmComposition(const WebString& text, ConfirmCompositionBehavior); |
529 | 528 |
530 // Returns true if the view was scrolled. | 529 // Returns true if the view was scrolled. |
531 bool scrollViewWithKeyboard(int keyCode, int modifiers); | 530 bool scrollViewWithKeyboard(int keyCode, int modifiers); |
532 | 531 |
533 void hideSelectPopup(); | 532 void hideSelectPopup(); |
534 | 533 |
535 // Converts |pos| from window coordinates to contents coordinates and gets | 534 // Converts |pos| from window coordinates to contents coordinates and gets |
536 // the HitTestResult for it. | 535 // the HitTestResult for it. |
537 blink::HitTestResult hitTestResultForWindowPos(const blink::IntPoint&); | 536 HitTestResult hitTestResultForWindowPos(const IntPoint&); |
538 | 537 |
539 // Consolidate some common code between starting a drag over a target and | 538 // Consolidate some common code between starting a drag over a target and |
540 // updating a drag over a target. If we're starting a drag, |isEntering| | 539 // updating a drag over a target. If we're starting a drag, |isEntering| |
541 // should be true. | 540 // should be true. |
542 WebDragOperation dragTargetDragEnterOrOver(const WebPoint& clientPoint, | 541 WebDragOperation dragTargetDragEnterOrOver(const WebPoint& clientPoint, |
543 const WebPoint& screenPoint, | 542 const WebPoint& screenPoint, |
544 DragAction, | 543 DragAction, |
545 int keyModifiers); | 544 int keyModifiers); |
546 | 545 |
547 void configureAutoResizeMode(); | 546 void configureAutoResizeMode(); |
548 | 547 |
549 void initializeLayerTreeView(); | 548 void initializeLayerTreeView(); |
550 | 549 |
551 void setIsAcceleratedCompositingActive(bool); | 550 void setIsAcceleratedCompositingActive(bool); |
552 void doComposite(); | 551 void doComposite(); |
553 void reallocateRenderer(); | 552 void reallocateRenderer(); |
554 void updateLayerTreeViewport(); | 553 void updateLayerTreeViewport(); |
555 void updateLayerTreeBackgroundColor(); | 554 void updateLayerTreeBackgroundColor(); |
556 void updateRootLayerTransform(); | 555 void updateRootLayerTransform(); |
557 void updateLayerTreeDeviceScaleFactor(); | 556 void updateLayerTreeDeviceScaleFactor(); |
558 | 557 |
559 // Helper function: Widens the width of |source| by the specified margins | 558 // Helper function: Widens the width of |source| by the specified margins |
560 // while keeping it smaller than page width. | 559 // while keeping it smaller than page width. |
561 WebRect widenRectWithinPageBounds(const WebRect& source, int targetMargin, i
nt minimumMargin); | 560 WebRect widenRectWithinPageBounds(const WebRect& source, int targetMargin, i
nt minimumMargin); |
562 | 561 |
563 void pointerLockMouseEvent(const WebInputEvent&); | 562 void pointerLockMouseEvent(const WebInputEvent&); |
564 | 563 |
565 // PageWidgetEventHandler functions | 564 // PageWidgetEventHandler functions |
566 virtual void handleMouseLeave(blink::LocalFrame&, const WebMouseEvent&) OVER
RIDE; | 565 virtual void handleMouseLeave(LocalFrame&, const WebMouseEvent&) OVERRIDE; |
567 virtual void handleMouseDown(blink::LocalFrame&, const WebMouseEvent&) OVERR
IDE; | 566 virtual void handleMouseDown(LocalFrame&, const WebMouseEvent&) OVERRIDE; |
568 virtual void handleMouseUp(blink::LocalFrame&, const WebMouseEvent&) OVERRID
E; | 567 virtual void handleMouseUp(LocalFrame&, const WebMouseEvent&) OVERRIDE; |
569 virtual bool handleMouseWheel(blink::LocalFrame&, const WebMouseWheelEvent&)
OVERRIDE; | 568 virtual bool handleMouseWheel(LocalFrame&, const WebMouseWheelEvent&) OVERRI
DE; |
570 virtual bool handleGestureEvent(const WebGestureEvent&) OVERRIDE; | 569 virtual bool handleGestureEvent(const WebGestureEvent&) OVERRIDE; |
571 virtual bool handleKeyEvent(const WebKeyboardEvent&) OVERRIDE; | 570 virtual bool handleKeyEvent(const WebKeyboardEvent&) OVERRIDE; |
572 virtual bool handleCharEvent(const WebKeyboardEvent&) OVERRIDE; | 571 virtual bool handleCharEvent(const WebKeyboardEvent&) OVERRIDE; |
573 | 572 |
574 blink::InputMethodContext* inputMethodContext(); | 573 InputMethodContext* inputMethodContext(); |
575 WebPlugin* focusedPluginIfInputMethodSupported(blink::LocalFrame*); | 574 WebPlugin* focusedPluginIfInputMethodSupported(LocalFrame*); |
576 | 575 |
577 WebViewClient* m_client; // Can be 0 (e.g. unittests, shared workers, etc.) | 576 WebViewClient* m_client; // Can be 0 (e.g. unittests, shared workers, etc.) |
578 WebAutofillClient* m_autofillClient; | 577 WebAutofillClient* m_autofillClient; |
579 WebSpellCheckClient* m_spellCheckClient; | 578 WebSpellCheckClient* m_spellCheckClient; |
580 | 579 |
581 ChromeClientImpl m_chromeClientImpl; | 580 ChromeClientImpl m_chromeClientImpl; |
582 ContextMenuClientImpl m_contextMenuClientImpl; | 581 ContextMenuClientImpl m_contextMenuClientImpl; |
583 DragClientImpl m_dragClientImpl; | 582 DragClientImpl m_dragClientImpl; |
584 EditorClientImpl m_editorClientImpl; | 583 EditorClientImpl m_editorClientImpl; |
585 InspectorClientImpl m_inspectorClientImpl; | 584 InspectorClientImpl m_inspectorClientImpl; |
586 BackForwardClientImpl m_backForwardClientImpl; | 585 BackForwardClientImpl m_backForwardClientImpl; |
587 SpellCheckerClientImpl m_spellCheckerClientImpl; | 586 SpellCheckerClientImpl m_spellCheckerClientImpl; |
588 StorageClientImpl m_storageClientImpl; | 587 StorageClientImpl m_storageClientImpl; |
589 | 588 |
590 WebSize m_size; | 589 WebSize m_size; |
591 bool m_fixedLayoutSizeLock; | 590 bool m_fixedLayoutSizeLock; |
592 // If true, automatically resize the render view around its content. | 591 // If true, automatically resize the render view around its content. |
593 bool m_shouldAutoResize; | 592 bool m_shouldAutoResize; |
594 // The lower bound on the size when auto-resizing. | 593 // The lower bound on the size when auto-resizing. |
595 blink::IntSize m_minAutoSize; | 594 IntSize m_minAutoSize; |
596 // The upper bound on the size when auto-resizing. | 595 // The upper bound on the size when auto-resizing. |
597 blink::IntSize m_maxAutoSize; | 596 IntSize m_maxAutoSize; |
598 | 597 |
599 OwnPtrWillBePersistent<blink::Page> m_page; | 598 OwnPtrWillBePersistent<Page> m_page; |
600 | 599 |
601 // An object that can be used to manipulate m_page->settings() without linki
ng | 600 // An object that can be used to manipulate m_page->settings() without linki
ng |
602 // against WebCore. This is lazily allocated the first time GetWebSettings() | 601 // against WebCore. This is lazily allocated the first time GetWebSettings() |
603 // is called. | 602 // is called. |
604 OwnPtr<WebSettingsImpl> m_webSettings; | 603 OwnPtr<WebSettingsImpl> m_webSettings; |
605 | 604 |
606 // A copy of the web drop data object we received from the browser. | 605 // A copy of the web drop data object we received from the browser. |
607 RefPtrWillBePersistent<blink::DataObject> m_currentDragData; | 606 RefPtrWillBePersistent<DataObject> m_currentDragData; |
608 | 607 |
609 // The point relative to the client area where the mouse was last pressed | 608 // The point relative to the client area where the mouse was last pressed |
610 // down. This is used by the drag client to determine what was under the | 609 // down. This is used by the drag client to determine what was under the |
611 // mouse when the drag was initiated. We need to track this here in | 610 // mouse when the drag was initiated. We need to track this here in |
612 // WebViewImpl since DragClient::startDrag does not pass the position the | 611 // WebViewImpl since DragClient::startDrag does not pass the position the |
613 // mouse was at when the drag was initiated, only the current point, which | 612 // mouse was at when the drag was initiated, only the current point, which |
614 // can be misleading as it is usually not over the element the user actually | 613 // can be misleading as it is usually not over the element the user actually |
615 // dragged by the time a drag is initiated. | 614 // dragged by the time a drag is initiated. |
616 WebPoint m_lastMouseDownPoint; | 615 WebPoint m_lastMouseDownPoint; |
617 | 616 |
618 // Keeps track of the current zoom level. 0 means no zoom, positive numbers | 617 // Keeps track of the current zoom level. 0 means no zoom, positive numbers |
619 // mean zoom in, negative numbers mean zoom out. | 618 // mean zoom in, negative numbers mean zoom out. |
620 double m_zoomLevel; | 619 double m_zoomLevel; |
621 | 620 |
622 double m_minimumZoomLevel; | 621 double m_minimumZoomLevel; |
623 | 622 |
624 double m_maximumZoomLevel; | 623 double m_maximumZoomLevel; |
625 | 624 |
626 PageScaleConstraintsSet m_pageScaleConstraintsSet; | 625 PageScaleConstraintsSet m_pageScaleConstraintsSet; |
627 | 626 |
628 // The scale moved to by the latest double tap zoom, if any. | 627 // The scale moved to by the latest double tap zoom, if any. |
629 float m_doubleTapZoomPageScaleFactor; | 628 float m_doubleTapZoomPageScaleFactor; |
630 // Have we sent a double-tap zoom and not yet heard back the scale? | 629 // Have we sent a double-tap zoom and not yet heard back the scale? |
631 bool m_doubleTapZoomPending; | 630 bool m_doubleTapZoomPending; |
632 | 631 |
633 // Used for testing purposes. | 632 // Used for testing purposes. |
634 bool m_enableFakePageScaleAnimationForTesting; | 633 bool m_enableFakePageScaleAnimationForTesting; |
635 blink::IntPoint m_fakePageScaleAnimationTargetPosition; | 634 IntPoint m_fakePageScaleAnimationTargetPosition; |
636 float m_fakePageScaleAnimationPageScaleFactor; | 635 float m_fakePageScaleAnimationPageScaleFactor; |
637 bool m_fakePageScaleAnimationUseAnchor; | 636 bool m_fakePageScaleAnimationUseAnchor; |
638 | 637 |
639 bool m_contextMenuAllowed; | 638 bool m_contextMenuAllowed; |
640 | 639 |
641 bool m_doingDragAndDrop; | 640 bool m_doingDragAndDrop; |
642 | 641 |
643 bool m_ignoreInputEvents; | 642 bool m_ignoreInputEvents; |
644 | 643 |
645 float m_compositorDeviceScaleFactorOverride; | 644 float m_compositorDeviceScaleFactorOverride; |
(...skipping 26 matching lines...) Expand all Loading... |
672 OwnPtr<WebDevToolsAgentPrivate> m_devToolsAgent; | 671 OwnPtr<WebDevToolsAgentPrivate> m_devToolsAgent; |
673 OwnPtr<PageOverlayList> m_pageOverlays; | 672 OwnPtr<PageOverlayList> m_pageOverlays; |
674 | 673 |
675 // Whether the webview is rendering transparently. | 674 // Whether the webview is rendering transparently. |
676 bool m_isTransparent; | 675 bool m_isTransparent; |
677 | 676 |
678 // Whether the user can press tab to focus links. | 677 // Whether the user can press tab to focus links. |
679 bool m_tabsToLinks; | 678 bool m_tabsToLinks; |
680 | 679 |
681 // If set, the (plugin) node which has mouse capture. | 680 // If set, the (plugin) node which has mouse capture. |
682 RefPtrWillBePersistent<blink::Node> m_mouseCaptureNode; | 681 RefPtrWillBePersistent<Node> m_mouseCaptureNode; |
683 RefPtr<blink::UserGestureToken> m_mouseCaptureGestureToken; | 682 RefPtr<UserGestureToken> m_mouseCaptureGestureToken; |
684 | 683 |
685 blink::IntRect m_rootLayerScrollDamage; | 684 IntRect m_rootLayerScrollDamage; |
686 WebLayerTreeView* m_layerTreeView; | 685 WebLayerTreeView* m_layerTreeView; |
687 WebLayer* m_rootLayer; | 686 WebLayer* m_rootLayer; |
688 blink::GraphicsLayer* m_rootGraphicsLayer; | 687 GraphicsLayer* m_rootGraphicsLayer; |
689 blink::GraphicsLayer* m_rootTransformLayer; | 688 GraphicsLayer* m_rootTransformLayer; |
690 OwnPtr<blink::GraphicsLayerFactory> m_graphicsLayerFactory; | 689 OwnPtr<GraphicsLayerFactory> m_graphicsLayerFactory; |
691 bool m_isAcceleratedCompositingActive; | 690 bool m_isAcceleratedCompositingActive; |
692 bool m_layerTreeViewCommitsDeferred; | 691 bool m_layerTreeViewCommitsDeferred; |
693 bool m_layerTreeViewClosed; | 692 bool m_layerTreeViewClosed; |
694 bool m_matchesHeuristicsForGpuRasterization; | 693 bool m_matchesHeuristicsForGpuRasterization; |
695 // If true, the graphics context is being restored. | 694 // If true, the graphics context is being restored. |
696 bool m_recreatingGraphicsContext; | 695 bool m_recreatingGraphicsContext; |
697 static const WebInputEvent* m_currentInputEvent; | 696 static const WebInputEvent* m_currentInputEvent; |
698 | 697 |
699 MediaKeysClientImpl m_mediaKeysClientImpl; | 698 MediaKeysClientImpl m_mediaKeysClientImpl; |
700 OwnPtr<WebActiveGestureAnimation> m_gestureAnimation; | 699 OwnPtr<WebActiveGestureAnimation> m_gestureAnimation; |
(...skipping 16 matching lines...) Expand all Loading... |
717 bool m_userGestureObserved; | 716 bool m_userGestureObserved; |
718 }; | 717 }; |
719 | 718 |
720 // We have no ways to check if the specified WebView is an instance of | 719 // We have no ways to check if the specified WebView is an instance of |
721 // WebViewImpl because WebViewImpl is the only implementation of WebView. | 720 // WebViewImpl because WebViewImpl is the only implementation of WebView. |
722 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); | 721 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); |
723 | 722 |
724 } // namespace blink | 723 } // namespace blink |
725 | 724 |
726 #endif | 725 #endif |
OLD | NEW |