Merge last green changeset from mozilla-inbound to mozilla-central

This commit is contained in:
Marco Bonardo 2011-07-04 20:26:29 +02:00
commit e88b205b60
42 changed files with 1447 additions and 167 deletions

View File

@ -1422,7 +1422,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
}
.panel-promo-icon {
list-style-image: url("chrome://browser/skin/sync-24.png");
list-style-image: url("chrome://browser/skin/sync-notification-24.png");
-moz-margin-end: 10px;
vertical-align: middle;
}

View File

@ -88,12 +88,12 @@ browser.jar:
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-16-throbber.png
skin/classic/browser/sync-16.png
skin/classic/browser/sync-24.png
skin/classic/browser/sync-24-throbber.png
skin/classic/browser/sync-32.png
skin/classic/browser/sync-bg.png
skin/classic/browser/sync-desktopIcon.png
skin/classic/browser/sync-mobileIcon.png
skin/classic/browser/sync-notification-24.png
skin/classic/browser/syncSetup.css
skin/classic/browser/syncCommon.css
skin/classic/browser/syncQuota.css

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1412,6 +1412,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
box-shadow: 0 1px 1px hsla(0,0%,0%,.25) inset;
color: hsl(0,0%,60%);
}
.panel-promo-message > .text-link {
@ -1419,7 +1420,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
}
.panel-promo-icon {
list-style-image: url("chrome://browser/skin/sync-24.png");
list-style-image: url("chrome://browser/skin/sync-notification-24.png");
-moz-margin-end: 10px;
vertical-align: middle;
}

View File

@ -126,11 +126,11 @@ browser.jar:
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-throbber.png
skin/classic/browser/sync-16.png
skin/classic/browser/sync-24.png
skin/classic/browser/sync-32.png
skin/classic/browser/sync-bg.png
skin/classic/browser/sync-desktopIcon.png
skin/classic/browser/sync-mobileIcon.png
skin/classic/browser/sync-notification-24.png
skin/classic/browser/syncSetup.css
skin/classic/browser/syncCommon.css
skin/classic/browser/syncQuota.css

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1538,7 +1538,7 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
}
.panel-promo-icon {
list-style-image: url("chrome://browser/skin/sync-24.png");
list-style-image: url("chrome://browser/skin/sync-notification-24.png");
-moz-margin-end: 10px;
vertical-align: middle;
}

View File

@ -105,11 +105,11 @@ browser.jar:
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/sync-throbber.png
skin/classic/browser/sync-16.png
skin/classic/browser/sync-24.png
skin/classic/browser/sync-32.png
skin/classic/browser/sync-bg.png
skin/classic/browser/sync-desktopIcon.png
skin/classic/browser/sync-mobileIcon.png
skin/classic/browser/sync-notification-24.png
skin/classic/browser/syncSetup.css
skin/classic/browser/syncCommon.css
skin/classic/browser/syncQuota.css
@ -221,11 +221,11 @@ browser.jar:
#ifdef MOZ_SERVICES_SYNC
skin/classic/aero/browser/sync-throbber.png
skin/classic/aero/browser/sync-16.png
skin/classic/aero/browser/sync-24.png
skin/classic/aero/browser/sync-32.png
skin/classic/aero/browser/sync-bg.png
skin/classic/aero/browser/sync-desktopIcon.png
skin/classic/aero/browser/sync-mobileIcon.png
skin/classic/aero/browser/sync-notification-24.png
skin/classic/aero/browser/syncSetup.css
skin/classic/aero/browser/syncCommon.css
skin/classic/aero/browser/syncQuota.css

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -102,6 +102,7 @@ CPPSRCS += \
ImageLayerD3D9.cpp \
ColorLayerD3D9.cpp \
CanvasLayerD3D9.cpp \
ShadowBufferD3D9.cpp \
DeviceManagerD3D9.cpp \
Nv3DVUtils.cpp \
$(NULL)

View File

@ -36,12 +36,17 @@
*
* ***** END LICENSE BLOCK ***** */
#include "CanvasLayerD3D9.h"
#include "mozilla/layers/PLayers.h"
#include "mozilla/layers/ShadowLayers.h"
#include "ShadowBufferD3D9.h"
#include "gfxImageSurface.h"
#include "gfxWindowsSurface.h"
#include "gfxWindowsPlatform.h"
#include "CanvasLayerD3D9.h"
namespace mozilla {
namespace layers {
@ -93,14 +98,14 @@ CanvasLayerD3D9::UpdateSurface()
if (mGLContext) {
// WebGL reads entire surface.
D3DLOCKED_RECT r;
HRESULT hr = mTexture->LockRect(0, &r, NULL, 0);
if (FAILED(hr)) {
LockTextureRectD3D9 textureLock(mTexture);
if (!textureLock.HasLock()) {
NS_WARNING("Failed to lock CanvasLayer texture.");
return;
}
D3DLOCKED_RECT r = textureLock.GetLockRect();
PRUint8 *destination;
if (r.Pitch != mBounds.width * 4) {
destination = new PRUint8[mBounds.width * mBounds.height * 4];
@ -143,7 +148,6 @@ CanvasLayerD3D9::UpdateSurface()
}
delete [] destination;
}
mTexture->UnlockRect(0);
} else if (mSurface) {
RECT r;
r.left = mBounds.x;
@ -151,14 +155,14 @@ CanvasLayerD3D9::UpdateSurface()
r.right = mBounds.XMost();
r.bottom = mBounds.YMost();
D3DLOCKED_RECT lockedRect;
HRESULT hr = mTexture->LockRect(0, &lockedRect, &r, 0);
if (FAILED(hr)) {
LockTextureRectD3D9 textureLock(mTexture);
if (!textureLock.HasLock()) {
NS_WARNING("Failed to lock CanvasLayer texture.");
return;
}
D3DLOCKED_RECT lockedRect = textureLock.GetLockRect();
nsRefPtr<gfxImageSurface> sourceSurface;
if (mSurface->GetType() == gfxASurface::SurfaceTypeWin32) {
@ -168,7 +172,6 @@ CanvasLayerD3D9::UpdateSurface()
if (sourceSurface->Format() != gfxASurface::ImageFormatARGB32 &&
sourceSurface->Format() != gfxASurface::ImageFormatRGB24)
{
mTexture->UnlockRect(0);
return;
}
} else {
@ -195,7 +198,6 @@ CanvasLayerD3D9::UpdateSurface()
mBounds.width * 4);
}
mTexture->UnlockRect(0);
}
}
@ -287,5 +289,99 @@ CanvasLayerD3D9::CreateTexture()
}
}
ShadowCanvasLayerD3D9::ShadowCanvasLayerD3D9(LayerManagerD3D9* aManager)
: ShadowCanvasLayer(aManager, nsnull)
, LayerD3D9(aManager)
, mNeedsYFlip(PR_FALSE)
{
mImplData = static_cast<LayerD3D9*>(this);
}
ShadowCanvasLayerD3D9::~ShadowCanvasLayerD3D9()
{}
void
ShadowCanvasLayerD3D9::Initialize(const Data& aData)
{
NS_RUNTIMEABORT("Non-shadow layer API unexpectedly used for shadow layer");
}
void
ShadowCanvasLayerD3D9::Init(const SurfaceDescriptor& aNewFront,
const nsIntSize& aSize, bool needYFlip)
{
if (!mBuffer) {
mBuffer = new ShadowBufferD3D9(this);
}
mNeedsYFlip = needYFlip;
}
void
ShadowCanvasLayerD3D9::Swap(const SurfaceDescriptor& aNewFront,
SurfaceDescriptor* aNewBack)
{
NS_ASSERTION(aNewFront.type() == SharedImage::TSurfaceDescriptor,
"ShadowCanvasLayerD3D9::Swap expected SharedImage surface");
nsRefPtr<gfxASurface> surf =
ShadowLayerForwarder::OpenDescriptor(aNewFront);
if (mBuffer) {
mBuffer->Upload(surf, GetVisibleRegion().GetBounds());
}
*aNewBack = aNewFront;
}
void
ShadowCanvasLayerD3D9::DestroyFrontBuffer()
{
Destroy();
}
void
ShadowCanvasLayerD3D9::Disconnect()
{
Destroy();
}
void
ShadowCanvasLayerD3D9::Destroy()
{
mBuffer = nsnull;
}
void
ShadowCanvasLayerD3D9::CleanResources()
{
Destroy();
}
void
ShadowCanvasLayerD3D9::LayerManagerDestroyed()
{
mD3DManager->deviceManager()->mLayersWithResources.RemoveElement(this);
mD3DManager = nsnull;
}
Layer*
ShadowCanvasLayerD3D9::GetLayer()
{
return this;
}
void
ShadowCanvasLayerD3D9::RenderLayer()
{
if (!mBuffer) {
return;
}
mBuffer->RenderTo(mD3DManager, GetEffectiveVisibleRegion());
}
} /* namespace layers */
} /* namespace mozilla */

