How do I clone a document? (For printing)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I clone a document? (For printing)

Eli Friedman
What is the best way to go about making an exact clone of a document
from C++?  I'm getting a bit lost as to what I need to call to create a
document with the same characteristics as the original.  Do I need
separate processing for HTML and XML?  Are there any special kinds of
documents I need to be aware of?

This is for use in layout/, so I can call internal APIs if needed.

The idea is that printing/print preview should have a copy of the
document so that the document being used is owned by the printing code,
cannot be changed by other documents, and can be modified by the
printing code for its own purposes (i.e. for printing selection.)

Thanks,
Eli Friedman
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: How do I clone a document? (For printing)

Jonas Sicking
Eli Friedman wrote:

> What is the best way to go about making an exact clone of a document
> from C++?  I'm getting a bit lost as to what I need to call to create a
> document with the same characteristics as the original.  Do I need
> separate processing for HTML and XML?  Are there any special kinds of
> documents I need to be aware of?
>
> This is for use in layout/, so I can call internal APIs if needed.
>
> The idea is that printing/print preview should have a copy of the
> document so that the document being used is owned by the printing code,
> cannot be changed by other documents, and can be modified by the
> printing code for its own purposes (i.e. for printing selection.)

Does calling CloneNode (on the nsIDOMNode interface) work? If not, it's
probably a bug.

/ Jonas
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: How do I clone a document? (For printing)

Eli Friedman
Just calling cloneNode on the document?
https://bugzilla.mozilla.org/show_bug.cgi?id=42976

Other than that, I think that's what I want.

-Eli

Jonas Sicking wrote:

> Eli Friedman wrote:
>> What is the best way to go about making an exact clone of a document
>> from C++?  I'm getting a bit lost as to what I need to call to create
>> a document with the same characteristics as the original.  Do I need
>> separate processing for HTML and XML?  Are there any special kinds of
>> documents I need to be aware of?
>>
>> This is for use in layout/, so I can call internal APIs if needed.
>>
>> The idea is that printing/print preview should have a copy of the
>> document so that the document being used is owned by the printing
>> code, cannot be changed by other documents, and can be modified by the
>> printing code for its own purposes (i.e. for printing selection.)
>
> Does calling CloneNode (on the nsIDOMNode interface) work? If not, it's
> probably a bug.
>
> / Jonas
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: How do I clone a document? (For printing)

Eli Friedman
Any other suggestions about what else I could do? It doesn't look like
bug 42976 is a very high priority, and I'm not confident I could come up
with a correct patch.  (I don't care about XUL at the moment, so only
XML and HTML matter.)

-Eli

Eli Friedman wrote:

> Just calling cloneNode on the document?
> https://bugzilla.mozilla.org/show_bug.cgi?id=42976
>
> Other than that, I think that's what I want.
>
> -Eli
>
> Jonas Sicking wrote:
>> Eli Friedman wrote:
>>> What is the best way to go about making an exact clone of a document
>>> from C++?  I'm getting a bit lost as to what I need to call to create
>>> a document with the same characteristics as the original.  Do I need
>>> separate processing for HTML and XML?  Are there any special kinds of
>>> documents I need to be aware of?
>>>
>>> This is for use in layout/, so I can call internal APIs if needed.
>>>
>>> The idea is that printing/print preview should have a copy of the
>>> document so that the document being used is owned by the printing
>>> code, cannot be changed by other documents, and can be modified by
>>> the printing code for its own purposes (i.e. for printing selection.)
>>
>> Does calling CloneNode (on the nsIDOMNode interface) work? If not,
>> it's probably a bug.
>>
>> / Jonas
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout