| Index: chrome/renderer/render_view.cc
|
| diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
|
| index 95da38238263431dacd9c411746067adf1a5382c..80dcacfe82857fc2616d81724ffe48f9cceebed6 100644
|
| --- a/chrome/renderer/render_view.cc
|
| +++ b/chrome/renderer/render_view.cc
|
| @@ -5806,6 +5806,42 @@ bool RenderView::IsNonLocalTopLevelNavigation(
|
| return false;
|
| }
|
|
|
| +bool RenderView::IsReadyToPaint() const {
|
| + if (!webview() || !webview()->mainFrame())
|
| + return false;
|
| +
|
| + WebDocument doc = webview()->mainFrame()->document();
|
| +
|
| + // There is no way to detect a paint readiness for non-(X)HTML page;
|
| + // Just allows to paint.
|
| + if (!doc.isHTMLDocument() && !doc.isXHTMLDocument())
|
| + return true;
|
| +
|
| + // The are some possible strategy to detect readiness:
|
| + // - (1) Gets ready when the downloading started, or
|
| + // - (2) Gets ready when the <head> contents are loaded, or
|
| + // - (3) Gets ready when the whole HTML loaded, or
|
| + // - (4) Gets ready when (3) plus whole external CSS loaded
|
| + //
|
| + // And here is a trade-off.
|
| + // - Former can start page rendering earlier.
|
| + // - Later can save page reflow and re-styling, thus avoid flickering.
|
| + //
|
| + // Current choice is (2).
|
| + // More intelligent design might be desirable though.
|
| +
|
| + // If you have <body>, It is expected that preceding <head> contents
|
| + // including inline <style> and <script> elements are totally loaded.
|
| + // Also note that:
|
| + // - WebKit generates <body> for images and plugins.
|
| + // - WebKit generates missing <body> for ill-formed HTMLs.
|
| + // - A <frameset> can be returned for body().
|
| + if ((doc.isNull() || doc.body().isNull()))
|
| + return false;
|
| +
|
| + return true;
|
| +}
|
| +
|
| void RenderView::OnOpenFileSystemRequestComplete(
|
| int request_id, bool accepted, const string16& name,
|
| const string16& root_path) {
|
|
|