Changeset 50876 in webkit
- Timestamp:
- Nov 12, 2009 5:52:50 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r50875 r50876 1 2009-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 1 17 2009-11-12 Alexander Pavlov <apavlov@chromium.org> 2 18 -
trunk/WebCore/page/PrintContext.cpp
r49769 r50876 26 26 #include "FrameView.h" 27 27 #include "RenderView.h" 28 #include "Settings.h"29 28 30 29 using namespace WebCore; … … 97 96 void PrintContext::begin(float width) 98 97 { 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; 101 104 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; 116 110 117 111 float minLayoutWidth = width * PrintingMinimumShrinkFactor; -
trunk/WebCore/page/Settings.cpp
r50754 r50876 64 64 , m_localStorageQuota(5 * 1024 * 1024) // Suggested by the HTML5 spec. 65 65 , m_pluginAllowedRunTime(numeric_limits<unsigned>::max()) 66 , m_printingMinimumShrinkFactor(0.0f)67 , m_printingMaximumShrinkFactor(0.0f)68 66 , m_isJavaEnabled(false) 69 67 , m_loadsImagesAutomatically(false) … … 526 524 } 527 525 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 538 526 } // namespace WebCore -
trunk/WebCore/page/Settings.h
r50810 r50876 268 268 bool webGLEnabled() const { return m_webGLEnabled; } 269 269 270 void setPrintingMinimumShrinkFactor(float);271 float printingMinimumShrinkFactor() const { return m_printingMinimumShrinkFactor; }272 273 void setPrintingMaximumShrinkFactor(float);274 float printingMaximumShrinkFactor() const { return m_printingMaximumShrinkFactor; }275 276 270 private: 277 271 Page* m_page; … … 296 290 unsigned m_localStorageQuota; 297 291 unsigned m_pluginAllowedRunTime; 298 float m_printingMinimumShrinkFactor;299 float m_printingMaximumShrinkFactor;300 292 bool m_isJavaEnabled : 1; 301 293 bool m_loadsImagesAutomatically : 1; -
trunk/WebKit/qt/Api/qwebsettings.cpp
r50659 r50876 63 63 QString offlineWebApplicationCachePath; 64 64 qint64 offlineStorageDefaultQuota; 65 float printingMinimumShrinkFactor;66 float printingMaximumShrinkFactor;67 65 68 66 void apply(); … … 176 174 QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath; 177 175 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);184 176 185 177 value = attributes.value(QWebSettings::ZoomTextOnly, … … 380 372 d->offlineStorageDefaultQuota = 5 * 1024 * 1024; 381 373 d->defaultTextEncoding = QLatin1String("iso-8859-1"); 382 d->printingMinimumShrinkFactor = 0.0f;383 d->printingMaximumShrinkFactor = 0.0f;384 374 } 385 375 … … 493 483 { 494 484 return d->defaultTextEncoding; 495 }496 497 /*!498 \since 4.7499 Specifies minimum shrink fator allowed for printing. If set to 0 a500 default value is used.501 502 When printing, content will be shrunk to reduce page usage, it503 will reduced by a factor between printingMinimumShrinkFactor and504 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.7518 returns the minimum shrink factor used for printing.519 520 \sa setPrintingMinimumShrinkFactor()521 */522 float QWebSettings::printingMinimumShrinkFactor() const523 {524 return d->printingMinimumShrinkFactor;525 }526 527 /*!528 \since 4.7529 Specifies maximum shrink fator allowed for printing. If set to 0 a530 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.7542 returns the maximum shrink factor used for printing.543 544 \sa setPrintingMinimumShrinkFactor()545 */546 float QWebSettings::printingMaximumShrinkFactor() const547 {548 return d->printingMaximumShrinkFactor;549 485 } 550 486 -
trunk/WebKit/qt/Api/qwebsettings.h
r50659 r50876 103 103 QString defaultTextEncoding() const; 104 104 105 void setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor);106 float printingMinimumShrinkFactor() const;107 108 void setPrintingMaximumShrinkFactor(float printingMaximimShrinkFactor);109 float printingMaximumShrinkFactor() const;110 111 105 static void setIconDatabasePath(const QString &location); 112 106 static QString iconDatabasePath(); -
trunk/WebKit/qt/ChangeLog
r50860 r50876 1 2009-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 1 16 2009-11-11 Antonio Gomes <tonikitoo@webkit.org> 2 17
Note: See TracChangeset
for help on using the changeset viewer.