Wait for @media print resources to load in Page.printToPDF [chromium/src : main]

0 views
Skip to first unread message

Lei Zhang (Gerrit)

unread,
Jul 24, 2026, 1:09:52 AMĀ (3 days ago)Ā Jul 24
to Eric Leese, Lei Zhang, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, pdf-r...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, cros-print...@google.com, print-rev...@chromium.org
Attention needed from Eric Leese

Lei Zhang added 4 comments

File chrome/browser/devtools/protocol/devtools_printtopdf_browsertest.cc
Line 35, Patchset 2 (Latest):#include "chrome/common/chrome_paths.h"
Lei Zhang . unresolved

Please auto-format and sort the list. Ideally a local presubmit would warn and pause/stop the CL upload.

Line 50, Patchset 2 (Latest): base::ReadFileToString(
Lei Zhang . unresolved

Make sure this succeeded, or use ReadFileToBytes() to force a check and then do byte to string_view conversion for set_content()?

Line 217, Patchset 2 (Latest): // We check that the image actually loaded and rendered.
Lei Zhang . unresolved

go/avoid-we

Line 227, Patchset 2 (Latest): base::DictValue params;
Lei Zhang . unresolved

Create a helper instead of repeating?

Open in Gerrit

Related details

Attention is currently required from:
  • Eric Leese
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Iae2119c8e62da0c5f7846a0aa1ae9e7a0c2b2865
Gerrit-Change-Number: 8138248
Gerrit-PatchSet: 2
Gerrit-Owner: Eric Leese <le...@chromium.org>
Gerrit-Reviewer: Eric Leese <le...@chromium.org>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Attention: Eric Leese <le...@chromium.org>
Gerrit-Comment-Date: Fri, 24 Jul 2026 05:09:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Eric Leese (Gerrit)

unread,
Jul 24, 2026, 11:51:38 AMĀ (2 days ago)Ā Jul 24
to Lei Zhang, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, pdf-r...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, cros-print...@google.com, print-rev...@chromium.org
Attention needed from Lei Zhang

Eric Leese added 4 comments

File chrome/browser/devtools/protocol/devtools_printtopdf_browsertest.cc
Line 35, Patchset 2 (Latest):#include "chrome/common/chrome_paths.h"
Lei Zhang . resolved

Please auto-format and sort the list. Ideally a local presubmit would warn and pause/stop the CL upload.

Eric Leese

Done

Line 50, Patchset 2 (Latest): base::ReadFileToString(
Lei Zhang . resolved

Make sure this succeeded, or use ReadFileToBytes() to force a check and then do byte to string_view conversion for set_content()?

Eric Leese

Done

Line 217, Patchset 2 (Latest): // We check that the image actually loaded and rendered.
Lei Zhang . resolved

go/avoid-we

Eric Leese

Done

Line 227, Patchset 2 (Latest): base::DictValue params;
Lei Zhang . resolved

Create a helper instead of repeating?

Eric Leese

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Lei Zhang
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iae2119c8e62da0c5f7846a0aa1ae9e7a0c2b2865
    Gerrit-Change-Number: 8138248
    Gerrit-PatchSet: 2
    Gerrit-Owner: Eric Leese <le...@chromium.org>
    Gerrit-Reviewer: Eric Leese <le...@chromium.org>
    Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
    Gerrit-Attention: Lei Zhang <the...@chromium.org>
    Gerrit-Comment-Date: Fri, 24 Jul 2026 15:51:27 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Lei Zhang <the...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Lei Zhang (Gerrit)

    unread,
    Jul 24, 2026, 1:25:55 PMĀ (2 days ago)Ā Jul 24
    to Eric Leese, Lei Zhang, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, pdf-r...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, cros-print...@google.com, print-rev...@chromium.org
    Attention needed from Eric Leese

    Lei Zhang voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Eric Leese
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iae2119c8e62da0c5f7846a0aa1ae9e7a0c2b2865
    Gerrit-Change-Number: 8138248
    Gerrit-PatchSet: 3
    Gerrit-Owner: Eric Leese <le...@chromium.org>
    Gerrit-Reviewer: Eric Leese <le...@chromium.org>
    Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
    Gerrit-Attention: Eric Leese <le...@chromium.org>
    Gerrit-Comment-Date: Fri, 24 Jul 2026 17:25:32 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Lei Zhang (Gerrit)

    unread,
    Jul 24, 2026, 5:16:29 PMĀ (2 days ago)Ā Jul 24
    to Eric Leese, Lei Zhang, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, pdf-r...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, cros-print...@google.com, print-rev...@chromium.org
    Attention needed from Eric Leese

    Lei Zhang voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Eric Leese
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iae2119c8e62da0c5f7846a0aa1ae9e7a0c2b2865
    Gerrit-Change-Number: 8138248
    Gerrit-PatchSet: 3
    Gerrit-Owner: Eric Leese <le...@chromium.org>
    Gerrit-Reviewer: Eric Leese <le...@chromium.org>
    Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
    Gerrit-Attention: Eric Leese <le...@chromium.org>
    Gerrit-Comment-Date: Fri, 24 Jul 2026 21:16:18 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    Jul 24, 2026, 5:20:03 PMĀ (2 days ago)Ā Jul 24
    to Eric Leese, Lei Zhang, android-bu...@system.gserviceaccount.com, pdf-r...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, cros-print...@google.com, print-rev...@chromium.org

    Chromium LUCI CQ submitted the change

    Change information

    Commit message:
    Wait for @media print resources to load in Page.printToPDF

    When printing to PDF, especially in headless mode, images loaded
    via CSS `content:` or `background-image` that only apply when
    `@media print` is active were occasionally not rendering because the
    PDF was generated before the network request completed.

    This adds a call to `PrintRenderFrameHelper::WillPrintSoon()` which
    properly kicks off loading and waits for these resources, and passes
    a closure that resumes the PDF generation once the frame finishes
    loading.

    A browser test has been added that utilizes a DelayedHttpResponse
    to reliably simulate a slow image and verify that the resulting
    PDF waits for it to render.

    TAG=agy
    CONV=3b1088ec-9d27-4819-a5cd-8adc21689612
    Bug: 411573949
    Change-Id: Iae2119c8e62da0c5f7846a0aa1ae9e7a0c2b2865
    Reviewed-by: Lei Zhang <the...@chromium.org>
    Commit-Queue: Lei Zhang <the...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1668167}
    Files:
    • M chrome/browser/devtools/protocol/devtools_printtopdf_browsertest.cc
    • A chrome/test/data/print_to_pdf/media_print_image.html
    • A chrome/test/data/print_to_pdf/media_print_slow_image.html
    • M components/printing/renderer/print_render_frame_helper.cc
    • M components/printing/renderer/print_render_frame_helper.h
    Change size: M
    Delta: 5 files changed, 135 insertions(+), 11 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Lei Zhang
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iae2119c8e62da0c5f7846a0aa1ae9e7a0c2b2865
    Gerrit-Change-Number: 8138248
    Gerrit-PatchSet: 4
    Gerrit-Owner: Eric Leese <le...@chromium.org>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Eric Leese <le...@chromium.org>
    Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages