From 07da6b90ed37e2050e0aa44e71ce8de3e0778f24 Mon Sep 17 00:00:00 2001 From: roytam1 Date: Thu, 30 May 2024 14:34:55 +0800 Subject: [PATCH] import changes from `dev' branch of rmottola/Arctic-Fox: - Bug 1248822 - In LayerManagerComposite::UpdateAndRender(), call PostProcessLayers() before LayerTreeInvalidation. r=mattwoodrow (503f81f51f) - Bug 1259541 - Reduce clearing backbuffer in nsBaseWidget::CreateBackBufferDrawTarget() r=mattwoodrow (4f8cf8ab04) - Bug 1174461 - [e10s] Return a cached result from SendGetNativePluginPort (r=jimm) a=kwierso (fff65b95ac) - Bug 1263200 - Reset the APZ pointer in the base widget to null if the compositor creation fails. r=mstange (109d4a16a8) - Bug 1264161 - Ensure we null out APZ pointers to the widget when it gets destroyed. r=botond (fdb516451e) - Bug 1260018 - Route drag events to APZ, so it can accurately detect the end of a drag. r=kats (acd2b4a051) - Remove drawWidgetAsOnScreen. (bug 1264393, r=mattwoodrow, webidl r=khuey) (b0ce23eacc) - Bug 1254151 - use B8G8R8X8 for 24 bit depth visuals in nsShmImage with Cairo. r=jrmuizel (070ef9495d) - Bug 1218955 - Remove nsIMEPicker, r=jchen (83adb6c582) - Bug 1255655 - Const-ify keysymtab. r=karlt. (d9544cbf0c) - Bug 1165048 - Music playback is getting stopped and is not resumed when modem is restarted. r=mwu (d3f99f8542) - Bug 1264183. Remove unused argument to nsView::InvalidateHierarchy. r=mats (218ce04623) - Bug 1210617 - [e10s] Implement PrivateBrowsingChannel for ExternalHelperAppParent. r=jduell (36e6ab7635) - Bug 1258087 - Fix -Wunreachable-code warning in StartupCache.cpp on macosx64-mulet. r=froydnj (5f88df6993) - Bug 1329798 - Include sys/sysmacros.h for major(), minor() on Linux. r=glandium, a=jcristau (a5c4073eb2) - guard for non-linux system again or mac & FreeBSD fail to compile (6b5d2856b6) --- dom/canvas/CanvasRenderingContext2D.cpp | 45 -------- dom/canvas/CanvasRenderingContext2D.h | 1 - dom/webidl/CanvasRenderingContext2D.webidl | 11 -- gfx/layers/Compositor.h | 2 +- gfx/layers/apz/src/APZCTreeManager.cpp | 6 +- gfx/layers/apz/src/DragTracker.cpp | 9 +- .../apz/util/ChromeProcessController.cpp | 3 + gfx/layers/basic/BasicCompositor.cpp | 22 ++-- gfx/layers/basic/BasicCompositor.h | 4 +- .../composite/LayerManagerComposite.cpp | 21 ++-- gfx/layers/composite/LayerManagerComposite.h | 2 +- gfx/layers/d3d11/CompositorD3D11.cpp | 2 +- gfx/layers/d3d11/CompositorD3D11.h | 2 +- gfx/layers/d3d9/CompositorD3D9.cpp | 2 +- gfx/layers/d3d9/CompositorD3D9.h | 2 +- gfx/layers/ipc/CompositorBridgeParent.cpp | 27 +---- gfx/layers/ipc/CompositorBridgeParent.h | 1 - gfx/layers/ipc/PCompositorBridge.ipdl | 8 -- gfx/layers/opengl/CompositorOGL.cpp | 2 +- gfx/layers/opengl/CompositorOGL.h | 2 +- startupcache/StartupCache.cpp | 4 +- .../exthandler/ExternalHelperAppParent.cpp | 6 ++ .../exthandler/ExternalHelperAppParent.h | 2 + view/nsView.cpp | 8 +- view/nsView.h | 7 +- widget/PluginWidgetProxy.cpp | 19 ++-- widget/PluginWidgetProxy.h | 1 + widget/cocoa/nsChildView.mm | 3 + widget/gonk/GonkPermission.cpp | 2 +- widget/gonk/HwcComposer2D.cpp | 2 +- widget/moz.build | 1 - widget/nsBaseDragService.cpp | 8 ++ widget/nsBaseWidget.cpp | 102 +++++++----------- widget/nsBaseWidget.h | 8 +- widget/nsIIMEPicker.idl | 14 --- widget/nsIWidget.h | 25 ++--- widget/nsShmImage.cpp | 6 +- widget/nsWidgetsCID.h | 4 - widget/windows/nsWindow.cpp | 41 ------- widget/windows/nsWindow.h | 2 - widget/x11/keysym2ucs.c | 2 +- xpcom/io/nsLocalFileUnix.cpp | 2 +- 42 files changed, 151 insertions(+), 292 deletions(-) delete mode 100644 widget/nsIIMEPicker.idl diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index c03897f19b..cc7ee4ab6c 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -5096,51 +5096,6 @@ CanvasRenderingContext2D::AsyncDrawXULElement(nsXULElement& aElem, #endif } -void -CanvasRenderingContext2D::DrawWidgetAsOnScreen(nsGlobalWindow& aWindow, - mozilla::ErrorResult& aError) -{ - EnsureTarget(); - - // This is an internal API. - if (!nsContentUtils::IsCallerChrome()) { - aError.Throw(NS_ERROR_DOM_SECURITY_ERR); - return; - } - - RefPtr presContext; - nsIDocShell* docshell = aWindow.GetDocShell(); - if (docshell) { - docshell->GetPresContext(getter_AddRefs(presContext)); - } - if (!presContext) { - aError.Throw(NS_ERROR_FAILURE); - return; - } - - nsIWidget* widget = presContext->GetRootWidget(); - if (!widget) { - aError.Throw(NS_ERROR_FAILURE); - return; - } - RefPtr snapshot = widget->SnapshotWidgetOnScreen(); - if (!snapshot) { - aError.Throw(NS_ERROR_FAILURE); - return; - } - - gfx::Rect sourceRect(gfx::Point(0, 0), gfx::Size(snapshot->GetSize())); - mTarget->DrawSurface(snapshot, sourceRect, sourceRect, - DrawSurfaceOptions(gfx::Filter::POINT), - DrawOptions(GlobalAlpha(), CompositionOp::OP_OVER, - AntialiasMode::NONE)); - mTarget->Flush(); - - RedrawUser(gfxRect(0, 0, - std::min(mWidth, snapshot->GetSize().width), - std::min(mHeight, snapshot->GetSize().height))); -} - // // device pixel getting/setting // diff --git a/dom/canvas/CanvasRenderingContext2D.h b/dom/canvas/CanvasRenderingContext2D.h index 7471baed51..5c34a67cec 100644 --- a/dom/canvas/CanvasRenderingContext2D.h +++ b/dom/canvas/CanvasRenderingContext2D.h @@ -408,7 +408,6 @@ public: void DrawWindow(nsGlobalWindow& aWindow, double aX, double aY, double aW, double aH, const nsAString& aBgColor, uint32_t aFlags, mozilla::ErrorResult& aError); - void DrawWidgetAsOnScreen(nsGlobalWindow& aWindow, mozilla::ErrorResult& aError); void AsyncDrawXULElement(nsXULElement& aElem, double aX, double aY, double aW, double aH, const nsAString& aBgColor, uint32_t aFlags, mozilla::ErrorResult& aError); diff --git a/dom/webidl/CanvasRenderingContext2D.webidl b/dom/webidl/CanvasRenderingContext2D.webidl index dd758b2e1d..7206c20f9e 100644 --- a/dom/webidl/CanvasRenderingContext2D.webidl +++ b/dom/webidl/CanvasRenderingContext2D.webidl @@ -231,17 +231,6 @@ interface CanvasRenderingContext2D { double h, DOMString bgColor, optional unsigned long flags = 0); - /** - * Render the root widget of a window into the canvas. Unlike drawWindow, - * this uses the operating system to snapshot the widget on-screen, rather - * than reading from our own compositor. - * - * Currently, this is only supported on Windows, and only on widgets that - * use OMTC, and only from within the chrome process. - */ - [Throws, ChromeOnly] - void drawWidgetAsOnScreen(Window window); - /** * This causes a context that is currently using a hardware-accelerated * backend to fallback to a software one. All state should be preserved. diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h index 7df2231ac8..5dbbbc1beb 100644 --- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -376,7 +376,7 @@ public: virtual void BeginFrame(const nsIntRegion& aInvalidRegion, const gfx::Rect* aClipRectIn, const gfx::Rect& aRenderBounds, - bool aOpaque, + const nsIntRegion& aOpaqueRegion, gfx::Rect* aClipRectOut = nullptr, gfx::Rect* aRenderBoundsOut = nullptr) = 0; diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 67fd31bd5e..0dcfffe5aa 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -623,7 +623,8 @@ WillHandleMouseEvent(const WidgetMouseEventBase& aEvent) { return aEvent.mMessage == eMouseMove || aEvent.mMessage == eMouseDown || - aEvent.mMessage == eMouseUp; + aEvent.mMessage == eMouseUp || + aEvent.mMessage == eDragEnd; } template @@ -1150,7 +1151,8 @@ APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent, } switch (aEvent.mClass) { - case eMouseEventClass: { + case eMouseEventClass: + case eDragEventClass: { WidgetMouseEventBase& mouseEvent = *aEvent.AsMouseEventBase(); if (WillHandleMouseEvent(mouseEvent)) { return ProcessMouseEvent(mouseEvent, aOutTargetGuid, aOutInputBlockId); diff --git a/gfx/layers/apz/src/DragTracker.cpp b/gfx/layers/apz/src/DragTracker.cpp index df52914590..ecd3ff16f9 100644 --- a/gfx/layers/apz/src/DragTracker.cpp +++ b/gfx/layers/apz/src/DragTracker.cpp @@ -27,7 +27,14 @@ DragTracker::StartsDrag(const MouseInput& aInput) /*static*/ bool DragTracker::EndsDrag(const MouseInput& aInput) { - return aInput.IsLeftButton() && aInput.mType == MouseInput::MOUSE_UP; + // On Windows, we don't receive a MOUSE_UP at the end of a drag if an + // actual drag session took place. As a backup, we detect the end of the + // drag using the MOUSE_DRAG_END event, which normally is routed directly + // to content, but we're specially routing to APZ for this purpose. Bug + // 1265105 tracks a solution to this at the Windows widget layer; once + // that is implemented, this workaround can be removed. + return (aInput.IsLeftButton() && aInput.mType == MouseInput::MOUSE_UP) + || aInput.mType == MouseInput::MOUSE_DRAG_END; } void diff --git a/gfx/layers/apz/util/ChromeProcessController.cpp b/gfx/layers/apz/util/ChromeProcessController.cpp index 14f0faa480..6bae3fc0c2 100644 --- a/gfx/layers/apz/util/ChromeProcessController.cpp +++ b/gfx/layers/apz/util/ChromeProcessController.cpp @@ -99,6 +99,9 @@ ChromeProcessController::Destroy() nsIPresShell* ChromeProcessController::GetPresShell() const { + if (!mWidget) { + return nullptr; + } if (nsView* view = nsView::GetViewFor(mWidget)) { return view->GetPresShell(); } diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 5a60800a19..116678bac5 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -162,7 +162,7 @@ BasicCompositor::CreateRenderTargetFromSource(const IntRect &aRect, } already_AddRefed -BasicCompositor::CreateRenderTargetForWindow(const LayoutDeviceIntRect& aRect, SurfaceInitMode aInit, BufferMode aBufferMode) +BasicCompositor::CreateRenderTargetForWindow(const LayoutDeviceIntRect& aRect, const LayoutDeviceIntRect& aClearRect, BufferMode aBufferMode) { MOZ_ASSERT(mDrawTarget); MOZ_ASSERT(aRect.width != 0 && aRect.height != 0, "Trying to create a render target of invalid size"); @@ -175,7 +175,7 @@ BasicCompositor::CreateRenderTargetForWindow(const LayoutDeviceIntRect& aRect, S IntRect rect = aRect.ToUnknownRect(); if (aBufferMode != BufferMode::BUFFER_NONE) { - RefPtr target = mWidget->CreateBackBufferDrawTarget(mDrawTarget, aRect, aInit == INIT_MODE_CLEAR); + RefPtr target = mWidget->CreateBackBufferDrawTarget(mDrawTarget, aRect, aClearRect); if (!target) { return nullptr; } @@ -187,8 +187,9 @@ BasicCompositor::CreateRenderTargetForWindow(const LayoutDeviceIntRect& aRect, S windowRect.ExpandToEnclose(IntPoint(0, 0)); } rt = new BasicCompositingRenderTarget(mDrawTarget, windowRect); - if (aInit == INIT_MODE_CLEAR) { - mDrawTarget->ClearRect(Rect(rect - rt->GetOrigin())); + if (!aClearRect.IsEmpty()) { + IntRect clearRect = aRect.ToUnknownRect(); + mDrawTarget->ClearRect(Rect(clearRect - rt->GetOrigin())); } } @@ -476,7 +477,7 @@ void BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion, const gfx::Rect *aClipRectIn, const gfx::Rect& aRenderBounds, - bool aOpaque, + const nsIntRegion& aOpaqueRegion, gfx::Rect *aClipRectOut /* = nullptr */, gfx::Rect *aRenderBoundsOut /* = nullptr */) { @@ -524,11 +525,20 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion, return; } + LayoutDeviceIntRect clearRect; + if (!aOpaqueRegion.IsEmpty()) { + LayoutDeviceIntRegion clearRegion = mInvalidRegion; + clearRegion.SubOut(LayoutDeviceIntRegion::FromUnknownRegion(aOpaqueRegion)); + clearRect = clearRegion.GetBounds(); + } else { + clearRect = mInvalidRect; + } + // Setup an intermediate render target to buffer all compositing. We will // copy this into mDrawTarget (the widget), and/or mTarget in EndFrame() RefPtr target = CreateRenderTargetForWindow(mInvalidRect, - aOpaque ? INIT_MODE_NONE : INIT_MODE_CLEAR, + clearRect, bufferMode); if (!target) { if (!mTarget) { diff --git a/gfx/layers/basic/BasicCompositor.h b/gfx/layers/basic/BasicCompositor.h index 022a39df51..8824115981 100644 --- a/gfx/layers/basic/BasicCompositor.h +++ b/gfx/layers/basic/BasicCompositor.h @@ -69,7 +69,7 @@ public: virtual already_AddRefed CreateRenderTargetForWindow(const LayoutDeviceIntRect& aRect, - SurfaceInitMode aInit, + const LayoutDeviceIntRect& aClearRect, BufferMode aBufferMode); virtual already_AddRefed @@ -102,7 +102,7 @@ public: virtual void BeginFrame(const nsIntRegion& aInvalidRegion, const gfx::Rect *aClipRectIn, const gfx::Rect& aRenderBounds, - bool aOpaque, + const nsIntRegion& aOpaqueRegion, gfx::Rect *aClipRectOut = nullptr, gfx::Rect *aRenderBoundsOut = nullptr) override; virtual void EndFrame() override; diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 7c5bad25b7..73fdeedf45 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -412,6 +412,10 @@ LayerManagerComposite::UpdateAndRender() nsIntRegion invalid; bool didEffectiveTransforms = false; + nsIntRegion opaque; + LayerIntRegion visible; + PostProcessLayers(mRoot, opaque, visible, Nothing()); + if (mClonedLayerTreeProperties) { // Effective transforms are needed by ComputeDifferences(). mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4()); @@ -465,11 +469,7 @@ LayerManagerComposite::UpdateAndRender() mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4()); } - nsIntRegion opaque; - LayerIntRegion visible; - PostProcessLayers(mRoot, opaque, visible, Nothing()); - - Render(invalid); + Render(invalid, opaque); #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK) RenderToPresentationSurface(); #endif @@ -801,7 +801,7 @@ ClearLayerFlags(Layer* aLayer) { } void -LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion) +LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegion& aOpaqueRegion) { PROFILER_LABEL("LayerManagerComposite", "Render", js::ProfileEntry::Category::GRAPHICS); @@ -887,14 +887,13 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion) CompositorBench(mCompositor, bounds); MOZ_ASSERT(mRoot->GetOpacity() == 1); - bool opaqueContent = (mRoot->GetContentFlags() & Layer::CONTENT_OPAQUE) != 0; if (mRoot->GetClipRect()) { clipRect = *mRoot->GetClipRect(); Rect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height); - mCompositor->BeginFrame(aInvalidRegion, &rect, bounds, opaqueContent, nullptr, &actualBounds); + mCompositor->BeginFrame(aInvalidRegion, &rect, bounds, aOpaqueRegion, nullptr, &actualBounds); } else { gfx::Rect rect; - mCompositor->BeginFrame(aInvalidRegion, nullptr, bounds, opaqueContent, &rect, &actualBounds); + mCompositor->BeginFrame(aInvalidRegion, nullptr, bounds, aOpaqueRegion, &rect, &actualBounds); clipRect = ParentLayerIntRect(rect.x, rect.y, rect.width, rect.height); } @@ -1148,9 +1147,7 @@ LayerManagerComposite::RenderToPresentationSurface() Rect bounds(0.0f, 0.0f, scale * pageWidth, (float)actualHeight); Rect rect, actualBounds; MOZ_ASSERT(mRoot->GetOpacity() == 1); - bool opaqueContent = (mRoot->GetContentFlags() & Layer::CONTENT_OPAQUE) != 0; - - mCompositor->BeginFrame(invalid, nullptr, bounds, opaqueContent, &rect, &actualBounds); + mCompositor->BeginFrame(invalid, nullptr, bounds, nsIntRegion(), &rect, &actualBounds); // The Java side of Fennec sets a scissor rect that accounts for // chrome such as the URL bar. Override that so that the entire frame buffer diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index 4e01e3eccb..c8d9ddecfa 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -339,7 +339,7 @@ private: /** * Render the current layer tree to the active target. */ - void Render(const nsIntRegion& aInvalidRegion); + void Render(const nsIntRegion& aInvalidRegion, const nsIntRegion& aOpaqueRegion); #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK) void RenderToPresentationSurface(); #endif diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index c0d50b4a37..ce4da6bf7e 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1115,7 +1115,7 @@ void CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, const Rect* aClipRectIn, const Rect& aRenderBounds, - bool aOpaque, + const nsIntRegion& aOpaqueRegion, Rect* aClipRectOut, Rect* aRenderBoundsOut) { diff --git a/gfx/layers/d3d11/CompositorD3D11.h b/gfx/layers/d3d11/CompositorD3D11.h index 1626960570..12cf8c54ba 100644 --- a/gfx/layers/d3d11/CompositorD3D11.h +++ b/gfx/layers/d3d11/CompositorD3D11.h @@ -114,7 +114,7 @@ public: virtual void BeginFrame(const nsIntRegion& aInvalidRegion, const gfx::Rect *aClipRectIn, const gfx::Rect& aRenderBounds, - bool aOpaque, + const nsIntRegion& aOpaqueRegion, gfx::Rect *aClipRectOut = nullptr, gfx::Rect *aRenderBoundsOut = nullptr) override; diff --git a/gfx/layers/d3d9/CompositorD3D9.cpp b/gfx/layers/d3d9/CompositorD3D9.cpp index 5199fda879..0ed9d2901e 100644 --- a/gfx/layers/d3d9/CompositorD3D9.cpp +++ b/gfx/layers/d3d9/CompositorD3D9.cpp @@ -678,7 +678,7 @@ void CompositorD3D9::BeginFrame(const nsIntRegion& aInvalidRegion, const Rect *aClipRectIn, const Rect& aRenderBounds, - bool aOpaque, + const nsIntRegion& aOpaqueRegion, Rect *aClipRectOut, Rect *aRenderBoundsOut) { diff --git a/gfx/layers/d3d9/CompositorD3D9.h b/gfx/layers/d3d9/CompositorD3D9.h index f4e1f3bcb7..3b67870f32 100644 --- a/gfx/layers/d3d9/CompositorD3D9.h +++ b/gfx/layers/d3d9/CompositorD3D9.h @@ -67,7 +67,7 @@ public: virtual void BeginFrame(const nsIntRegion& aInvalidRegion, const gfx::Rect *aClipRectIn, const gfx::Rect& aRenderBounds, - bool aOpaque, + const nsIntRegion& aOpaqueRegion, gfx::Rect *aClipRectOut = nullptr, gfx::Rect *aRenderBoundsOut = nullptr) override; diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp index 4f03019ee9..13784670a2 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -828,22 +828,6 @@ CompositorBridgeParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, return true; } -bool -CompositorBridgeParent::RecvMakeWidgetSnapshot(const SurfaceDescriptor& aInSnapshot) -{ - if (!mCompositor || !mCompositor->GetWidget()) { - return false; - } - - RefPtr target = GetDrawTargetForDescriptor(aInSnapshot, gfx::BackendType::CAIRO); - MOZ_ASSERT(target); - if (!target) { - return false; - } - mCompositor->GetWidget()->CaptureWidgetOnScreen(target); - return true; -} - bool CompositorBridgeParent::RecvFlushRendering() { @@ -959,10 +943,11 @@ CompositorBridgeParent::ActorDestroy(ActorDestroyReason why) if (mLayerManager) { mLayerManager->Destroy(); mLayerManager = nullptr; - { // scope lock - MonitorAutoLock lock(*sIndirectLayerTreesLock); - sIndirectLayerTrees.erase(mRootLayerTreeID); - } + } + + { // scope lock + MonitorAutoLock lock(*sIndirectLayerTreesLock); + sIndirectLayerTrees.erase(mRootLayerTreeID); } if (mCompositor) { @@ -1962,8 +1947,6 @@ public: virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, const gfx::IntRect& aRect) override { return true; } - virtual bool RecvMakeWidgetSnapshot(const SurfaceDescriptor& aInSnapshot) override - { return true; } virtual bool RecvFlushRendering() override { return true; } virtual bool RecvForcePresent() override { return true; } virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) override { return true; } diff --git a/gfx/layers/ipc/CompositorBridgeParent.h b/gfx/layers/ipc/CompositorBridgeParent.h index f26fc77061..8abad4a90e 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.h +++ b/gfx/layers/ipc/CompositorBridgeParent.h @@ -240,7 +240,6 @@ public: virtual bool RecvAdoptChild(const uint64_t& child) override; virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, const gfx::IntRect& aRect) override; - virtual bool RecvMakeWidgetSnapshot(const SurfaceDescriptor& aInSnapshot) override; virtual bool RecvFlushRendering() override; virtual bool RecvForcePresent() override; diff --git a/gfx/layers/ipc/PCompositorBridge.ipdl b/gfx/layers/ipc/PCompositorBridge.ipdl index fc58aacec6..42f937b3a5 100644 --- a/gfx/layers/ipc/PCompositorBridge.ipdl +++ b/gfx/layers/ipc/PCompositorBridge.ipdl @@ -138,14 +138,6 @@ parent: // and so forth being interpolated. That's what we want to happen. sync MakeSnapshot(SurfaceDescriptor inSnapshot, IntRect dirtyRect); - // Same as Makesnapshot(), except the snapshot is read from the underlying - // operating system desktop rather than the compositor's backbuffer. This - // is intended for testing whether hardware acceleration works. - // - // This call is part of IPDL, even though it simply wraps an nsIWidget - // call, to make sure it does not occur in the middle of a composite. - sync MakeWidgetSnapshot(SurfaceDescriptor inSnapshot); - // Make sure any pending composites are started immediately and // block until they are completed. sync FlushRendering(); diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index bcc685b7b2..2b594b503c 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -631,7 +631,7 @@ void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion, const Rect *aClipRectIn, const Rect& aRenderBounds, - bool aOpaque, + const nsIntRegion& aOpaqueRegion, Rect *aClipRectOut, Rect *aRenderBoundsOut) { diff --git a/gfx/layers/opengl/CompositorOGL.h b/gfx/layers/opengl/CompositorOGL.h index b32d627455..c705f41813 100644 --- a/gfx/layers/opengl/CompositorOGL.h +++ b/gfx/layers/opengl/CompositorOGL.h @@ -406,7 +406,7 @@ private: virtual void BeginFrame(const nsIntRegion& aInvalidRegion, const gfx::Rect *aClipRectIn, const gfx::Rect& aRenderBounds, - bool aOpaque, + const nsIntRegion& aOpaqueRegion, gfx::Rect *aClipRectOut = nullptr, gfx::Rect *aRenderBoundsOut = nullptr) override; diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp index 75e37a7354..47199b7a66 100644 --- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -92,9 +92,9 @@ StartupCache::GetSingleton() } #ifdef MOZ_DISABLE_STARTUPCACHE return nullptr; -#endif - +#else StartupCache::InitSingleton(); +#endif } return StartupCache::gStartupCache; diff --git a/uriloader/exthandler/ExternalHelperAppParent.cpp b/uriloader/exthandler/ExternalHelperAppParent.cpp index 612563ffc4..e4e8add459 100644 --- a/uriloader/exthandler/ExternalHelperAppParent.cpp +++ b/uriloader/exthandler/ExternalHelperAppParent.cpp @@ -32,6 +32,7 @@ NS_IMPL_ISUPPORTS_INHERITED(ExternalHelperAppParent, nsIRequest, nsIChannel, nsIMultiPartChannel, + nsIPrivateBrowsingChannel, nsIResumableChannel, nsIStreamListener) @@ -86,6 +87,11 @@ ExternalHelperAppParent::Init(ContentParent *parent, TabParent* tabParent = TabParent::GetFrom(aBrowser); if (tabParent->GetOwnerElement()) window = do_QueryInterface(tabParent->GetOwnerElement()->OwnerDoc()->GetWindow()); + + bool isPrivate = false; + nsCOMPtr loadContext = tabParent->GetLoadContext(); + loadContext->GetUsePrivateBrowsing(&isPrivate); + SetPrivate(isPrivate); } helperAppService->DoContent(aMimeContentType, this, window, diff --git a/uriloader/exthandler/ExternalHelperAppParent.h b/uriloader/exthandler/ExternalHelperAppParent.h index f890e26cce..43b38506af 100644 --- a/uriloader/exthandler/ExternalHelperAppParent.h +++ b/uriloader/exthandler/ExternalHelperAppParent.h @@ -10,6 +10,7 @@ #include "nsIResumableChannel.h" #include "nsIStreamListener.h" #include "nsHashPropertyBag.h" +#include "PrivateBrowsingChannel.h" namespace IPC { class URI; @@ -36,6 +37,7 @@ class ExternalHelperAppParent : public PExternalHelperAppParent , public nsIMultiPartChannel , public nsIResumableChannel , public nsIStreamListener + , public net::PrivateBrowsingChannel { typedef mozilla::ipc::OptionalURIParams OptionalURIParams; diff --git a/view/nsView.cpp b/view/nsView.cpp index 49cf167053..ed736a23cf 100644 --- a/view/nsView.cpp +++ b/view/nsView.cpp @@ -440,13 +440,13 @@ void nsView::SetFloating(bool aFloatingView) mVFlags &= ~NS_VIEW_FLAG_FLOATING; } -void nsView::InvalidateHierarchy(nsViewManager *aViewManagerParent) +void nsView::InvalidateHierarchy() { if (mViewManager->GetRootView() == this) mViewManager->InvalidateHierarchy(); for (nsView *child = mFirstChild; child; child = child->GetNextSibling()) - child->InvalidateHierarchy(aViewManagerParent); + child->InvalidateHierarchy(); } void nsView::InsertChild(nsView *aChild, nsView *aSibling) @@ -477,7 +477,7 @@ void nsView::InsertChild(nsView *aChild, nsView *aSibling) nsViewManager *vm = aChild->GetViewManager(); if (vm->GetRootView() == aChild) { - aChild->InvalidateHierarchy(nullptr); // don't care about releasing grabs + aChild->InvalidateHierarchy(); } } } @@ -513,7 +513,7 @@ void nsView::RemoveChild(nsView *child) nsViewManager *vm = child->GetViewManager(); if (vm->GetRootView() == child) { - child->InvalidateHierarchy(GetViewManager()); + child->InvalidateHierarchy(); } } } diff --git a/view/nsView.h b/view/nsView.h index 94bd4fed34..018d523845 100644 --- a/view/nsView.h +++ b/view/nsView.h @@ -458,11 +458,8 @@ private: void NotifyEffectiveVisibilityChanged(bool aEffectivelyVisible); - // Update the cached RootViewManager for all view manager descendents, - // If the hierarchy is being removed, aViewManagerParent points to the view - // manager for the hierarchy's old parent, and will have its mouse grab - // released if it points to any view in this view hierarchy. - void InvalidateHierarchy(nsViewManager *aViewManagerParent); + // Update the cached RootViewManager for all view manager descendents. + void InvalidateHierarchy(); nsViewManager *mViewManager; nsView *mParent; diff --git a/widget/PluginWidgetProxy.cpp b/widget/PluginWidgetProxy.cpp index b509db8a78..10476d9c08 100644 --- a/widget/PluginWidgetProxy.cpp +++ b/widget/PluginWidgetProxy.cpp @@ -35,7 +35,8 @@ NS_IMPL_ISUPPORTS_INHERITED(PluginWidgetProxy, PuppetWidget, nsIWidget) PluginWidgetProxy::PluginWidgetProxy(dom::TabChild* aTabChild, mozilla::plugins::PluginWidgetChild* aActor) : PuppetWidget(aTabChild), - mActor(aActor) + mActor(aActor), + mCachedPluginPort(0) { // See ChannelDestroyed() in the header mActor->SetWidget(this); @@ -63,6 +64,7 @@ PluginWidgetProxy::Create(nsIWidget* aParent, } BaseCreate(aParent, aInitData); + mParent = aParent; mBounds = aRect; mEnabled = true; @@ -74,8 +76,6 @@ PluginWidgetProxy::Create(nsIWidget* aParent, NS_IMETHODIMP PluginWidgetProxy::SetParent(nsIWidget* aNewParent) { - mParent = aNewParent; - nsCOMPtr kungFuDeathGrip(this); nsIWidget* parent = GetParent(); if (parent) { @@ -84,6 +84,7 @@ PluginWidgetProxy::SetParent(nsIWidget* aNewParent) if (aNewParent) { aNewParent->AddChild(this); } + mParent = aNewParent; return NS_OK; } @@ -135,10 +136,14 @@ PluginWidgetProxy::GetNativeData(uint32_t aDataType) NS_WARNING("PluginWidgetProxy::GetNativeData received request for unsupported data type."); return nullptr; } - uintptr_t value = 0; - mActor->SendGetNativePluginPort(&value); - PWLOG("PluginWidgetProxy::GetNativeData %p\n", (void*)value); - return (void*)value; + // The parent side window handle or xid never changes so we can + // cache this for our lifetime. + if (mCachedPluginPort) { + return (void*)mCachedPluginPort; + } + mActor->SendGetNativePluginPort(&mCachedPluginPort); + PWLOG("PluginWidgetProxy::GetNativeData %p\n", (void*)mCachedPluginPort); + return (void*)mCachedPluginPort; } #if defined(XP_WIN) diff --git a/widget/PluginWidgetProxy.h b/widget/PluginWidgetProxy.h index bcac94c838..703b0408f6 100644 --- a/widget/PluginWidgetProxy.h +++ b/widget/PluginWidgetProxy.h @@ -67,6 +67,7 @@ private: // PuppetWidget does not implement parent apis, but we need // them for plugin widgets. nsCOMPtr mParent; + uintptr_t mCachedPluginPort; }; } // namespace widget diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 3045df4129..9a19d333e7 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -631,6 +631,9 @@ NS_IMETHODIMP nsChildView::Destroy() return NS_OK; mOnDestroyCalled = true; + // Stuff below may delete the last ref to this + nsCOMPtr kungFuDeathGrip(this); + [mView widgetDestroyed]; nsBaseWidget::Destroy(); diff --git a/widget/gonk/GonkPermission.cpp b/widget/gonk/GonkPermission.cpp index ae8f231c50..7dab1f095f 100644 --- a/widget/gonk/GonkPermission.cpp +++ b/widget/gonk/GonkPermission.cpp @@ -123,7 +123,7 @@ GonkPermissionService::checkPermission(const String16& permission, int32_t pid, String8 perm8(permission); // Some ril implementations need android.permission.MODIFY_AUDIO_SETTINGS - if ((uid == AID_RADIO || uid == AID_BLUETOOTH) && + if ((uid == AID_SYSTEM || uid == AID_RADIO || uid == AID_BLUETOOTH) && perm8 == "android.permission.MODIFY_AUDIO_SETTINGS") { return true; } diff --git a/widget/gonk/HwcComposer2D.cpp b/widget/gonk/HwcComposer2D.cpp index 79ef588c01..eaf690245b 100644 --- a/widget/gonk/HwcComposer2D.cpp +++ b/widget/gonk/HwcComposer2D.cpp @@ -229,7 +229,7 @@ private: GonkDisplay::DisplayType mType; bool mConnected; }; -} // anonymous namespace +} // namespace void HwcComposer2D::Hotplug(int aDisplay, int aConnected) diff --git a/widget/moz.build b/widget/moz.build index 6549f8e52f..7c07803842 100644 --- a/widget/moz.build +++ b/widget/moz.build @@ -74,7 +74,6 @@ XPIDL_SOURCES += [ 'nsIGfxInfoDebug.idl', 'nsIIdleService.idl', 'nsIIdleServiceInternal.idl', - 'nsIIMEPicker.idl', 'nsIPrintOptions.idl', 'nsIPrintSession.idl', 'nsIPrintSettings.idl', diff --git a/widget/nsBaseDragService.cpp b/widget/nsBaseDragService.cpp index ff5bb1fadf..28ad393881 100644 --- a/widget/nsBaseDragService.cpp +++ b/widget/nsBaseDragService.cpp @@ -440,6 +440,14 @@ nsBaseDragService::FireDragEventAtSource(EventMessage aEventMessage) event.mUserCancelled = mUserCancelled; } + // Send the drag event to APZ, which needs to know about them to be + // able to accurately detect the end of a drag gesture. + if (nsPresContext* presContext = presShell->GetPresContext()) { + if (nsCOMPtr widget = presContext->GetRootWidget()) { + widget->DispatchEventToAPZOnly(&event); + } + } + nsCOMPtr content = do_QueryInterface(mSourceNode); return presShell->HandleDOMEventWithTarget(content, &event, &status); } diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index a39dea8e8b..92babae28d 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -590,15 +590,15 @@ double nsIWidget::DefaultScaleOverride() //------------------------------------------------------------------------- void nsBaseWidget::AddChild(nsIWidget* aChild) { - NS_PRECONDITION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(), - "aChild not properly removed from its old child list"); + MOZ_RELEASE_ASSERT(!aChild->GetNextSibling() && !aChild->GetPrevSibling(), + "aChild not properly removed from its old child list"); if (!mFirstChild) { mFirstChild = mLastChild = aChild; } else { // append to the list - NS_ASSERTION(mLastChild, "Bogus state"); - NS_ASSERTION(!mLastChild->GetNextSibling(), "Bogus state"); + MOZ_RELEASE_ASSERT(mLastChild); + MOZ_RELEASE_ASSERT(!mLastChild->GetNextSibling()); mLastChild->SetNextSibling(aChild); aChild->SetPrevSibling(mLastChild); mLastChild = aChild; @@ -620,7 +620,7 @@ void nsBaseWidget::RemoveChild(nsIWidget* aChild) nsIWidget* parent = aChild->GetParent(); NS_ASSERTION(!parent || parent == this, "Not one of our kids!"); #else - NS_ASSERTION(aChild->GetParent() == this, "Not one of our kids!"); + MOZ_RELEASE_ASSERT(aChild->GetParent() == this, "Not one of our kids!"); #endif #endif @@ -982,10 +982,10 @@ void nsBaseWidget::ConfigureAPZCTreeManager() aInputBlockId, aFlags)); }; - RefPtr controller = CreateRootContentController(); - if (controller) { + mRootContentController = CreateRootContentController(); + if (mRootContentController) { uint64_t rootLayerTreeId = mCompositorBridgeParent->RootLayerTreeId(); - CompositorBridgeParent::SetControllerForLayerTree(rootLayerTreeId, controller); + CompositorBridgeParent::SetControllerForLayerTree(rootLayerTreeId, mRootContentController); } // When APZ is enabled, we can actually enable raw touch events because we @@ -1199,6 +1199,18 @@ nsBaseWidget::DispatchInputEvent(WidgetInputEvent* aEvent) return status; } +void +nsBaseWidget::DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) +{ + MOZ_ASSERT(NS_IsMainThread()); + if (mAPZC) { + MOZ_ASSERT(APZThreadUtils::IsControllerThread()); + uint64_t inputBlockId = 0; + ScrollableLayerGuid guid; + mAPZC->ReceiveInputEvent(*aEvent, &guid, &inputBlockId); + } +} + nsIDocument* nsBaseWidget::GetDocument() const { @@ -1288,6 +1300,11 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight) if (!success || !lf) { NS_WARNING("Failed to create an OMT compositor."); + mAPZC = nullptr; + if (mRootContentController) { + mRootContentController->Destroy(); + mRootContentController = nullptr; + } DestroyCompositor(); mLayerManager = nullptr; mCompositorBridgeChild = nullptr; @@ -1368,7 +1385,7 @@ nsBaseWidget::CleanupRemoteDrawing() already_AddRefed nsBaseWidget::CreateBackBufferDrawTarget(mozilla::gfx::DrawTarget* aScreenTarget, const LayoutDeviceIntRect& aRect, - const bool aInitModeClear) + const LayoutDeviceIntRect& aClearRect) { MOZ_ASSERT(aScreenTarget); gfx::SurfaceFormat format = gfx::SurfaceFormat::B8G8R8A8; @@ -1384,8 +1401,9 @@ nsBaseWidget::CreateBackBufferDrawTarget(mozilla::gfx::DrawTarget* aScreenTarget mLastBackBuffer->GetSize() <= clientSize) { target = mLastBackBuffer; target->SetTransform(gfx::Matrix()); - if (aInitModeClear) { - target->ClearRect(gfx::Rect(0, 0, size.width, size.height)); + if (!aClearRect.IsEmpty()) { + gfx::IntRect clearRect = aClearRect.ToUnknownRect() - aRect.ToUnknownRect().TopLeft(); + target->ClearRect(gfx::Rect(clearRect.x, clearRect.y, clearRect.width, clearRect.height)); } } else { target = aScreenTarget->CreateSimilarDrawTarget(size, format); @@ -1406,6 +1424,14 @@ void nsBaseWidget::OnDestroy() // Don't release it until this widget actually released because after this // is called, TextEventDispatcher() may create it again. } + + // If this widget is being destroyed, let the APZ code know to drop references + // to this widget. Callers of this function all should be holding a deathgrip + // on this widget already. + if (mRootContentController) { + mRootContentController->Destroy(); + mRootContentController = nullptr; + } } NS_METHOD nsBaseWidget::SetWindowClass(const nsAString& xulWinType) @@ -2091,60 +2117,6 @@ nsIWidget::UpdateRegisteredPluginWindowVisibility(uintptr_t aOwnerWidget, #endif } -already_AddRefed -nsIWidget::SnapshotWidgetOnScreen() -{ - // This is only supported on a widget with a compositor. - LayerManager* layerManager = GetLayerManager(); - if (!layerManager) { - return nullptr; - } - - ClientLayerManager* lm = layerManager->AsClientLayerManager(); - if (!lm) { - return nullptr; - } - - CompositorBridgeChild* cc = lm->GetRemoteRenderer(); - if (!cc) { - return nullptr; - } - - LayoutDeviceIntRect bounds; - GetBounds(bounds); - if (bounds.IsEmpty()) { - return nullptr; - } - - gfx::IntSize size(bounds.width, bounds.height); - - ShadowLayerForwarder* forwarder = lm->AsShadowForwarder(); - SurfaceDescriptor surface; - if (!forwarder->AllocSurfaceDescriptor(size, gfxContentType::COLOR_ALPHA, &surface)) { - return nullptr; - } - - if (!cc->SendMakeWidgetSnapshot(surface)) { - return nullptr; - } - - RefPtr snapshot = GetSurfaceForDescriptor(surface); - RefPtr dt = - gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(size, gfx::SurfaceFormat::B8G8R8A8); - if (!snapshot || !dt) { - forwarder->DestroySurfaceDescriptor(&surface); - return nullptr; - } - - dt->DrawSurface(snapshot, - gfx::Rect(gfx::Point(), gfx::Size(size)), - gfx::Rect(gfx::Point(), gfx::Size(size)), - gfx::DrawSurfaceOptions(gfx::Filter::POINT)); - - forwarder->DestroySurfaceDescriptor(&surface); - return dt->Snapshot(); -} - NS_IMETHODIMP_(nsIWidget::NativeIMEContext) nsIWidget::GetNativeIMEContext() { diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index a37deb35d3..5b91435842 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -175,7 +175,7 @@ public: virtual void CleanupRemoteDrawing() override; virtual already_AddRefed CreateBackBufferDrawTarget(mozilla::gfx::DrawTarget* aScreenTarget, const LayoutDeviceIntRect& aRect, - const bool aInitModeClear) override; + const LayoutDeviceIntRect& aClearRect) override; virtual void UpdateThemeGeometries(const nsTArray& aThemeGeometries) override {} NS_IMETHOD SetModal(bool aModal) override; virtual uint32_t GetMaxTouchPoints() const override; @@ -261,6 +261,7 @@ public: const uint32_t& aFlags) override; // Dispatch an event that must be first be routed through APZ. nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) override; + void DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) override; void SetConfirmedTargetAPZC(uint64_t aInputBlockId, const nsTArray& aTargets) const override; @@ -316,10 +317,6 @@ public: virtual const SizeConstraints GetSizeConstraints() override; virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override; - virtual bool CaptureWidgetOnScreen(RefPtr aDT) override { - return false; - } - virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) override; /** @@ -520,6 +517,7 @@ protected: RefPtr mCompositorBridgeParent; RefPtr mCompositorVsyncDispatcher; RefPtr mAPZC; + RefPtr mRootContentController; RefPtr mAPZEventState; // Back buffer of BasicCompositor RefPtr mLastBackBuffer; diff --git a/widget/nsIIMEPicker.idl b/widget/nsIIMEPicker.idl deleted file mode 100644 index ab081b9cfc..0000000000 --- a/widget/nsIIMEPicker.idl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsISupports.idl" - -[scriptable, uuid(9e631b1d-7a07-4925-a47e-697c6edaf408)] -interface nsIIMEPicker : nsISupports -{ - /** - * Show IME Picker dialog. - */ - void show(); -}; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index a6beea163c..caf5e78f0a 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -1299,7 +1299,7 @@ class nsIWidget : public nsISupports { */ virtual already_AddRefed CreateBackBufferDrawTarget(mozilla::gfx::DrawTarget* aScreenTarget, const LayoutDeviceIntRect& aRect, - const bool aInitModeClear) = 0; + const LayoutDeviceIntRect& aClearRect) = 0; /** * A hook for the widget to prepare a Compositor, during the latter's initialization. @@ -1398,6 +1398,12 @@ class nsIWidget : public nsISupports { NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* event, nsEventStatus & aStatus) = 0; + /** + * Dispatches an event to APZ only. + * No-op in the child process. + */ + virtual void DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) = 0; + /** * Dispatches an event that must be handled by APZ first, when APZ is * enabled. If invoked in the child process, it is forwarded to the @@ -1695,23 +1701,6 @@ class nsIWidget : public nsISupports { */ virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver); - /* - * Snapshot the contents of the widget by reading pixels back from the - * Operating System. Unlike RenderDocument(), this does not read from our - * own backbuffers, so that we can test if there is a difference in how - * our buffers are being presented. - * - * This is only supported for widgets using OMTC. - */ - already_AddRefed SnapshotWidgetOnScreen(); - - /* - * Implementation of SnapshotWidgetOnScreen. This is invoked by the - * compositor for SnapshotWidgetOnScreen(), and should not be called - * otherwise. - */ - virtual bool CaptureWidgetOnScreen(RefPtr aDT) = 0; - virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) = 0; private: diff --git a/widget/nsShmImage.cpp b/widget/nsShmImage.cpp index 1ec7bb9fe9..ea42a7faf8 100644 --- a/widget/nsShmImage.cpp +++ b/widget/nsShmImage.cpp @@ -163,6 +163,8 @@ nsShmImage::CreateImage(const IntSize& aSize) return false; } + BackendType backend = gfxPlatform::GetPlatform()->GetDefaultContentBackend(); + mFormat = SurfaceFormat::UNKNOWN; switch (mDepth) { case 32: @@ -175,10 +177,12 @@ nsShmImage::CreateImage(const IntSize& aSize) case 24: // Only support the BGRX layout, and report it as BGRA to the compositor. // The alpha channel will be discarded when we put the image. + // Cairo/pixman lacks some fast paths for compositing BGRX onto BGRA, so + // just report it as BGRX directly in that case. if (mVisual->red_mask == 0xff0000 && mVisual->green_mask == 0xff00 && mVisual->blue_mask == 0xff) { - mFormat = SurfaceFormat::B8G8R8A8; + mFormat = backend == BackendType::CAIRO ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8; } break; case 16: diff --git a/widget/nsWidgetsCID.h b/widget/nsWidgetsCID.h index 802abb2592..54ebe63abc 100644 --- a/widget/nsWidgetsCID.h +++ b/widget/nsWidgetsCID.h @@ -186,10 +186,6 @@ { 0xd755a760, 0x9f27, 0x11df, \ { 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66, 0x42, 0x42 } } -#define NS_IMEPICKER_CID \ -{ 0x8e5c35ef, 0xb65b, 0x47aa, \ -{ 0xbb, 0x90, 0x5b, 0x89, 0x6d, 0x88, 0x24, 0x18 } } - #define NS_WINDOWS_UIUTILS_CID \ { 0xe04a55e8, 0xfee3, 0x4ea2, \ { 0xa9, 0x8b, 0x41, 0xd2, 0x62, 0x1a, 0xdc, 0x3c } } diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 30c73d239e..aae84e587b 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -7593,47 +7593,6 @@ void nsWindow::PickerClosed() } } -bool nsWindow::CaptureWidgetOnScreen(RefPtr aDT) -{ - BOOL dwmEnabled = false; - if (WinUtils::dwmIsCompositionEnabledPtr && - WinUtils::dwmFlushProcPtr && - WinUtils::dwmIsCompositionEnabledPtr(&dwmEnabled) && - dwmEnabled) - { - WinUtils::dwmFlushProcPtr(); - } - - HDC dc = ::GetDC(mWnd); - uint32_t flags = (mTransparencyMode == eTransparencyOpaque) - ? 0 - : gfxWindowsSurface::FLAG_IS_TRANSPARENT; - - RefPtr surf = new gfxWindowsSurface(dc, flags); - IntSize size(surf->GetSize().width, surf->GetSize().height); - if (size.width <= 0 || size.height <= 0) { - ::ReleaseDC(mWnd, dc); - return false; - } - - RefPtr source = Factory::CreateDrawTargetForCairoSurface(surf->CairoSurface(), size); - if (!source) { - ::ReleaseDC(mWnd, dc); - return false; - } - RefPtr snapshot = source->Snapshot(); - if (!snapshot) { - ::ReleaseDC(mWnd, dc); - return false; - } - - aDT->DrawSurface(snapshot, - Rect(0, 0, size.width, size.height), - Rect(0, 0, size.width, size.height)); - ::ReleaseDC(mWnd, dc); - return true; -} - bool nsWindow::PreRender(LayerManagerComposite*) { // This can block waiting for WM_SETTEXT to finish diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h index f2f2f104e2..5d431ea9d6 100644 --- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -299,8 +299,6 @@ public: bool IsPopup(); virtual bool ShouldUseOffMainThreadCompositing() override; - bool CaptureWidgetOnScreen(RefPtr aDT) override; - const IMEContext& DefaultIMC() const { return mDefaultIMC; } virtual void SetCandidateWindowForPlugin( diff --git a/widget/x11/keysym2ucs.c b/widget/x11/keysym2ucs.c index 06dd65d235..9ea0fbbfbf 100644 --- a/widget/x11/keysym2ucs.c +++ b/widget/x11/keysym2ucs.c @@ -41,7 +41,7 @@ #include "keysym2ucs.h" -struct codepair { +static const struct codepair { unsigned short keysym; unsigned short ucs; } keysymtab[] = { diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index be785056fe..87dc28e513 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -14,7 +14,7 @@ #include #include #if !defined(XP_MACOSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) -#include // No longer implicitly included in later glibc +#include #endif #include #include