From a03ce4b8aefb1174dce6de05babc441ac511298a Mon Sep 17 00:00:00 2001 From: Tamas Zakor Date: Tue, 21 Aug 2018 14:25:03 +0200 Subject: Replace RenderWidgetHostViewQt::m_host by RenderWidgetHostViewBase::host() Change-Id: I327c2459e803602dae107defec8d03d75f363cd7 Reviewed-by: Peter Varga --- src/core/render_widget_host_view_qt.cpp | 77 ++++++++++++++++----------------- 1 file changed, 38 insertions(+), 39 deletions(-) (limited to 'src/core/render_widget_host_view_qt.cpp') diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index e706c5869..7d70da9ec 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -321,7 +321,6 @@ bool isAccessibilityEnabled() { RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget) : content::RenderWidgetHostViewBase::RenderWidgetHostViewBase(widget) - , m_host(content::RenderWidgetHostImpl::From(widget)) , m_gestureProvider(QtGestureProviderConfig(), this) , m_sendMotionActionDown(false) , m_touchMotionStarted(false) @@ -348,7 +347,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget m_beginFrameSource.reset(new viz::DelayBasedBeginFrameSource( std::make_unique(task_runner), 0)); - m_host->SetView(this); + host()->SetView(this); #ifndef QT_NO_ACCESSIBILITY if (isAccessibilityEnabled()) { QAccessible::installActivationObserver(this); @@ -477,7 +476,7 @@ void RenderWidgetHostViewQt::Focus() { if (!IsPopup()) m_delegate->setKeyboardFocus(); - m_host->Focus(); + host()->Focus(); } bool RenderWidgetHostViewQt::HasFocus() const @@ -528,8 +527,8 @@ void RenderWidgetHostViewQt::SetBackgroundColor(SkColor color) // Set the background of the compositor if necessary m_delegate->setClearColor(toQt(color)); // Set the background of the blink::FrameView - m_host->SetBackgroundOpaque(SkColorGetA(color) == SK_AlphaOPAQUE); - m_host->Send(new RenderViewObserverQt_SetBackgroundColor(m_host->GetRoutingID(), color)); + host()->SetBackgroundOpaque(SkColorGetA(color) == SK_AlphaOPAQUE); + host()->Send(new RenderViewObserverQt_SetBackgroundColor(host()->GetRoutingID(), color)); } // Return value indicates whether the mouse is locked successfully or not. @@ -547,7 +546,7 @@ void RenderWidgetHostViewQt::UnlockMouse() mouse_locked_ = false; m_delegate->unlockMouse(); qApp->restoreOverrideCursor(); - m_host->LostMouseLock(); + host()->LostMouseLock(); } void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) @@ -973,7 +972,7 @@ void RenderWidgetHostViewQt::selectionChanged() void RenderWidgetHostViewQt::OnGestureEvent(const ui::GestureEventData& gesture) { - m_host->ForwardGestureEvent(ui::CreateWebGestureEventFromGestureEventData(gesture)); + host()->ForwardGestureEvent(ui::CreateWebGestureEventFromGestureEventData(gesture)); } QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode) @@ -997,36 +996,36 @@ QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode) void RenderWidgetHostViewQt::notifyResize() { - m_host->WasResized(); - m_host->SendScreenRects(); + host()->WasResized(); + host()->SendScreenRects(); } void RenderWidgetHostViewQt::notifyShown() { - m_host->WasShown(ui::LatencyInfo()); + host()->WasShown(ui::LatencyInfo()); } void RenderWidgetHostViewQt::notifyHidden() { - m_host->WasHidden(); + host()->WasHidden(); } void RenderWidgetHostViewQt::windowBoundsChanged() { - m_host->SendScreenRects(); + host()->SendScreenRects(); if (m_delegate->window()) - m_host->NotifyScreenInfoChanged(); + host()->NotifyScreenInfoChanged(); } void RenderWidgetHostViewQt::windowChanged() { if (m_delegate->window()) - m_host->NotifyScreenInfoChanged(); + host()->NotifyScreenInfoChanged(); } bool RenderWidgetHostViewQt::forwardEvent(QEvent *event) { - Q_ASSERT(m_host->GetView()); + Q_ASSERT(host()->GetView()); switch (event->type()) { case QEvent::ShortcutOverride: { @@ -1123,7 +1122,7 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event) break; case QEvent::HoverLeave: case QEvent::Leave: - m_host->ForwardMouseEvent(WebEventFactory::toWebMouseEvent(event)); + host()->ForwardMouseEvent(WebEventFactory::toWebMouseEvent(event)); break; default: return false; @@ -1183,8 +1182,8 @@ void RenderWidgetHostViewQt::closePopup() // We notify the popup to be closed by telling it that it lost focus. WebKit does the rest // (hiding the widget and automatic memory cleanup via // RenderWidget::CloseWidgetSoon() -> RenderWidgetHostImpl::ShutdownAndDestroyWidget(true). - m_host->SetActive(false); - m_host->Blur(); + host()->SetActive(false); + host()->Blur(); } void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, content::InputEventAckState ack_result) { @@ -1211,7 +1210,7 @@ void RenderWidgetHostViewQt::processMotionEvent(const ui::MotionEvent &motionEve blink::WebTouchEvent touchEvent = ui::CreateWebTouchEventFromMotionEvent(motionEvent, result.moved_beyond_slop_region, false /*hovering, FIXME ?*/); - m_host->ForwardTouchEventWithLatencyInfo(touchEvent, CreateLatencyInfo(touchEvent)); + host()->ForwardTouchEventWithLatencyInfo(touchEvent, CreateLatencyInfo(touchEvent)); } QList RenderWidgetHostViewQt::mapTouchPointIds(const QList &inputPoints) @@ -1264,11 +1263,11 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev) // We're getting the composition result in a key event. if (ev->key() != 0) { // The key event is not a result of an IME composition. Cancel IME. - m_host->ImeCancelComposition(); + host()->ImeCancelComposition(); m_receivedEmptyImeEvent = false; } else { if (ev->type() == QEvent::KeyRelease) { - m_host->ImeCommitText(toString16(ev->text()), + host()->ImeCommitText(toString16(ev->text()), std::vector(), gfx::Range::InvalidRange(), 0); @@ -1286,13 +1285,13 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev) content::EditCommands commands; commands.emplace_back(m_editCommand, ""); m_editCommand.clear(); - m_host->ForwardKeyboardEventWithCommands(webEvent, latency, &commands, nullptr); + host()->ForwardKeyboardEventWithCommands(webEvent, latency, &commands, nullptr); return; } bool keyDownTextInsertion = webEvent.GetType() == blink::WebInputEvent::kRawKeyDown && webEvent.text[0]; webEvent.skip_in_browser = keyDownTextInsertion; - m_host->ForwardKeyboardEvent(webEvent); + host()->ForwardKeyboardEvent(webEvent); if (keyDownTextInsertion) { // Blink won't consume the RawKeyDown, but rather the Char event in this case. @@ -1300,7 +1299,7 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev) // The same os_event will be set on both NativeWebKeyboardEvents. webEvent.skip_in_browser = false; webEvent.SetType(blink::WebInputEvent::kChar); - m_host->ForwardKeyboardEvent(webEvent); + host()->ForwardKeyboardEvent(webEvent); } } @@ -1309,7 +1308,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) // Reset input manager state m_imState = 0; - if (!m_host) + if (!host()) return; QString commitString = ev->commitString(); @@ -1423,7 +1422,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) m_receivedEmptyImeEvent = false; if (m_imeInProgress) { m_imeInProgress = false; - m_host->ImeCancelComposition(); + host()->ImeCancelComposition(); } } @@ -1434,7 +1433,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) // Finish compostion: insert or erase text. if (!commitString.isEmpty() || replacementLength > 0) { - m_host->ImeCommitText(toString16(commitString), + host()->ImeCommitText(toString16(commitString), underlines, replacementRange, 0); @@ -1445,7 +1444,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) // Be aware of that, we might get a commit string and a pre-edit string in a single event and // this means a new composition. if (!preeditString.isEmpty()) { - m_host->ImeSetComposition(toString16(preeditString), + host()->ImeSetComposition(toString16(preeditString), underlines, replacementRange, selectionRange.start(), @@ -1482,7 +1481,7 @@ void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *ev) if (!m_wheelAckPending) { Q_ASSERT(m_pendingWheelEvents.isEmpty()); m_wheelAckPending = true; - m_host->ForwardWheelEvent(WebEventFactory::toWebWheelEvent(ev, dpiScale())); + host()->ForwardWheelEvent(WebEventFactory::toWebWheelEvent(ev, dpiScale())); return; } if (!m_pendingWheelEvents.isEmpty()) { @@ -1498,7 +1497,7 @@ void RenderWidgetHostViewQt::WheelEventAck(const blink::WebMouseWheelEvent &/*ev m_wheelAckPending = false; if (!m_pendingWheelEvents.isEmpty()) { m_wheelAckPending = true; - m_host->ForwardWheelEvent(m_pendingWheelEvents.takeFirst()); + host()->ForwardWheelEvent(m_pendingWheelEvents.takeFirst()); } // TODO: We could forward unhandled wheelevents to our parent. } @@ -1515,7 +1514,7 @@ void RenderWidgetHostViewQt::handleGestureEvent(QNativeGestureEvent *ev) const Qt::NativeGestureType type = ev->gestureType(); // These are the only supported gestures by Chromium so far. if (type == Qt::ZoomNativeGesture || type == Qt::SmartZoomNativeGesture) { - m_host->ForwardGestureEvent(WebEventFactory::toWebGestureEvent( + host()->ForwardGestureEvent(WebEventFactory::toWebGestureEvent( ev, static_cast(dpiScale()))); } @@ -1685,20 +1684,20 @@ void RenderWidgetHostViewQt::handlePointerEvent(T *event) #endif } - m_host->ForwardMouseEvent(webEvent); + host()->ForwardMouseEvent(webEvent); } void RenderWidgetHostViewQt::handleHoverEvent(QHoverEvent *ev) { - m_host->ForwardMouseEvent(WebEventFactory::toWebMouseEvent(ev, dpiScale())); + host()->ForwardMouseEvent(WebEventFactory::toWebMouseEvent(ev, dpiScale())); } void RenderWidgetHostViewQt::handleFocusEvent(QFocusEvent *ev) { if (ev->gotFocus()) { - m_host->GotFocus(); - m_host->SetActive(true); - content::RenderViewHostImpl *viewHost = content::RenderViewHostImpl::From(m_host); + host()->GotFocus(); + host()->SetActive(true); + content::RenderViewHostImpl *viewHost = content::RenderViewHostImpl::From(host()); Q_ASSERT(viewHost); if (ev->reason() == Qt::TabFocusReason) viewHost->SetInitialFocus(false); @@ -1706,8 +1705,8 @@ void RenderWidgetHostViewQt::handleFocusEvent(QFocusEvent *ev) viewHost->SetInitialFocus(true); ev->accept(); } else if (ev->lostFocus()) { - m_host->SetActive(false); - m_host->Blur(); + host()->SetActive(false); + host()->Blur(); ev->accept(); } } @@ -1749,7 +1748,7 @@ void RenderWidgetHostViewQt::OnBeginFrameSourcePausedChanged(bool paused) content::RenderFrameHost *RenderWidgetHostViewQt::getFocusedFrameHost() { - content::RenderViewHostImpl *viewHost = content::RenderViewHostImpl::From(m_host); + content::RenderViewHostImpl *viewHost = content::RenderViewHostImpl::From(host()); if (!viewHost) return nullptr; -- cgit v1.2.3