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

[api-minor] Convert PDFObjects, in src/display/api.js, to an ES6 class #10233

Merged
merged 2 commits into from
Nov 8, 2018

Conversation

Snuffleupagus
Copy link
Collaborator

No description provided.

@pdfjsbot
Copy link

pdfjsbot commented Nov 7, 2018

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/5425b5e437f7c96/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 7, 2018

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/ee0d50a8914a607/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 7, 2018

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/5425b5e437f7c96/output.txt

Total script time: 19.29 mins

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

@pdfjsbot
Copy link

pdfjsbot commented Nov 7, 2018

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/ee0d50a8914a607/output.txt

Total script time: 24.97 mins

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

@@ -448,7 +448,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {

let font = null;
if (this.data.fontRefName) {
font = this.page.commonObjs.getData(this.data.fontRefName);
font = this.page.commonObjs.getSafely(this.data.fontRefName);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can get rid of getSafely altogether if we remove this font code since, as far as I could tell, this.data.fontRefName is never actually set (one of the open points from #7613 that has been bothering me a bit). If we decide to implement font support later on, we can probably just use the regular get method with a try-catch block if necessary. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

While I totally agree that this code looks quite weird, I'd nonetheless prefer to not start making larger annotationLayer changes here since that feels like scope creep.

However, I'm not entirely happy about needing the getSafely method, so I'll change this to a combination of PDFObjects.{has, get} here instead to minimize the size of the patch.

Also changes all occurrences of `var` to `const`, and marks internal properties/methods as "private".
First of all, note how there's currently *two* methods for checking if a certain object exists, which seems completely unwarranted.
Furthermore, the rarely used `getData` method was removed and its only callsite changed to use a combination of `PDFObjects.{has, get}` instead.
Finally, the methods were rearranged slightly, to bring the most important ones (for an API user) to the top of the class.
@pdfjsbot
Copy link

pdfjsbot commented Nov 8, 2018

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/09d62e7efd43910/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 8, 2018

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/d14048382b67370/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 8, 2018

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/d14048382b67370/output.txt

Total script time: 19.37 mins

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

@pdfjsbot
Copy link

pdfjsbot commented Nov 8, 2018

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/09d62e7efd43910/output.txt

Total script time: 24.46 mins

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

@timvandermeij timvandermeij merged commit 0dfedac into mozilla:master Nov 8, 2018
@timvandermeij
Copy link
Contributor

Thank you for simplifying this!

@Snuffleupagus Snuffleupagus deleted the PDFObjects-class branch November 8, 2018 22:57
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.

3 participants