summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2014-07-25 08:40:54 -0700
committerSzabolcs David <davidsz@inf.u-szeged.hu>2014-08-01 09:59:37 +0200
commit2781345715338669e2573fb0c05efe5656ca37d8 (patch)
treeb55dd9e07f5d868500a3ec3ab1ddb0b69174f784 /src/core
parenta2a8ded66e33db0313194bd23c7337f106c2140e (diff)
Add loadVisuallyCommitted signal to the experimental Quick API
This fixes the flaky QQuickWebEngineViewGraphics test and extends it with a new test case. Change-Id: I2d8a0762716cb9232fdea6473760e67ac2e7146d Reviewed-by: Andras Becsi <andras.becsi@digia.com> Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/common/qt_messages.h2
-rw-r--r--src/core/qt_render_view_observer_host.cpp11
-rw-r--r--src/core/qt_render_view_observer_host.h2
-rw-r--r--src/core/render_widget_host_view_qt.cpp11
-rw-r--r--src/core/render_widget_host_view_qt.h3
-rw-r--r--src/core/renderer/qt_render_view_observer.cpp5
-rw-r--r--src/core/renderer/qt_render_view_observer.h2
-rw-r--r--src/core/web_contents_adapter_client.h1
8 files changed, 37 insertions, 0 deletions
diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h
index 3150a9376..315987cd3 100644
--- a/src/core/common/qt_messages.h
+++ b/src/core/common/qt_messages.h
@@ -40,3 +40,5 @@ IPC_MESSAGE_ROUTED2(QtRenderViewObserverHost_DidFetchDocumentMarkup,
IPC_MESSAGE_ROUTED2(QtRenderViewObserverHost_DidFetchDocumentInnerText,
uint64 /* requestId */,
base::string16 /* innerText */)
+
+IPC_MESSAGE_ROUTED0(QtRenderViewObserverHost_DidFirstVisuallyNonEmptyLayout)
diff --git a/src/core/qt_render_view_observer_host.cpp b/src/core/qt_render_view_observer_host.cpp
index be811e0b9..178452a2c 100644
--- a/src/core/qt_render_view_observer_host.cpp
+++ b/src/core/qt_render_view_observer_host.cpp
@@ -42,6 +42,8 @@
#include "qt_render_view_observer_host.h"
#include "common/qt_messages.h"
+#include "content/public/browser/web_contents.h"
+#include "render_widget_host_view_qt.h"
#include "type_conversion.h"
#include "web_contents_adapter_client.h"
@@ -69,6 +71,8 @@ bool QtRenderViewObserverHost::OnMessageReceived(const IPC::Message& message)
onDidFetchDocumentMarkup)
IPC_MESSAGE_HANDLER(QtRenderViewObserverHost_DidFetchDocumentInnerText,
onDidFetchDocumentInnerText)
+ IPC_MESSAGE_HANDLER(QtRenderViewObserverHost_DidFirstVisuallyNonEmptyLayout,
+ onDidFirstVisuallyNonEmptyLayout)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -84,3 +88,10 @@ void QtRenderViewObserverHost::onDidFetchDocumentInnerText(quint64 requestId, co
{
m_adapterClient->didFetchDocumentInnerText(requestId, toQt(innerText));
}
+
+void QtRenderViewObserverHost::onDidFirstVisuallyNonEmptyLayout()
+{
+ RenderWidgetHostViewQt *rwhv = static_cast<RenderWidgetHostViewQt*>(web_contents()->GetRenderWidgetHostView());
+ if (rwhv)
+ rwhv->didFirstVisuallyNonEmptyLayout();
+}
diff --git a/src/core/qt_render_view_observer_host.h b/src/core/qt_render_view_observer_host.h
index 375bc816b..374e6b04b 100644
--- a/src/core/qt_render_view_observer_host.h
+++ b/src/core/qt_render_view_observer_host.h
@@ -49,6 +49,7 @@
namespace content {
class WebContents;
}
+
class WebContentsAdapterClient;
class QtRenderViewObserverHost : public content::WebContentsObserver
@@ -62,6 +63,7 @@ private:
bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE;
void onDidFetchDocumentMarkup(quint64 requestId, const base::string16& markup);
void onDidFetchDocumentInnerText(quint64 requestId, const base::string16& innerText);
+ void onDidFirstVisuallyNonEmptyLayout();
WebContentsAdapterClient *m_adapterClient;
};
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index ef07584a6..77588bc16 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -161,6 +161,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget
, m_gestureRecognizer(ui::GestureRecognizer::Create())
, m_frameNodeData(new DelegatedFrameNodeData)
, m_needsDelegatedFrameAck(false)
+ , m_didFirstVisuallyNonEmptyLayout(false)
, m_adapterClient(0)
, m_anchorPositionWithinSelection(0)
, m_cursorPositionWithinSelection(0)
@@ -608,6 +609,11 @@ void RenderWidgetHostViewQt::OnSwapCompositorFrame(uint32 output_surface_id, sco
m_frameNodeData->frameDevicePixelRatio /= dpiScale;
m_delegate->update();
+
+ if (m_didFirstVisuallyNonEmptyLayout) {
+ m_adapterClient->loadVisuallyCommitted();
+ m_didFirstVisuallyNonEmptyLayout = false;
+ }
}
void RenderWidgetHostViewQt::GetScreenInfo(blink::WebScreenInfo* results)
@@ -1099,3 +1105,8 @@ QAccessibleInterface *RenderWidgetHostViewQt::GetQtAccessible()
content::BrowserAccessibilityQt *accQt = static_cast<content::BrowserAccessibilityQt*>(acc);
return accQt;
}
+
+void RenderWidgetHostViewQt::didFirstVisuallyNonEmptyLayout()
+{
+ m_didFirstVisuallyNonEmptyLayout = true;
+}
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index 7f2090995..b4a75ad89 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -221,6 +221,8 @@ public:
QAccessibleInterface *GetQtAccessible();
+ void didFirstVisuallyNonEmptyLayout();
+
private:
void sendDelegatedFrameAck();
void Paint(const gfx::Rect& damage_rect);
@@ -243,6 +245,7 @@ private:
QExplicitlySharedDataPointer<DelegatedFrameNodeData> m_frameNodeData;
cc::ReturnedResourceArray m_resourcesToRelease;
bool m_needsDelegatedFrameAck;
+ bool m_didFirstVisuallyNonEmptyLayout;
uint32 m_pendingOutputSurfaceId;
WebContentsAdapterClient *m_adapterClient;
diff --git a/src/core/renderer/qt_render_view_observer.cpp b/src/core/renderer/qt_render_view_observer.cpp
index 192ba99f9..3322f092d 100644
--- a/src/core/renderer/qt_render_view_observer.cpp
+++ b/src/core/renderer/qt_render_view_observer.cpp
@@ -70,6 +70,11 @@ void QtRenderViewObserver::onFetchDocumentInnerText(quint64 requestId)
render_view()->GetWebView()->mainFrame()->document().documentElement().innerText()));
}
+void QtRenderViewObserver::OnFirstVisuallyNonEmptyLayout()
+{
+ Send(new QtRenderViewObserverHost_DidFirstVisuallyNonEmptyLayout(routing_id()));
+}
+
bool QtRenderViewObserver::OnMessageReceived(const IPC::Message& message)
{
bool handled = true;
diff --git a/src/core/renderer/qt_render_view_observer.h b/src/core/renderer/qt_render_view_observer.h
index c37dce16d..491b4052f 100644
--- a/src/core/renderer/qt_render_view_observer.h
+++ b/src/core/renderer/qt_render_view_observer.h
@@ -51,6 +51,8 @@ private:
void onFetchDocumentMarkup(quint64 requestId);
void onFetchDocumentInnerText(quint64 requestId);
+ void OnFirstVisuallyNonEmptyLayout() Q_DECL_OVERRIDE;
+
virtual bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(QtRenderViewObserver);
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index b7836e4ca..f8f729f60 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -138,6 +138,7 @@ public:
virtual qreal dpiScale() const = 0;
virtual void loadStarted(const QUrl &provisionalUrl) = 0;
virtual void loadCommitted() = 0;
+ virtual void loadVisuallyCommitted() = 0;
virtual void loadFinished(bool success, int error_code = 0, const QString &error_description = QString()) = 0;
virtual void focusContainer() = 0;
virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect & initialGeometry) = 0;