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

[PDFSidebarResizer] Add a couple of (small) readability improvements in the code #11198

Merged
merged 3 commits into from
Oct 5, 2019

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Oct 3, 2019

Please refer to the individual commit messages for additional details.

Smaller diff with https://github.com/mozilla/pdf.js/pull/11198/files?w=1

Since CSS variable support cannot be disabled any more in Firefox, the run-time checks are of no using for MOZCENTRAL builds.
Rather than manually clamping the `width` here, we can just `export` an already existing helper function from `ui_utils.js` instead.

(Hopefully it will eventually be possible to replace this helper function with a native `Math.clamp` function, given that there exists a "Stage 1 Proposal" for adding such a thing to the ECMAScript specification.)
…readability

I've absolutely no idea why I wrote the code that way originally, since the nested `if`s are not really helping readability one bit.
Hence this patch which changes things to use early `return`s instead, to help readability.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Oct 3, 2019

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/3763234f99ada90/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 3, 2019

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/3763234f99ada90/output.txt

Total script time: 1.66 mins

Published

@timvandermeij timvandermeij merged commit 0786363 into mozilla:master Oct 5, 2019
@timvandermeij
Copy link
Contributor

Looks good!

@Snuffleupagus Snuffleupagus deleted the PDFSidebarResizer-fixes branch October 6, 2019 08:23
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