fix: webContents.printToPDF()
with cross-process subframes (#46218)
fix: webContents.printToPDF() with cross-process subframes
This commit is contained in:
parent
8e856dfdb8
commit
1d6cb348b4
5 changed files with 63 additions and 1 deletions
|
@ -176,6 +176,7 @@
|
|||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
#include "chrome/browser/printing/print_view_manager_base.h"
|
||||
#include "components/printing/browser/print_composite_client.h"
|
||||
#include "components/printing/browser/print_manager_utils.h"
|
||||
#include "components/printing/browser/print_to_pdf/pdf_print_result.h"
|
||||
#include "components/printing/browser/print_to_pdf/pdf_print_utils.h"
|
||||
|
@ -1023,6 +1024,7 @@ void WebContents::InitWithWebContents(
|
|||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
PrintViewManagerElectron::CreateForWebContents(web_contents.get());
|
||||
printing::CreateCompositeClientIfNeeded(web_contents.get(), GetUserAgent());
|
||||
#endif
|
||||
|
||||
// Determine whether the WebContents is offscreen.
|
||||
|
@ -1983,6 +1985,17 @@ void WebContents::DraggableRegionsChanged(
|
|||
draggable_region_ = DraggableRegionsToSkRegion(regions);
|
||||
}
|
||||
|
||||
void WebContents::PrintCrossProcessSubframe(
|
||||
content::WebContents* web_contents,
|
||||
const gfx::Rect& rect,
|
||||
int document_cookie,
|
||||
content::RenderFrameHost* subframe_host) const {
|
||||
if (auto* client =
|
||||
printing::PrintCompositeClient::FromWebContents(web_contents)) {
|
||||
client->PrintCrossProcessSubframe(rect, document_cookie, subframe_host);
|
||||
}
|
||||
}
|
||||
|
||||
SkRegion* WebContents::draggable_region() {
|
||||
return g_disable_draggable_regions ? nullptr : draggable_region_.get();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue