Changeset 50876 in webkit


Ignore:
Timestamp:
Nov 12, 2009 5:52:50 AM (14 years ago)
Author:
eric@webkit.org
Message:

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 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:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r50875 r50876  
     12009-11-12  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        Custom printing shrink factors
     6        https://bugs.webkit.org/show_bug.cgi?id=29042
     7
     8        This reverts commit r49769. The public API for this needs to be reviewed
     9        before its inclusion in Qt.
     10
     11        * page/PrintContext.cpp:
     12        (WebCore::PrintContext::begin):
     13        * page/Settings.cpp:
     14        (WebCore::Settings::Settings):
     15        * page/Settings.h:
     16
    1172009-11-12  Alexander Pavlov  <apavlov@chromium.org>
    218
  • trunk/WebCore/page/PrintContext.cpp

    r49769 r50876  
    2626#include "FrameView.h"
    2727#include "RenderView.h"
    28 #include "Settings.h"
    2928
    3029using namespace WebCore;
     
    9796void PrintContext::begin(float width)
    9897{
    99     float PrintingMinimumShrinkFactor = m_frame->settings() ? m_frame->settings()->printingMinimumShrinkFactor() : 0.0f;
    100     float PrintingMaximumShrinkFactor = m_frame->settings() ? m_frame->settings()->printingMaximumShrinkFactor() : 0.0f;
     98    // By imaging to a width a little wider than the available pixels,
     99    // thin pages will be scaled down a little, matching the way they
     100    // print in IE and Camino. This lets them use fewer sheets than they
     101    // would otherwise, which is presumably why other browsers do this.
     102    // Wide pages will be scaled down more than this.
     103    const float PrintingMinimumShrinkFactor = 1.25f;
    101104
    102     if (PrintingMaximumShrinkFactor < PrintingMinimumShrinkFactor || PrintingMinimumShrinkFactor <= 0.0f) {
    103         // By imaging to a width a little wider than the available pixels,
    104         // thin pages will be scaled down a little, matching the way they
    105         // print in IE and Camino. This lets them use fewer sheets than they
    106         // would otherwise, which is presumably why other browsers do this.
    107         // Wide pages will be scaled down more than this.
    108         PrintingMinimumShrinkFactor = 1.25f;
    109 
    110         // This number determines how small we are willing to reduce the page content
    111         // in order to accommodate the widest line. If the page would have to be
    112         // reduced smaller to make the widest line fit, we just clip instead (this
    113         // behavior matches MacIE and Mozilla, at least)
    114         PrintingMaximumShrinkFactor = 2.0f;
    115     }
     105    // This number determines how small we are willing to reduce the page content
     106    // in order to accommodate the widest line. If the page would have to be
     107    // reduced smaller to make the widest line fit, we just clip instead (this
     108    // behavior matches MacIE and Mozilla, at least)
     109    const float PrintingMaximumShrinkFactor = 2.0f;
    116110
    117111    float minLayoutWidth = width * PrintingMinimumShrinkFactor;
  • trunk/WebCore/page/Settings.cpp

    r50754 r50876  
    6464    , m_localStorageQuota(5 * 1024 * 1024)  // Suggested by the HTML5 spec.
    6565    , m_pluginAllowedRunTime(numeric_limits<unsigned>::max())
    66     , m_printingMinimumShrinkFactor(0.0f)
    67     , m_printingMaximumShrinkFactor(0.0f)
    6866    , m_isJavaEnabled(false)
    6967    , m_loadsImagesAutomatically(false)
     
    526524}
    527525
    528 void Settings::setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor)
    529 {
    530     m_printingMinimumShrinkFactor = printingMinimumShrinkFactor;
    531 }   
    532 
    533 void Settings::setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor)
    534 {
    535     m_printingMaximumShrinkFactor = printingMaximumShrinkFactor;
    536 }   
    537 
    538526} // namespace WebCore
  • trunk/WebCore/page/Settings.h

    r50810 r50876  
    268268        bool webGLEnabled() const { return m_webGLEnabled; }
    269269
    270         void setPrintingMinimumShrinkFactor(float);
    271         float printingMinimumShrinkFactor() const { return m_printingMinimumShrinkFactor; }
    272 
    273         void setPrintingMaximumShrinkFactor(float);
    274         float printingMaximumShrinkFactor() const { return m_printingMaximumShrinkFactor; }
    275 
    276270    private:
    277271        Page* m_page;
     
    296290        unsigned m_localStorageQuota;
    297291        unsigned m_pluginAllowedRunTime;
    298         float m_printingMinimumShrinkFactor;
    299         float m_printingMaximumShrinkFactor;
    300292        bool m_isJavaEnabled : 1;
    301293        bool m_loadsImagesAutomatically : 1;
  • trunk/WebKit/qt/Api/qwebsettings.cpp

    r50659 r50876  
    6363    QString offlineWebApplicationCachePath;
    6464    qint64 offlineStorageDefaultQuota;
    65     float printingMinimumShrinkFactor;
    66     float printingMaximumShrinkFactor;
    6765
    6866    void apply();
     
    176174        QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath;
    177175        settings->setLocalStorageDatabasePath(storagePath);
    178 
    179         float minimumShrinkFactor = printingMinimumShrinkFactor > 0.0f ? printingMinimumShrinkFactor : global->printingMinimumShrinkFactor;
    180         settings->setPrintingMinimumShrinkFactor(minimumShrinkFactor);
    181 
    182         float maximumShrinkFactor = printingMaximumShrinkFactor > 0.0f ? printingMaximumShrinkFactor : global->printingMaximumShrinkFactor;
    183         settings->setPrintingMaximumShrinkFactor(maximumShrinkFactor);
    184176
    185177        value = attributes.value(QWebSettings::ZoomTextOnly,
     
    380372    d->offlineStorageDefaultQuota = 5 * 1024 * 1024;
    381373    d->defaultTextEncoding = QLatin1String("iso-8859-1");
    382     d->printingMinimumShrinkFactor = 0.0f;
    383     d->printingMaximumShrinkFactor = 0.0f;
    384374}
    385375
     
    493483{
    494484    return d->defaultTextEncoding;
    495 }
    496 
    497 /*!
    498     \since 4.7
    499     Specifies minimum shrink fator allowed for printing. If set to 0 a
    500     default value is used.
    501 
    502     When printing, content will be shrunk to reduce page usage, it
    503     will reduced by a factor between printingMinimumShrinkFactor and
    504     printingMaximumShrinkFactor.
    505 
    506     \sa printingMinimumShrinkFactor()
    507     \sa setPrintingMaximumShrinkFactor()
    508     \sa printingMaximumShrinkFactor()
    509 */
    510 void QWebSettings::setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor)
    511 {
    512     d->printingMinimumShrinkFactor = printingMinimumShrinkFactor;
    513     d->apply();
    514 }
    515 
    516 /*!
    517     \since 4.7
    518     returns the minimum shrink factor used for printing.
    519 
    520     \sa setPrintingMinimumShrinkFactor()
    521 */
    522 float QWebSettings::printingMinimumShrinkFactor() const
    523 {
    524     return d->printingMinimumShrinkFactor;
    525 }
    526 
    527 /*!
    528     \since 4.7
    529     Specifies maximum shrink fator allowed for printing. If set to 0 a
    530     default value is used.
    531 
    532     \sa setPrintingMinimumShrinkFactor()
    533 */
    534 void QWebSettings::setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor)
    535 {
    536     d->printingMaximumShrinkFactor = printingMaximumShrinkFactor;
    537     d->apply();
    538 }
    539 
    540 /*!
    541     \since 4.7
    542     returns the maximum shrink factor used for printing.
    543 
    544     \sa setPrintingMinimumShrinkFactor()
    545 */
    546 float QWebSettings::printingMaximumShrinkFactor() const
    547 {
    548     return d->printingMaximumShrinkFactor;
    549485}
    550486
  • trunk/WebKit/qt/Api/qwebsettings.h

    r50659 r50876  
    103103    QString defaultTextEncoding() const;
    104104
    105     void setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor);
    106     float printingMinimumShrinkFactor() const;
    107 
    108     void setPrintingMaximumShrinkFactor(float printingMaximimShrinkFactor);
    109     float printingMaximumShrinkFactor() const;
    110 
    111105    static void setIconDatabasePath(const QString &location);
    112106    static QString iconDatabasePath();
  • trunk/WebKit/qt/ChangeLog

    r50860 r50876  
     12009-11-12  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        Custom printing shrink factors
     6        https://bugs.webkit.org/show_bug.cgi?id=29042
     7
     8        This reverts commit r49769. The public API for this needs to be reviewed
     9        before its inclusion in Qt.
     10
     11        * Api/qwebsettings.cpp:
     12        (QWebSettingsPrivate::apply):
     13        (QWebSettings::QWebSettings):
     14        * Api/qwebsettings.h:
     15
    1162009-11-11  Antonio Gomes  <tonikitoo@webkit.org>
    217
Note: See TracChangeset for help on using the changeset viewer.