View File

@ -39,13 +39,15 @@
#ifndef GFX_CANVASLAYERD3D9_H
#define GFX_CANVASLAYERD3D9_H
#include "LayerManagerD3D9.h"
#include "GLContext.h"
#include "gfxASurface.h"
#include "LayerManagerD3D9.h"
#include "GLContext.h"
#include "gfxASurface.h"
namespace mozilla {
namespace layers {
class ShadowBufferD3D9;
class THEBES_API CanvasLayerD3D9 :
public CanvasLayer,
public LayerD3D9
@ -91,6 +93,42 @@ protected:
PRPackedBool mHasAlpha;
};
// NB: eventually we'll have separate shadow canvas2d and shadow
// canvas3d layers, but currently they look the same from the
// perspective of the compositor process
class ShadowCanvasLayerD3D9 : public ShadowCanvasLayer,
public LayerD3D9
{
public:
ShadowCanvasLayerD3D9(LayerManagerD3D9* aManager);
virtual ~ShadowCanvasLayerD3D9();
// CanvasLayer impl
virtual void Initialize(const Data& aData);
virtual void Init(const SurfaceDescriptor& aNewFront, const nsIntSize& aSize, bool needYFlip);
// This isn't meaningful for shadow canvas.
virtual void Updated(const nsIntRect&) {}
// ShadowCanvasLayer impl
virtual void Swap(const SurfaceDescriptor& aNewFront,
SurfaceDescriptor* aNewBack);
virtual void DestroyFrontBuffer();
virtual void Disconnect();
virtual void Destroy();
// LayerD3D9 implementation
virtual Layer* GetLayer();
virtual void RenderLayer();
virtual void CleanResources();
virtual void LayerManagerDestroyed();
private:
PRPackedBool mNeedsYFlip;
nsRefPtr<ShadowBufferD3D9> mBuffer;
};
} /* layers */
} /* mozilla */
#endif /* GFX_CANVASLAYERD3D9_H */

View File

@ -47,15 +47,15 @@ ColorLayerD3D9::GetLayer()
return this;
}
void
ColorLayerD3D9::RenderLayer()
static void
RenderColorLayerD3D9(ColorLayer* aLayer, LayerManagerD3D9 *aManager)
{
// XXX we might be able to improve performance by using
// IDirect3DDevice9::Clear
nsIntRect visibleRect = mVisibleRegion.GetBounds();
nsIntRect visibleRect = aLayer->GetEffectiveVisibleRegion().GetBounds();
device()->SetVertexShaderConstantF(
aManager->device()->SetVertexShaderConstantF(
CBvLayerQuad,
ShaderConstantRect(visibleRect.x,
visibleRect.y,
@ -63,23 +63,36 @@ ColorLayerD3D9::RenderLayer()
visibleRect.height),
1);
const gfx3DMatrix& transform = GetEffectiveTransform();
device()->SetVertexShaderConstantF(CBmLayerTransform, &transform._11, 4);
const gfx3DMatrix& transform = aLayer->GetEffectiveTransform();
aManager->device()->SetVertexShaderConstantF(CBmLayerTransform, &transform._11, 4);
gfxRGBA layerColor(aLayer->GetColor());
float color[4];
float opacity = GetEffectiveOpacity() * mColor.a;
float opacity = aLayer->GetEffectiveOpacity() * layerColor.a;
// output color is premultiplied, so we need to adjust all channels.
// mColor is not premultiplied.
color[0] = (float)(mColor.r * opacity);
color[1] = (float)(mColor.g * opacity);
color[2] = (float)(mColor.b * opacity);
color[0] = (float)(layerColor.r * opacity);
color[1] = (float)(layerColor.g * opacity);
color[2] = (float)(layerColor.b * opacity);
color[3] = (float)(opacity);
device()->SetPixelShaderConstantF(0, color, 1);
aManager->device()->SetPixelShaderConstantF(0, color, 1);
mD3DManager->SetShaderMode(DeviceManagerD3D9::SOLIDCOLORLAYER);
aManager->SetShaderMode(DeviceManagerD3D9::SOLIDCOLORLAYER);
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
aManager->device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
void
ColorLayerD3D9::RenderLayer()
{
return RenderColorLayerD3D9(this, mD3DManager);
}
void
ShadowColorLayerD3D9::RenderLayer()
{
return RenderColorLayerD3D9(this, mD3DManager);
}
} /* layers */

View File

@ -61,6 +61,26 @@ public:
virtual void RenderLayer();
};
class ShadowColorLayerD3D9 : public ShadowColorLayer,
public LayerD3D9
{
public:
ShadowColorLayerD3D9(LayerManagerD3D9 *aManager)
: ShadowColorLayer(aManager, NULL)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);
}
~ShadowColorLayerD3D9() { Destroy(); }
// LayerOGL Implementation
virtual Layer* GetLayer() { return this; }
virtual void Destroy() { }
virtual void RenderLayer();
};
} /* layers */
} /* mozilla */

View File

