Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the optional UserUnit entry as a page property #7832

Merged
merged 1 commit into from
Nov 22, 2016

Conversation

seanburke-wf
Copy link
Contributor

@seanburke-wf seanburke-wf commented Nov 21, 2016

This provides access to the optional UserUnit page entry from spec v1.6+ for consumers of the API. Returns a default value of 1.0 (per spec) when entry is not present.

I've attempted to follow the pattern used by other page entries, as found in the surrounding code.

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/02086fde5bbfbc4/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/02086fde5bbfbc4/output.txt

Total script time: 2.74 mins

Published

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.22.172.223:8877/4aedfd7b93108f0/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/11bc75d40ec9939/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/4aedfd7b93108f0/output.txt

Total script time: 26.04 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.22.172.223:8877/4aedfd7b93108f0/reftest-analyzer.html#web=eq.log

@@ -138,6 +138,15 @@ var Page = (function PageClosure() {
return shadow(this, 'mediaBox', obj);
},

get userUnit() {
var obj = this.getPageProp('UserUnit');
// Optional according to the spec with a default value of 1.0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the comment and introduce DEFAULT_USER_UNIT = 1.0; constant above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed.

@pdfjsbot
Copy link

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/11bc75d40ec9939/output.txt

Total script time: 41.25 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.21.233.14:8877/11bc75d40ec9939/reftest-analyzer.html#web=eq.log

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/357d50c8ff77e13/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/357d50c8ff77e13/output.txt

Total script time: 2.17 mins

Published

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.22.172.223:8877/ffbd93659b11303/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/0e26674a8fe4a92/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/ffbd93659b11303/output.txt

Total script time: 25.71 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/0e26674a8fe4a92/output.txt

Total script time: 26.90 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@@ -138,6 +139,14 @@ var Page = (function PageClosure() {
return shadow(this, 'mediaBox', obj);
},

get userUnit() {
var obj = this.getPageProp('UserUnit');
if (typeof obj !== 'number') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the isNum utility function instead; note that you may have to add var isNum = sharedUtil.isNum; at top of the file along with the other sharedUtil imports.
Furthermore, since the specification mentions that this should be a positive number, let's add a check for that as well, e.g.

if (!(isNum(obj) && obj > 0)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed.

@yurydelendik
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/cf10118c7e368cf/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/9b0d3541007b7fb/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/cf10118c7e368cf/output.txt

Total script time: 26.15 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/9b0d3541007b7fb/output.txt

Total script time: 26.41 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@timvandermeij timvandermeij merged commit 9ff1998 into mozilla:master Nov 22, 2016
@timvandermeij
Copy link
Contributor

Thank you!

@seanburke-wf seanburke-wf deleted the expose-userunit-on-page branch November 22, 2016 20:37
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
…page

Expose the optional UserUnit entry as a page property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants