| 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 28 matching lines...) Expand all Loading... |
| 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 "WebInputEvent.h" | 44 #include "WebInputEvent.h" |
| 45 #include "WebNavigationPolicy.h" | 45 #include "WebNavigationPolicy.h" |
| 46 #include "WebView.h" | 46 #include "WebView.h" |
| 47 #include "WebViewBenchmarkSupportImpl.h" | 47 #include "WebViewBenchmarkSupportImpl.h" |
| 48 #include "core/page/PagePopupDriver.h" | 48 #include "core/page/PagePopupDriver.h" |
| 49 #include "core/page/PageScaleConstraintsSet.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" |
| 54 #include <public/WebFloatQuad.h> | 55 #include <public/WebFloatQuad.h> |
| 55 #include <public/WebGestureCurveTarget.h> | 56 #include <public/WebGestureCurveTarget.h> |
| 56 #include <public/WebLayer.h> | 57 #include <public/WebLayer.h> |
| 57 #include <public/WebPoint.h> | 58 #include <public/WebPoint.h> |
| 58 #include <public/WebRect.h> | 59 #include <public/WebRect.h> |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 virtual void scrollFocusedNodeIntoView(); | 218 virtual void scrollFocusedNodeIntoView(); |
| 218 virtual void scrollFocusedNodeIntoRect(const WebRect&); | 219 virtual void scrollFocusedNodeIntoRect(const WebRect&); |
| 219 virtual void zoomToFindInPageRect(const WebRect&); | 220 virtual void zoomToFindInPageRect(const WebRect&); |
| 220 virtual void advanceFocus(bool reverse); | 221 virtual void advanceFocus(bool reverse); |
| 221 virtual double zoomLevel(); | 222 virtual double zoomLevel(); |
| 222 virtual double setZoomLevel(bool textOnly, double zoomLevel); | 223 virtual double setZoomLevel(bool textOnly, double zoomLevel); |
| 223 virtual void zoomLimitsChanged(double minimumZoomLevel, | 224 virtual void zoomLimitsChanged(double minimumZoomLevel, |
| 224 double maximumZoomLevel); | 225 double maximumZoomLevel); |
| 225 virtual void setInitialPageScaleOverride(float); | 226 virtual void setInitialPageScaleOverride(float); |
| 226 virtual float pageScaleFactor() const; | 227 virtual float pageScaleFactor() const; |
| 227 virtual bool isPageScaleFactorSet() const; | |
| 228 virtual void setPageScaleFactorPreservingScrollOffset(float); | 228 virtual void setPageScaleFactorPreservingScrollOffset(float); |
| 229 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin); | 229 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin); |
| 230 virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale
); | 230 virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale
); |
| 231 virtual float minimumPageScaleFactor() const; | 231 virtual float minimumPageScaleFactor() const; |
| 232 virtual float maximumPageScaleFactor() const; | 232 virtual float maximumPageScaleFactor() const; |
| 233 virtual void saveScrollAndScaleState(); | 233 virtual void saveScrollAndScaleState(); |
| 234 virtual void restoreScrollAndScaleState(); | 234 virtual void restoreScrollAndScaleState(); |
| 235 virtual void resetScrollAndScaleState(); | 235 virtual void resetScrollAndScaleState(); |
| 236 virtual void setIgnoreViewportTagMaximumScale(bool); | 236 virtual void setIgnoreViewportTagScaleLimits(bool); |
| 237 | 237 |
| 238 virtual float deviceScaleFactor() const; | 238 virtual float deviceScaleFactor() const; |
| 239 virtual void setDeviceScaleFactor(float); | 239 virtual void setDeviceScaleFactor(float); |
| 240 virtual bool isFixedLayoutModeEnabled() const; | 240 virtual bool isFixedLayoutModeEnabled() const; |
| 241 virtual void enableFixedLayoutMode(bool enable); | 241 virtual void enableFixedLayoutMode(bool enable); |
| 242 virtual WebSize fixedLayoutSize() const; | 242 virtual WebSize fixedLayoutSize() const; |
| 243 virtual void setFixedLayoutSize(const WebSize&); | 243 virtual void setFixedLayoutSize(const WebSize&); |
| 244 virtual void enableAutoResizeMode( | 244 virtual void enableAutoResizeMode( |
| 245 const WebSize& minSize, | 245 const WebSize& minSize, |
| 246 const WebSize& maxSize); | 246 const WebSize& maxSize); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 WebCore::IntSize minAutoSize() const | 434 WebCore::IntSize minAutoSize() const |
| 435 { | 435 { |
| 436 return m_minAutoSize; | 436 return m_minAutoSize; |
| 437 } | 437 } |
| 438 | 438 |
| 439 WebCore::IntSize maxAutoSize() const | 439 WebCore::IntSize maxAutoSize() const |
| 440 { | 440 { |
| 441 return m_maxAutoSize; | 441 return m_maxAutoSize; |
| 442 } | 442 } |
| 443 | 443 |
| 444 WebCore::IntSize scaledSize(float) const; | |
| 445 | |
| 446 // Set the disposition for how this webview is to be initially shown. | 444 // Set the disposition for how this webview is to be initially shown. |
| 447 void setInitialNavigationPolicy(WebNavigationPolicy policy) | 445 void setInitialNavigationPolicy(WebNavigationPolicy policy) |
| 448 { | 446 { |
| 449 m_initialNavigationPolicy = policy; | 447 m_initialNavigationPolicy = policy; |
| 450 } | 448 } |
| 451 WebNavigationPolicy initialNavigationPolicy() const | 449 WebNavigationPolicy initialNavigationPolicy() const |
| 452 { | 450 { |
| 453 return m_initialNavigationPolicy; | 451 return m_initialNavigationPolicy; |
| 454 } | 452 } |
| 455 | 453 |
| 456 // Sets the emulated text zoom factor | 454 // Sets the emulated text zoom factor |
| 457 // (may not be 1 in the device metrics emulation mode). | 455 // (may not be 1 in the device metrics emulation mode). |
| 458 void setEmulatedTextZoomFactor(float); | 456 void setEmulatedTextZoomFactor(float); |
| 459 | 457 |
| 460 // Returns the emulated text zoom factor | 458 // Returns the emulated text zoom factor |
| 461 // (which may not be 1 in the device metrics emulation mode). | 459 // (which may not be 1 in the device metrics emulation mode). |
| 462 float emulatedTextZoomFactor() const | 460 float emulatedTextZoomFactor() const |
| 463 { | 461 { |
| 464 return m_emulatedTextZoomFactor; | 462 return m_emulatedTextZoomFactor; |
| 465 } | 463 } |
| 466 | 464 |
| 467 void setInitialPageScaleFactor(float initialPageScaleFactor) { m_initialPage
ScaleFactor = initialPageScaleFactor; } | 465 void updatePageDefinedPageScaleConstraints(const WebCore::ViewportArguments&
); |
| 468 bool ignoreViewportTagMaximumScale() const { return m_ignoreViewportTagMaxim
umScale; } | |
| 469 | 466 |
| 470 // Determines whether a page should e.g. be opened in a background tab. | 467 // Determines whether a page should e.g. be opened in a background tab. |
| 471 // Returns false if it has no opinion, in which case it doesn't set *policy. | 468 // Returns false if it has no opinion, in which case it doesn't set *policy. |
| 472 static bool navigationPolicyFromMouseEvent( | 469 static bool navigationPolicyFromMouseEvent( |
| 473 unsigned short button, | 470 unsigned short button, |
| 474 bool ctrl, | 471 bool ctrl, |
| 475 bool shift, | 472 bool shift, |
| 476 bool alt, | 473 bool alt, |
| 477 bool meta, | 474 bool meta, |
| 478 WebNavigationPolicy*); | 475 WebNavigationPolicy*); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 // Heuristic-based function for determining if we should disable workarounds | 576 // Heuristic-based function for determining if we should disable workarounds |
| 580 // for viewing websites that are not optimized for mobile devices. | 577 // for viewing websites that are not optimized for mobile devices. |
| 581 bool shouldDisableDesktopWorkarounds(); | 578 bool shouldDisableDesktopWorkarounds(); |
| 582 | 579 |
| 583 // Exposed for tests. | 580 // Exposed for tests. |
| 584 LinkHighlight* linkHighlight() { return m_linkHighlight.get(); } | 581 LinkHighlight* linkHighlight() { return m_linkHighlight.get(); } |
| 585 | 582 |
| 586 WebSettingsImpl* settingsImpl(); | 583 WebSettingsImpl* settingsImpl(); |
| 587 | 584 |
| 588 private: | 585 private: |
| 589 void computePageScaleFactorLimits(); | 586 void refreshPageScaleFactorAfterLayout(); |
| 590 float clampPageScaleFactorToLimits(float scale); | 587 void setUserAgentPageScaleConstraints(WebCore::PageScaleConstraints newConst
raints); |
| 591 WebCore::IntPoint clampOffsetAtScale(const WebCore::IntPoint& offset, float
scale) const; | 588 float clampPageScaleFactorToLimits(float) const; |
| 589 WebCore::IntPoint clampOffsetAtScale(const WebCore::IntPoint& offset, float
scale); |
| 592 WebCore::IntSize contentsSize() const; | 590 WebCore::IntSize contentsSize() const; |
| 593 | 591 |
| 594 void resetSavedScrollAndScaleState(); | 592 void resetSavedScrollAndScaleState(); |
| 595 | 593 |
| 596 void updateMainFrameScrollPosition(const WebCore::IntPoint& scrollPosition,
bool programmaticScroll); | 594 void updateMainFrameScrollPosition(const WebCore::IntPoint& scrollPosition,
bool programmaticScroll); |
| 597 | 595 |
| 598 friend class WebView; // So WebView::Create can call our constructor | 596 friend class WebView; // So WebView::Create can call our constructor |
| 599 friend class WTF::RefCounted<WebViewImpl>; | 597 friend class WTF::RefCounted<WebViewImpl>; |
| 600 friend void setCurrentInputEventForTest(const WebInputEvent*); | 598 friend void setCurrentInputEventForTest(const WebInputEvent*); |
| 601 | 599 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 WebPoint m_lastMouseDownPoint; | 709 WebPoint m_lastMouseDownPoint; |
| 712 | 710 |
| 713 // Keeps track of the current zoom level. 0 means no zoom, positive numbers | 711 // Keeps track of the current zoom level. 0 means no zoom, positive numbers |
| 714 // mean zoom in, negative numbers mean zoom out. | 712 // mean zoom in, negative numbers mean zoom out. |
| 715 double m_zoomLevel; | 713 double m_zoomLevel; |
| 716 | 714 |
| 717 double m_minimumZoomLevel; | 715 double m_minimumZoomLevel; |
| 718 | 716 |
| 719 double m_maximumZoomLevel; | 717 double m_maximumZoomLevel; |
| 720 | 718 |
| 721 // State related to the page scale | 719 WebCore::PageScaleConstraintsSet m_pageScaleConstraintsSet; |
| 722 float m_pageDefinedMinimumPageScaleFactor; | |
| 723 float m_pageDefinedMaximumPageScaleFactor; | |
| 724 float m_minimumPageScaleFactor; | |
| 725 float m_maximumPageScaleFactor; | |
| 726 float m_initialPageScaleFactorOverride; | |
| 727 float m_initialPageScaleFactor; | |
| 728 bool m_ignoreViewportTagMaximumScale; | |
| 729 bool m_pageScaleFactorIsSet; | |
| 730 | 720 |
| 731 // Saved page scale state. | 721 // Saved page scale state. |
| 732 float m_savedPageScaleFactor; // 0 means that no page scale factor is saved. | 722 float m_savedPageScaleFactor; // 0 means that no page scale factor is saved. |
| 733 WebCore::IntSize m_savedScrollOffset; | 723 WebCore::IntSize m_savedScrollOffset; |
| 734 | 724 |
| 735 // The scale moved to by the latest double tap zoom, if any. | 725 // The scale moved to by the latest double tap zoom, if any. |
| 736 float m_doubleTapZoomPageScaleFactor; | 726 float m_doubleTapZoomPageScaleFactor; |
| 737 // Have we sent a double-tap zoom and not yet heard back the scale? | 727 // Have we sent a double-tap zoom and not yet heard back the scale? |
| 738 bool m_doubleTapZoomPending; | 728 bool m_doubleTapZoomPending; |
| 739 | 729 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 | 850 |
| 861 bool m_showFPSCounter; | 851 bool m_showFPSCounter; |
| 862 bool m_showPaintRects; | 852 bool m_showPaintRects; |
| 863 bool m_showDebugBorders; | 853 bool m_showDebugBorders; |
| 864 bool m_continuousPaintingEnabled; | 854 bool m_continuousPaintingEnabled; |
| 865 }; | 855 }; |
| 866 | 856 |
| 867 } // namespace WebKit | 857 } // namespace WebKit |
| 868 | 858 |
| 869 #endif | 859 #endif |
| OLD | NEW |