@ -44,39 +44,26 @@
namespace mozilla {
namespace layers {
ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager)
: ContainerLayer(aManager, NULL)
, LayerD3D9(aManager)
template<class Container>
static void
ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter)
{
mImplData = static_cast<LayerD3D9*>(this);
}
ContainerLayerD3D9::~ContainerLayerD3D9()
{
while (mFirstChild) {
RemoveChild(mFirstChild);
}
}
void
ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter)
{
aChild->SetParent(this);
aChild->SetParent(aContainer);
if (!aAfter) {
Layer *oldFirstChild = GetFirstChild();
mFirstChild = aChild;
Layer *oldFirstChild = aContainer->GetFirstChild();
aContainer->mFirstChild = aChild;
aChild->SetNextSibling(oldFirstChild);
aChild->SetPrevSibling(nsnull);
if (oldFirstChild) {
oldFirstChild->SetPrevSibling(aChild);
} else {
mLastChild = aChild;
aContainer->mLastChild = aChild;
}
NS_ADDREF(aChild);
DidInsertChild(aChild);
aContainer->DidInsertChild(aChild);
return;
}
for (Layer *child = GetFirstChild();
for (Layer *child = aContainer->GetFirstChild();
child; child = child->GetNextSibling()) {
if (aAfter == child) {
Layer *oldNextSibling = child->GetNextSibling();
@ -85,36 +72,37 @@ ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter)
if (oldNextSibling) {
oldNextSibling->SetPrevSibling(aChild);
} else {
mLastChild = aChild;
aContainer->mLastChild = aChild;
}
aChild->SetPrevSibling(child);
NS_ADDREF(aChild);
DidInsertChild(aChild);
aContainer->DidInsertChild(aChild);
return;
}
}
NS_WARNING("Failed to find aAfter layer!");
}
void
ContainerLayerD3D9::RemoveChild(Layer *aChild)
template<class Container>
static void
ContainerRemoveChild(Container* aContainer, Layer* aChild)
{
if (GetFirstChild() == aChild) {
mFirstChild = GetFirstChild()->GetNextSibling();
if (mFirstChild) {
mFirstChild->SetPrevSibling(nsnull);
if (aContainer->GetFirstChild() == aChild) {
aContainer->mFirstChild = aContainer->GetFirstChild()->GetNextSibling();
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(nsnull);
} else {
mLastChild = nsnull;
aContainer->mLastChild = nsnull;
}
aChild->SetNextSibling(nsnull);
aChild->SetPrevSibling(nsnull);
aChild->SetParent(nsnull);
DidRemoveChild(aChild);
aContainer->DidRemoveChild(aChild);
NS_RELEASE(aChild);
return;
}
Layer *lastChild = nsnull;
for (Layer *child = GetFirstChild(); child;
for (Layer *child = aContainer->GetFirstChild(); child;
child = child->GetNextSibling()) {
if (child == aChild) {
// We're sure this is not our first child. So lastChild != NULL.
@ -122,12 +110,12 @@ ContainerLayerD3D9::RemoveChild(Layer *aChild)
if (child->GetNextSibling()) {
child->GetNextSibling()->SetPrevSibling(lastChild);
} else {
mLastChild = lastChild;
aContainer->mLastChild = lastChild;
}
child->SetNextSibling(nsnull);
child->SetPrevSibling(nsnull);
child->SetParent(nsnull);
DidRemoveChild(aChild);
aContainer->DidRemoveChild(aChild);
NS_RELEASE(aChild);
return;
}
@ -135,27 +123,12 @@ ContainerLayerD3D9::RemoveChild(Layer *aChild)
}
}
Layer*
ContainerLayerD3D9::GetLayer()
{
return this;
}
LayerD3D9*
ContainerLayerD3D9::GetFirstChildD3D9()
{
if (!mFirstChild) {
return nsnull;
}
return static_cast<LayerD3D9*>(mFirstChild->ImplData());
}
static inline LayerD3D9*
GetNextSiblingD3D9(LayerD3D9* aLayer)
GetNextSibling(LayerD3D9* aLayer)
{
Layer* layer = aLayer->GetLayer()->GetNextSibling();
return layer ? static_cast<LayerD3D9*>(layer->
ImplData())
ImplData())
: nsnull;
}
@ -169,8 +142,19 @@ HasOpaqueAncestorLayer(Layer* aLayer)
return PR_FALSE;
}
void
ContainerLayerD3D9::RenderLayer()
static inline LayerD3D9*
GetNextSiblingD3D9(LayerD3D9* aLayer)
{
Layer* layer = aLayer->GetLayer()->GetNextSibling();
return layer ? static_cast<LayerD3D9*>(layer->
ImplData())
: nsnull;
}
template<class Container>
static void
ContainerRender(Container* aContainer,
LayerManagerD3D9* aManager)
{
nsRefPtr<IDirect3DSurface9> previousRenderTarget;
nsRefPtr<IDirect3DTexture9> renderTexture;
@ -179,7 +163,7 @@ ContainerLayerD3D9::RenderLayer()
float oldViewMatrix[4][4];
RECT containerD3D9ClipRect;
device()->GetScissorRect(&containerD3D9ClipRect);
aManager->device()->GetScissorRect(&containerD3D9ClipRect);
// Convert scissor to an nsIntRect. RECT's are exclusive on the bottom and
// right values.
nsIntRect oldScissor(containerD3D9ClipRect.left,
@ -188,34 +172,35 @@ ContainerLayerD3D9::RenderLayer()
containerD3D9ClipRect.bottom - containerD3D9ClipRect.top);
ReadbackProcessor readback;
readback.BuildUpdates(this);
readback.BuildUpdates(aContainer);
nsIntRect visibleRect = mVisibleRegion.GetBounds();
PRBool useIntermediate = UseIntermediateSurface();
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
PRBool useIntermediate = aContainer->UseIntermediateSurface();
mSupportsComponentAlphaChildren = PR_FALSE;
aContainer->mSupportsComponentAlphaChildren = PR_FALSE;
if (useIntermediate) {
device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget));
device()->CreateTexture(visibleRect.width, visibleRect.height, 1,
aManager->device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget));
aManager->device()->CreateTexture(visibleRect.width, visibleRect.height, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(renderTexture),
NULL);
nsRefPtr<IDirect3DSurface9> renderSurface;
renderTexture->GetSurfaceLevel(0, getter_AddRefs(renderSurface));
device()->SetRenderTarget(0, renderSurface);
aManager->device()->SetRenderTarget(0, renderSurface);
if (mVisibleRegion.GetNumRects() == 1 && (GetContentFlags() & CONTENT_OPAQUE)) {
if (aContainer->mVisibleRegion.GetNumRects() == 1 &&
(aContainer->GetContentFlags() & aContainer->CONTENT_OPAQUE)) {
// don't need a background, we're going to paint all opaque stuff
mSupportsComponentAlphaChildren = PR_TRUE;
aContainer->mSupportsComponentAlphaChildren = PR_TRUE;
} else {
const gfx3DMatrix& transform3D = GetEffectiveTransform();
const gfx3DMatrix& transform3D = aContainer->GetEffectiveTransform();
gfxMatrix transform;
// If we have an opaque ancestor layer, then we can be sure that
// all the pixels we draw into are either opaque already or will be
// covered by something opaque. Otherwise copying up the background is
// not safe.
HRESULT hr = E_FAIL;
if (HasOpaqueAncestorLayer(this) &&
if (HasOpaqueAncestorLayer(aContainer) &&
transform3D.Is2D(&transform) && !transform.HasNonIntegerTranslation()) {
// Copy background up from below
RECT dest = { 0, 0, visibleRect.width, visibleRect.height };
@ -223,20 +208,23 @@ ContainerLayerD3D9::RenderLayer()
::OffsetRect(&src,
visibleRect.x + PRInt32(transform.x0),
visibleRect.y + PRInt32(transform.y0));
hr = device()->
hr = aManager->device()->
StretchRect(previousRenderTarget, &src, renderSurface, &dest, D3DTEXF_NONE);
}
if (hr == S_OK) {
mSupportsComponentAlphaChildren = PR_TRUE;
aContainer->mSupportsComponentAlphaChildren = PR_TRUE;
} else {
device()->Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 0), 0, 0);
aManager->device()->
Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 0), 0, 0);
}
}
device()->GetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1);
aManager->device()->
GetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1);
renderTargetOffset[0] = (float)visibleRect.x;
renderTargetOffset[1] = (float)visibleRect.y;
device()->SetVertexShaderConstantF(CBvRenderTargetOffset, renderTargetOffset, 1);
aManager->device()->
SetVertexShaderConstantF(CBvRenderTargetOffset, renderTargetOffset, 1);
gfx3DMatrix viewMatrix;
/*
@ -248,17 +236,21 @@ ContainerLayerD3D9::RenderLayer()
viewMatrix._41 = -1.0f;
viewMatrix._42 = 1.0f;
device()->GetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4);
device()->SetVertexShaderConstantF(CBmProjection, &viewMatrix._11, 4);
aManager->device()->
GetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4);
aManager->device()->
SetVertexShaderConstantF(CBmProjection, &viewMatrix._11, 4);
} else {
mSupportsComponentAlphaChildren = (GetContentFlags() & CONTENT_OPAQUE) ||
(mParent && mParent->SupportsComponentAlphaChildren());
aContainer->mSupportsComponentAlphaChildren =
(aContainer->GetContentFlags() & aContainer->CONTENT_OPAQUE) ||
(aContainer->mParent &&
aContainer->mParent->SupportsComponentAlphaChildren());
}
/*
* Render this container's contents.
*/
for (LayerD3D9* layerToRender = GetFirstChildD3D9();
for (LayerD3D9* layerToRender = aContainer->GetFirstChildD3D9();
layerToRender != nsnull;
layerToRender = GetNextSiblingD3D9(layerToRender)) {
@ -277,38 +269,86 @@ ContainerLayerD3D9::RenderLayer()
d3drect.top = scissorRect.y;
d3drect.right = scissorRect.x + scissorRect.width;
d3drect.bottom = scissorRect.y + scissorRect.height;
device()->SetScissorRect(&d3drect);
aManager->device()->SetScissorRect(&d3drect);
if (layerToRender->GetLayer()->GetType() == TYPE_THEBES) {
if (layerToRender->GetLayer()->GetType() == aContainer->TYPE_THEBES) {
static_cast<ThebesLayerD3D9*>(layerToRender)->RenderThebesLayer(&readback);
} else {
layerToRender->RenderLayer();
}
}
device()->SetScissorRect(&containerD3D9ClipRect);
aManager->device()->SetScissorRect(&containerD3D9ClipRect);
if (useIntermediate) {
device()->SetRenderTarget(0, previousRenderTarget);
device()->SetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1);
device()->SetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4);
aManager->device()->SetRenderTarget(0, previousRenderTarget);
aManager->device()->SetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1);
aManager->device()->SetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4);
device()->SetVertexShaderConstantF(CBvLayerQuad,
aManager->device()->SetVertexShaderConstantF(CBvLayerQuad,
ShaderConstantRect(visibleRect.x,
visibleRect.y,
visibleRect.width,
visibleRect.height),
1);
SetShaderTransformAndOpacity();
aContainer->SetShaderTransformAndOpacity();
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER);
aManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER);
device()->SetTexture(0, renderTexture);
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
aManager->device()->SetTexture(0, renderTexture);
aManager->device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
}
ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager)
: ContainerLayer(aManager, NULL)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);
}
ContainerLayerD3D9::~ContainerLayerD3D9()
{
while (mFirstChild) {
RemoveChild(mFirstChild);
}
}
void
ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter)
{
ContainerInsertAfter(this, aChild, aAfter);
}
void
ContainerLayerD3D9::RemoveChild(Layer *aChild)
{
ContainerRemoveChild(this, aChild);
}
Layer*
ContainerLayerD3D9::GetLayer()
{
return this;
}
LayerD3D9*
ContainerLayerD3D9::GetFirstChildD3D9()
{
if (!mFirstChild) {
return nsnull;
}
return static_cast<LayerD3D9*>(mFirstChild->ImplData());
}
void
ContainerLayerD3D9::RenderLayer()
{
ContainerRender(this, mD3DManager);
}
void
ContainerLayerD3D9::LayerManagerDestroyed()
{
@ -318,5 +358,52 @@ ContainerLayerD3D9::LayerManagerDestroyed()
}
}
ShadowContainerLayerD3D9::ShadowContainerLayerD3D9(LayerManagerD3D9 *aManager)
: ShadowContainerLayer(aManager, NULL)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);
}
ShadowContainerLayerD3D9::~ShadowContainerLayerD3D9()
{
Destroy();
}
void
ShadowContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter)
{
ContainerInsertAfter(this, aChild, aAfter);
}
void
ShadowContainerLayerD3D9::RemoveChild(Layer *aChild)
{
ContainerRemoveChild(this, aChild);
}
void
ShadowContainerLayerD3D9::Destroy()
{
while (mFirstChild) {
RemoveChild(mFirstChild);
}
}
LayerD3D9*
ShadowContainerLayerD3D9::GetFirstChildD3D9()
{
if (!mFirstChild) {
return nsnull;
}
return static_cast<LayerD3D9*>(mFirstChild->ImplData());
}
void
ShadowContainerLayerD3D9::RenderLayer()
{
ContainerRender(this, mD3DManager);
}
} /* layers */
} /* mozilla */

View File

@ -43,10 +43,24 @@
namespace mozilla {
namespace layers {
template<class Container>
static void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
static void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
static void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager);
class ContainerLayerD3D9 : public ContainerLayer,
public LayerD3D9
{
template<class Container>
friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
friend void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
friend void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager);
public:
ContainerLayerD3D9(LayerManagerD3D9 *aManager);
~ContainerLayerD3D9();
@ -75,6 +89,39 @@ public:
}
};
class ShadowContainerLayerD3D9 : public ShadowContainerLayer,
public LayerD3D9
{
template<class Container>
friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
friend void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
friend void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager);
public:
ShadowContainerLayerD3D9(LayerManagerD3D9 *aManager);
~ShadowContainerLayerD3D9();
void InsertAfter(Layer* aChild, Layer* aAfter);
void RemoveChild(Layer* aChild);
// LayerD3D9 Implementation
virtual Layer* GetLayer() { return this; }
virtual void Destroy();
LayerD3D9* GetFirstChildD3D9();
virtual void RenderLayer();
virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
{
DefaultComputeEffectiveTransforms(aTransformToSurface);
}
};
} /* layers */
} /* mozilla */

View File

@ -35,7 +35,14 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/layers/PLayers.h"
#include "mozilla/layers/ShadowLayers.h"
#include "ShadowBufferD3D9.h"
#include "gfxSharedImageSurface.h"
#include "ImageLayerD3D9.h"
#include "ThebesLayerD3D9.h"
#include "gfxPlatform.h"
#include "gfxImageSurface.h"
#include "yuv_convert.h"
#include "nsIServiceManager.h"
@ -643,5 +650,147 @@ CairoImageD3D9::GetAsSurface()
return surface.forget();
}
ShadowImageLayerD3D9::ShadowImageLayerD3D9(LayerManagerD3D9* aManager)
: ShadowImageLayer(aManager, nsnull)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);
}
ShadowImageLayerD3D9::~ShadowImageLayerD3D9()
{}
PRBool
ShadowImageLayerD3D9::Init(const SharedImage& aFront,
const nsIntSize& aSize)
{
if (aFront.type() == SharedImage::TSurfaceDescriptor) {
SurfaceDescriptor desc = aFront.get_SurfaceDescriptor();
nsRefPtr<gfxASurface> surf =
ShadowLayerForwarder::OpenDescriptor(desc);
if (!mBuffer) {
mBuffer = new ShadowBufferD3D9(this);
}
return !!mBuffer;
} else {
if (!mYCbCrImage) {
mYCbCrImage = new PlanarYCbCrImageD3D9();
}
return !!mYCbCrImage;
}
}
void
ShadowImageLayerD3D9::Swap(const SharedImage& aNewFront, SharedImage* aNewBack)
{
if (aNewFront.type() == SharedImage::TSurfaceDescriptor) {
nsRefPtr<gfxASurface> surf =
ShadowLayerForwarder::OpenDescriptor(aNewFront.get_SurfaceDescriptor());
if (mBuffer) {
mBuffer->Upload(surf, GetVisibleRegion().GetBounds());
}
} else {
const YUVImage& yuv = aNewFront.get_YUVImage();
nsRefPtr<gfxSharedImageSurface> surfY =
gfxSharedImageSurface::Open(yuv.Ydata());
nsRefPtr<gfxSharedImageSurface> surfU =
gfxSharedImageSurface::Open(yuv.Udata());
nsRefPtr<gfxSharedImageSurface> surfV =
gfxSharedImageSurface::Open(yuv.Vdata());
PlanarYCbCrImage::Data data;
data.mYChannel = surfY->Data();
data.mYStride = surfY->Stride();
data.mYSize = surfY->GetSize();
data.mCbChannel = surfU->Data();
data.mCrChannel = surfV->Data();
data.mCbCrStride = surfU->Stride();
data.mCbCrSize = surfU->GetSize();
data.mPicSize = surfY->GetSize();
data.mPicX = 0;
data.mPicY = 0;
mYCbCrImage->SetData(data);
}
*aNewBack = aNewFront;
}
void
ShadowImageLayerD3D9::DestroyFrontBuffer()
{
Destroy();
}
void
ShadowImageLayerD3D9::Disconnect()
{
Destroy();
}
void
ShadowImageLayerD3D9::Destroy()
{
mBuffer = nsnull;
mYCbCrImage = nsnull;
}
Layer*
ShadowImageLayerD3D9::GetLayer()
{
return this;
}
void
ShadowImageLayerD3D9::RenderLayer()
{
if (mBuffer) {
mBuffer->RenderTo(mD3DManager, GetEffectiveVisibleRegion());
} else if (mYCbCrImage) {
if (!mYCbCrImage->HasData()) {
return;
}
mYCbCrImage->AllocateTextures(device());
SetShaderTransformAndOpacity();
device()->SetVertexShaderConstantF(CBvLayerQuad,
ShaderConstantRect(0,
0,
mYCbCrImage->mSize.width,
mYCbCrImage->mSize.height),
1);
mD3DManager->SetShaderMode(DeviceManagerD3D9::YCBCRLAYER);
/*
* Send 3d control data and metadata
*/
if (mD3DManager->GetNv3DVUtils()) {
// TODO Add 3D support
}
// Linear scaling is default here, adhering to mFilter is difficult since
// presumably even with point filtering we'll still want chroma upsampling
// to be linear. In the current approach we can't.
device()->SetTexture(0, mYCbCrImage->mYTexture);
device()->SetTexture(1, mYCbCrImage->mCbTexture);
device()->SetTexture(2, mYCbCrImage->mCrTexture);
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
} else {
NS_ERROR("Unexpected image format.");
}
}
} /* layers */
} /* mozilla */

View File

@ -45,6 +45,8 @@
namespace mozilla {
namespace layers {
class ShadowBufferD3D9;
class THEBES_API ImageContainerD3D9 : public ImageContainer
{
public:
@ -173,6 +175,34 @@ private:
LayerManagerD3D9 *mManager;
};
class ShadowImageLayerD3D9 : public ShadowImageLayer,
public LayerD3D9
{
public:
ShadowImageLayerD3D9(LayerManagerD3D9* aManager);
virtual ~ShadowImageLayerD3D9();
// ShadowImageLayer impl
virtual PRBool Init(const SharedImage& aFront, const nsIntSize& aSize);
virtual void Swap(const SharedImage& aFront, SharedImage* aNewBack);
virtual void DestroyFrontBuffer();
virtual void Disconnect();
// LayerD3D9 impl
virtual void Destroy();
virtual Layer* GetLayer();
virtual void RenderLayer();
private:
nsRefPtr<ShadowBufferD3D9> mBuffer;
nsRefPtr<PlanarYCbCrImageD3D9> mYCbCrImage;
};
} /* layers */
} /* mozilla */
#endif /* GFX_IMAGELAYERD3D9_H */

View File

@ -245,6 +245,56 @@ LayerManagerD3D9::CreateImageContainer()
return container.forget();
}
already_AddRefed<ShadowThebesLayer>
LayerManagerD3D9::CreateShadowThebesLayer()
{
if (LayerManagerD3D9::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nsnull;
}
return nsRefPtr<ShadowThebesLayerD3D9>(new ShadowThebesLayerD3D9(this)).forget();
}
already_AddRefed<ShadowContainerLayer>
LayerManagerD3D9::CreateShadowContainerLayer()
{
if (LayerManagerD3D9::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nsnull;
}
return nsRefPtr<ShadowContainerLayerD3D9>(new ShadowContainerLayerD3D9(this)).forget();
}
already_AddRefed<ShadowImageLayer>
LayerManagerD3D9::CreateShadowImageLayer()
{
if (LayerManagerD3D9::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nsnull;
}
return nsRefPtr<ShadowImageLayerD3D9>(new ShadowImageLayerD3D9(this)).forget();
}
already_AddRefed<ShadowColorLayer>
LayerManagerD3D9::CreateShadowColorLayer()
{
if (LayerManagerD3D9::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nsnull;
}
return nsRefPtr<ShadowColorLayerD3D9>(new ShadowColorLayerD3D9(this)).forget();
}
already_AddRefed<ShadowCanvasLayer>
LayerManagerD3D9::CreateShadowCanvasLayer()
{
if (LayerManagerD3D9::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nsnull;
}
return nsRefPtr<ShadowCanvasLayerD3D9>(new ShadowCanvasLayerD3D9(this)).forget();
}
void ReleaseTexture(void *texture)
{
static_cast<IDirect3DTexture9*>(texture)->Release();

View File

@ -40,6 +40,8 @@
#include "Layers.h"
#include "mozilla/layers/ShadowLayers.h"
#include <windows.h>
#include <d3d9.h>
@ -88,7 +90,7 @@ struct ShaderConstantRect
* This is the LayerManager used for Direct3D 9. For now this will render on
* the main thread.
*/
class THEBES_API LayerManagerD3D9 : public LayerManager {
class THEBES_API LayerManagerD3D9 : public ShadowLayerManager {
public:
LayerManagerD3D9(nsIWidget *aWidget);
virtual ~LayerManagerD3D9();
@ -153,6 +155,12 @@ public:
virtual already_AddRefed<ImageContainer> CreateImageContainer();
virtual already_AddRefed<ShadowThebesLayer> CreateShadowThebesLayer();
virtual already_AddRefed<ShadowContainerLayer> CreateShadowContainerLayer();
virtual already_AddRefed<ShadowImageLayer> CreateShadowImageLayer();
virtual already_AddRefed<ShadowColorLayer> CreateShadowColorLayer();
virtual already_AddRefed<ShadowCanvasLayer> CreateShadowCanvasLayer();
virtual LayersBackend GetBackendType() { return LAYERS_D3D9; }
virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Direct3D 9"); }
bool DeviceWasRemoved() { return deviceManager()->DeviceWasRemoved(); }
@ -283,6 +291,40 @@ protected:
LayerManagerD3D9 *mD3DManager;
};
/*
* RAII helper for locking D3D9 textures.
*/
class LockTextureRectD3D9
{
public:
LockTextureRectD3D9(IDirect3DTexture9* aTexture)
: mTexture(aTexture)
{
mLockResult = mTexture->LockRect(0, &mR, NULL, 0);
}
~LockTextureRectD3D9()
{
mTexture->UnlockRect(0);
}
bool HasLock() {
return SUCCEEDED(mLockResult);
}
D3DLOCKED_RECT GetLockRect()
{
return mR;
}
private:
LockTextureRectD3D9 (const LockTextureRectD3D9&);
LockTextureRectD3D9& operator= (const LockTextureRectD3D9&);
IDirect3DTexture9* mTexture;
D3DLOCKED_RECT mR;
HRESULT mLockResult;
};
} /* layers */
} /* mozilla */

View File

@ -0,0 +1,118 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Benoit Girard <bgirard@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "LayerManagerD3D9.h"
#include "ShadowBufferD3D9.h"
#include "gfxWindowsSurface.h"
#include "gfxWindowsPlatform.h"
namespace mozilla {
namespace layers {
void
ShadowBufferD3D9::Upload(gfxASurface* aUpdate,
const nsIntRect& aVisibleRect)
{
gfxIntSize size = aUpdate->GetSize();
if (GetSize() != nsIntSize(size.width, size.height)) {
mLayer->device()->CreateTexture(size.width, size.height, 1,
D3DUSAGE_DYNAMIC,
D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);
mTextureRect = aVisibleRect;
}
LockTextureRectD3D9 textureLock(mTexture);
if (!textureLock.HasLock()) {
NS_WARNING("Failed to lock ShadowBufferD3D9 texture.");
return;
}
D3DLOCKED_RECT r = textureLock.GetLockRect();
nsRefPtr<gfxImageSurface> imgSurface =
new gfxImageSurface((unsigned char *)r.pBits,
GetSize(),
r.Pitch,
gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxContext> context = new gfxContext(imgSurface);
context->SetSource(aUpdate);
context->SetOperator(gfxContext::OPERATOR_SOURCE);
context->Paint();
imgSurface = NULL;
}
void
ShadowBufferD3D9::RenderTo(LayerManagerD3D9 *aD3DManager,
const nsIntRegion& aVisibleRegion)
{
mLayer->SetShaderTransformAndOpacity();
aD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER);
mLayer->device()->SetTexture(0, mTexture);
nsIntRegionRectIterator iter(aVisibleRegion);
const nsIntRect *iterRect;
while ((iterRect = iter.Next())) {
mLayer->device()->SetVertexShaderConstantF(CBvLayerQuad,
ShaderConstantRect(iterRect->x,
iterRect->y,
iterRect->width,
iterRect->height),
1);
mLayer->device()->SetVertexShaderConstantF(CBvTextureCoords,
ShaderConstantRect(
(float)(iterRect->x - mTextureRect.x) / (float)mTextureRect.width,
(float)(iterRect->y - mTextureRect.y) / (float)mTextureRect.height,
(float)iterRect->width / (float)mTextureRect.width,
(float)iterRect->height / (float)mTextureRect.height), 1);
mLayer->device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
}
} /* namespace layers */
} /* namespace mozilla */

View File

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Benoit Girard <bgirard@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_SHADOWBUFFERD3D9_H
#define GFX_SHADOWBUFFERD3D9_H
#include "LayerManagerD3D9.h"
namespace mozilla {
namespace layers {
class LayerManagerD3D9;
class LayerD3D9;
class ShadowBufferD3D9
{
NS_INLINE_DECL_REFCOUNTING(ShadowBufferD3D9)
public:
ShadowBufferD3D9(LayerD3D9* aLayer)
: mLayer(aLayer)
{
}
virtual ~ShadowBufferD3D9() {}
void Upload(gfxASurface* aUpdate, const nsIntRect& aVisibleRect);
void RenderTo(LayerManagerD3D9 *aD3DManager, const nsIntRegion& aVisibleRegion);
nsIntSize GetSize() {
if (mTexture)
return nsIntSize(mTextureRect.Width(), mTextureRect.Height());
return nsIntSize(0, 0);
}
protected:
nsRefPtr<IDirect3DTexture9> mTexture;
nsIntRect mTextureRect;
LayerD3D9* mLayer;
};
} /* layers */
} /* mozilla */
#endif /* GFX_SHADOWBUFFERD3D9_H */

View File

@ -35,6 +35,10 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/layers/PLayers.h"
#include "mozilla/layers/ShadowLayers.h"
#include "ShadowBufferD3D9.h"
#include "ThebesLayerD3D9.h"
#include "gfxPlatform.h"
@ -516,8 +520,13 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
break;
case SURFACE_SINGLE_CHANNEL_ALPHA: {
D3DLOCKED_RECT r;
tmpTexture->LockRect(0, &r, NULL, 0);
LockTextureRectD3D9 textureLock(tmpTexture);
if (!textureLock.HasLock()) {
NS_WARNING("Failed to lock ThebesLayer tmpTexture texture.");
return;
}
D3DLOCKED_RECT r = textureLock.GetLockRect();
nsRefPtr<gfxImageSurface> imgSurface =
new gfxImageSurface((unsigned char *)r.pBits,
@ -534,8 +543,6 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
imgSurface = NULL;
tmpTexture->UnlockRect(0);
srcTextures.AppendElement(tmpTexture);
destTextures.AppendElement(mTexture);
break;
@ -601,5 +608,95 @@ ThebesLayerD3D9::CreateNewTextures(const gfxIntSize &aSize,
}
}
ShadowThebesLayerD3D9::ShadowThebesLayerD3D9(LayerManagerD3D9 *aManager)
: ShadowThebesLayer(aManager, nsnull)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);
}
ShadowThebesLayerD3D9::~ShadowThebesLayerD3D9()
{}
void
ShadowThebesLayerD3D9::SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion)
{
if (!mBuffer) {
mBuffer = new ShadowBufferD3D9(this);
}
NS_ASSERTION(OptionalThebesBuffer::Tnull_t == aNewFront.type(),
"Only one system-memory buffer expected");
}
void
ShadowThebesLayerD3D9::Swap(const ThebesBuffer& aNewFront,
const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack,
nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront,
nsIntRegion* aFrontUpdatedRegion)
{
if (mBuffer) {
nsRefPtr<gfxASurface> surf = ShadowLayerForwarder::OpenDescriptor(aNewFront.buffer());
mBuffer->Upload(surf, GetVisibleRegion().GetBounds());
}
*aNewBack = aNewFront;
*aNewBackValidRegion = mValidRegion;
*aReadOnlyFront = null_t();
aFrontUpdatedRegion->SetEmpty();
}
void
ShadowThebesLayerD3D9::DestroyFrontBuffer()
{
mBuffer = nsnull;
}
void
ShadowThebesLayerD3D9::Disconnect()
{
mBuffer = nsnull;
}
Layer*
ShadowThebesLayerD3D9::GetLayer()
{
return this;
}
PRBool
ShadowThebesLayerD3D9::IsEmpty()
{
return !mBuffer;
}
void
ShadowThebesLayerD3D9::RenderThebesLayer()
{
if (!mBuffer) {
return;
}
NS_ABORT_IF_FALSE(mBuffer, "should have a buffer here");
mBuffer->RenderTo(mD3DManager, GetEffectiveVisibleRegion());
}
void
ShadowThebesLayerD3D9::CleanResources()
{
mBuffer = nsnull;
mValidRegion.SetEmpty();
}
void
ShadowThebesLayerD3D9::LayerManagerDestroyed()
{
mD3DManager->deviceManager()->mLayersWithResources.RemoveElement(this);
mD3DManager = nsnull;
}
} /* namespace layers */
} /* namespace mozilla */

