-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Simplify B2G viewer #5947
Simplify B2G viewer #5947
Conversation
c287dc8
to
40268e9
Compare
The (standard) preview and the extension is still not working: |
40268e9
to
0cb074d
Compare
document.getElementById('activityTitle').textContent = title; | ||
}, | ||
|
||
get pagesCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we have a link service here and this function (and the other two below this one) are also implemented there, can't we make use of the ones in the link service instead to avoid duplication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is nice to have those functions on the PDFViewerApplication level as well.
This is a really nice refactoring! I think we can make the code in |
container.addEventListener('pagesinit', function () { | ||
// we can use pdfViewer now, e.g. let's change default scale. | ||
pdfViewer.currentScaleValue = 'page-width'; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just asking: did you intend to change the initial zoom level from auto
to page-width
, or is it a result of copy-pasting from the simpleviewer component?
I'd still like to think through the class dependencies, between e.g. One small request on my part though: Can we please try and land PR #5699 before this one? That one has been open for quite some time, and it's already been bit-rotten a couple of times. This patch would cause even more merge conflicts, so I'd really appreciate if it could go first :-) This PR removes both
|
0cb074d
to
a892bc8
Compare
this.pdfHistory.initialize(pdfDocument.fingerprint); | ||
}.bind(this), function (error) { | ||
// TODO handle and localize loading error? | ||
console.error('PDF loading error: ' + error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're missing a semicolon here at the end (Travis also appears to be complaining about that).
@yurydelendik Now that #5971 has landed, could you rebase the PR so I can play with it more, also on an actual Flame? |
A quick visual glitch that I noticed in the UI: |
Also, is the |
There appears to be a problem with the "zoom in" functionality. To reproduce, open http://107.21.233.14:8877/a5bae2087f5c8d3/extensions/b2g/content/web/viewer.html and click the Zoom In button (plus icon) in the bottom right. Notice the page not zooming in and notice that the following message is printed in the console: "pdfViewSetScale: '0' is an unknown zoom value." Zooming out zooms out to the minimal scale so it seems, which is also not correct, but after that zooming appears to work properly. Any idea what is causing this? |
e144bd5
to
a801cf0
Compare
Question: How about instead using https://github.com/gaia-components/gaia-progress, similar to the other gaia-components used in the B2G viewer, for the loading bar? |
|
||
var DEFAULT_SCALE_DELTA = 1.1; | ||
var MIN_SCALE = 0.25; | ||
var MAX_SCALE = 10.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to move these constants into ui_utils.js
instead (i.e. move them from web/viewer.js
), to reduce duplication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm expecting those to be different for B2G.
Maybe. But at the moment I want to split viewer.js from B2G code. Supporting Firefox OS things shall fall on the shoulders of the professionals :) See also bug 1171998 |
These commits still have the On desktop I also notice that in the new preview the Gaia header is somewhat broken. It had a white background with black text and a 'x' sign, but now it is a gray background with white text and without the 'x' sign. I'm not yet sure what broke this though (probably we are not getting here: yurydelendik@fff0866#diff-af61da45d81c12dd8e6859e95eba2cc4R358). I have also not had time to test this on an actual Flame because I'm busy until the June 12th. I will do those tests after that time though. |
I decided to keep them in case if PDF file will be corrupted. Therefore I added proper error handling. |
It will be. The gaia project keep changing/reorganizing UI dependencies and l10n support. That's why we need to phase out the support of this viewer in this repo. |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/e4fdc7bfa4fb412/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/f207f3bbe4aa073/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/f207f3bbe4aa073/output.txt Total script time: 18.11 mins
|
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/e4fdc7bfa4fb412/output.txt Total script time: 18.22 mins
|
<!-- <link rel="stylesheet" type="text/css" href="/shared/elements/gaia-icons/style.css" /> --> | ||
<script type="text/javascript" src="/shared/elements/config.js"></script> | ||
<script type="text/javascript" src="/shared/elements/gaia-header/dist/script.js"></script> | ||
<link rel="stylesheet" type="text/css" href="/shared/elements/gaia-theme/gaia-theme.css" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove /
at the end: end it with gaia-theme.css">
pdfViewer: null, | ||
pdfHistory: null, | ||
pdfLinkService: null, | ||
loading: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this line is unused and can be removed (#6140).
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/397d75075264a93/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/397d75075264a93/output.txt Total script time: 0.62 mins Published |
/botio lint |
From: Bot.io (Windows)ReceivedCommand cmd_lint from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/d91f0eb88f9f40d/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_lint from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/70f3339a1385d0b/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/70f3339a1385d0b/output.txt Total script time: 0.77 mins
|
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/d91f0eb88f9f40d/output.txt Total script time: 1.04 mins
|
Great work! |
... also extracts PDFLinkService and PDFHistory APIs