mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
60a7b63caa
- Bug 1202965 (part 1) - Add MOZ_UNUSED. r=froydnj. (457960f48) - Bug 1200097 - Fix warnings in logalloc. r=glandium. (3f115e470) - Bug 1200623 - Fix FdPrintf.o link error in --disable-optimize builds. r=glandium. (4f07a36e2) - Bug 1202965 (part 2) - Use MOZ_UNUSED in FdPrintf.c. r=glandium. (2dd55aaa7) - Bug 1203314 - Make operator<< a method on unused_t. r=froydnj This prevents operator overload resolution from failing when this file is included in a file that uses Chromium IPC logging. (80f5cf4c5) - Bug 1014691 - Move APZ mochitests to gfx/layers/apz/test/mochitest. r=kats (b3e811b10) - Bug 1014691 - Move TestAsyncPanZoomController.cpp to gfx/layers/apz/test/gtest. r=kats,glandium (7c7598033) - Bug 1083101 - Add a memory arena to Moz2D. r=jrmuizel (986b49392) - Bug 1083101 - Add a task scheduler to Moz2D. r=jrmuizel (58002f967) - partial of Bug 1140675 - Disable failing tests on windows opt. r=me (8d4b5b761) - Bug 1170081 - Add a tag to run only mochitests that use HTMLMediaElement::MozCaptureStream. r=cpearce. (fc9e19146) - Bug 1189744 - Fix crash after GetOwnPropertyDescriptor failed to populate all fields of desc. r=jandem, a=abillings. (464905f1b) - Bug 1184414 - X.[[SetPrototypeOf]](Y) should succeed if X.[[Prototype]] is already Y. r=jorendorff. (3c3b9767c) - Bug 1240792 - Test that assignment to primitives throws in strict mode. r=jorendorff (5fe30b7d1) - Bug 1172609 - Part 5: Add js::ResetTimeZone() function. r=waldo, r=ted (2f8021714) - Bug 1172609 - Part 6: Add nsJSUtils::ResetTimeZone() function. r=ehsan (35c1bbeb2) - Bug 1172609 - Part 7: Hal calls nsJSUtils::ResetTimeZone() when timezone changes. r=dhylands (fe55a0830) - Bug 1150534 - Synchronously decode favicons before calling GetFrame. r=tn (4f1acc810) - Bug 1168495 - Restrict updated region to fall within GTK window. r=jrmuizel (d92a71a5c) - Bug 1180971 - Fix X11 SHM invalidation regions on HiDPI with GTK3. r=karlt (98cce94d0) - Bug 1156182 - Prevent widgets from creating a LayerManager during shutdown. r=sotaro (4af6914c9) - Bug 1194397 - Force gdk_window_ensure_native on gdk window creation. r=acomminos (06a6eb2d8) - Bug 1190935 - Fix race condition in gtk window EndRemoteDrawingInRegion. r=nical (cc7468e81) - Bug 1182972 - Fallback to GTK monitor scale factor when mGdkWindow is null. r=karlt (69326bcfd) - Bug 1168843 - use thread-safe refcounting for shared memory surfaces to avoid shutdown crashes. r=jmuizelaar (1d9b0914e) - Bug 1167786. Restrict bounds of drawn region to the nsShmImage bounds to avoid X errors. r=karlt (005464f91) - Bug 1205045 - remove GTK calls from compositor thread. r=jmuizelaar (ce5753137) - Bug 1120851 - Set candidate window position for prediction even if no composition. r=masayuki (5814e776e) - Bug 1176843 - Don't query caret rect on layout change. r=masayuki (4673f14ff) - Bug 1177171 - Round widget coordinates on GTK3. r=karlt (3cd3af1c1) - Bug 1186017 part.1 Rename nsGtkIMModule to mozilla::widget::IMContextWrapper r=m_kato+kerlt (f2b60dcd2) - Bug 1186017 part.2 Rename GetBoolName() in IMContextWrapper.cpp to ToChar() r=kerlt (dade4fd9d) - bug 1182972 remove unused aRepaint parameter from NativeResize methods r=acomminos (ae76c8f99) - bug 1182972 remove mNeedsMove/mNeedsResize logic; instead process changes immediately r=acomminos (9417b03dc) - bug 1182972 no need to pass member variable bounds to NativeResize r=acomminos (422e57acc) - Bug 1181000 - Use logical pixel to set IME candidate window. r=karlt (d6f78610a) - Bug 1191213 nsBaseWidget::NotifyWindowMoved() shouldn't notify IME when native IME handler doesn't have focus r=m_kato (59ee4fc9c) - Bug 1198861 - Improve aliasing information and type barrier handling for unboxed arrays, r=jandem. (9ea8fd1cd) - Bug 1198861 - Improve type barrier logic to avoid unnecessary tests on primitive types, and fix redundant baseline stubs for SETELEM property adds, r=jandem. (f1f2252c0) - Bug 1083101 - Win32 implementation of the JobScheduler. r=jrmuizel (https://github.com/mozilla/newtab-dev/commit/120cce1d) - Bug 1083101 - rename gfx::Mutex into gfx::CriticalSection and move it to its own file. r=jrmuizel (https://github.com/mozilla/newtab-dev/commit/6198b794) - Bug 1083101 - Make SyncObject's waiting jobs list lock-free. r=jrmuizel (https://github.com/mozilla/newtab-dev/commit/e27060d8)
199 lines
5.9 KiB
C++
199 lines
5.9 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* 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/. */
|
|
|
|
#if defined(MOZ_WIDGET_GTK)
|
|
#include <gtk/gtk.h>
|
|
#include <gdk/gdkx.h>
|
|
#elif defined(MOZ_WIDGET_QT)
|
|
#include <QWindow>
|
|
#endif
|
|
|
|
#include "nsShmImage.h"
|
|
#ifdef MOZ_WIDGET_GTK
|
|
#include "gfxPlatformGtk.h"
|
|
#endif
|
|
|
|
#ifdef MOZ_HAVE_SHMIMAGE
|
|
|
|
using namespace mozilla::ipc;
|
|
using namespace mozilla::gfx;
|
|
|
|
// If XShm isn't available to our client, we'll try XShm once, fail,
|
|
// set this to false and then never try again.
|
|
static bool gShmAvailable = true;
|
|
bool nsShmImage::UseShm()
|
|
{
|
|
#ifdef MOZ_WIDGET_GTK
|
|
return (gShmAvailable && !gfxPlatformGtk::GetPlatform()->UseXRender());
|
|
#else
|
|
return gShmAvailable;
|
|
#endif
|
|
}
|
|
|
|
#ifdef MOZ_WIDGET_GTK
|
|
static int gShmError = 0;
|
|
|
|
static int
|
|
TrapShmError(Display* aDisplay, XErrorEvent* aEvent)
|
|
{
|
|
// store the error code and ignore the error
|
|
gShmError = aEvent->error_code;
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
already_AddRefed<nsShmImage>
|
|
nsShmImage::Create(const gfxIntSize& aSize,
|
|
Display* aDisplay, Visual* aVisual, unsigned int aDepth)
|
|
{
|
|
nsRefPtr<nsShmImage> shm = new nsShmImage();
|
|
shm->mDisplay = aDisplay;
|
|
shm->mImage = XShmCreateImage(aDisplay, aVisual, aDepth,
|
|
ZPixmap, nullptr,
|
|
&(shm->mInfo),
|
|
aSize.width, aSize.height);
|
|
if (!shm->mImage) {
|
|
return nullptr;
|
|
}
|
|
|
|
size_t size = SharedMemory::PageAlignedSize(
|
|
shm->mImage->bytes_per_line * shm->mImage->height);
|
|
shm->mSegment = new SharedMemorySysV();
|
|
if (!shm->mSegment->Create(size) || !shm->mSegment->Map(size)) {
|
|
return nullptr;
|
|
}
|
|
|
|
shm->mInfo.shmid = shm->mSegment->GetHandle();
|
|
shm->mInfo.shmaddr =
|
|
shm->mImage->data = static_cast<char*>(shm->mSegment->memory());
|
|
shm->mInfo.readOnly = False;
|
|
|
|
#if defined(MOZ_WIDGET_GTK)
|
|
gShmError = 0;
|
|
XErrorHandler previousHandler = XSetErrorHandler(TrapShmError);
|
|
Status attachOk = XShmAttach(aDisplay, &shm->mInfo);
|
|
XSync(aDisplay, False);
|
|
XSetErrorHandler(previousHandler);
|
|
if (gShmError) {
|
|
attachOk = 0;
|
|
}
|
|
#elif defined(MOZ_WIDGET_QT)
|
|
Status attachOk = XShmAttach(aDisplay, &shm->mInfo);
|
|
#endif
|
|
|
|
if (!attachOk) {
|
|
// Assume XShm isn't available, and don't attempt to use it
|
|
// again.
|
|
gShmAvailable = false;
|
|
return nullptr;
|
|
}
|
|
|
|
shm->mXAttached = true;
|
|
shm->mSize = aSize;
|
|
switch (shm->mImage->depth) {
|
|
case 32:
|
|
if ((shm->mImage->red_mask == 0xff0000) &&
|
|
(shm->mImage->green_mask == 0xff00) &&
|
|
(shm->mImage->blue_mask == 0xff)) {
|
|
shm->mFormat = SurfaceFormat::B8G8R8A8;
|
|
break;
|
|
}
|
|
goto unsupported;
|
|
case 24:
|
|
// Only xRGB is supported.
|
|
if ((shm->mImage->red_mask == 0xff0000) &&
|
|
(shm->mImage->green_mask == 0xff00) &&
|
|
(shm->mImage->blue_mask == 0xff)) {
|
|
shm->mFormat = SurfaceFormat::B8G8R8X8;
|
|
break;
|
|
}
|
|
goto unsupported;
|
|
case 16:
|
|
shm->mFormat = SurfaceFormat::R5G6B5;
|
|
break;
|
|
unsupported:
|
|
default:
|
|
NS_WARNING("Unsupported XShm Image format!");
|
|
gShmAvailable = false;
|
|
return nullptr;
|
|
}
|
|
return shm.forget();
|
|
}
|
|
|
|
already_AddRefed<DrawTarget>
|
|
nsShmImage::CreateDrawTarget()
|
|
{
|
|
return gfxPlatform::GetPlatform()->CreateDrawTargetForData(
|
|
static_cast<unsigned char*>(mSegment->memory()),
|
|
mSize,
|
|
mImage->bytes_per_line,
|
|
mFormat);
|
|
}
|
|
|
|
#ifdef MOZ_WIDGET_GTK
|
|
void
|
|
nsShmImage::Put(Display* aDisplay, Drawable aWindow, const nsIntRegion& aRegion)
|
|
{
|
|
GC gc = XCreateGC(aDisplay, aWindow, 0, nullptr);
|
|
nsIntRegion bounded;
|
|
bounded.And(aRegion, nsIntRect(0, 0, mImage->width, mImage->height));
|
|
nsIntRegionRectIterator iter(bounded);
|
|
for (const nsIntRect *r = iter.Next(); r; r = iter.Next()) {
|
|
XShmPutImage(aDisplay, aWindow, gc, mImage,
|
|
r->x, r->y,
|
|
r->x, r->y,
|
|
r->width, r->height,
|
|
False);
|
|
}
|
|
|
|
XFreeGC(aDisplay, gc);
|
|
|
|
// FIXME/bug 597336: we need to ensure that the shm image isn't
|
|
// scribbled over before all its pending XShmPutImage()s complete.
|
|
// However, XSync() is an unnecessarily heavyweight
|
|
// synchronization mechanism; other options are possible. If this
|
|
// XSync is shown to hurt responsiveness, we need to explore the
|
|
// other options.
|
|
XSync(aDisplay, False);
|
|
}
|
|
|
|
#elif defined(MOZ_WIDGET_QT)
|
|
void
|
|
nsShmImage::Put(QWindow* aWindow, QRect& aRect)
|
|
{
|
|
Display* dpy = gfxQtPlatform::GetXDisplay(aWindow);
|
|
Drawable d = aWindow->winId();
|
|
|
|
GC gc = XCreateGC(dpy, d, 0, nullptr);
|
|
// Avoid out of bounds painting
|
|
QRect inter = aRect.intersected(aWindow->geometry());
|
|
XShmPutImage(dpy, d, gc, mImage,
|
|
inter.x(), inter.y(),
|
|
inter.x(), inter.y(),
|
|
inter.width(), inter.height(),
|
|
False);
|
|
XFreeGC(dpy, gc);
|
|
}
|
|
#endif
|
|
|
|
already_AddRefed<DrawTarget>
|
|
nsShmImage::EnsureShmImage(const gfxIntSize& aSize,
|
|
Display* aDisplay, Visual* aVisual, unsigned int aDepth,
|
|
nsRefPtr<nsShmImage>& aImage)
|
|
{
|
|
if (!aImage || aImage->Size() != aSize) {
|
|
// Because we XSync() after XShmAttach() to trap errors, we
|
|
// know that the X server has the old image's memory mapped
|
|
// into its address space, so it's OK to destroy the old image
|
|
// here even if there are outstanding Puts. The Detach is
|
|
// ordered after the Puts.
|
|
aImage = nsShmImage::Create(aSize, aDisplay, aVisual, aDepth);
|
|
}
|
|
return !aImage ? nullptr : aImage->CreateDrawTarget();
|
|
}
|
|
|
|
#endif // defined(MOZ_X11) && defined(MOZ_HAVE_SHAREDMEMORYSYSV)
|