On Sunday, March 18, 2012 6:59:14 PM UTC+1, smaug wrote:
> On 03/15/2012 09:08 PM, julian.viereck@goog... wrote:
> > > Right now, execution of page JS is suspended for the course of the print
> >> operation. (Within the cloned document, that is. Although there are
> >> still comments within layout/printing that suggest that the
> >> document-cloning project is incomplete.) If we want to allow the UI to
> >> process events *during* the painting of one page, your "paint this
> >> canvas now" API is going to need some sort of interruptibility. Off the
> >> top of my head I don't know what that ought to look like.
> > If you say the JS is suspended, is it still able to call a callback on the canvas element that does the drawing while the print is taking place?
> JS in the cloned document is suspended. JS in the cloned document never
> runs. The callback would run in the original document, and possibly
> update the cloned document (if needed).
If I get that picture right, here is what would happen during printing:
1) the document is cloned, printing is started on the cloned document
2) while printing the cloned document, a canvas element is detected
3) for this canvas in the cloned document, the canvas object in the original document is looked up
4) on the original canvas, it's checked if the canvas has a callback specified doing the special print drawing
5a) If true: this callback is called on the original document passing over a context that knows how to render directly to the printer
5b) If false: the canvas data as available in the cloned document is printed (like it is done right now)
For step 3, is it possible to find the corresponding "original" canvas based on the canvas in the cloned document? Is it possible to call a JS function on the original object like required in step 5a)?
How much is this possible if the original document structure has changed already?
Also, the callback is called within the original document, that might have changed already compared to the cloned document. This might be confusing for developers. Is this a problem or just something to tell the developers that this might be the case and it should be all fine?
dev-tech-layout mailing list