2009-11-12 Benjamin Poulain <benjamin.poulain@nokia.com>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Nov 2009 13:52:50 +0000 (13:52 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Nov 2009 13:52:50 +0000 (13:52 +0000)
        Reviewed by Kenneth Rohde Christiansen.

        Custom printing shrink factors
        https://bugs.webkit.org/show_bug.cgi?id=29042

        This reverts commit r49769. The public API for this needs to be reviewed
        before its inclusion in Qt.

        * page/PrintContext.cpp:
        (WebCore::PrintContext::begin):
        * page/Settings.cpp:
        (WebCore::Settings::Settings):
        * page/Settings.h:
2009-11-12  Benjamin Poulain  <benjamin.poulain@nokia.com>

        Reviewed by Kenneth Rohde Christiansen.

        Custom printing shrink factors
        https://bugs.webkit.org/show_bug.cgi?id=29042

        This reverts commit r49769. The public API for this needs to be reviewed
        before its inclusion in Qt.

        * Api/qwebsettings.cpp:
        (QWebSettingsPrivate::apply):
        (QWebSettings::QWebSettings):
        * Api/qwebsettings.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@50876 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/PrintContext.cpp
WebCore/page/Settings.cpp
WebCore/page/Settings.h
WebKit/qt/Api/qwebsettings.cpp
WebKit/qt/Api/qwebsettings.h
WebKit/qt/ChangeLog

index 2693e8e7f36b3b903a1926dfd6b6c8f4ab1247d7..9f304285e133c92e1665d02b0a6f87c6099cbea0 100644 (file)
@@ -1,3 +1,19 @@
+2009-11-12  Benjamin Poulain  <benjamin.poulain@nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Custom printing shrink factors
+        https://bugs.webkit.org/show_bug.cgi?id=29042
+
+        This reverts commit r49769. The public API for this needs to be reviewed
+        before its inclusion in Qt.
+
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::begin):
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        * page/Settings.h:
+
 2009-11-12  Alexander Pavlov  <apavlov@chromium.org>
 
         Reviewed by Pavel Feldman.
index bba678a7169f22e54fdefc072fc33722b4556d9d..4d3a839927efdff3fc8853aa68e056bf0363e131 100644 (file)
@@ -25,7 +25,6 @@
 #include "Frame.h"
 #include "FrameView.h"
 #include "RenderView.h"
-#include "Settings.h"
 
 using namespace WebCore;
 
@@ -96,23 +95,18 @@ void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig
 
 void PrintContext::begin(float width)
 {
-    float PrintingMinimumShrinkFactor = m_frame->settings() ? m_frame->settings()->printingMinimumShrinkFactor() : 0.0f;
-    float PrintingMaximumShrinkFactor = m_frame->settings() ? m_frame->settings()->printingMaximumShrinkFactor() : 0.0f;
-
-    if (PrintingMaximumShrinkFactor < PrintingMinimumShrinkFactor || PrintingMinimumShrinkFactor <= 0.0f) {
-        // By imaging to a width a little wider than the available pixels,
-        // thin pages will be scaled down a little, matching the way they
-        // print in IE and Camino. This lets them use fewer sheets than they
-        // would otherwise, which is presumably why other browsers do this.
-        // Wide pages will be scaled down more than this.
-        PrintingMinimumShrinkFactor = 1.25f;
-
-        // This number determines how small we are willing to reduce the page content
-        // in order to accommodate the widest line. If the page would have to be
-        // reduced smaller to make the widest line fit, we just clip instead (this
-        // behavior matches MacIE and Mozilla, at least)
-        PrintingMaximumShrinkFactor = 2.0f;
-    }
+    // By imaging to a width a little wider than the available pixels,
+    // thin pages will be scaled down a little, matching the way they
+    // print in IE and Camino. This lets them use fewer sheets than they
+    // would otherwise, which is presumably why other browsers do this.
+    // Wide pages will be scaled down more than this.
+    const float PrintingMinimumShrinkFactor = 1.25f;
+
+    // This number determines how small we are willing to reduce the page content
+    // in order to accommodate the widest line. If the page would have to be
+    // reduced smaller to make the widest line fit, we just clip instead (this
+    // behavior matches MacIE and Mozilla, at least)
+    const float PrintingMaximumShrinkFactor = 2.0f;
 
     float minLayoutWidth = width * PrintingMinimumShrinkFactor;
     float maxLayoutWidth = width * PrintingMaximumShrinkFactor;
index c57c56d342d9b3c482912028fb199140c525f8d0..c3cc6a2757b01750a836a3f5b3c8fc02df91b110 100644 (file)
@@ -63,8 +63,6 @@ Settings::Settings(Page* page)
     , m_maximumDecodedImageSize(numeric_limits<size_t>::max())
     , m_localStorageQuota(5 * 1024 * 1024)  // Suggested by the HTML5 spec.
     , m_pluginAllowedRunTime(numeric_limits<unsigned>::max())
-    , m_printingMinimumShrinkFactor(0.0f)
-    , m_printingMaximumShrinkFactor(0.0f)
     , m_isJavaEnabled(false)
     , m_loadsImagesAutomatically(false)
     , m_privateBrowsingEnabled(false)
@@ -525,14 +523,4 @@ void Settings::setWebGLEnabled(bool enabled)
     m_webGLEnabled = enabled;
 }
 