View File

@ -47,6 +47,7 @@ namespace mozilla {
namespace layers {
class ReadbackProcessor;
class ShadowBufferD3D9;
class ThebesLayerD3D9 : public ThebesLayer,
public LayerD3D9
@ -112,6 +113,37 @@ private:
const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion);
};
class ShadowThebesLayerD3D9 : public ShadowThebesLayer,
public LayerD3D9
{
public:
ShadowThebesLayerD3D9(LayerManagerD3D9 *aManager);
virtual ~ShadowThebesLayerD3D9();
// ShadowThebesLayer impl
virtual void SetFrontBuffer(const OptionalThebesBuffer& aNewFront,
const nsIntRegion& aValidRegion);
virtual void
Swap(const ThebesBuffer& aNewFront, const nsIntRegion& aUpdatedRegion,
ThebesBuffer* aNewBack, nsIntRegion* aNewBackValidRegion,
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
virtual void DestroyFrontBuffer();
virtual void Disconnect();
// LayerD3D9 impl
Layer* GetLayer();
virtual PRBool IsEmpty();
virtual void RenderLayer() { RenderThebesLayer(); }
virtual void CleanResources();
virtual void LayerManagerDestroyed();
void RenderThebesLayer();
private:
nsRefPtr<ShadowBufferD3D9> mBuffer;
};
} /* layers */
} /* mozilla */
#endif /* GFX_THEBESLAYERD3D9_H */

View File

@ -35,6 +35,9 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/layers/PLayers.h"
#include "mozilla/layers/ShadowLayers.h"
#include "gfxSharedImageSurface.h"
#include "CanvasLayerOGL.h"

View File

@ -38,8 +38,6 @@
#ifndef GFX_CANVASLAYEROGL_H
#define GFX_CANVASLAYEROGL_H
#include "mozilla/layers/PLayers.h"
#include "mozilla/layers/ShadowLayers.h"
#include "LayerManagerOGL.h"
#include "gfxASurface.h"

View File

@ -579,6 +579,10 @@ ImageLayerOGL::RenderLayer(int,
gl()->MakeCurrent();
ioImage = static_cast<MacIOSurfaceImageOGL*>(image.get());
}
if (!ioImage) {
return;
}
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, ioImage->mTexture.GetTextureID());

View File

