New issue
Advanced search Search tips

Issue 817433 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

PDF caculated form fields fail to display negative values

Reported by jturner...@gmail.com, Feb 28 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3358.0 Safari/537.36

Example URL:
http://www.pdfscripting.com/public/FreeStuff/PDFSamples/SimpleCalcExample_v2.pdf

Steps to reproduce the problem:
1. Open PDF form with 'simple' calculations (First row in example)
2. Enter negative values in fields 
3. View incorrect answer

What is the expected behavior?
The far right field should display a negative value.

What went wrong?
The far right field failed to display a negative value.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? Yes Internals>Plugins>PDF

Did this work before? No 

Does this work in other browsers? Yes

Chrome version: 66.0.3358.0  Channel: dev
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: 

This also fails on Chrome 63.0.3239.108 stable.

This works correctly in Adobe Acrobat.

I wrote a custom calculation script to see if it was a problem with the simplified field notation and the script failed in that same way. I placed an alert() into the script just above the value assignment:

app.alert(LinesSum3);
event.value = LinesSum3;

and the alert displayed the correct negative value but the field failed to update. This works fine as long as the field is being given a value of zero or higher.
 
Labels: Needs-Triage-M66
Components: -Blink Internals>Plugins>PDF
Owner: dsinclair@chromium.org
Status: Assigned (was: Unconfirmed)
Dan, can you take a look at this?
So, this is a different issue from the AFSimple_Calculate bug.The number is getting calculated correct just, for some reason, we don't trigger the code to display the number in the text field when it's negative.
So adding another CJS_PublicMethodsEmbedderTest for AFSimple_Calculate with negative inputs won't actually reveal the problem?
Nope, tried that already. AFSimple_Calculate returns the correct values. It seems for some reason when the results go negative we no longer call the AFNumber_Format method. I'm trying to track down what triggers that method to be called after the Calculate method. It's in the additional actions to trigger but it just doesn't.
Labels: M-66
Status: Started (was: Assigned)
https://pdfium-review.googlesource.com/c/pdfium/+/28110

Not a regression, right?
It's possible it's a regression, I didn't bisect. There is a lot of code in there that could have thrown this off.
Although, given it says also fails in M63 it's been in for ... a while at least.
Project Member

Comment 9 by bugdroid1@chromium.org, Mar 12 2018

The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium/+/c2df008640f56631735dd3ae89e118c9c56cd36d

commit c2df008640f56631735dd3ae89e118c9c56cd36d
Author: Dan Sinclair <dsinclair@chromium.org>
Date: Mon Mar 12 14:17:54 2018

Handle inserting negative values without a selection

When handling the AFNumber_Keystroke callback, if the changed value is
negative and there is no selection, we'd incorrectly error out thinking
we were inserting before the negative sign.

This CL checks if the selection string is empty before erroring out.

Bug:  chromium:817433 
Change-Id: I0ca08e121e9a8c207e9c7793f5b8a4e795c135e6
Reviewed-on: https://pdfium-review.googlesource.com/28110
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>

[modify] https://crrev.com/c2df008640f56631735dd3ae89e118c9c56cd36d/fxjs/cjs_publicmethods.cpp
[modify] https://crrev.com/c2df008640f56631735dd3ae89e118c9c56cd36d/fxjs/cjs_publicmethods_embeddertest.cpp

Status: Fixed (was: Started)
Cc: dsinclair@chromium.org
 Issue 826291  has been merged into this issue.
Labels: Merge-Request-66
Project Member

Comment 13 by sheriffbot@chromium.org, Apr 3 2018

Labels: -Merge-Request-66 Merge-Review-66 Hotlist-Merge-Review
This bug requires manual review: We are only 13 days from stable.
Please contact the milestone owner if you have questions.
Owners: cmasso@(Android), cmasso@(iOS), josafat@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Merge-Review-66 Merge-Approved-66
Approving merge to M66. Branch:3359
Project Member

Comment 15 by bugdroid1@chromium.org, Apr 4 2018

Labels: -merge-approved-66 merge-merged-3359
The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium/+/2e8701bf5c0703e8d76ad77223a99dd8b8fe6b6f

commit 2e8701bf5c0703e8d76ad77223a99dd8b8fe6b6f
Author: Dan Sinclair <dsinclair@chromium.org>
Date: Wed Apr 04 02:24:20 2018

[Merge M66] Handle inserting negative values without a selection

When handling the AFNumber_Keystroke callback, if the changed value is
negative and there is no selection, we'd incorrectly error out thinking
we were inserting before the negative sign.

This CL checks if the selection string is empty before erroring out.

TBR=hnakashima@chromium.org

Bug:  chromium:817433 
Change-Id: I0ca08e121e9a8c207e9c7793f5b8a4e795c135e6
Reviewed-on: https://pdfium-review.googlesource.com/28110
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
(cherry picked from commit c2df008640f56631735dd3ae89e118c9c56cd36d)
Reviewed-on: https://pdfium-review.googlesource.com/29730
Reviewed-by: dsinclair <dsinclair@chromium.org>

[modify] https://crrev.com/2e8701bf5c0703e8d76ad77223a99dd8b8fe6b6f/fxjs/cjs_publicmethods.cpp
[modify] https://crrev.com/2e8701bf5c0703e8d76ad77223a99dd8b8fe6b6f/fxjs/cjs_publicmethods_embeddertest.cpp

Sign in to add a comment