New issue
Advanced search Search tips

Issue 784932 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 2
Type: Bug



Sign in to add a comment

DCHECK when scrolling with a PDF form text is selected

Project Member Reported by hnakashima@chromium.org, Nov 14 2017

Issue description

In a debug build:
1. Open the attached file in Chrome's PDF viewer.
2. Click the text area that says "line one line two".
3. Scroll down with the mouse wheel.
Actual: DCHECK crash
Expected: Normal scrolling

[1:1:1114/130101.075282:FATAL:pdfium_engine.cc(3827)] Check failed: !in_form_text_area_. 
#0 0x7f80ba942dbd base::debug::StackTrace::StackTrace()
#1 0x7f80ba9411ec base::debug::StackTrace::StackTrace()
#2 0x7f80ba9c7f7a logging::LogMessage::~LogMessage()
#3 0x55d216722f60 chrome_pdf::PDFiumEngine::OnSelectionChanged()
#4 0x55d216722e98 chrome_pdf::PDFiumEngine::ScrolledToXPosition()
#5 0x55d216702870 chrome_pdf::OutOfProcessInstance::DidChangeView()
[...]

The bug does not happen on release.

Culprit is https://chromium-review.googlesource.com/c/chromium/src/+/712696

Not sure if the problem is if the DCHECK makes incorrect assumptions or if the CL has a bug.
 
example_054.pdf
39.3 KB Download
Labels: OS-Chrome OS-Mac OS-Windows
I didn't look at r509091 closely. What is it trying to do exactly by explicitly calling OnSelectionChanged()? Prior to that CL, all OnSelectionChanged() calls went through a SelectionChangeInvalidator.
The change in r509091 forces PDFiumEngine to notify the client of a selection change (in global coordinates) due to scrolling of the PDF content. The client needs to know when this happens so that it can update text selection handles, which are drawn by the browser compositor and in global coords. Typically during a scroll the selection bounds don't change within the PDF coord space, but they do change in the global coord space.

We could avoid this if we directly exposed an interface on the client called (something like) DidScroll() ... and then expect that the client remembers the last set of left/right coords it got from the engine.

If that seems reasonable, I can take this over and plumb it through.
Cc: thestig@chromium.org
Owner: wjmaclean@chromium.org
Status: Assigned (was: Untriaged)
Labels: M-64
Yes, you probably want a different interface. One that does not also have the effect of calling pp::PDF::SetSelectedText().
Project Member

Comment 5 by bugdroid1@chromium.org, Nov 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/289948d07fd71d92862af6523794d366633e1d80

commit 289948d07fd71d92862af6523794d366633e1d80
Author: W. James MacLean <wjmaclean@chromium.org>
Date: Thu Nov 23 15:12:47 2017

Plumb separate DidScroll message from PDF plugin to embedder.

The change in r509091 added code to notify the embedder whenever the
PDF was scrolled so that touch-selection handles, which are drawn by the
browser and not the PDF viewer, could have their positions adjusted to
match the scroll.

This was done by having PDFiumEngine call OnSelectionChanged() for
each scroll, which triggers re-sending the selection coordinates to the
embedder. However, it seems this also triggers a DCHECK as
OnSelectionChanged() should not be called when the selection is in
a form area.

This CL plumbs an independent pathway from the PDF plugin to the
embedder so that this DCHECK can be avoided.

Bug:  784932 
Change-Id: I8db353f0afa0e8c8bd625735d27e00d58c9b0dac
Reviewed-on: https://chromium-review.googlesource.com/782404
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: James MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518936}
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/components/pdf/common/pdf.mojom
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/components/pdf/renderer/pepper_pdf_host.cc
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/components/pdf/renderer/pepper_pdf_host.h
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/pdf/out_of_process_instance.cc
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/pdf/pdfium/pdfium_engine.cc
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/ppapi/c/private/ppb_pdf.h
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/ppapi/cpp/private/pdf.cc
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/ppapi/cpp/private/pdf.h
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/ppapi/proxy/pdf_resource.cc
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/ppapi/proxy/pdf_resource.h
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/ppapi/proxy/ppapi_messages.h
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/ppapi/thunk/ppb_pdf_api.h
[modify] https://crrev.com/289948d07fd71d92862af6523794d366633e1d80/ppapi/thunk/ppb_pdf_thunk.cc

Status: Fixed (was: Assigned)
This should be fixed now, please re-open if there are further occurrences.

Sign in to add a comment