@ -2830,6 +2830,18 @@ nsLayoutUtils::GetTextColor(nsIFrame* aFrame)
return color;
}
gfxFloat
nsLayoutUtils::GetSnappedBaselineY(nsIFrame* aFrame, gfxContext* aContext,
nscoord aY, nscoord aAscent)
{
gfxFloat appUnitsPerDevUnit = aFrame->PresContext()->AppUnitsPerDevPixel();
gfxFloat baseline = gfxFloat(aY) + aAscent;
gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1);
if (!aContext->UserToDevicePixelSnapped(putativeRect, PR_TRUE))
return baseline;
return aContext->DeviceToUser(putativeRect.TopLeft()).y * appUnitsPerDevUnit;
}
void
nsLayoutUtils::DrawString(const nsIFrame* aFrame,
nsRenderingContext* aContext,

View File

@ -934,6 +934,10 @@ public:
// Get a suitable foreground color for painting text for the frame.
static nscolor GetTextColor(nsIFrame* aFrame);
// Get a baseline y position in app units that is snapped to device pixels.
static gfxFloat GetSnappedBaselineY(nsIFrame* aFrame, gfxContext* aContext,
nscoord aY, nscoord aAscent);
static void DrawString(const nsIFrame* aFrame,
nsRenderingContext* aContext,
const PRUnichar* aString,

View File

@ -87,14 +87,9 @@ IsAtomicElement(nsIFrame* aFrame, const nsIAtom* aFrameType)
{
NS_PRECONDITION(!aFrame->GetStyleDisplay()->IsBlockOutside(),
"unexpected block frame");
if (aFrame->IsFrameOfType(nsIFrame::eReplaced)) {
if (aFrameType != nsGkAtoms::textFrame &&
aFrameType != nsGkAtoms::brFrame) {
return true;
}
}
return aFrame->GetStyleDisplay()->mDisplay != NS_STYLE_DISPLAY_INLINE;
NS_PRECONDITION(aFrameType != nsGkAtoms::placeholderFrame,
"unexpected placeholder frame");
return !aFrame->IsFrameOfType(nsIFrame::eLineParticipant);
}
static bool
@ -240,7 +235,6 @@ nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder,
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, mRect, mVisibleRect,
foregroundColor, PaintTextShadowCallback,
(void*)this);
aCtx->SetColor(foregroundColor);
PaintTextToContext(aCtx, nsPoint(0, 0));
}
@ -251,10 +245,9 @@ nsDisplayTextOverflowMarker::PaintTextToContext(nsRenderingContext* aCtx,
{
nsStyleContext* sc = mFrame->GetStyleContext();
nsLayoutUtils::SetFontFromStyle(aCtx, sc);
nsPoint baselinePt = mRect.TopLeft();
baselinePt.y += mAscent;
gfxFloat y = nsLayoutUtils::GetSnappedBaselineY(mFrame, aCtx->ThebesContext(),
mRect.y, mAscent);
nsPoint baselinePt(mRect.x, NSToCoordFloor(y));
nsLayoutUtils::DrawString(mFrame, aCtx, mString.get(),
mString.Length(), baselinePt + aOffsetFromRect);
}
@ -317,7 +310,8 @@ TextOverflow::ExamineFrameSubtree(nsIFrame* aFrame,
AlignmentEdges* aAlignmentEdges)
{
const nsIAtom* frameType = aFrame->GetType();
if (frameType == nsGkAtoms::brFrame) {
if (frameType == nsGkAtoms::brFrame ||
frameType == nsGkAtoms::placeholderFrame) {
return;
}
const bool isAtomic = IsAtomicElement(aFrame, frameType);

View File

@ -271,8 +271,6 @@ public:
void AddInlinePrefWidthForFlow(nsRenderingContext *aRenderingContext,
InlinePrefWidthData *aData);
gfxFloat GetSnappedBaselineY(gfxContext* aContext, gfxFloat aY);
/**
* Calculate the horizontal bounds of the grapheme clusters that fit entirely
* inside the given left/right edges (which are positive lengths from the

View File

@ -5121,17 +5121,6 @@ ComputeTransformedLength(PropertyProvider& aProvider)
return iter.GetSkippedOffset() - start;
}
gfxFloat
nsTextFrame::GetSnappedBaselineY(gfxContext* aContext, gfxFloat aY)
{
gfxFloat appUnitsPerDevUnit = mTextRun->GetAppUnitsPerDevUnit();
gfxFloat baseline = aY + mAscent;
gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1);
if (!aContext->UserToDevicePixelSnapped(putativeRect, PR_TRUE))
return baseline;
return aContext->DeviceToUser(putativeRect.TopLeft()).y*appUnitsPerDevUnit;
}
bool
nsTextFrame::MeasureCharClippedText(gfxContext* aCtx,
nscoord aLeftEdge, nscoord aRightEdge,
@ -5258,7 +5247,7 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
const nscoord frameWidth = GetSize().width;
gfxPoint framePt(aPt.x, aPt.y);
gfxPoint textBaselinePt(rtl ? gfxFloat(aPt.x + frameWidth) : framePt.x,
GetSnappedBaselineY(ctx, aPt.y));
nsLayoutUtils::GetSnappedBaselineY(this, ctx, aPt.y, mAscent));
PRUint32 startOffset = provider.GetStart().GetSkippedOffset();
PRUint32 maxLength = ComputeTransformedLength(provider);
nscoord snappedLeftEdge, snappedRightEdge;

View File

@ -42,6 +42,9 @@
#include "BasicLayers.h"
#include "LayerManagerOGL.h"
#ifdef MOZ_ENABLE_D3D9_LAYER
#include "LayerManagerD3D9.h"
#endif //MOZ_ENABLE_D3D9_LAYER
#include "RenderFrameParent.h"
#include "gfx3DMatrix.h"
@ -723,6 +726,12 @@ RenderFrameParent::AllocPLayers()
LayerManagerOGL* lmo = static_cast<LayerManagerOGL*>(lm);
return new ShadowLayersParent(lmo);
}
#ifdef MOZ_ENABLE_D3D9_LAYER
case LayerManager::LAYERS_D3D9: {
LayerManagerD3D9* lmd3d9 = static_cast<LayerManagerD3D9*>(lm);
return new ShadowLayersParent(lmd3d9);
}
#endif //MOZ_ENABLE_D3D9_LAYER
default: {
NS_WARNING("shadow layers no sprechen D3D backend yet");
return nsnull;

View File

@ -0,0 +1,100 @@
<!DOCTYPE html>
<html>
<head>
<title>Testcase for bug 668919</title>
<style>
.tab-title {
overflow:hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 5em;
height:25px;
}
.c1 { font-size: 14px; }
.c2 { font-size: 15px; }
.c3 { font-size: 16px; }
.c4 { font-size: 17px; }
.c5 { font-size: 18px; }
.c6 { font-size: 19px; }
.c7 { font-size: 20px; }
.c8 { font-size: 24px; }
.c9 { font-size: 28px; }
.c10 { font-size: 32px; }
.c11 { font-size: 36px; }
.p0 { padding-top:0; }
.p1 { padding-top:0px; }
.p2 { padding-top:0px; }
.col2 .tab-title { text-shadow: 1px 1px 1px blue; }
</style>
</head>
<body>
<div style="position:absolute; top: 0px;">
<div class="tab-title c1 p0">CSS is awesome</div>
<div class="tab-title c1 p2">CSS is awesome</div>
<div class="tab-title c1 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 100px;">
<div class="tab-title c2 p0">CSS is awesome</div>
<div class="tab-title c2 p2">CSS is awesome</div>
<div class="tab-title c2 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 200px;">
<div class="tab-title c3 p0">CSS is awesome</div>
<div class="tab-title c3 p2">CSS is awesome</div>
<div class="tab-title c3 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 300px;">
<div class="tab-title c4 p0">CSS is awesome</div>
<div class="tab-title c4 p2">CSS is awesome</div>
<div class="tab-title c4 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 400px;">
<div class="tab-title c5 p0">CSS is awesome</div>
<div class="tab-title c5 p2">CSS is awesome</div>
<div class="tab-title c5 p3">CSS is awesome</div>
</div>
<div class="col2" style="position:absolute; top: 0px; left:8em;">
<div style="position:absolute; top: 0px;">
<div class="tab-title c1 p0">CSS is awesome</div>
<div class="tab-title c1 p2">CSS is awesome</div>
<div class="tab-title c1 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 100px;">
<div class="tab-title c2 p0">CSS is awesome</div>
<div class="tab-title c2 p2">CSS is awesome</div>
<div class="tab-title c2 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 200px;">
<div class="tab-title c3 p0">CSS is awesome</div>
<div class="tab-title c3 p2">CSS is awesome</div>
<div class="tab-title c3 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 300px;">
<div class="tab-title c4 p0">CSS is awesome</div>
<div class="tab-title c4 p2">CSS is awesome</div>
<div class="tab-title c4 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 400px;">
<div class="tab-title c5 p0">CSS is awesome</div>
<div class="tab-title c5 p2">CSS is awesome</div>
<div class="tab-title c5 p3">CSS is awesome</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,100 @@
<!DOCTYPE html>
<html>
<head>
<title>Testcase for bug 668919</title>
<style>
.tab-title {
overflow:hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 5em;
height:25px;
}
.c1 { font-size: 14px; }
.c2 { font-size: 15px; }
.c3 { font-size: 16px; }
.c4 { font-size: 17px; }
.c5 { font-size: 18px; }
.c6 { font-size: 19px; }
.c7 { font-size: 20px; }
.c8 { font-size: 24px; }
.c9 { font-size: 28px; }
.c10 { font-size: 32px; }
.c11 { font-size: 36px; }
.p0 { padding-top:0; }
.p1 { padding-top:0.1px; }
.p2 { padding-top:0.2px; }
.col2 .tab-title { text-shadow: 1px 1px 1px blue; }
</style>
</head>
<body>
<div style="position:absolute; top: 0px;">
<div class="tab-title c1 p0">CSS is awesome</div>
<div class="tab-title c1 p2">CSS is awesome</div>
<div class="tab-title c1 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 100px;">
<div class="tab-title c2 p0">CSS is awesome</div>
<div class="tab-title c2 p2">CSS is awesome</div>
<div class="tab-title c2 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 200px;">
<div class="tab-title c3 p0">CSS is awesome</div>
<div class="tab-title c3 p2">CSS is awesome</div>
<div class="tab-title c3 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 300px;">
<div class="tab-title c4 p0">CSS is awesome</div>
<div class="tab-title c4 p2">CSS is awesome</div>
<div class="tab-title c4 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 400px;">
<div class="tab-title c5 p0">CSS is awesome</div>
<div class="tab-title c5 p2">CSS is awesome</div>
<div class="tab-title c5 p3">CSS is awesome</div>
</div>
<div class="col2" style="position:absolute; top: 0px; left:8em;">
<div style="position:absolute; top: 0px;">
<div class="tab-title c1 p0">CSS is awesome</div>
<div class="tab-title c1 p2">CSS is awesome</div>
<div class="tab-title c1 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 100px;">
<div class="tab-title c2 p0">CSS is awesome</div>
<div class="tab-title c2 p2">CSS is awesome</div>
<div class="tab-title c2 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 200px;">
<div class="tab-title c3 p0">CSS is awesome</div>
<div class="tab-title c3 p2">CSS is awesome</div>
<div class="tab-title c3 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 300px;">
<div class="tab-title c4 p0">CSS is awesome</div>
<div class="tab-title c4 p2">CSS is awesome</div>
<div class="tab-title c4 p3">CSS is awesome</div>
</div>
<div style="position:absolute; top: 400px;">
<div class="tab-title c5 p0">CSS is awesome</div>
<div class="tab-title c5 p2">CSS is awesome</div>
<div class="tab-title c5 p3">CSS is awesome</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,78 @@
<!DOCTYPE html><html>
<head><style>
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}
.test {
overflow: hidden;
text-align:right;
width: 50px;
margin-bottom:1em;
height: 20px;
white-space:nowrap;
/*border:1px solid red;width: 500px;*/
}
.rel { position:relative; text-align:left;}
input,select,fieldset,textarea,hr,span {
border:1px solid black;
background: white;
color: black;
padding:0 40px;
}
iframe,img { width: 80px; height:10px; }
select[size="4"],iframe,textarea,hr { height:10px; margin:0; }
</style></head>
<body>
<div style="position:absolute; top:0; left:0;">
<div class="test">&#x2026;</div>
<div class="test">&#x2026;</div>
<div class="test"><fieldset style="display:block;"></fieldset></div>
<div class="test">&#x2026;</div>
<div class="test">&#x2026;</div>
<div class="test"><input type="button" style="display:list-item;"></div>
<div class="test"><input type="button" style="display:block;"></div>
<div class="test">&#x2026;</div>
<div class="test">&#x2026;</div>
<div class="test"><input type="text" style="display:block;"></div>
<div class="test">&#x2026;</div>
<div class="test">&#x2026;</div>
<div class="test"><textarea style="display:block;"></textarea></div>
<div class="test">&#x2026;</div>
<div class="test"><select size="1" style="display:block;"><option>&nbsp;<option>&nbsp;</select></div>
<div class="test">&#x2026;</div>
<div class="test"><select size="4" style="display:block;"><option>&nbsp;<option>&nbsp;</select></div>
</div>
<div style="position:absolute; top:0; left:100px;">
<div class="test">&#x2026;</div>
<div class="test"><iframe src="about:blank" style="display:block"></iframe></div>
<div class="test" style="text-align:left">&nbsp;&#x2026;</div>
<div class="test" style="text-align:left">&nbsp;&#x2026;</div>
<div class="test"><img style="display:block;" src="../image/big.png"></div>
<div class="test"><x style="display:inline-block; height:100px; width:100%; background:lime">&#x2026;</x></div>
<div class="test">&#x2026;</div>
<div class="test"><hr style="display:block;"></div>
<div class="test">&#x2026;</div>
<div class="test">&#x2026;</div>
<div class="test">&#x2026;</div>
<div class="test"><span style="display:list-item;"></span></div>
<div class="test"><span style="display:block;"></span></div>
<div class="test rel">1<span style="position:relative;"></span></div>
<div class="test rel">2<span style="position:absolute;"></span></div>
<div class="test rel">3</div>
<div class="test rel">4</div>
<div class="test"><span style="float:left"></span></div>
<div class="test"><span style="float:left; margin-left:-10px"></span></div>
<div class="test"><span style="float:right; margin-right:-10px"></span></div>
</div>
</body></html>

View File

@ -0,0 +1,80 @@
<!DOCTYPE html><html>
<head><style>
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}
.test {
overflow: hidden;
text-overflow: ellipsis;
width: 50px;
margin-bottom:1em;
height: 20px;
white-space:nowrap;
/*border:1px solid red;width: 500px;*/
}
.rel { position:relative;}
input,select,fieldset,textarea,hr,span {
border:1px solid black;
background: white;
color: black;
padding:0 40px;
}
iframe,img { width: 80px; height:10px; }
select[size="4"],iframe,textarea,hr { height:10px; margin:0; }
x {visibility:hidden;display:inline-block;margin-left:-10px;width:1000px;}
</style></head>
<body>
<div style="position:absolute; top:0; left:0;">
<div class="test"><fieldset style="display:inline;"></fieldset></div>
<div class="test"><fieldset style="display:inline-block;"></fieldset></div>
<div class="test"><fieldset style="display:block;"></fieldset></div>
<div class="test"><input type="button"></div>
<div class="test"><input type="button" style="display:inline-block;"></div>
<div class="test"><input type="button" style="display:list-item;"></div>
<div class="test"><input type="button" style="display:block;"></div>
<div class="test"><input type="text"></div>
<div class="test"><input type="text" style="display:inline-block;"></div>
<div class="test"><input type="text" style="display:block;"></div>
<div class="test"><textarea></textarea></div>
<div class="test"><textarea style="display:inline-block;"></textarea></div>
<div class="test"><textarea style="display:block;"></textarea></div>
<div class="test"><select size="1" style=""><option>&nbsp;<option>&nbsp;</select></div>
<div class="test"><select size="1" style="display:block;"><option>&nbsp;<option>&nbsp;</select></div>
<div class="test"><select size="4" style=""><option>&nbsp;<option>&nbsp;</select></div>
<div class="test"><select size="4" style="display:block;"><option>&nbsp;<option>&nbsp;</select></div>
</div>
<div style="position:absolute; top:0; left:100px;">
<div class="test"><iframe src="about:blank" style=""></iframe></div>
<div class="test"><iframe src="about:blank" style="display:block"></iframe></div>
<div class="test">&nbsp;<img src="../image/big.png"></div>
<div class="test">&nbsp;<img style="display:inline-block;" src="../image/big.png"></div>
<div class="test"><img style="display:block;" src="../image/big.png"></div>
<div class="test"><hr style="display:inline;background:lime;vertical-align:top;padding-top:100px;padding-bottom:100px; border-width:0"></div>
<div class="test"><hr style="display:inline-block;vertical-align:top"></div>
<div class="test"><hr style="display:block;"></div>
<div class="test"><span style="border-width:0"></span></div>
<div class="test"><span style="display:inline-block;"></span></div>
<div class="test"><span style="display:inline-table;"></span></div>
<div class="test"><span style="display:list-item;"></span></div>
<div class="test"><span style="display:block;"></span></div>
<div class="test rel">1<span style="position:relative;"></span></div>
<div class="test rel">2<span style="position:absolute"></span></div>
<div class="test rel">3<span style="position:absolute; left:60px"></span></div>
<div class="test rel">4<x></x><span style="position:absolute;">abs4</span></div>
<div class="test"><span style="float:left"></span></div>
<div class="test"><span style="float:left; margin-left:-10px"></span></div>
<div class="test"><span style="float:right; margin-right:-10px"></span></div>
</div>
</body></html>

View File

@ -14,3 +14,5 @@ HTTP(..) == standards-decorations.html standards-decorations-ref.html
HTTP(..) == standards-line-height.html standards-line-height-ref.html
HTTP(..) == selection.html selection-ref.html
HTTP(..) == marker-shadow.html marker-shadow-ref.html
== aligned-baseline.html aligned-baseline-ref.html
skip-if(Android) == clipped-elements.html clipped-elements-ref.html

View File

@ -39,7 +39,7 @@
/**
* This file lists Telemetry histograms collected by Firefox. The format is
*
* HISTOGRAM(id, minium, maximum, bucket count, histogram kind,
* HISTOGRAM(id, minimum, maximum, bucket count, histogram kind,
* human-readable description for about:telemetry)
*
*/
@ -53,6 +53,10 @@ HISTOGRAM(TELEMETRY_SUCCESS, 0, 1, 2, BOOLEAN, "Successful telemetry submission
HISTOGRAM(MEMORY_JS_GC_HEAP, 1024, 512 * 1024, 10, EXPONENTIAL, "Memory used by the garbage-collected JavaScript heap (KB)")
HISTOGRAM(MEMORY_RESIDENT, 32 * 1024, 1024 * 1024, 10, EXPONENTIAL, "Resident memory size (KB)")
HISTOGRAM(MEMORY_LAYOUT_ALL, 1024, 64 * 1024, 10, EXPONENTIAL, "Memory used by layout (KB)")
HISTOGRAM(MEMORY_IMAGES_CONTENT_USED_UNCOMPRESSED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Memory used for uncompressed, in-use content images (KB)")
HISTOGRAM(MEMORY_HEAP_USED, 1024, 1024 * 1024, 10, EXPONENTIAL, "Heap memory used (KB)")
// XXX: bug 660731 will enable this
//HISTOGRAM(MEMORY_EXPLICIT, 1024, 1024 * 1024, 10, EXPONENTIAL, "Explicit memory allocations (KB)")
#if defined(XP_WIN)
HISTOGRAM(EARLY_GLUESTARTUP_READ_OPS, 1, 100, 12, LINEAR, "ProcessIoCounters.ReadOperationCount before glue startup")
HISTOGRAM(EARLY_GLUESTARTUP_READ_TRANSFER, 1, 50 * 1024, 12, EXPONENTIAL, "ProcessIoCounters.ReadTransferCount before glue startup (KB)")

View File

@ -57,6 +57,9 @@ const MEM_HISTOGRAMS = {
"js-gc-heap": "MEMORY_JS_GC_HEAP",
"resident": "MEMORY_RESIDENT",
"explicit/layout/all": "MEMORY_LAYOUT_ALL",
"explicit/images/content/used/uncompressed":
"MEMORY_IMAGES_CONTENT_USED_UNCOMPRESSED",
"heap-used": "MEMORY_HEAP_USED",
"hard-page-faults": "HARD_PAGE_FAULTS"
};
@ -191,6 +194,15 @@ TelemetryPing.prototype = {
_initialized: false,
_prevValues: {},
addValue: function addValue(name, id, val) {
let h = this._histograms[name];
if (!h) {
h = Telemetry.getHistogramById(id);
this._histograms[name] = h;
}
h.add(val);
},
/**
* Pull values from about:memory into corresponding histograms
*/
@ -205,7 +217,6 @@ TelemetryPing.prototype = {
}
let e = mgr.enumerateReporters();
let memReporters = {};
while (e.hasMoreElements()) {
let mr = e.getNext().QueryInterface(Ci.nsIMemoryReporter);
let id = MEM_HISTOGRAMS[mr.path];
@ -238,15 +249,11 @@ TelemetryPing.prototype = {
NS_ASSERT(false, "Can't handle memory reporter with units " + mr.units);
continue;
}
let h = this._histograms[mr.path];
if (!h) {
h = Telemetry.getHistogramById(id);
this._histograms[mr.path] = h;
}
h.add(val);
this.addValue(mr.path, id, val);
}
return memReporters;
// XXX: bug 660731 will enable this
// "explicit" is found differently.
//this.addValue("explicit", "MEMORY_EXPLICIT", Math.floor(mgr.explicit / 1024));
},
/**