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 23 matching lines...) Expand all Loading... |
34 #include "BackForwardClientImpl.h" | 34 #include "BackForwardClientImpl.h" |
35 #include "ChromeClientImpl.h" | 35 #include "ChromeClientImpl.h" |
36 #include "ContextMenuClientImpl.h" | 36 #include "ContextMenuClientImpl.h" |
37 #include "DragClientImpl.h" | 37 #include "DragClientImpl.h" |
38 #include "EditorClientImpl.h" | 38 #include "EditorClientImpl.h" |
39 #include "InspectorClientImpl.h" | 39 #include "InspectorClientImpl.h" |
40 #include "NotificationPresenterImpl.h" | 40 #include "NotificationPresenterImpl.h" |
41 #include "PageOverlayList.h" | 41 #include "PageOverlayList.h" |
42 #include "PageWidgetDelegate.h" | 42 #include "PageWidgetDelegate.h" |
43 #include "UserMediaClientImpl.h" | 43 #include "UserMediaClientImpl.h" |
| 44 #include "ViewportAttributesManager.h" |
44 #include "WebInputEvent.h" | 45 #include "WebInputEvent.h" |
45 #include "WebNavigationPolicy.h" | 46 #include "WebNavigationPolicy.h" |
46 #include "WebView.h" | 47 #include "WebView.h" |
47 #include "WebViewBenchmarkSupportImpl.h" | 48 #include "WebViewBenchmarkSupportImpl.h" |
48 #include "core/page/PagePopupDriver.h" | 49 #include "core/page/PagePopupDriver.h" |
49 #include "core/platform/graphics/FloatSize.h" | 50 #include "core/platform/graphics/FloatSize.h" |
50 #include "core/platform/graphics/GraphicsContext3D.h" | 51 #include "core/platform/graphics/GraphicsContext3D.h" |
51 #include "core/platform/graphics/GraphicsLayer.h" | 52 #include "core/platform/graphics/GraphicsLayer.h" |
52 #include "core/platform/graphics/IntPoint.h" | 53 #include "core/platform/graphics/IntPoint.h" |
53 #include "core/platform/graphics/IntRect.h" | 54 #include "core/platform/graphics/IntRect.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 virtual void scrollFocusedNodeIntoView(); | 220 virtual void scrollFocusedNodeIntoView(); |
220 virtual void scrollFocusedNodeIntoRect(const WebRect&); | 221 virtual void scrollFocusedNodeIntoRect(const WebRect&); |
221 virtual void zoomToFindInPageRect(const WebRect&); | 222 virtual void zoomToFindInPageRect(const WebRect&); |
222 virtual void advanceFocus(bool reverse); | 223 virtual void advanceFocus(bool reverse); |
223 virtual double zoomLevel(); | 224 virtual double zoomLevel(); |
224 virtual double setZoomLevel(bool textOnly, double zoomLevel); | 225 virtual double setZoomLevel(bool textOnly, double zoomLevel); |
225 virtual void zoomLimitsChanged(double minimumZoomLevel, | 226 virtual void zoomLimitsChanged(double minimumZoomLevel, |
226 double maximumZoomLevel); | 227 double maximumZoomLevel); |
227 virtual void setInitialPageScaleOverride(float); | 228 virtual void setInitialPageScaleOverride(float); |
228 virtual float pageScaleFactor() const; | 229 virtual float pageScaleFactor() const; |
229 virtual bool isPageScaleFactorSet() const; | |
230 virtual void setPageScaleFactorPreservingScrollOffset(float); | 230 virtual void setPageScaleFactorPreservingScrollOffset(float); |
231 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin); | 231 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin); |
232 virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale
); | 232 virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale
); |
233 virtual float minimumPageScaleFactor() const; | 233 virtual float minimumPageScaleFactor() const; |
234 virtual float maximumPageScaleFactor() const; | 234 virtual float maximumPageScaleFactor() const; |
235 virtual void saveScrollAndScaleState(); | 235 virtual void saveScrollAndScaleState(); |
236 virtual void restoreScrollAndScaleState(); | 236 virtual void restoreScrollAndScaleState(); |
237 virtual void resetScrollAndScaleState(); | 237 virtual void resetScrollAndScaleState(); |
238 virtual void setIgnoreViewportTagMaximumScale(bool); | 238 virtual void setIgnoreViewportTagScaleLimits(bool); |
239 | 239 |
240 virtual float deviceScaleFactor() const; | 240 virtual float deviceScaleFactor() const; |
241 virtual void setDeviceScaleFactor(float); | 241 virtual void setDeviceScaleFactor(float); |
242 virtual bool isFixedLayoutModeEnabled() const; | 242 virtual bool isFixedLayoutModeEnabled() const; |
243 virtual void enableFixedLayoutMode(bool enable); | 243 virtual void enableFixedLayoutMode(bool enable); |
244 virtual WebSize fixedLayoutSize() const; | 244 virtual WebSize fixedLayoutSize() const; |
245 virtual void setFixedLayoutSize(const WebSize&); | 245 virtual void setFixedLayoutSize(const WebSize&); |
246 virtual void enableAutoResizeMode( | 246 virtual void enableAutoResizeMode( |
247 const WebSize& minSize, | 247 const WebSize& minSize, |
248 const WebSize& maxSize); | 248 const WebSize& maxSize); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 WebCore::IntSize minAutoSize() const | 436 WebCore::IntSize minAutoSize() const |
437 { | 437 { |
438 return m_minAutoSize; | 438 return m_minAutoSize; |
439 } | 439 } |
440 | 440 |
441 WebCore::IntSize maxAutoSize() const | 441 WebCore::IntSize maxAutoSize() const |
442 { | 442 { |
443 return m_maxAutoSize; | 443 return m_maxAutoSize; |
444 } | 444 } |
445 | 445 |
446 WebCore::IntSize scaledSize(float) const; | |
447 | |
448 // Set the disposition for how this webview is to be initially shown. | 446 // Set the disposition for how this webview is to be initially shown. |
449 void setInitialNavigationPolicy(WebNavigationPolicy policy) | 447 void setInitialNavigationPolicy(WebNavigationPolicy policy) |
450 { | 448 { |
451 m_initialNavigationPolicy = policy; | 449 m_initialNavigationPolicy = policy; |
452 } | 450 } |
453 WebNavigationPolicy initialNavigationPolicy() const | 451 WebNavigationPolicy initialNavigationPolicy() const |
454 { | 452 { |
455 return m_initialNavigationPolicy; | 453 return m_initialNavigationPolicy; |
456 } | 454 } |
457 | 455 |
458 // Sets the emulated text zoom factor | 456 // Sets the emulated text zoom factor |
459 // (may not be 1 in the device metrics emulation mode). | 457 // (may not be 1 in the device metrics emulation mode). |
460 void setEmulatedTextZoomFactor(float); | 458 void setEmulatedTextZoomFactor(float); |
461 | 459 |
462 // Returns the emulated text zoom factor | 460 // Returns the emulated text zoom factor |
463 // (which may not be 1 in the device metrics emulation mode). | 461 // (which may not be 1 in the device metrics emulation mode). |
464 float emulatedTextZoomFactor() const | 462 float emulatedTextZoomFactor() const |
465 { | 463 { |
466 return m_emulatedTextZoomFactor; | 464 return m_emulatedTextZoomFactor; |
467 } | 465 } |
468 | 466 |
469 void setInitialPageScaleFactor(float initialPageScaleFactor) { m_initialPage
ScaleFactor = initialPageScaleFactor; } | 467 void updatePageDefinedViewportConstraints(const WebCore::ViewportArguments&)
; |
470 bool ignoreViewportTagMaximumScale() const { return m_ignoreViewportTagMaxim
umScale; } | |
471 | 468 |
472 // Determines whether a page should e.g. be opened in a background tab. | 469 // Determines whether a page should e.g. be opened in a background tab. |
473 // Returns false if it has no opinion, in which case it doesn't set *policy. | 470 // Returns false if it has no opinion, in which case it doesn't set *policy. |
474 static bool navigationPolicyFromMouseEvent( | 471 static bool navigationPolicyFromMouseEvent( |
475 unsigned short button, | 472 unsigned short button, |
476 bool ctrl, | 473 bool ctrl, |
477 bool shift, | 474 bool shift, |
478 bool alt, | 475 bool alt, |
479 bool meta, | 476 bool meta, |
480 WebNavigationPolicy*); | 477 WebNavigationPolicy*); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 // Heuristic-based function for determining if we should disable workarounds | 584 // Heuristic-based function for determining if we should disable workarounds |
588 // for viewing websites that are not optimized for mobile devices. | 585 // for viewing websites that are not optimized for mobile devices. |
589 bool shouldDisableDesktopWorkarounds(); | 586 bool shouldDisableDesktopWorkarounds(); |
590 | 587 |
591 // Exposed for tests. | 588 // Exposed for tests. |
592 LinkHighlight* linkHighlight() { return m_linkHighlight.get(); } | 589 LinkHighlight* linkHighlight() { return m_linkHighlight.get(); } |
593 | 590 |
594 WebSettingsImpl* settingsImpl(); | 591 WebSettingsImpl* settingsImpl(); |
595 | 592 |
596 private: | 593 private: |
597 void computePageScaleFactorLimits(); | 594 void refreshPageScaleFactorAfterLayout(); |
598 float clampPageScaleFactorToLimits(float scale); | 595 void setUserAgentViewportConstraints(WebCore::ViewportAttributes newConstrai
nts); |
599 WebCore::IntPoint clampOffsetAtScale(const WebCore::IntPoint& offset, float
scale) const; | 596 float clampPageScaleFactorToLimits(float) const; |
| 597 WebCore::IntPoint clampOffsetAtScale(const WebCore::IntPoint& offset, float
scale); |
600 WebCore::IntSize contentsSize() const; | 598 WebCore::IntSize contentsSize() const; |
601 | 599 |
602 void resetSavedScrollAndScaleState(); | 600 void resetSavedScrollAndScaleState(); |
603 | 601 |
604 void updateMainFrameScrollPosition(const WebCore::IntPoint& scrollPosition,
bool programmaticScroll); | 602 void updateMainFrameScrollPosition(const WebCore::IntPoint& scrollPosition,
bool programmaticScroll); |
605 | 603 |
606 friend class WebView; // So WebView::Create can call our constructor | 604 friend class WebView; // So WebView::Create can call our constructor |
607 friend class WTF::RefCounted<WebViewImpl>; | 605 friend class WTF::RefCounted<WebViewImpl>; |
608 friend void setCurrentInputEventForTest(const WebInputEvent*); | 606 friend void setCurrentInputEventForTest(const WebInputEvent*); |
609 | 607 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 WebPoint m_lastMouseDownPoint; | 717 WebPoint m_lastMouseDownPoint; |
720 | 718 |
721 // Keeps track of the current zoom level. 0 means no zoom, positive numbers | 719 // Keeps track of the current zoom level. 0 means no zoom, positive numbers |
722 // mean zoom in, negative numbers mean zoom out. | 720 // mean zoom in, negative numbers mean zoom out. |
723 double m_zoomLevel; | 721 double m_zoomLevel; |
724 | 722 |
725 double m_minimumZoomLevel; | 723 double m_minimumZoomLevel; |
726 | 724 |
727 double m_maximumZoomLevel; | 725 double m_maximumZoomLevel; |
728 | 726 |
729 // State related to the page scale | 727 ViewportAttributesManager m_viewportAttributesManager; |
730 float m_pageDefinedMinimumPageScaleFactor; | |
731 float m_pageDefinedMaximumPageScaleFactor; | |
732 float m_minimumPageScaleFactor; | |
733 float m_maximumPageScaleFactor; | |
734 float m_initialPageScaleFactorOverride; | |
735 float m_initialPageScaleFactor; | |
736 bool m_ignoreViewportTagMaximumScale; | |
737 bool m_pageScaleFactorIsSet; | |
738 | 728 |
739 // Saved page scale state. | 729 // Saved page scale state. |
740 float m_savedPageScaleFactor; // 0 means that no page scale factor is saved. | 730 float m_savedPageScaleFactor; // 0 means that no page scale factor is saved. |
741 WebCore::IntSize m_savedScrollOffset; | 731 WebCore::IntSize m_savedScrollOffset; |
742 | 732 |
743 // The scale moved to by the latest double tap zoom, if any. | 733 // The scale moved to by the latest double tap zoom, if any. |
744 float m_doubleTapZoomPageScaleFactor; | 734 float m_doubleTapZoomPageScaleFactor; |
745 // Have we sent a double-tap zoom and not yet heard back the scale? | 735 // Have we sent a double-tap zoom and not yet heard back the scale? |
746 bool m_doubleTapZoomPending; | 736 bool m_doubleTapZoomPending; |
747 | 737 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 | 860 |
871 bool m_showFPSCounter; | 861 bool m_showFPSCounter; |
872 bool m_showPaintRects; | 862 bool m_showPaintRects; |
873 bool m_showDebugBorders; | 863 bool m_showDebugBorders; |
874 bool m_continuousPaintingEnabled; | 864 bool m_continuousPaintingEnabled; |
875 }; | 865 }; |
876 | 866 |
877 } // namespace WebKit | 867 } // namespace WebKit |
878 | 868 |
879 #endif | 869 #endif |
OLD | NEW |