-void Settings::setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor)
-{
-    m_printingMinimumShrinkFactor = printingMinimumShrinkFactor;
-}    
-
-void Settings::setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor)
-{
-    m_printingMaximumShrinkFactor = printingMaximumShrinkFactor;
-}    
-
 } // namespace WebCore
index 9cb43624d391fa28ee7756b6f22cfdccdbbba33a..a215a3e2160c7decd97576291835d0aa17b439ce 100644 (file)
@@ -267,12 +267,6 @@ namespace WebCore {
         void setWebGLEnabled(bool);
         bool webGLEnabled() const { return m_webGLEnabled; }
 
-        void setPrintingMinimumShrinkFactor(float);
-        float printingMinimumShrinkFactor() const { return m_printingMinimumShrinkFactor; }
-
-        void setPrintingMaximumShrinkFactor(float);
-        float printingMaximumShrinkFactor() const { return m_printingMaximumShrinkFactor; }
-
     private:
         Page* m_page;
         
@@ -295,8 +289,6 @@ namespace WebCore {
         size_t m_maximumDecodedImageSize;
         unsigned m_localStorageQuota;
         unsigned m_pluginAllowedRunTime;
-        float m_printingMinimumShrinkFactor;
-        float m_printingMaximumShrinkFactor;
         bool m_isJavaEnabled : 1;
         bool m_loadsImagesAutomatically : 1;
         bool m_privateBrowsingEnabled : 1;
index ff86e1f1ad212a7f467e346f450e11d24cbed1be..490fe92f7af969caea68b786cb00861b5af531a5 100644 (file)
@@ -62,8 +62,6 @@ public:
     QString localStoragePath;
     QString offlineWebApplicationCachePath;
     qint64 offlineStorageDefaultQuota;
-    float printingMinimumShrinkFactor;
-    float printingMaximumShrinkFactor;
 
     void apply();
     WebCore::Settings* settings;
@@ -176,12 +174,6 @@ void QWebSettingsPrivate::apply()
         QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath;
         settings->setLocalStorageDatabasePath(storagePath);
 
-        float minimumShrinkFactor = printingMinimumShrinkFactor > 0.0f ? printingMinimumShrinkFactor : global->printingMinimumShrinkFactor;
-        settings->setPrintingMinimumShrinkFactor(minimumShrinkFactor);
-
-        float maximumShrinkFactor = printingMaximumShrinkFactor > 0.0f ? printingMaximumShrinkFactor : global->printingMaximumShrinkFactor;
-        settings->setPrintingMaximumShrinkFactor(maximumShrinkFactor);
-
         value = attributes.value(QWebSettings::ZoomTextOnly,
                                  global->attributes.value(QWebSettings::ZoomTextOnly));
         settings->setZoomsTextOnly(value);
@@ -379,8 +371,6 @@ QWebSettings::QWebSettings()
     d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, false);
     d->offlineStorageDefaultQuota = 5 * 1024 * 1024;
     d->defaultTextEncoding = QLatin1String("iso-8859-1");
-    d->printingMinimumShrinkFactor = 0.0f;
-    d->printingMaximumShrinkFactor = 0.0f;
 }
 
 /*!
@@ -494,60 +484,6 @@ QString QWebSettings::defaultTextEncoding() const
     return d->defaultTextEncoding;
 }
 
-/*!
-    \since 4.7 
-    Specifies minimum shrink fator allowed for printing. If set to 0 a
-    default value is used.
-
-    When printing, content will be shrunk to reduce page usage, it
-    will reduced by a factor between printingMinimumShrinkFactor and
-    printingMaximumShrinkFactor. 
-
-    \sa printingMinimumShrinkFactor()
-    \sa setPrintingMaximumShrinkFactor()
-    \sa printingMaximumShrinkFactor()
-*/
-void QWebSettings::setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor)
-{
-    d->printingMinimumShrinkFactor = printingMinimumShrinkFactor;
-    d->apply();
-}
-
-/*!
-    \since 4.7 
-    returns the minimum shrink factor used for printing.
-
-    \sa setPrintingMinimumShrinkFactor()
-*/
-float QWebSettings::printingMinimumShrinkFactor() const
-{
-    return d->printingMinimumShrinkFactor;
-}
-
-/*!
-    \since 4.7 
-    Specifies maximum shrink fator allowed for printing. If set to 0 a
-    default value is used.
-
-    \sa setPrintingMinimumShrinkFactor()
-*/
-void QWebSettings::setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor)
-{
-    d->printingMaximumShrinkFactor = printingMaximumShrinkFactor;
-    d->apply();
-}
-
-/*!
-    \since 4.7 
-    returns the maximum shrink factor used for printing.
-
-    \sa setPrintingMinimumShrinkFactor()
-*/
-float QWebSettings::printingMaximumShrinkFactor() const
-{
-    return d->printingMaximumShrinkFactor;
-}
-
 /*!
     Sets the path of the icon database to \a path. The icon database is used
     to store "favicons" associated with web sites.
index 3b6d1a738dccaf1df6164c24aa5e42db537a2d6d..50cf424397ae398ce65dd2c9452c4c33d7278ef2 100644 (file)
@@ -102,12 +102,6 @@ public:
     void setDefaultTextEncoding(const QString &encoding);
     QString defaultTextEncoding() const;
 
-    void setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor);
-    float printingMinimumShrinkFactor() const;
-
-    void setPrintingMaximumShrinkFactor(float printingMaximimShrinkFactor);
-    float printingMaximumShrinkFactor() const;
-
     static void setIconDatabasePath(const QString &location);
     static QString iconDatabasePath();
     static void clearIconDatabase();
index bd8c4ad0017f96058664e989b107e0e277e9ee9d..bb70fb372eb14534e63ddca4a5ff075a4648f2fe 100644 (file)
@@ -1,3 +1,18 @@
+2009-11-12  Benjamin Poulain  <benjamin.poulain@nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Custom printing shrink factors
+        https://bugs.webkit.org/show_bug.cgi?id=29042
+
+        This reverts commit r49769. The public API for this needs to be reviewed
+        before its inclusion in Qt.
+
+        * Api/qwebsettings.cpp:
+        (QWebSettingsPrivate::apply):
+        (QWebSettings::QWebSettings):
+        * Api/qwebsettings.h:
+
 2009-11-11  Antonio Gomes  <tonikitoo@webkit.org>
 
         Reviewed by Kenneth Christiansen.