Include reader mode assets as real resources

RESOLVED FIXED

Status

()

Firefox for iOS
Reader View
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: st3fan, Assigned: st3fan)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

47 bytes, text/x-github-pull-request
bnicholson
: review+
Details | Review | Splinter Review
(Assignee)

Description

3 years ago
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.
(Assignee)

Comment 1

3 years ago
The last bit of comment #1 should be in a separate bug. It can be done as a followup bug to this one.
(Assignee)

Comment 2

3 years ago
Created attachment 8553203 [details] [review]
Pull Request
Attachment #8553203 - Flags: review?(wjohnston)
(Assignee)

Updated

3 years ago
Attachment #8553203 - Flags: review?(wjohnston) → review?(bnicholson)
Assignee: nobody → sarentz
Status: NEW → ASSIGNED
Attachment #8553203 - Flags: review?(bnicholson) → review+
(Assignee)

Updated

3 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Blocks: 1127017
You need to log in before you can comment on or make changes to this bug.