Skip to content

Commit

Permalink
Add 1 extra delayed big frames render at page load
Browse files Browse the repository at this point in the history
Without getting into the whole CSS transitions problem, this is a quick
solution to ensuring that text both loads as quickly as possible and
also loads aftera delay fo 500ms when hopefully all page load
transitions have completed.

Touches #39
  • Loading branch information
tombh committed Jun 23, 2018
1 parent f01b72d commit 802a612
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion webext/src/dom/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ export default class extends utils.mixins(CommonMixin, CommandsMixin) {
_setupInteractiveMode() {
this._setupDebouncedFunctions();
this._startMutationObserver();
this.sendAllBigFrames();
this.sendAllBigFrames()
// Send again for pages that have page load transition effects :/
// TODO:
// Disabling CSS transitions is not easy, many pages won't even render
// if they're disabled. Eg; Google's login process.
// What if we could get a post-transition hook?
setTimeout(()=> {this.sendAllBigFrames()}, 500);
}

_setupDebouncedFunctions() {
Expand Down
2 changes: 1 addition & 1 deletion webext/src/dom/text_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default class extends utils.mixins(CommonMixin, SerialiseMixin) {

buildFormattedText() {
this._updateState();
this.graphics_builder.getScreenshotWithText();
this.graphics_builder.getScreenshotWithoutText();
this.graphics_builder.getScreenshotWithText();
this._getTextNodes();
this._positionTextNodes();
}
Expand Down

0 comments on commit 802a612

Please sign in to comment.