Hi Marc-Antoine, Thank you for your fast response!
I've made my work-in-progress patches available here: http://www.magpcss.net/patches/chromium_test_shell_printing_rev2056.diff Most of the changes are in the webkit/tools/test_shell/ folder, but one small change was required to the PrintingContext class as well. I've added an additional argument to the PrintingContext::NewDocument() method that can be set to "false" to disable the default functionality of forcing print-to-file if no g_browser_process instance exists. Using default arguments violates Google's style requirements, of course, so we'll probably want to come up with a better solution. The TestShell::PrintPage() method implements the suggested approach of writing directly to the printer device context. All of the elements of the page are printed, but appear very small. If the DPI settings are likely to be the problem, how would I go about notifying the WebFrame instance that the DPI settings are different? One other thing I've noticed is that Google Chrome doesn't remember the print settings last selected by the user during the same session. We may want to add support for that as well while we're at it. Regards, Marshall On Thu, Sep 11, 2008 at 9:10 AM, Marc-Antoine Ruel <[EMAIL PROTECTED]>wrote: > > Hi > > That's a good idea. I didn't think about implementing printing support > in test_shell. I see that you really took the time to investigate > before asking, that's really appreciated. > > You don't need to buffer the commands into a EMF buffer. So you should > print directly into the context; e.g. use the third approach. The EMF > buffer is solely used to pass the buffer from one process to the > other. By using it inside test_shell, you multiply by 2x the memory > usage. > > I looked at the code and I can't tell the exact reason you got correct > output with your first 2 examples. In theory, that's > PrintedDocument::RenderPrintedPage() that is doing the last fixup in > scale. This is done according to the expected dpi settings. > > The code assumes a 72 dpi for display. In reality, it's much higher > than that but that's the ratio people are used to expect. The scaling > factor is directly dependent of the dpi of the printer. > > 72 dpi is specified in PrintSettings::desired_dpi. > > Note that you will loose the headers and footers, what I call > overlays. They are generated on the browser side in > PrintedDocument::RenderPrintedPage(). They are manually scaled and > added over. > > If you have any question, ping me on irc. > > If you want to show me the current state of your prototype, you can > gcl change/gcl upload and send me the link to your review. > > M-A --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Chromium-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/chromium-dev?hl=en -~----------~----~----~----~------~----~------~--~---
