Advertisement
Guest User

Untitled

a guest
May 17th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 8.67 KB | None | 0 0
  1. diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp
  2. index 20c5643..2c2b8bf 100644
  3. --- a/Source/WebCore/page/Settings.cpp
  4. +++ b/Source/WebCore/page/Settings.cpp
  5. @@ -130,6 +130,7 @@ Settings::Settings(Page* page)
  6.      , m_defaultFontSize(0)
  7.      , m_defaultFixedFontSize(0)
  8.      , m_defaultDeviceScaleFactor(1)
  9. +    , m_applyDefaultDeviceScaleFactorInCompositor(false)
  10.      , m_validationMessageTimerMagnification(50)
  11.      , m_minimumAccelerated2dCanvasSize(257 * 256)
  12.      , m_layoutFallbackWidth(980)
  13. @@ -398,6 +399,11 @@ void Settings::setDefaultDeviceScaleFactor(int defaultDeviceScaleFactor)
  14.      m_defaultDeviceScaleFactor = defaultDeviceScaleFactor;
  15.  }
  16.  
  17. +void Settings::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor)
  18. +{
  19. +    m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor;
  20. +}
  21. +
  22.  void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
  23.  {
  24.      m_loadsImagesAutomatically = loadsImagesAutomatically;
  25. diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h
  26. index d5ca684..05cf323 100644
  27. --- a/Source/WebCore/page/Settings.h
  28. +++ b/Source/WebCore/page/Settings.h
  29. @@ -106,6 +106,9 @@ namespace WebCore {
  30.          void setDefaultDeviceScaleFactor(int);
  31.          int defaultDeviceScaleFactor() const { return m_defaultDeviceScaleFactor; }
  32.  
  33. +        void setApplyDefaultDeviceScaleFactorInCompositor(bool);
  34. +        bool applyDefaultDeviceScaleFactorInCompositor() const { return m_applyDefaultDeviceScaleFactorInCompositor; }
  35. +
  36.          // Unlike areImagesEnabled, this only suppresses the network load of
  37.          // the image URL.  A cached image will still be rendered if requested.
  38.          void setLoadsImagesAutomatically(bool);
  39. @@ -592,6 +595,7 @@ namespace WebCore {
  40.          int m_defaultFontSize;
  41.          int m_defaultFixedFontSize;
  42.          int m_defaultDeviceScaleFactor;
  43. +        bool m_applyDefaultDeviceScaleFactorInCompositor;
  44.          int m_validationMessageTimerMagnification;
  45.          int m_minimumAccelerated2dCanvasSize;
  46.          int m_layoutFallbackWidth;
  47. diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h
  48. index aad1b9d..885e69a 100644
  49. --- a/Source/WebKit/chromium/public/WebSettings.h
  50. +++ b/Source/WebKit/chromium/public/WebSettings.h
  51. @@ -63,6 +63,7 @@ public:
  52.      virtual void setMinimumFontSize(int) = 0;
  53.      virtual void setMinimumLogicalFontSize(int) = 0;
  54.      virtual void setDefaultDeviceScaleFactor(int) = 0;
  55. +    virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0;
  56.      virtual void setDefaultTextEncodingName(const WebString&) = 0;
  57.      virtual void setJavaScriptEnabled(bool) = 0;
  58.      virtual void setWebSecurityEnabled(bool) = 0;
  59. diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp
  60. index 2a2462a..ef90cd7 100644
  61. --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp
  62. +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp
  63. @@ -115,6 +115,11 @@ void WebSettingsImpl::setDefaultDeviceScaleFactor(int defaultDeviceScaleFactor)
  64.      m_settings->setDefaultDeviceScaleFactor(defaultDeviceScaleFactor);
  65.  }
  66.  
  67. +void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDefaultDeviceScaleFactorInCompositor)
  68. +{
  69. +    m_settings->setApplyDefaultDeviceScaleFactorInCompositor(applyDefaultDeviceScaleFactorInCompositor);
  70. +}
  71. +
  72.  void WebSettingsImpl::setDefaultTextEncodingName(const WebString& encoding)
  73.  {
  74.      m_settings->setDefaultTextEncodingName((String)encoding);
  75. diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h
  76. index e159214..e07fd6c 100644
  77. --- a/Source/WebKit/chromium/src/WebSettingsImpl.h
  78. +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h
  79. @@ -55,6 +55,7 @@ public:
  80.      virtual void setMinimumFontSize(int);
  81.      virtual void setMinimumLogicalFontSize(int);
  82.      virtual void setDefaultDeviceScaleFactor(int);
  83. +    virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool);
  84.      virtual void setDefaultTextEncodingName(const WebString&);
  85.      virtual void setJavaScriptEnabled(bool);
  86.      virtual void setWebSecurityEnabled(bool);
  87. diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp
  88. index 88f86c2..baac307 100644
  89. --- a/Source/WebKit/chromium/src/WebViewImpl.cpp
  90. +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp
  91. @@ -977,10 +977,10 @@ void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZo
  92.          // need to zoom in further when automatically determining zoom level
  93.          // (after double tap, find in page, etc), though the user should still
  94.          // be allowed to manually pinch zoom in further if they desire.
  95. -        const float maxScale = deviceScaleFactor() / m_deviceScaleInCompositor;
  96. +        const float maxScale = deviceScaleFactor();
  97.  
  98. -        const float defaultMargin = doubleTapZoomContentDefaultMargin * (deviceScaleFactor() / m_deviceScaleInCompositor);
  99. -        const float minimumMargin = doubleTapZoomContentMinimumMargin * (deviceScaleFactor() / m_deviceScaleInCompositor);
  100. +        const float defaultMargin = doubleTapZoomContentDefaultMargin * deviceScaleFactor();
  101. +        const float minimumMargin = doubleTapZoomContentMinimumMargin * deviceScaleFactor();
  102.          // We want the margins to have the same physical size, which means we
  103.          // need to express them in post-scale size. To do that we'd need to know
  104.          // the scale we're scaling to, but that depends on the margins. Instead
  105. @@ -3404,9 +3404,9 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
  106.          m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this));
  107.          m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
  108.  
  109. -        m_deviceScaleInCompositor = page()->settings()->defaultDeviceScaleFactor();
  110. -        layerTreeViewSettings.deviceScaleFactor = m_deviceScaleInCompositor;
  111. -        if (m_deviceScaleInCompositor != 1) {
  112. +        if (page()->settings()->applyDefaultDeviceScaleFactorInCompositor() && page()->settings()->defaultDeviceScaleFactor() != 1) {
  113. +            m_deviceScaleInCompositor = page()->settings()->defaultDeviceScaleFactor();
  114. +            layerTreeViewSettings.deviceScaleFactor = m_deviceScaleInCompositor;
  115.              setDeviceScaleFactor(m_deviceScaleInCompositor);
  116.              // When applying a scale factor in the compositor, we disallow page
  117.              // scaling as they are currently incompatible.
  118. diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp
  119. index 3cf3835..74251f3 100644
  120. --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp
  121. +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp
  122. @@ -229,10 +229,6 @@ TEST_F(WebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag)
  123.      WebView* webView = static_cast<WebView*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "no_viewport_tag.html", true, 0, &client));
  124.  
  125.      webView->settings()->setViewportEnabled(true);
  126. -    // Setting the defaultDeviceScaleFactor after initialization of the WebView
  127. -    // will avoid the compositor using the value. This gives the desired
  128. -    // behaviour when fixed-layout mode is being used. In this case, the device
  129. -    // scale factor will be used as part of the page scale.
  130.      webView->settings()->setDefaultDeviceScaleFactor(2);
  131.      webView->enableFixedLayoutMode(true);
  132.      webView->resize(WebSize(viewportWidth, viewportHeight));
  133. @@ -254,14 +250,7 @@ TEST_F(WebFrameTest, DivAutoZoomParamsTest)
  134.  {
  135.      registerMockedHttpURLLoad("get_scale_for_auto_zoom_into_div_test.html");
  136.  
  137. -    int viewportWidth = 640;
  138. -    int viewportHeight = 480;
  139. -
  140. -    FixedLayoutTestWebViewClient client;
  141. -    client.m_screenInfo.horizontalDPI = 160;
  142. -    client.m_windowRect = WebRect(0, 0, viewportWidth, viewportHeight);
  143. -
  144. -    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_div_test.html", true, 0, &client));
  145. +    WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(m_baseURL + "get_scale_for_auto_zoom_into_div_test.html", true));
  146.      int pageWidth = 640;
  147.      int pageHeight = 480;
  148.      int divPosX = 200;
  149. @@ -273,9 +262,6 @@ TEST_F(WebFrameTest, DivAutoZoomParamsTest)
  150.      float scale;
  151.      WebPoint scroll;
  152.  
  153. -    // Enable fixed layout mode to make deviceScale a component of pageScale.
  154. -    webViewImpl->enableFixedLayoutMode(true);
  155. -
  156.      // Test for Doubletap scaling
  157.  
  158.      // Tests for zooming in and out without clamping.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement