Commit 4ca4d21e authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[quickview] Render text content documents the same way always

CL:720656 injected CSS into the QuickView <webview> for PDF/Text.  PDF
does not inject CSS after CL:1933850 and moreover, keeps the <webview>
transparent. We can use that fact to fix the text file rendering issue
introduced by CL:720656.

From https://bugs.chromium.org/p/chromium/issues/detail?id=742944#c37,
using webview.insertCSS() sometimes works, and sometimes does not, due
to <webview> permissions check races. And the result is different text
renderings of the same text file, depending on race results.

The cause is calling insertCSS in the loadstart event i.e., too early.
Delay it until contentload fires; that avoids the permissions race.

Bug: 742944
No-try: true
Change-Id: I0c637d5366ee6cf3448c65035b2932a62f925d91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933859Reviewed-by: default avatarAustin Tankiang <austinct@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Austin Tankiang <austinct@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718529}
parent 93422f72
......@@ -36,7 +36,7 @@
<div id="innerContentPanel" type$="[[type]]">
<!-- PDF, Text -->
<template is="dom-if" if="[[browsable]]">
<webview style="color: transparent; background: transparent;" on-loadstart='applyTextCss' class="content text-content" src="[[contentUrl]]"></webview>
<webview style="color: transparent; background: transparent;" on-contentload='applyTextCss' class="content text-content" src="[[contentUrl]]"></webview>
</template>
<!-- document/HTML -->
<template is="dom-if" if="[[isHtml_(type, subtype)]]">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment