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)
This commit is contained in:
2024-05-30 14:34:55 +08:00
parent 2ce8c88a9b
commit 07da6b90ed
42 changed files with 151 additions and 292 deletions
-45
View File
@@ -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<nsPresContext> 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<SourceSurface> 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
//
-1
View File
@@ -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);
@@ -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.
+1 -1
View File
@@ -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;
+4 -2
View File
@@ -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<typename PanGestureOrScrollWheelInput>
@@ -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);
+8 -1
View File
@@ -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
@@ -99,6 +99,9 @@ ChromeProcessController::Destroy()
nsIPresShell*
ChromeProcessController::GetPresShell() const
{
if (!mWidget) {
return nullptr;
}
if (nsView* view = nsView::GetViewFor(mWidget)) {
return view->GetPresShell();
}
+16 -6
View File
@@ -162,7 +162,7 @@ BasicCompositor::CreateRenderTargetFromSource(const IntRect &aRect,
}
already_AddRefed<CompositingRenderTarget>
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<DrawTarget> target = mWidget->CreateBackBufferDrawTarget(mDrawTarget, aRect, aInit == INIT_MODE_CLEAR);
RefPtr<DrawTarget> 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<CompositingRenderTarget> target =
CreateRenderTargetForWindow(mInvalidRect,
aOpaque ? INIT_MODE_NONE : INIT_MODE_CLEAR,
clearRect,
bufferMode);
if (!target) {
if (!mTarget) {
+2 -2
View File
@@ -69,7 +69,7 @@ public:
virtual already_AddRefed<CompositingRenderTarget>
CreateRenderTargetForWindow(const LayoutDeviceIntRect& aRect,
SurfaceInitMode aInit,
const LayoutDeviceIntRect& aClearRect,
BufferMode aBufferMode);
virtual already_AddRefed<DataTextureSource>
@@ -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;
+9 -12
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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)
{
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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)
{
+1 -1
View File
@@ -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;
+5 -22
View File
@@ -828,22 +828,6 @@ CompositorBridgeParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
return true;
}
bool
CompositorBridgeParent::RecvMakeWidgetSnapshot(const SurfaceDescriptor& aInSnapshot)
{
if (!mCompositor || !mCompositor->GetWidget()) {
return false;
}
RefPtr<DrawTarget> 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; }
-1
View File
@@ -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;
-8
View File
@@ -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();
+1 -1
View File
@@ -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)
{
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -92,9 +92,9 @@ StartupCache::GetSingleton()
}
#ifdef MOZ_DISABLE_STARTUPCACHE
return nullptr;
#endif
#else
StartupCache::InitSingleton();
#endif
}
return StartupCache::gStartupCache;
@@ -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<nsILoadContext> loadContext = tabParent->GetLoadContext();
loadContext->GetUsePrivateBrowsing(&isPrivate);
SetPrivate(isPrivate);
}
helperAppService->DoContent(aMimeContentType, this, window,
@@ -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<ExternalHelperAppParent>
{
typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
+4 -4
View File
@@ -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();
}
}
}
+2 -5
View File
@@ -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;
+12 -7
View File
@@ -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<nsIWidget> 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)
+1
View File
@@ -67,6 +67,7 @@ private:
// PuppetWidget does not implement parent apis, but we need
// them for plugin widgets.
nsCOMPtr<nsIWidget> mParent;
uintptr_t mCachedPluginPort;
};
} // namespace widget
+3
View File
@@ -631,6 +631,9 @@ NS_IMETHODIMP nsChildView::Destroy()
return NS_OK;
mOnDestroyCalled = true;
// Stuff below may delete the last ref to this
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
[mView widgetDestroyed];
nsBaseWidget::Destroy();
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -229,7 +229,7 @@ private:
GonkDisplay::DisplayType mType;
bool mConnected;
};
} // anonymous namespace
} // namespace
void
HwcComposer2D::Hotplug(int aDisplay, int aConnected)
-1
View File
@@ -74,7 +74,6 @@ XPIDL_SOURCES += [
'nsIGfxInfoDebug.idl',
'nsIIdleService.idl',
'nsIIdleServiceInternal.idl',
'nsIIMEPicker.idl',
'nsIPrintOptions.idl',
'nsIPrintSession.idl',
'nsIPrintSettings.idl',
+8
View File
@@ -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<nsIWidget> widget = presContext->GetRootWidget()) {
widget->DispatchEventToAPZOnly(&event);
}
}
nsCOMPtr<nsIContent> content = do_QueryInterface(mSourceNode);
return presShell->HandleDOMEventWithTarget(content, &event, &status);
}
+37 -65
View File
@@ -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<GeckoContentController> 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<mozilla::gfx::DrawTarget>
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<mozilla::gfx::SourceSurface>
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<gfx::DataSourceSurface> snapshot = GetSurfaceForDescriptor(surface);
RefPtr<gfx::DrawTarget> 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()
{
+3 -5
View File
@@ -175,7 +175,7 @@ public:
virtual void CleanupRemoteDrawing() override;
virtual already_AddRefed<mozilla::gfx::DrawTarget> CreateBackBufferDrawTarget(mozilla::gfx::DrawTarget* aScreenTarget,
const LayoutDeviceIntRect& aRect,
const bool aInitModeClear) override;
const LayoutDeviceIntRect& aClearRect) override;
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& 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<ScrollableLayerGuid>& aTargets) const override;
@@ -316,10 +317,6 @@ public:
virtual const SizeConstraints GetSizeConstraints() override;
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
virtual bool CaptureWidgetOnScreen(RefPtr<mozilla::gfx::DrawTarget> aDT) override {
return false;
}
virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) override;
/**
@@ -520,6 +517,7 @@ protected:
RefPtr<CompositorBridgeParent> mCompositorBridgeParent;
RefPtr<mozilla::CompositorVsyncDispatcher> mCompositorVsyncDispatcher;
RefPtr<APZCTreeManager> mAPZC;
RefPtr<GeckoContentController> mRootContentController;
RefPtr<APZEventState> mAPZEventState;
// Back buffer of BasicCompositor
RefPtr<DrawTarget> mLastBackBuffer;
-14
View File
@@ -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();
};
+7 -18
View File
@@ -1299,7 +1299,7 @@ class nsIWidget : public nsISupports {
*/
virtual already_AddRefed<mozilla::gfx::DrawTarget> 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<mozilla::gfx::SourceSurface> SnapshotWidgetOnScreen();
/*
* Implementation of SnapshotWidgetOnScreen. This is invoked by the
* compositor for SnapshotWidgetOnScreen(), and should not be called
* otherwise.
*/
virtual bool CaptureWidgetOnScreen(RefPtr<mozilla::gfx::DrawTarget> aDT) = 0;
virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) = 0;
private:
+5 -1
View File
@@ -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:
-4
View File
@@ -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 } }
-41
View File
@@ -7593,47 +7593,6 @@ void nsWindow::PickerClosed()
}
}
bool nsWindow::CaptureWidgetOnScreen(RefPtr<DrawTarget> 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<gfxASurface> 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<DrawTarget> source = Factory::CreateDrawTargetForCairoSurface(surf->CairoSurface(), size);
if (!source) {
::ReleaseDC(mWnd, dc);
return false;
}
RefPtr<SourceSurface> 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
-2
View File
@@ -299,8 +299,6 @@ public:
bool IsPopup();
virtual bool ShouldUseOffMainThreadCompositing() override;
bool CaptureWidgetOnScreen(RefPtr<mozilla::gfx::DrawTarget> aDT) override;
const IMEContext& DefaultIMC() const { return mDefaultIMC; }
virtual void SetCandidateWindowForPlugin(
+1 -1
View File
@@ -41,7 +41,7 @@
#include "keysym2ucs.h"
struct codepair {
static const struct codepair {
unsigned short keysym;
unsigned short ucs;
} keysymtab[] = {
+1 -1
View File
@@ -14,7 +14,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#if !defined(XP_MACOSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
#include <sys/sysmacros.h> // No longer implicitly included in later glibc
#include <sys/sysmacros.h>
#endif
#include <unistd.h>
#include <fcntl.h>