Skip to content

Annotation border styles - #5585

Merged
brendandahl merged 4 commits into
mozilla:masterfrom
timvandermeij:annotation-layer-borderstyle
Jul 1, 2015
Merged

brendandahl merged 4 commits into
mozilla:masterfrom
timvandermeij:annotation-layer-borderstyle

Conversation

@timvandermeij

Copy link
Copy Markdown
Collaborator

This PR implements annotation border styles according to the official PDF specification at https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf, section 8.4.3.

Most of the code is rewriting the old code, but there are some minor additions in order to adhere better to the specification. These are:

Unimplemented border styles have been indicated using warn() so it is clear that these are missing (and there are barely used in PDFs on the web). I have added documentation and unit/regression tests to increase testability of the annotation layer and to avoid regressions.

@timvandermeij
timvandermeij force-pushed the annotation-layer-borderstyle branch 2 times, most recently from 44c7126 to 7959f7a Compare December 25, 2014 20:49
Comment thread src/core/annotation.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: space

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@timvandermeij
timvandermeij force-pushed the annotation-layer-borderstyle branch 3 times, most recently from c0e9b85 to 4d357a9 Compare December 25, 2014 22:00
@CodingFabian

Copy link
Copy Markdown
Contributor

looks good to me.

Comment thread src/core/annotation.js Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As I commented in #5218 (diff):

Does every kind of Annotation contain a Border entry? If not, you might want to initialize this lazily instead.

To initialize it lazily, you remove this line and instead add e.g. the following method to the prototype:

get borderStyle() {
  return shadow(this, 'borderStyle', new AnnotationBorderStyle());
},

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This has been fixed now. Thank you for reminding me about this, I forgot to apply this fix from the previous PR.

@CodingFabian

Copy link
Copy Markdown
Contributor

thanks @timvandermeij for picking this up. i thought it landed already.

Comment thread src/core/annotation.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems a bit weird to have a get and set that return/take different things. What about:

  1. In the constructor create the AnnotationBorderStyle and set it to borderStyle
  2. have setBorderStyle become updateBorderStyle
  3. remove the getters for border style and access the object directly

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed as per discussion on IRC.

@brendandahl

Copy link
Copy Markdown
Contributor

Overall looks good, just need to iron the getter/setter stuff.

@timvandermeij
timvandermeij force-pushed the annotation-layer-borderstyle branch 2 times, most recently from 5cabc5c to 7f8a4f0 Compare June 17, 2015 19:52
This patch adds:
- Unit tests for the annotation border style class
- Regression test (self-made) for the annotation border style class
- Documentation generation using JSDoc
@timvandermeij
timvandermeij force-pushed the annotation-layer-borderstyle branch from 7f8a4f0 to 6007a57 Compare June 17, 2015 20:28
@timvandermeij

Copy link
Copy Markdown
Collaborator Author

/botio-linux preview

@pdfjsbot

Copy link
Copy Markdown

@timvandermeij

Copy link
Copy Markdown
Collaborator Author

/botio test

@pdfjsbot

Copy link
Copy Markdown

@pdfjsbot

Copy link
Copy Markdown

@pdfjsbot

Copy link
Copy Markdown

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/273ecadc4658c28/output.txt

Total script time: 18.14 mins

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

@pdfjsbot

Copy link
Copy Markdown

From: Bot.io (Windows)


Success

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

Total script time: 18.82 mins

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

brendandahl added a commit that referenced this pull request Jul 1, 2015
@brendandahl
brendandahl merged commit 98339f6 into mozilla:master Jul 1, 2015
@timvandermeij
timvandermeij deleted the annotation-layer-borderstyle branch July 1, 2015 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hyperlink displays incorrectly

6 participants