Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1129)

Unified Diff: ui/file_manager/file_manager/foreground/elements/files_safe_media_webview_content.js

Issue 2274713006: Fix FOUC issue on Quick View. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/file_manager/foreground/elements/files_safe_media_webview_content.js
diff --git a/ui/file_manager/file_manager/foreground/elements/files_safe_audio_webview_content.js b/ui/file_manager/file_manager/foreground/elements/files_safe_media_webview_content.js
similarity index 54%
rename from ui/file_manager/file_manager/foreground/elements/files_safe_audio_webview_content.js
rename to ui/file_manager/file_manager/foreground/elements/files_safe_media_webview_content.js
index 53bcfdb6b18029f18ed0998017fb6e9c14a2f1f4..7294b5738cb4bf4c8bb08095ed6a57f49a82a3d8 100644
--- a/ui/file_manager/file_manager/foreground/elements/files_safe_audio_webview_content.js
+++ b/ui/file_manager/file_manager/foreground/elements/files_safe_media_webview_content.js
@@ -9,9 +9,6 @@ window.onload = function() {
var content = document.getElementById('content');
window.addEventListener('message', function(event) {
- // TODO(oka): Fix FOUC problem. When webview is first created and receives
- // the first message, sometimes the body size is smaller than the outer
- // window for a moment and it causes flush of unstyled content.
if (event.origin !== FILES_APP_ORIGIN) {
console.error('Unknown origin: ' + event.origin);
return;
@@ -36,4 +33,21 @@ window.onload = function() {
if (messageSource)
messageSource.postMessage(data, FILES_APP_ORIGIN);
});
+
+ // TODO(oka): This is a workaround to fix FOUC problem, where sometimes
+ // immature view with smaller window size than outer window is rendered for a
+ // moment. Remove this after the root cause is fixed. http://crbug.com/640525
+ window.addEventListener('resize', function() {
+ // Remove hidden attribute on event of resize to avoid FOUC. The window's
+ // initial size is 100 x 100 and it's fit into the outer window size after a
+ // moment. Due to Files App's window size constraint, resized window must be
+ // larger than 100 x 100. So this event is always invoked.
+ content.removeAttribute('hidden');
+ });
+ // Fallback for the case of webview bug is fixed and above code is not
+ // executed.
+ setTimeout(function() {
+ content.removeAttribute('hidden');
+ }, 500);
+
};

Powered by Google App Engine
This is Rietveld 408576698