Bug 1054590 - [pdf.js] Update to use gaia-header
Merge pull request #5199 from yor-mozilla-com/bug1054590

Bug 1054590 - [pdf.js] Update to use gaia-header
CalRGB: optimize CalRGB calculations

Also fix one silly mistake.
Small re-factoring of DocumentProperties

With the changes made in PR 5169 to enable quicker display of the File size, `setFileSize()` can now be called during file loading. This function parses *and* localizes the file size, where the l10n is a synchronous operation.
This patch:
* Re-factors `setFileSize()` to *only* update `rawFileSize`, and moves parsing and fetching of the l10n string to a separate method that isn't called until the Document Properties dialog is actually opened.

* Adds a couple of checks to make sure that `rawFileSize` is set to a positive number.

* Removes the `fileName` and `fileSize` properties. Since they are parsed every time the Document Properties dialog is opened, it doesn't seem necessary to cache them.
Merge pull request #5200 from kkujala/calrgb

CalRGB: optimize CalRGB calculations
Merge pull request #5201 from Snuffleupagus/DocumentProperties-refactor

Small re-factoring of DocumentProperties
Only use data-font-name attributes when necessary.

The data-font-name attribute of textLayer divs are only used by the Font
Inspector. This change ensures they are only present when the pdfBug
tools are enabled.
Remove setGStateForKey() closure.

setGStateForKey() is a closure that serves no particularly useful
purpose. This change inlines it at the single call site. This avoids 1.7
MiB of allocations (because closures are objects) for the MTA map
mentioned in https://bugzilla.mozilla.org/show_bug.cgi?id=835380#c17.
Merge pull request #5205 from nnethercote/setGState-closure

Remove setGStateForKey() closure.
Merge pull request #5193 from nnethercote/data-font-name

Only use data-font-name attributes when necessary.
Debounces scroll events in web viewer.

As requested in #5178, this change debounces the scroll events.
The reason for doing so is that browsers can event-storm especially on
scroll, communicating hundreds of subpixel changes.

The main reason for this resulting in poor performance is that on each
scroll event `scrollTop` was queried, which forces layouting.

This change will use `requestAnimationFrame` to make sure the browser can
allocate enough time to other tasks. The delay is however quite small, thus
the reduction in executions is less noticeable. Modern browsers however utilize
`requestAnimationFrame` to smoothen out rendering.
Fixes Type3 negative font direction
Apply the GRAYSCALE_1BPP optimization when `needsDecode` is set.

The scanned, black-and-white document at
https://bugzilla.mozilla.org/show_bug.cgi?id=835380 doesn't benefit from
the critical GRAYSCALE_1BPP optimization because the optimization is
skipped if `needsDecode` is set.

This change addresses that, and reduces both rendering time and memory
usage for that document by almost 10x.
Merge pull request #5210 from yurydelendik/type3dir

Fixes Type3 negative font direction
Merge pull request #5208 from CodingFabian/debounce-scroll

Debounces scroll events in web viewer.
Fix ensureByte() function name (copy-and-paste error)
Merge pull request #5212 from fkaelberer/fixFunctionName

Fix ensureByte() function name (copy-and-paste error)
Merge pull request #5204 from nnethercote/needsDecode

Apply the GRAYSCALE_1BPP optimization when `needsDecode` is set.
Set transformOrigin for text layer in css.

transformOrigin is set to 0% 0% in all cases. This adds extra memory
impact into the dom tree. It also involves the CustomStyles workaround
to determine the correct css rule for the browser.
By setting all vendor and standard variants in css, the rule is applied
without the dom memory overhead and without the minor computation
overhead to set the value.
no need to set textlayer properties which are overwritten in individual styles.