Closed Bug 1123408 Opened 9 years ago Closed 9 years ago

Include reader mode assets as real resources

Categories

(Firefox for iOS :: Reader View, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: st3fan, Assigned: st3fan)

References

Details

Attachments

(1 file)

Currently the reader mode assets (aboutReader.html and aboutReader.css) are included inline in ReaderMode.js as a base64 encoded string.

This works fine and fast but it is not ideal because it is hard to work with those files.

This was done because there is no easy way to load an application resource from the WKWebView: because of the content process separation and sandboxing that happens it is not possible use file: URLs.

As an alternative I am going to suggest that the Swift side loads the template instead, does the substitutions in it and then loads it in the WKWebView.

This means that the template setup code in ReaderMode.js will move to the ReaderMode.swift so that the native code will then prepare the content and passes it to the WKWebView via loadHTMLString().

The original CSS in aboutReader.css has all the content set to invisible. This was probably done to minimize flickering when the readerized content is loaded in it and the user defined settings (font face/size/theme) are applied.

We can keep this but it means that the ReaderMode.swift needs a page loaded callback so that we can apply the user style and make the document visible. Need to experiment because ideally we go from original page to readerized page really quickly without seeing any noticable delay or flickering or changes in content.
The last bit of comment #1 should be in a separate bug. It can be done as a followup bug to this one.
Attached file Pull Request
Attachment #8553203 - Flags: review?(wjohnston)
Attachment #8553203 - Flags: review?(wjohnston) → review?(bnicholson)
Assignee: nobody → sarentz
Status: NEW → ASSIGNED
Attachment #8553203 - Flags: review?(bnicholson) → review+
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: