RESOLVED LATER 29042
Custom printing shrink factors
https://bugs.webkit.org/show_bug.cgi?id=29042
Summary Custom printing shrink factors
Jakob Truelsen
Reported Tuesday, September 8, 2009 7:44:37 PM UTC
Currently webkit shrinks pages with a factor of 1.25 to 2.0. While this is fine in most cases, it might not be the best choice in some cases. For for instance one might want to clamp these two values to a constant to get a predicable dpi on the printed document. The following patch allows one to configure these two factors.
Attachments
Shrink factor patch (10.41 KB, patch)
2009-09-08 11:54 PDT, Jakob Truelsen
no flags
Shrink factor patch 1.1 (10.41 KB, patch)
2009-09-08 22:34 PDT, Jakob Truelsen
no flags
Shrink factor patch 1.2 (10.33 KB, patch)
2009-09-22 00:04 PDT, Jakob Truelsen
abarth: review+
commit-queue: commit-queue-
Shrink factor patch 1.3 (10.34 KB, patch)
2009-10-14 02:08 PDT, Jakob Truelsen
abarth: review-
commit-queue: commit-queue-
Patch now ^I free (10.84 KB, patch)
2009-10-18 23:56 PDT, Jakob Truelsen
no flags
Revert the commit r49769 (9.74 KB, patch)
2009-11-12 05:07 PST, Benjamin Poulain
no flags
Jakob Truelsen
Comment 1 Tuesday, September 8, 2009 7:54:31 PM UTC
Created attachment 39199 [details] Shrink factor patch
Eric Seidel (no email)
Comment 2 Tuesday, September 8, 2009 8:45:57 PM UTC
Comment on attachment 39199 [details] Shrink factor patch Dive-by nit: 502 void Settings::setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor) { 503 m_printingMaximumShrinkFactor = printingMaximumShrinkFactor; Style issues { goes on a new line.
Jakob Truelsen
Comment 3 Wednesday, September 9, 2009 6:34:30 AM UTC
Created attachment 39246 [details] Shrink factor patch 1.1 Sorry about that, the braces are now the correct place.
Jakob Truelsen
Comment 4 Tuesday, September 22, 2009 8:04:46 AM UTC
Created attachment 39905 [details] Shrink factor patch 1.2
Adam Barth
Comment 5 Tuesday, October 13, 2009 10:41:14 PM UTC
Comment on attachment 39905 [details] Shrink factor patch 1.2 Ok. This looks reasonable.
WebKit Commit Bot
Comment 6 Tuesday, October 13, 2009 10:45:07 PM UTC
Comment on attachment 39905 [details] Shrink factor patch 1.2 Rejecting patch 39905 from commit-queue. Patch https://bugs.webkit.org/attachment.cgi?id=39905 from bug 29042 failed to download and apply.
Jakob Truelsen
Comment 7 Wednesday, October 14, 2009 10:08:43 AM UTC
Created attachment 41154 [details] Shrink factor patch 1.3 Make patch apply to trunk
Adam Barth
Comment 8 Friday, October 16, 2009 12:41:06 AM UTC
Comment on attachment 41154 [details] Shrink factor patch 1.3 Ok. I don't have time to watch the bots right now, but someone else can mark this cq+
WebKit Commit Bot
Comment 9 Monday, October 19, 2009 7:34:10 AM UTC
Comment on attachment 41154 [details] Shrink factor patch 1.3 Rejecting patch 41154 from commit-queue. Failed to run "['git', 'svn', 'dcommit']" exit_code: 1 Last 500 characters of output: t/qt/ChangeLog A repository hook failed: MERGE request failed on '/repository/webkit/trunk': Commit blocked by pre-commit hook (exit code 1) with output: svnlook: Can't write to stream: Broken pipe The following files contain tab characters: trunk/WebCore/ChangeLog trunk/WebCore/page/Settings.h Please use spaces instead to indent. If you must commit a file with tabs, use svn propset to set the "allow-tabs" property. at /usr/local/libexec/git-core//git-svn line 469
Adam Barth
Comment 10 Monday, October 19, 2009 7:35:28 AM UTC
Comment on attachment 41154 [details] Shrink factor patch 1.3 Ack Hans! It's the tabs!
Jakob Truelsen
Comment 11 Monday, October 19, 2009 7:56:26 AM UTC
Created attachment 41399 [details] Patch now ^I free Sorry about that. Emacs apparently adds tabs on empty lines
WebKit Commit Bot
Comment 12 Monday, October 19, 2009 8:17:49 AM UTC
Comment on attachment 41399 [details] Patch now ^I free Clearing flags on attachment: 41399 Committed r49769: <http://trac.webkit.org/changeset/49769>
WebKit Commit Bot
Comment 13 Monday, October 19, 2009 8:17:53 AM UTC
All reviewed patches have been landed. Closing bug.
Simon Hausmann
Comment 14 Wednesday, November 11, 2009 8:55:55 PM UTC
This patch has API issues. The use of float in the API has to be replaced with the use of qreal and the documentation tags are incorrect, they should refer to \since 4.6 instead of 4.7. Re-opening this bug (Hm, I can't use REOPEN, but I'll set it to UNCONFIRMED instead)
Benjamin Poulain
Comment 15 Thursday, November 12, 2009 8:51:24 AM UTC
Note that the patch is not correct. If QWebSettings is initialized from WebCore::Settings, QWebSettingsPrivate::printingMinimumShrinkFactor and QWebSettingsPrivate::printingMaximumShrinkFactor are not initialized. When QWebSettingsPrivate::apply() is called, the following code has an undefined behavior: float minimumShrinkFactor = printingMinimumShrinkFactor > 0.0f ? printingMinimumShrinkFactor : global->printingMinimumShrinkFactor; settings->setPrintingMinimumShrinkFactor(minimumShrinkFactor); float maximumShrinkFactor = printingMaximumShrinkFactor > 0.0f ? printingMaximumShrinkFactor : global->printingMaximumShrinkFactor; settings->setPrintingMaximumShrinkFactor(maximumShrinkFactor);
Jakob Truelsen
Comment 16 Thursday, November 12, 2009 9:25:14 AM UTC
#15 is not news to me. I submitted a patch for that here https://bugs.webkit.org/show_bug.cgi?id=30755 As for \since 4.7, I was under the impression that 4.6 had gone into feature freeze. I will submit a new patch to 30755 ASAP..
Benjamin Poulain
Comment 17 Thursday, November 12, 2009 1:07:55 PM UTC
Created attachment 43058 [details] Revert the commit r49769 Revert the original patch. This API should not be part of Qt 4.6. This could be submitted for Qt 4.7, but the public API should be reviewed by someone from Qt.
Jakob Truelsen
Comment 18 Thursday, November 12, 2009 1:22:06 PM UTC
I see you just proposed reverting my original patch instead of fixing the issue. Is QT pulling WebKit trunk into the QT 4.6 tree, if yes is there real WebKit trunk I can submit patches against, or is it only possible to submit QT related patches into WebKit at time-windows according with the QT release schedule. I have tried many different strategies for getting patches such as this in, submitting to the QT bug-tracker, QT Gitorius and so on but all of them state that I should submit here. Now you seem to claim that one needs some sort of QT rewiew, how would that happen. I'm beginning to wonder if it is at all possible to get a QT related patch into WebKit?
Benjamin Poulain
Comment 19 Thursday, November 12, 2009 1:35:12 PM UTC
(In reply to comment #18) > I see you just proposed reverting my original patch instead of fixing the > issue. > Is QT pulling WebKit trunk into the QT 4.6 tree, if yes is there real WebKit > trunk I can submit patches against, or is it only possible to submit QT related > patches into WebKit at time-windows according with the QT release schedule. I > have tried many different strategies for getting patches such as this in, > submitting to the QT bug-tracker, QT Gitorius and so on but all of them state > that I should submit here. Now you seem to claim that one needs some sort of > QT rewiew, how would that happen. I'm beginning to wonder if it is at all > possible to get a QT related patch into WebKit? You have done the right workflow, it is correct to submit the patches here for QtWebkit. We have failed on this patch. Nobody from Qt did notice the patch and it has been merged without any API review (necessary for public APIs). I suggest to revert the patch here instead of the 4.6 branch in order to have a proper API review before it's inclusion for 4.7. I personally think we could introduce a new class for printing in order to add more flexibility in the future. E.g.: void QWebFrame::print (QPrinter* printer, const QWebPrintSettings& settings) This would have the advantage of giving the right visibility to the parameters (next to ::print, instead of hidden in the settings). And this would be more future proof in case of new parameters (zoomFactor, and CSS media type for example). This is just my point of view, that need to be discussed with the others.
WebKit Commit Bot
Comment 20 Thursday, November 12, 2009 1:52:57 PM UTC
Comment on attachment 43058 [details] Revert the commit r49769 Clearing flags on attachment: 43058 Committed r50876: <http://trac.webkit.org/changeset/50876>
WebKit Commit Bot
Comment 21 Thursday, November 12, 2009 1:53:04 PM UTC
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.