summaryrefslogtreecommitdiffstats
path: root/src/core/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r--src/core/render_widget_host_view_qt.cpp152
1 files changed, 87 insertions, 65 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 2918fd8bc..7633aa44c 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -120,8 +120,7 @@ static inline ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& even
if (!event.TimeStamp().is_null()) {
latency_info.AddLatencyNumberWithTimestamp(
ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
- event.TimeStamp(),
- 1);
+ event.TimeStamp());
}
return latency_info;
}
@@ -280,6 +279,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget
, m_touchMotionStarted(false)
, m_enableViz(features::IsVizDisplayCompositorEnabled())
, m_visible(false)
+ , m_needsBeginFrames(false)
, m_loadVisuallyCommittedState(NotCommitted)
, m_adapterClient(0)
, m_imeInProgress(false)
@@ -340,6 +340,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget
// May call SetNeedsBeginFrames
host()->SetView(this);
+ host()->GetProcess()->AddObserver(this);
}
RenderWidgetHostViewQt::~RenderWidgetHostViewQt()
@@ -353,6 +354,7 @@ RenderWidgetHostViewQt::~RenderWidgetHostViewQt()
if (text_input_manager_)
text_input_manager_->RemoveObserver(this);
+ host()->GetProcess()->RemoveObserver(this);
m_touchSelectionController.reset();
m_touchSelectionControllerClient.reset();
@@ -536,110 +538,110 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor)
ui::CursorType auraType = ui::CursorType::kNull;
#endif
switch (cursorInfo.type) {
- case blink::WebCursorInfo::kTypePointer:
+ case ui::CursorType::kPointer:
shape = Qt::ArrowCursor;
break;
- case blink::WebCursorInfo::kTypeCross:
+ case ui::CursorType::kCross:
shape = Qt::CrossCursor;
break;
- case blink::WebCursorInfo::kTypeHand:
+ case ui::CursorType::kHand:
shape = Qt::PointingHandCursor;
break;
- case blink::WebCursorInfo::kTypeIBeam:
+ case ui::CursorType::kIBeam:
shape = Qt::IBeamCursor;
break;
- case blink::WebCursorInfo::kTypeWait:
+ case ui::CursorType::kWait:
shape = Qt::WaitCursor;
break;
- case blink::WebCursorInfo::kTypeHelp:
+ case ui::CursorType::kHelp:
shape = Qt::WhatsThisCursor;
break;
- case blink::WebCursorInfo::kTypeEastResize:
- case blink::WebCursorInfo::kTypeWestResize:
- case blink::WebCursorInfo::kTypeEastWestResize:
- case blink::WebCursorInfo::kTypeEastPanning:
- case blink::WebCursorInfo::kTypeWestPanning:
+ case ui::CursorType::kEastResize:
+ case ui::CursorType::kWestResize:
+ case ui::CursorType::kEastWestResize:
+ case ui::CursorType::kEastPanning:
+ case ui::CursorType::kWestPanning:
shape = Qt::SizeHorCursor;
break;
- case blink::WebCursorInfo::kTypeNorthResize:
- case blink::WebCursorInfo::kTypeSouthResize:
- case blink::WebCursorInfo::kTypeNorthSouthResize:
- case blink::WebCursorInfo::kTypeNorthPanning:
- case blink::WebCursorInfo::kTypeSouthPanning:
+ case ui::CursorType::kNorthResize:
+ case ui::CursorType::kSouthResize:
+ case ui::CursorType::kNorthSouthResize:
+ case ui::CursorType::kNorthPanning:
+ case ui::CursorType::kSouthPanning:
shape = Qt::SizeVerCursor;
break;
- case blink::WebCursorInfo::kTypeNorthEastResize:
- case blink::WebCursorInfo::kTypeSouthWestResize:
- case blink::WebCursorInfo::kTypeNorthEastSouthWestResize:
- case blink::WebCursorInfo::kTypeNorthEastPanning:
- case blink::WebCursorInfo::kTypeSouthWestPanning:
+ case ui::CursorType::kNorthEastResize:
+ case ui::CursorType::kSouthWestResize:
+ case ui::CursorType::kNorthEastSouthWestResize:
+ case ui::CursorType::kNorthEastPanning:
+ case ui::CursorType::kSouthWestPanning:
shape = Qt::SizeBDiagCursor;
break;
- case blink::WebCursorInfo::kTypeNorthWestResize:
- case blink::WebCursorInfo::kTypeSouthEastResize:
- case blink::WebCursorInfo::kTypeNorthWestSouthEastResize:
- case blink::WebCursorInfo::kTypeNorthWestPanning:
- case blink::WebCursorInfo::kTypeSouthEastPanning:
+ case ui::CursorType::kNorthWestResize:
+ case ui::CursorType::kSouthEastResize:
+ case ui::CursorType::kNorthWestSouthEastResize:
+ case ui::CursorType::kNorthWestPanning:
+ case ui::CursorType::kSouthEastPanning:
shape = Qt::SizeFDiagCursor;
break;
- case blink::WebCursorInfo::kTypeColumnResize:
+ case ui::CursorType::kColumnResize:
shape = Qt::SplitHCursor;
break;
- case blink::WebCursorInfo::kTypeRowResize:
+ case ui::CursorType::kRowResize:
shape = Qt::SplitVCursor;
break;
- case blink::WebCursorInfo::kTypeMiddlePanning:
- case blink::WebCursorInfo::kTypeMove:
+ case ui::CursorType::kMiddlePanning:
+ case ui::CursorType::kMove:
shape = Qt::SizeAllCursor;
break;
- case blink::WebCursorInfo::kTypeProgress:
+ case ui::CursorType::kProgress:
shape = Qt::BusyCursor;
break;
- case blink::WebCursorInfo::kTypeCopy:
+ case ui::CursorType::kCopy:
shape = Qt::DragCopyCursor;
break;
- case blink::WebCursorInfo::kTypeAlias:
+ case ui::CursorType::kAlias:
shape = Qt::DragLinkCursor;
break;
#if defined(USE_AURA)
- case blink::WebCursorInfo::kTypeVerticalText:
+ case ui::CursorType::kVerticalText:
auraType = ui::CursorType::kVerticalText;
break;
- case blink::WebCursorInfo::kTypeCell:
+ case ui::CursorType::kCell:
auraType = ui::CursorType::kCell;
break;
- case blink::WebCursorInfo::kTypeContextMenu:
+ case ui::CursorType::kContextMenu:
auraType = ui::CursorType::kContextMenu;
break;
- case blink::WebCursorInfo::kTypeZoomIn:
+ case ui::CursorType::kZoomIn:
auraType = ui::CursorType::kZoomIn;
break;
- case blink::WebCursorInfo::kTypeZoomOut:
+ case ui::CursorType::kZoomOut:
auraType = ui::CursorType::kZoomOut;
break;
#else
- case blink::WebCursorInfo::kTypeVerticalText:
- case blink::WebCursorInfo::kTypeCell:
- case blink::WebCursorInfo::kTypeContextMenu:
- case blink::WebCursorInfo::kTypeZoomIn:
- case blink::WebCursorInfo::kTypeZoomOut:
+ case ui::CursorType::kVerticalText:
+ case ui::CursorType::kCell:
+ case ui::CursorType::kContextMenu:
+ case ui::CursorType::kZoomIn:
+ case ui::CursorType::kZoomOut:
// FIXME: Support on OS X
break;
#endif
- case blink::WebCursorInfo::kTypeNoDrop:
- case blink::WebCursorInfo::kTypeNotAllowed:
+ case ui::CursorType::kNoDrop:
+ case ui::CursorType::kNotAllowed:
shape = Qt::ForbiddenCursor;
break;
- case blink::WebCursorInfo::kTypeNone:
+ case ui::CursorType::kNone:
shape = Qt::BlankCursor;
break;
- case blink::WebCursorInfo::kTypeGrab:
+ case ui::CursorType::kGrab:
shape = Qt::OpenHandCursor;
break;
- case blink::WebCursorInfo::kTypeGrabbing:
+ case ui::CursorType::kGrabbing:
shape = Qt::ClosedHandCursor;
break;
- case blink::WebCursorInfo::kTypeCustom:
+ case ui::CursorType::kCustom:
if (cursorInfo.custom_image.colorType() == SkColorType::kN32_SkColorType) {
QImage cursor = toQImage(cursorInfo.custom_image, QImage::Format_ARGB32);
m_delegate->updateCursor(QCursor(QPixmap::fromImage(cursor), cursorInfo.hotspot.x(), cursorInfo.hotspot.y()));
@@ -693,15 +695,20 @@ void RenderWidgetHostViewQt::ImeCompositionRangeChanged(const gfx::Range&, const
QT_NOT_YET_IMPLEMENTED
}
-void RenderWidgetHostViewQt::RenderProcessGone(base::TerminationStatus terminationStatus,
- int exitCode)
+void RenderWidgetHostViewQt::RenderProcessExited(content::RenderProcessHost *host,
+ const content::ChildProcessTerminationInfo &info)
{
+ Q_UNUSED(host);
// RenderProcessHost::FastShutdownIfPossible results in TERMINATION_STATUS_STILL_RUNNING
- if (m_adapterClient && terminationStatus != base::TERMINATION_STATUS_STILL_RUNNING) {
+ if (m_adapterClient && info.status != base::TERMINATION_STATUS_STILL_RUNNING) {
m_adapterClient->renderProcessTerminated(
- m_adapterClient->renderProcessExitStatus(terminationStatus),
- exitCode);
+ m_adapterClient->renderProcessExitStatus(info.status),
+ info.exit_code);
}
+}
+
+void RenderWidgetHostViewQt::RenderProcessGone()
+{
Destroy();
}
@@ -769,8 +776,11 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana
}
ui::TextInputType type = getTextInputType();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText | Qt::ImhNoTextHandles | Qt::ImhNoEditMenu);
-
+#else
+ m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText);
+#endif
m_surroundingText = toQt(state->value);
// Remove IME composition text from the surrounding text
if (state->composition_start != -1 && state->composition_end != -1)
@@ -824,7 +834,7 @@ void RenderWidgetHostViewQt::OnTextSelectionChanged(content::TextInputManager *t
#if defined(USE_OZONE)
if (!selection->selected_text().empty() && selection->user_initiated()) {
// Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
- ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION);
+ ui::ScopedClipboardWriter clipboard_writer(ui::ClipboardType::kSelection);
clipboard_writer.WriteText(selection->selected_text());
}
#endif // defined(USE_OZONE)
@@ -1005,11 +1015,9 @@ void RenderWidgetHostViewQt::notifyShown()
m_delegatedFrameHost->AttachToCompositor(m_uiCompositor.get());
m_delegatedFrameHost->WasShown(GetLocalSurfaceIdAllocation().local_surface_id(),
m_viewRectInDips.size(),
- false /* record_presentation_time */);
- host()->WasShown(false);
- } else {
- host()->WasShown(false);
+ base::nullopt);
}
+ host()->WasShown(base::nullopt);
}
void RenderWidgetHostViewQt::notifyHidden()
@@ -1019,7 +1027,7 @@ void RenderWidgetHostViewQt::notifyHidden()
return;
m_visible = false;
host()->WasHidden();
- m_delegatedFrameHost->WasHidden();
+ m_delegatedFrameHost->WasHidden(content::DelegatedFrameHost::HiddenCause::kOther);
m_delegatedFrameHost->DetachFromCompositor();
} else {
host()->WasHidden();
@@ -1199,7 +1207,11 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query)
// TODO: Implement this
return QVariant(); // No limit.
case Qt::ImHints:
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
return int(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText | Qt::ImhNoTextHandles | Qt::ImhNoEditMenu);
+#else
+ return int(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText);
+#endif
default:
return QVariant();
}
@@ -1741,8 +1753,8 @@ void RenderWidgetHostViewQt::handleFocusEvent(QFocusEvent *ev)
void RenderWidgetHostViewQt::SetNeedsBeginFrames(bool needs_begin_frames)
{
- DCHECK(!m_enableViz);
- m_compositor->setNeedsBeginFrames(needs_begin_frames);
+ m_needsBeginFrames = needs_begin_frames;
+ UpdateNeedsBeginFramesInternal();
}
content::RenderFrameHost *RenderWidgetHostViewQt::getFocusedFrameHost()
@@ -1777,6 +1789,8 @@ ui::TextInputType RenderWidgetHostViewQt::getTextInputType() const
void RenderWidgetHostViewQt::SetWantsAnimateOnlyBeginFrames()
{
+ if (m_enableViz)
+ m_delegatedFrameHost->SetWantsAnimateOnlyBeginFrames();
}
viz::SurfaceId RenderWidgetHostViewQt::GetCurrentSurfaceId() const
@@ -1877,4 +1891,12 @@ std::unique_ptr<content::SyntheticGestureTarget> RenderWidgetHostViewQt::CreateS
return nullptr;
}
+void RenderWidgetHostViewQt::UpdateNeedsBeginFramesInternal()
+{
+ if (m_enableViz)
+ m_delegatedFrameHost->SetNeedsBeginFrames(m_needsBeginFrames);
+ else
+ m_compositor->setNeedsBeginFrames(m_needsBeginFrames);
+}
+
} // namespace QtWebEngineCore