From 390a6fda73369e447569efb1e8a7622460307d22 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Wed, 3 Dec 2014 15:34:09 +0100 Subject: Update Chromium to version 40.0.2214.28 and ninja to 1.5.3. * scoped_refptr operator for implicit conversion to pointer has been disabled upstream: https://codereview.chromium.org/510323002 * Group permission API as done upstream: https://codereview.chromium.org/622793002 * content_worker gyp target has been removed upstream. * GetPageThumbnailData moved to DevToolsManagerDelegate. * ui/ui_resources has been renamed to ui/resources * WebPreferences and ResourceType have moved inside content. * Merge ResourceBundle's InitSharedInstanceLocaleOnly with InitSharedInstanceWithLocale(): https://codereview.chromium.org/457103003 * Remove obsolete accessibility events. * AX_EVENT_SELECTED_TEXT_CHANGED has been renamed to AX_EVENT_TEXT_SELECTION_CHANGED * AX_ROLE_MATH_ELEMENT was removed upstream. https://codereview.chromium.org/695133002 * Screen::IsDIPEnabled has been removed upstream. https://codereview.chromium.org/672823002 * Update DevToolsHttpHandlerDelegateQt according to ShellDevToolsManagerDelegate. * Various functionality from DevToolsHttpHandler was moved to DevToolsManagerDelegate https://codereview.chromium.org/560323005 * DevToolsHttpHandler::Start expects a scoped_ptr now. * Make sure event_factory_evdev.h is not included when USE_OZONE is not defined * ErrorPageParams was moved into namespace error_page. * Media Access is now handled by ContentBrowserClient::CheckMediaAccessPermission * SpecialStoragePolicy moved to namespace storage * Add implementation for new pure virtual function BrowserContext::GetSSLHostStateDelegate. * RenderPass::Id was renamed to RenderPass::RenderPassId * Include view_messages.h for ViewHostMsg_TextInputState_Param * CERT_UNABLE_TO_CHECK_REVOCATION has been deprecated by Chromium: https://codereview.chromium.org/449743002 * MailboxManager::ConsumeTexture only takes the mailbox as an argument * Replace RWHVQt::TextInputStateChanged with RWHVQt::TextInputTypeChanged. * RenderWidgetHostView::ScrollOffsetChanged has been removed. * SkBitmap::Config was removed upstream. * CopyFromCompositingSurfaceCallback has become an own type. * AcceleratedSurfaceInitialized only takes route_id as an argument. * ServerBoundCertService has been renamed to ChannelIDService. Related API has been renamed accordingly. * TextureImageTransportSurface was removed upstream. * Update MediaCaptureDispatcher::OnMediaRequestStateChanged signature. * AudioStream related functions are gone upstream. https://codereview.chromium.org/569713002 * Add implementation for RenderWidgetHostViewQt::GetLastScrollOffset. * Include generic touch_device implementation. * switches::kDisableDesktopNotifications was removed upstream. https://codereview.chromium.org/607843002 * PageTransition moved to ui. * Messages headers are not guarded. Including them multiple times does hurt. * ScaleGestureDetector does not create a standalone GestureDetector anymore. https://codereview.chromium.org/501503003 * MotionEvent::Cancel and Clone are not virtual anymore. https://codereview.chromium.org/502993004 * Exclude os_exchange_data_provider_mac from build. * Remove argument from ScopedClipboardWriter ctor. https://codereview.chromium.org/558913003 * Remove ShowPopupMenu override from WebContentsQt. The function is not pure virtual anymore, and we never implemented any specifics. * Do not use clang on desktop linux. * Request functions in ContentBrowserClient were merged into RequestPermission. * ninja: use configure.py --bootstrap instead of bootstrap.py Change-Id: I3575612826db7845461a949b4e737264bb4e8d88 Reviewed-by: Pierre Rossi --- src/core/render_widget_host_view_qt.cpp | 104 +++++++++++++------------------- 1 file changed, 43 insertions(+), 61 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 a94ae6995..1e9d2bbf7 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -52,8 +52,6 @@ #include "content/browser/renderer_host/input/web_input_event_util.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/common/cursors/webcursor.h" -#include "content/common/gpu/gpu_messages.h" -#include "content/common/view_messages.h" #include "content/public/browser/browser_accessibility_state.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" @@ -62,7 +60,8 @@ #include "third_party/WebKit/public/platform/WebCursorInfo.h" #include "third_party/WebKit/public/web/WebCompositionUnderline.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" -#include "ui/events/gesture_detection/gesture_config_helper.h" +#include "ui/events/event.h" +#include "ui/events/gesture_detection/gesture_provider_config_helper.h" #include "ui/events/gesture_detection/motion_event.h" #include "ui/gfx/size_conversions.h" @@ -80,6 +79,22 @@ #include #include +static inline ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& event) { + ui::LatencyInfo latency_info; + // The latency number should only be added if the timestamp is valid. + if (event.timeStampSeconds) { + const int64 time_micros = static_cast( + event.timeStampSeconds * base::Time::kMicrosecondsPerSecond); + latency_info.AddLatencyNumberWithTimestamp( + ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, + 0, + 0, + base::TimeTicks() + base::TimeDelta::FromMicroseconds(time_micros), + 1); + } + return latency_info; +} + static inline Qt::InputMethodHints toQtInputMethodHints(ui::TextInputType inputType) { switch (inputType) { @@ -128,8 +143,6 @@ static inline ui::GestureProvider::Config QtGestureProviderConfig() { ui::GestureProvider::Config config = ui::DefaultGestureProviderConfig(); // Causes an assert in CreateWebGestureEventFromGestureEventData and we don't need them in Qt. config.gesture_begin_end_types_enabled = false; - // Swipe gestures aren't forwarded, we don't use them and they abort the gesture detection. - config.scale_gesture_detector_config.gesture_detector_config.swipe_enabled = config.gesture_detector_config.swipe_enabled = false; return config; } @@ -172,12 +185,6 @@ public: virtual ToolType GetToolType(size_t pointer_index) const Q_DECL_OVERRIDE { return ui::MotionEvent::TOOL_TYPE_UNKNOWN; } virtual int GetButtonState() const Q_DECL_OVERRIDE { return 0; } - virtual scoped_ptr Cancel() const Q_DECL_OVERRIDE { Q_UNREACHABLE(); return scoped_ptr(); } - - virtual scoped_ptr Clone() const Q_DECL_OVERRIDE { - return scoped_ptr(new MotionEventQt(*this)); - } - private: QList touchPoints; base::TimeTicks eventTime; @@ -263,6 +270,10 @@ void RenderWidgetHostViewQt::SetBounds(const gfx::Rect& screenRect) SetSize(screenRect.size()); } +gfx::Vector2dF RenderWidgetHostViewQt::GetLastScrollOffset() const { + return m_lastScrollOffset; +} + gfx::Size RenderWidgetHostViewQt::GetPhysicalBackingSize() const { if (!m_delegate || !m_delegate->window() || !m_delegate->window()->screen()) @@ -369,7 +380,7 @@ void RenderWidgetHostViewQt::UnlockMouse() void RenderWidgetHostViewQt::WasShown() { - m_host->WasShown(); + m_host->WasShown(ui::LatencyInfo()); } void RenderWidgetHostViewQt::WasHidden() @@ -490,10 +501,13 @@ void RenderWidgetHostViewQt::SetIsLoading(bool) // We use WebContentsDelegateQt::LoadingStateChanged to notify about loading state. } -void RenderWidgetHostViewQt::TextInputStateChanged(const ViewHostMsg_TextInputState_Params& params) +void RenderWidgetHostViewQt::TextInputTypeChanged(ui::TextInputType type, ui::TextInputMode mode, bool can_compose_inline, int flags) { - m_currentInputType = params.type; - m_delegate->inputMethodStateChanged(static_cast(params.type)); + Q_UNUSED(mode); + Q_UNUSED(can_compose_inline); + Q_UNUSED(flags); + m_currentInputType = type; + m_delegate->inputMethodStateChanged(static_cast(type)); } void RenderWidgetHostViewQt::ImeCancelComposition() @@ -538,14 +552,12 @@ void RenderWidgetHostViewQt::SelectionBoundsChanged(const ViewHostMsg_SelectionB m_cursorRect = QRect(caretRect.x(), caretRect.y(), caretRect.width(), caretRect.height()); } -void RenderWidgetHostViewQt::ScrollOffsetChanged() -{ - // Not used. -} - -void RenderWidgetHostViewQt::CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& /* dst_size */, const base::Callback& callback, const SkBitmap::Config config) +void RenderWidgetHostViewQt::CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& dst_size, content::CopyFromCompositingSurfaceCallback& callback, const SkColorType color_type) { NOTIMPLEMENTED(); + Q_UNUSED(src_subrect); + Q_UNUSED(dst_size); + Q_UNUSED(color_type); callback.Run(false, SkBitmap()); } @@ -560,36 +572,6 @@ bool RenderWidgetHostViewQt::CanCopyToVideoFrame() const return false; } -void RenderWidgetHostViewQt::AcceleratedSurfaceInitialized(int host_id, int route_id) -{ -} - -void RenderWidgetHostViewQt::AcceleratedSurfaceBuffersSwapped(const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, int gpu_host_id) -{ - AcceleratedSurfaceMsg_BufferPresented_Params ack_params; - ack_params.sync_point = 0; - content::RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, gpu_host_id, ack_params); - content::RenderWidgetHostImpl::CompositorFrameDrawn(params.latency_info); -} - -void RenderWidgetHostViewQt::AcceleratedSurfacePostSubBuffer(const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, int gpu_host_id) -{ - AcceleratedSurfaceMsg_BufferPresented_Params ack_params; - ack_params.sync_point = 0; - content::RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, gpu_host_id, ack_params); - content::RenderWidgetHostImpl::CompositorFrameDrawn(params.latency_info); -} - -void RenderWidgetHostViewQt::AcceleratedSurfaceSuspend() -{ - QT_NOT_YET_IMPLEMENTED -} - -void RenderWidgetHostViewQt::AcceleratedSurfaceRelease() -{ - QT_NOT_YET_IMPLEMENTED -} - bool RenderWidgetHostViewQt::HasAcceleratedSurface(const gfx::Size&) { return false; @@ -597,6 +579,7 @@ bool RenderWidgetHostViewQt::HasAcceleratedSurface(const gfx::Size&) void RenderWidgetHostViewQt::OnSwapCompositorFrame(uint32 output_surface_id, scoped_ptr frame) { + m_lastScrollOffset = frame->metadata.root_scroll_offset; Q_ASSERT(!m_needsDelegatedFrameAck); m_needsDelegatedFrameAck = true; m_pendingOutputSurfaceId = output_surface_id; @@ -640,7 +623,7 @@ gfx::Rect RenderWidgetHostViewQt::GetBoundsInRootWindow() gfx::GLSurfaceHandle RenderWidgetHostViewQt::GetCompositingSurface() { - return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); + return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NULL_TRANSPORT); } void RenderWidgetHostViewQt::SelectionChanged(const base::string16 &text, size_t offset, const gfx::Range &range) @@ -650,9 +633,7 @@ void RenderWidgetHostViewQt::SelectionChanged(const base::string16 &text, size_t #if defined(USE_X11) // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. - ui::ScopedClipboardWriter clipboard_writer( - ui::Clipboard::GetForCurrentThread(), - ui::CLIPBOARD_TYPE_SELECTION); + ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); clipboard_writer.WriteText(text); #endif } @@ -792,8 +773,8 @@ void RenderWidgetHostViewQt::processMotionEvent(const ui::MotionEvent &motionEve m_gestureProvider.OnTouchEventAck(eventConsumed); return; } - - m_host->ForwardTouchEvent(content::CreateWebTouchEventFromMotionEvent(motionEvent)); + blink::WebTouchEvent touchEvent = content::CreateWebTouchEventFromMotionEvent(motionEvent); + m_host->ForwardTouchEventWithLatencyInfo(touchEvent, CreateLatencyInfo(touchEvent)); } QList RenderWidgetHostViewQt::mapTouchPointIds(const QList &inputPoints) @@ -887,10 +868,12 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) QTextCharFormat textCharFormat = attribute.value.value().toCharFormat(); QColor qcolor = textCharFormat.underlineColor(); + QColor qBackgroundColor = textCharFormat.background().color(); blink::WebColor color = SkColorSetARGB(qcolor.alpha(), qcolor.red(), qcolor.green(), qcolor.blue()); + blink::WebColor backgroundColor = SkColorSetARGB(qBackgroundColor.alpha(), qBackgroundColor.red(), qBackgroundColor.green(), qBackgroundColor.blue()); int start = qMin(attribute.start, (attribute.start + attribute.length)); int end = qMax(attribute.start, (attribute.start + attribute.length)); - underlines.push_back(blink::WebCompositionUnderline(start, end, color, false)); + underlines.push_back(blink::WebCompositionUnderline(start, end, color, false, backgroundColor)); break; } case QInputMethodEvent::Cursor: @@ -934,15 +917,14 @@ void RenderWidgetHostViewQt::AccessibilityDoDefaultAction(int acc_obj_id) return; m_host->AccessibilityDoDefaultAction(acc_obj_id); } - -void RenderWidgetHostViewQt::AccessibilityScrollToMakeVisible(int acc_obj_id, gfx::Rect subfocus) +void RenderWidgetHostViewQt::AccessibilityScrollToMakeVisible(int acc_obj_id, const gfx::Rect& subfocus) { if (!m_host) return; m_host->AccessibilityScrollToMakeVisible(acc_obj_id, subfocus); } -void RenderWidgetHostViewQt::AccessibilityScrollToPoint(int acc_obj_id, gfx::Point point) +void RenderWidgetHostViewQt::AccessibilityScrollToPoint(int acc_obj_id, const gfx::Point& point) { if (!m_host) return; -- cgit v1.2.3