This commit is contained in:
Rob Campbell 2011-04-29 09:05:20 -03:00
Родитель 2f572de04f d2f1f3108d
Коммит e56c66f89b
293 изменённых файлов: 4090 добавлений и 5547 удалений

Просмотреть файл

@ -0,0 +1,203 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* ***** 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.org code.
*
* The Initial Developer of the Original Code is
* Novell, Inc.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brad Taylor <brad@getcoded.net> (original author)
*
* 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 <atk/atk.h>
#include "AtkSocketAccessible.h"
#include "nsMai.h"
#include "nsMaiInterfaceComponent.h"
void (*AtkSocketAccessible::g_atk_socket_embed) (AtkSocket*, gchar*) = NULL;
GType AtkSocketAccessible::g_atk_socket_type = G_TYPE_INVALID;
const char* AtkSocketAccessible::sATKSocketEmbedSymbol = "atk_socket_embed";
const char* AtkSocketAccessible::sATKSocketGetTypeSymbol = "atk_socket_get_type";
bool AtkSocketAccessible::gCanEmbed = FALSE;
/* MaiAtkSocket */
#define MAI_TYPE_ATK_SOCKET (mai_atk_socket_get_type ())
#define MAI_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
MAI_TYPE_ATK_SOCKET, MaiAtkSocket))
#define MAI_IS_ATK_SOCKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
MAI_TYPE_ATK_SOCKET))
#define MAI_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
MAI_TYPE_ATK_SOCKET,\
MaiAtkSocketClass))
#define MAI_IS_ATK_SOCKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
MAI_TYPE_ATK_SOCKET))
#define MAI_ATK_SOCKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
MAI_TYPE_ATK_SOCKET,\
MaiAtkSocketClass))
typedef struct _MaiAtkSocket MaiAtkSocket;
typedef struct _MaiAtkSocketClass MaiAtkSocketClass;
struct _MaiAtkSocket
{
AtkSocket parent;
nsAccessibleWrap* accWrap;
};
struct _MaiAtkSocketClass
{
AtkSocketClass parent_class;
};
G_BEGIN_DECLS
GType mai_atk_socket_get_type(void);
AtkObject* mai_atk_socket_new(nsAccessibleWrap* aAccWrap);
void mai_atk_component_iface_init(AtkComponentIface* aIface);
AtkObject* mai_atk_socket_ref_accessible_at_point(AtkComponent *aComponent,
gint aAccX,
gint aAccY,
AtkCoordType aCoordType);
void mai_atk_socket_get_extents(AtkComponent* aComponent,
gint* aAccX,
gint* aAccY,
gint* aAccWidth,
gint* aAccHeight,
AtkCoordType aCoordType);
G_END_DECLS
G_DEFINE_TYPE_EXTENDED(MaiAtkSocket, mai_atk_socket,
AtkSocketAccessible::g_atk_socket_type, 0,
G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT,
mai_atk_component_iface_init))
void
mai_atk_socket_class_init(MaiAtkSocketClass* aAcc)
{
}
void
mai_atk_socket_init(MaiAtkSocket* aAcc)
{
}
AtkObject*
mai_atk_socket_new(nsAccessibleWrap* aAccWrap)
{
NS_ENSURE_TRUE(aAccWrap, NULL);
MaiAtkSocket* acc = nsnull;
acc = static_cast<MaiAtkSocket*>(g_object_new(MAI_TYPE_ATK_SOCKET, NULL));
NS_ENSURE_TRUE(acc, NULL);
acc->accWrap = aAccWrap;
return ATK_OBJECT(acc);
}
void
mai_atk_component_iface_init(AtkComponentIface* aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
aIface->ref_accessible_at_point = mai_atk_socket_ref_accessible_at_point;
aIface->get_extents = mai_atk_socket_get_extents;
}
AtkObject*
mai_atk_socket_ref_accessible_at_point(AtkComponent* aComponent,
gint aX, gint aY,
AtkCoordType aCoordType)
{
NS_ENSURE_TRUE(MAI_IS_ATK_SOCKET(aComponent), nsnull);
return refAccessibleAtPointHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
aX, aY, aCoordType);
}
void
mai_atk_socket_get_extents(AtkComponent* aComponent,
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
AtkCoordType aCoordType)
{
*aX = *aY = *aWidth = *aHeight = 0;
if (!MAI_IS_ATK_SOCKET(aComponent))
return;
getExtentsHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
aX, aY, aWidth, aHeight, aCoordType);
}
AtkSocketAccessible::AtkSocketAccessible(nsIContent* aContent,
nsIWeakReference* aShell,
const nsCString& aPlugId) :
nsAccessibleWrap(aContent, aShell)
{
mAtkObject = mai_atk_socket_new(this);
if (!mAtkObject)
return;
// Embeds the children of an AtkPlug, specified by plugId, as the children of
// this socket.
// Using G_TYPE macros instead of ATK_SOCKET macros to avoid undefined
// symbols.
if (gCanEmbed && G_TYPE_CHECK_INSTANCE_TYPE(mAtkObject, g_atk_socket_type) &&
!aPlugId.IsVoid()) {
AtkSocket* accSocket =
G_TYPE_CHECK_INSTANCE_CAST(mAtkObject, g_atk_socket_type, AtkSocket);
g_atk_socket_embed(accSocket, (gchar*)aPlugId.get());
}
}
NS_IMETHODIMP
AtkSocketAccessible::GetNativeInterface(void** aOutAccessible)
{
*aOutAccessible = mAtkObject;
return NS_OK;
}
void
AtkSocketAccessible::Shutdown()
{
if (mAtkObject) {
if (MAI_IS_ATK_SOCKET(mAtkObject))
MAI_ATK_SOCKET(mAtkObject)->accWrap = nsnull;
g_object_unref(mAtkObject);
mAtkObject = nsnull;
}
nsAccessibleWrap::Shutdown();
}

Просмотреть файл

@ -1,4 +1,6 @@
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -12,15 +14,15 @@
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Fennec Installer for WinCE.
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is The Mozilla Foundation.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* The Initial Developer of the Original Code is
* Novell, Inc.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Pakhotin <alexp@mozilla.com> (original author)
* Brad Taylor <brad@getcoded.net> (original author)
*
* 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
@ -36,45 +38,49 @@
*
* ***** END LICENSE BLOCK ***** */
#pragma once
#ifndef _AtkSocketAccessible_H_
#define _AtkSocketAccessible_H_
#include "nsAccessibleWrap.h"
// This file gets included by nsAccessibilityService.cpp, which can't include
// atk.h (or glib.h), so we can't rely on it being included.
#ifdef __ATK_H__
typedef void (*AtkSocketEmbedType) (AtkSocket*, gchar*);
#else
typedef void (*AtkSocketEmbedType) (void*, void*);
#endif
/**
* Class to show the progress
* Provides a nsAccessibleWrap wrapper around AtkSocket for out-of-process
* accessibles.
*/
class nsExtractorProgress
class AtkSocketAccessible: public nsAccessibleWrap
{
public:
nsExtractorProgress() {}
virtual void Progress(int nPercentComplete) = 0; /* to be overriden to get progress notifications */
// Soft references to AtkSocket
static AtkSocketEmbedType g_atk_socket_embed;
#ifdef __ATK_H__
static GType g_atk_socket_type;
#endif
static const char* sATKSocketEmbedSymbol;
static const char* sATKSocketGetTypeSymbol;
/*
* True if the current Atk version supports AtkSocket and it was correctly
* loaded.
*/
static bool gCanEmbed;
AtkSocketAccessible(nsIContent* aContent, nsIWeakReference* aShell,
const nsCString& aPlugId);
// nsAccessNode
virtual void Shutdown();
// nsIAccessible
NS_IMETHODIMP GetNativeInterface(void** aOutAccessible);
};
/**
* Base archive-extractor class.
* Used to derive a specific archive format implementation.
*/
class nsArchiveExtractor
{
public:
enum
{
OK = 0,
ERR_FAIL = -1,
ERR_PARAM = -2,
ERR_READ = -3,
ERR_WRITE = -4,
ERR_MEM = -5,
ERR_NO_ARCHIVE = -6,
ERR_EXTRACTION = -7,
};
nsArchiveExtractor(const WCHAR *sArchiveName, DWORD dwSfxStubSize, nsExtractorProgress *pProgress);
virtual ~nsArchiveExtractor();
virtual int Extract(const WCHAR *sDestinationDir);
virtual int ExtractFile(const WCHAR *sFileName, const WCHAR *sDestinationDir);
protected:
WCHAR *m_sArchiveName;
nsExtractorProgress *m_pProgress;
DWORD m_dwSfxStubSize;
};
#endif

Просмотреть файл

@ -48,6 +48,7 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \
AtkSocketAccessible.cpp \
nsAccessNodeWrap.cpp \
nsAccessibleWrap.cpp \
nsDocAccessibleWrap.cpp \
@ -68,6 +69,7 @@ CPPSRCS = \
$(NULL)
EXPORTS = \
AtkSocketAccessible.h \
nsAccessNodeWrap.h \
nsARIAGridAccessibleWrap.h \
nsAccessibleWrap.h \

Просмотреть файл

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -49,6 +48,7 @@
#include "nsIServiceManager.h"
#include "nsAutoPtr.h"
#include "nsAccessibilityService.h"
#include "AtkSocketAccessible.h"
#include <gtk/gtk.h>
#include <atk/atk.h>
@ -722,8 +722,23 @@ nsApplicationAccessibleWrap::PreCreate()
sATKLib = PR_LoadLibrary(sATKLibName);
if (sATKLib) {
AtkGetTypeType pfn_atk_hyperlink_impl_get_type = (AtkGetTypeType) PR_FindFunctionSymbol(sATKLib, sATKHyperlinkImplGetTypeSymbol);
if (pfn_atk_hyperlink_impl_get_type) {
if (pfn_atk_hyperlink_impl_get_type)
g_atk_hyperlink_impl_type = pfn_atk_hyperlink_impl_get_type();
AtkGetTypeType pfn_atk_socket_get_type;
pfn_atk_socket_get_type = (AtkGetTypeType)
PR_FindFunctionSymbol(sATKLib,
AtkSocketAccessible::sATKSocketGetTypeSymbol);
if (pfn_atk_socket_get_type) {
AtkSocketAccessible::g_atk_socket_type =
pfn_atk_socket_get_type();
AtkSocketAccessible::g_atk_socket_embed = (AtkSocketEmbedType)
PR_FindFunctionSymbol(sATKLib,
AtkSocketAccessible
::sATKSocketEmbedSymbol);
AtkSocketAccessible::gCanEmbed =
AtkSocketAccessible::g_atk_socket_type != G_TYPE_INVALID &&
AtkSocketAccessible::g_atk_socket_embed;
}
}
sATKChecked = PR_TRUE;

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -67,76 +67,84 @@ componentInterfaceInitCB(AtkComponentIface *aIface)
aIface->grab_focus = grabFocusCB;
}
AtkObject *
refAccessibleAtPointCB(AtkComponent *aComponent,
gint aAccX, gint aAccY,
AtkObject*
refAccessibleAtPointCB(AtkComponent* aComponent, gint aAccX, gint aAccY,
AtkCoordType aCoordType)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
if (!accWrap || nsAccUtils::MustPrune(accWrap))
return nsnull;
// nsIAccessible getChildAtPoint (x,y) is in screen pixels.
if (aCoordType == ATK_XY_WINDOW) {
nsIntPoint winCoords =
nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode());
aAccX += winCoords.x;
aAccY += winCoords.y;
}
nsCOMPtr<nsIAccessible> pointAcc;
accWrap->GetChildAtPoint(aAccX, aAccY, getter_AddRefs(pointAcc));
if (!pointAcc) {
return nsnull;
}
AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(pointAcc);
if (atkObj) {
g_object_ref(atkObj);
}
return atkObj;
return refAccessibleAtPointHelper(GetAccessibleWrap(ATK_OBJECT(aComponent)),
aAccX, aAccY, aCoordType);
}
void
getExtentsCB(AtkComponent *aComponent,
gint *aAccX,
gint *aAccY,
gint *aAccWidth,
gint *aAccHeight,
AtkCoordType aCoordType)
getExtentsCB(AtkComponent* aComponent, gint* aX, gint* aY,
gint* aWidth, gint* aHeight, AtkCoordType aCoordType)
{
*aAccX = *aAccY = *aAccWidth = *aAccHeight = 0;
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
if (!accWrap)
return;
PRInt32 nsAccX, nsAccY, nsAccWidth, nsAccHeight;
// Returned in screen coordinates
nsresult rv = accWrap->GetBounds(&nsAccX, &nsAccY,
&nsAccWidth, &nsAccHeight);
if (NS_FAILED(rv))
return;
if (aCoordType == ATK_XY_WINDOW) {
nsIntPoint winCoords =
nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode());
nsAccX -= winCoords.x;
nsAccY -= winCoords.y;
}
*aAccX = nsAccX;
*aAccY = nsAccY;
*aAccWidth = nsAccWidth;
*aAccHeight = nsAccHeight;
getExtentsHelper(GetAccessibleWrap(ATK_OBJECT(aComponent)),
aX, aY, aWidth, aHeight, aCoordType);
}
gboolean
grabFocusCB(AtkComponent *aComponent)
grabFocusCB(AtkComponent* aComponent)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
if (!accWrap)
return FALSE;
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
if (!accWrap)
return FALSE;
nsresult rv = accWrap->TakeFocus();
return (NS_FAILED(rv)) ? FALSE : TRUE;
nsresult rv = accWrap->TakeFocus();
return (NS_FAILED(rv)) ? FALSE : TRUE;
}
AtkObject*
refAccessibleAtPointHelper(nsAccessibleWrap* aAccWrap, gint aX, gint aY,
AtkCoordType aCoordType)
{
if (!aAccWrap || aAccWrap->IsDefunct() || nsAccUtils::MustPrune(aAccWrap))
return nsnull;
// nsAccessible::GetChildAtPoint(x,y) is in screen pixels.
if (aCoordType == ATK_XY_WINDOW) {
nsIntPoint winCoords =
nsCoreUtils::GetScreenCoordsForWindow(aAccWrap->GetNode());
aX += winCoords.x;
aY += winCoords.y;
}
nsAccessible* accAtPoint = aAccWrap->GetChildAtPoint(aX, aY,
nsAccessible::eDirectChild);
if (!accAtPoint)
return nsnull;
AtkObject* atkObj = nsAccessibleWrap::GetAtkObject(accAtPoint);
if (atkObj)
g_object_ref(atkObj);
return atkObj;
}
void
getExtentsHelper(nsAccessibleWrap* aAccWrap,
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
AtkCoordType aCoordType)
{
*aX = *aY = *aWidth = *aHeight = 0;
if (!aAccWrap || aAccWrap->IsDefunct())
return;
PRInt32 x = 0, y = 0, width = 0, height = 0;
// Returned in screen coordinates
nsresult rv = aAccWrap->GetBounds(&x, &y, &width, &height);
if (NS_FAILED(rv))
return;
if (aCoordType == ATK_XY_WINDOW) {
nsIntPoint winCoords =
nsCoreUtils::GetScreenCoordsForWindow(aAccWrap->GetNode());
x -= winCoords.x;
y -= winCoords.y;
}
*aX = x;
*aY = y;
*aWidth = width;
*aHeight = height;
}

Просмотреть файл

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@ -46,22 +46,20 @@
G_BEGIN_DECLS
/* component interface callbacks */
void componentInterfaceInitCB(AtkComponentIface *aIface);
AtkObject *refAccessibleAtPointCB(AtkComponent *aComponent,
gint aAccX, gint aAccY,
void componentInterfaceInitCB(AtkComponentIface* aIface);
AtkObject* refAccessibleAtPointCB(AtkComponent* aComponent,
gint aX, gint aY,
AtkCoordType aCoordType);
void getExtentsCB(AtkComponent *aComponent,
gint *aAccX, gint *aAccY,
gint *aAccWidth, gint *aAccHeight,
void getExtentsCB(AtkComponent* aComponent,
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
AtkCoordType aCoordType);
/* the "contains", "get_position", "get_size" can take advantage of
* "get_extents", there is no need to implement them now.
*/
gboolean grabFocusCB(AtkComponent *aComponent);
gboolean grabFocusCB(AtkComponent* aComponent);
/* what are missing now for atk component */
/* ==================================================
/* what are missing now for atk component:
*
* add_focus_handler
* remove_focus_handler
* set_extents
@ -69,8 +67,14 @@ gboolean grabFocusCB(AtkComponent *aComponent);
* set_size
* get_layer
* get_mdi_zorder
* ==================================================
*/
AtkObject* refAccessibleAtPointHelper(nsAccessibleWrap* aAccWrap,
gint aX, gint aY, AtkCoordType aCoordType);
void getExtentsHelper(nsAccessibleWrap* aAccWrap,
gint* aX, gint* aY, gint* aWidth, gint* aHeight,
AtkCoordType aCoordType);
G_END_DECLS
#endif /* __MAI_INTERFACE_COMPONENT_H__ */

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

Просмотреть файл

@ -95,6 +95,11 @@
#include "nsHTMLWin32ObjectAccessible.h"
#endif
// For embedding plugin accessibles
#ifdef MOZ_ACCESSIBILITY_ATK
#include "AtkSocketAccessible.h"
#endif
#ifndef DISABLE_XFORMS_HOOKS
#include "nsXFormsFormControlsAccessible.h"
#include "nsXFormsWidgetsAccessible.h"
@ -339,11 +344,12 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
return CreateOuterDocAccessible(aContent, aPresShell);
}
#ifdef XP_WIN
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
// 2) for plugins
nsCOMPtr<nsIPluginInstance> pluginInstance ;
aFrame->GetPluginInstance(*getter_AddRefs(pluginInstance));
if (pluginInstance) {
nsCOMPtr<nsIPluginInstance> pluginInstance;
if (NS_SUCCEEDED(aFrame->GetPluginInstance(*getter_AddRefs(pluginInstance))) &&
pluginInstance) {
#ifdef XP_WIN
// Note: pluginPort will be null if windowless.
HWND pluginPort = nsnull;
aFrame->GetPluginPort(&pluginPort);
@ -353,6 +359,22 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
pluginPort);
NS_IF_ADDREF(accessible);
return accessible;
#elif MOZ_ACCESSIBILITY_ATK
if (!AtkSocketAccessible::gCanEmbed)
return nsnull;
nsCString plugId;
nsresult rv = pluginInstance->GetValueFromPlugin(
NPPVpluginNativeAccessibleAtkPlugId, &plugId);
if (NS_SUCCEEDED(rv) && !plugId.IsVoid()) {
AtkSocketAccessible* socketAccessible =
new AtkSocketAccessible(aContent, weakShell, plugId);
NS_IF_ADDREF(socketAccessible);
return socketAccessible;
}
#endif
}
#endif

Просмотреть файл

@ -193,15 +193,15 @@ nsRootAccessible::NativeState()
#ifdef MOZ_XUL
PRUint32 chromeFlags = GetChromeFlags();
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE)
states |= states::SIZEABLE;
}
if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR) {
// If it has a titlebar it's movable
// XXX unless it's minimized or maximized, but not sure
// how to detect that
if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR)
states |= states::MOVEABLE;
}
if (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)
states |= states::MODAL;
#endif
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
@ -215,12 +215,6 @@ nsRootAccessible::NativeState()
states |= states::ACTIVE;
}
#ifdef MOZ_XUL
if (GetChromeFlags() & nsIWebBrowserChrome::CHROME_MODAL) {
states |= states::MODAL;
}
#endif
return states;
}

Просмотреть файл

@ -2296,9 +2296,15 @@ function getShortcutOrURI(aURL, aPostDataRef) {
} catch (e) {}
}
// encodeURIComponent produces UTF-8, and cannot be used for other charsets.
// escape() works in those cases, but it doesn't uri-encode +, @, and /.
// Therefore we need to manually replace these ASCII characters by their
// encodeURIComponent result, to match the behavior of nsEscape() with
// url_XPAlphas
var encodedParam = "";
if (charset)
encodedParam = escape(convertFromUnicode(charset, param));
if (charset && charset != "UTF-8")
encodedParam = escape(convertFromUnicode(charset, param)).
replace(/[+@\/]+/g, encodeURIComponent);
else // Default charset is UTF-8
encodedParam = encodeURIComponent(param);

Просмотреть файл

@ -1,50 +0,0 @@
<?xml version="1.0"?>
# ***** 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.org code.
#
# The Initial Developer of the Original Code is Asaf Romano
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Asaf Romano <mozilla.mano@sent.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 *****
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
<overlay id="extensionsManagerOverlay"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<window id="extensionsManager">
#include browserMountPoints.inc
</window>
</overlay>

Просмотреть файл

@ -74,6 +74,14 @@ var testData = [
// Explicitly-defined ISO-8859-1
[new bmKeywordData("bmget-escaping2", "http://bmget/?esc=%s&raw=%S&mozcharset=ISO-8859-1", null, "foé"),
new keywordResult("http://bmget/?esc=fo%E9&raw=foé", null)],
// Bug 359809: Test escaping +, /, and @
// UTF-8 default
[new bmKeywordData("bmget-escaping", "http://bmget/?esc=%s&raw=%S", null, "+/@"),
new keywordResult("http://bmget/?esc=%2B%2F%40&raw=+/@", null)],
// Explicitly-defined ISO-8859-1
[new bmKeywordData("bmget-escaping2", "http://bmget/?esc=%s&raw=%S&mozcharset=ISO-8859-1", null, "+/@"),
new keywordResult("http://bmget/?esc=%2B%2F%40&raw=+/@", null)],
];
function test() {

Просмотреть файл

@ -2,7 +2,6 @@ browser.jar:
% content browser %content/browser/ contentaccessible=yes
#ifdef XP_MACOSX
% overlay chrome://mozapps/content/downloads/downloads.xul chrome://browser/content/downloadManagerOverlay.xul
% overlay chrome://mozapps/content/extensions/extensions.xul chrome://browser/content/extensionsManagerOverlay.xul
% overlay chrome://global/content/console.xul chrome://browser/content/jsConsoleOverlay.xul
% overlay chrome://mozapps/content/update/updates.xul chrome://browser/content/softwareUpdateOverlay.xul
#endif
@ -81,7 +80,6 @@ browser.jar:
#ifdef XP_MACOSX
* content/browser/macBrowserOverlay.xul (content/macBrowserOverlay.xul)
* content/browser/downloadManagerOverlay.xul (content/downloadManagerOverlay.xul)
* content/browser/extensionsManagerOverlay.xul (content/extensionsManagerOverlay.xul)
* content/browser/jsConsoleOverlay.xul (content/jsConsoleOverlay.xul)
* content/browser/softwareUpdateOverlay.xul (content/softwareUpdateOverlay.xul)
#endif

Просмотреть файл

@ -62,7 +62,6 @@ XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
return PlacesUtils;
});
const PREF_EM_NEW_ADDONS_LIST = "extensions.newAddons";
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
@ -397,24 +396,6 @@ BrowserGlue.prototype = {
if (Services.prefs.prefHasUserValue("app.update.postupdate"))
this._showUpdateNotification();
// If new add-ons were installed during startup open the add-ons manager.
if (Services.prefs.prefHasUserValue(PREF_EM_NEW_ADDONS_LIST)) {
var args = Cc["@mozilla.org/supports-array;1"].
createInstance(Ci.nsISupportsArray);
var str = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString);
str.data = "";
args.AppendElement(str);
var str = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString);
str.data = Services.prefs.getCharPref(PREF_EM_NEW_ADDONS_LIST);
args.AppendElement(str);
const EMURL = "chrome://mozapps/content/extensions/extensions.xul";
const EMFEATURES = "chrome,menubar,extra-chrome,toolbar,dialog=no,resizable";
Services.ww.openWindow(null, EMURL, "_blank", EMFEATURES, args);
Services.prefs.clearUserPref(PREF_EM_NEW_ADDONS_LIST);
}
// Load the "more info" page for a locked places.sqlite
// This property is set earlier by places-database-locked topic.
if (this._isPlacesDatabaseLocked) {

Просмотреть файл

@ -145,7 +145,6 @@ MOZ_TOOLKIT_SEARCH = @MOZ_TOOLKIT_SEARCH@
MOZ_PLACES = @MOZ_PLACES@
MOZ_STORAGE = @MOZ_STORAGE@
MOZ_SAFE_BROWSING = @MOZ_SAFE_BROWSING@
MOZ_FASTSTART = @MOZ_FASTSTART@
MOZ_URL_CLASSIFIER = @MOZ_URL_CLASSIFIER@
MOZ_ZIPWRITER = @MOZ_ZIPWRITER@
MOZ_MORK = @MOZ_MORK@

Просмотреть файл

@ -2188,9 +2188,9 @@ ia64*-hpux*)
esac
# If we're building with --enable-profiling, we need a frame pointer.
if test -z "$MOZ_PROFILING"; then
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
else
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
fi
MOZ_DEBUG_FLAGS="-g"
fi
@ -4802,7 +4802,6 @@ MOZ_PSM=1
MOZ_RDF=1
MOZ_REFLOW_PERF=
MOZ_SAFE_BROWSING=
MOZ_FASTSTART=
MOZ_HELP_VIEWER=
MOZ_SPELLCHECK=1
MOZ_SPLASHSCREEN=
@ -6771,18 +6770,6 @@ if test -n "$MOZ_SAFE_BROWSING"; then
fi
AC_SUBST(MOZ_SAFE_BROWSING)
dnl ========================================================
dnl = Enable faststart component
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(faststart,
[ --enable-faststart Enable the faststart component],
MOZ_FASTSTART=1,
MOZ_FASTSTART= )
if test -n "$MOZ_FASTSTART"; then
AC_DEFINE(MOZ_FASTSTART)
fi
AC_SUBST(MOZ_FASTSTART)
dnl ========================================================
dnl = Enable url-classifier
dnl ========================================================

Просмотреть файл

@ -1777,6 +1777,25 @@ public:
FindInternalContentViewer(const char* aType,
ContentViewerType* aLoaderType = nsnull);
/**
* This helper method returns true if the aPattern pattern matches aValue.
* aPattern should not contain leading and trailing slashes (/).
* The pattern has to match the entire value not just a subset.
* aDocument must be a valid pointer (not null).
*
* This is following the HTML5 specification:
* http://dev.w3.org/html5/spec/forms.html#attr-input-pattern
*
* WARNING: This method mutates aPattern and aValue!
*
* @param aValue the string to check.
* @param aPattern the string defining the pattern.
* @param aDocument the owner document of the element.
* @result whether the given string is matches the pattern.
*/
static PRBool IsPatternMatching(nsAString& aValue, nsAString& aPattern,
nsIDocument* aDocument);
/**
* Calling this adds support for
* ontouch* event handler DOM attributes.

Просмотреть файл

@ -6552,3 +6552,37 @@ nsContentUtils::FindInternalContentViewer(const char* aType,
return NULL;
}
// static
PRBool
nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
nsIDocument* aDocument)
{
NS_ASSERTION(aDocument, "aDocument should be a valid pointer (not null)");
NS_ENSURE_TRUE(aDocument->GetScriptGlobalObject(), PR_TRUE);
JSContext* ctx = (JSContext*) aDocument->GetScriptGlobalObject()->
GetContext()->GetNativeContext();
NS_ENSURE_TRUE(ctx, PR_TRUE);
JSAutoRequest ar(ctx);
// The pattern has to match the entire value.
aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0);
aPattern.Append(NS_LITERAL_STRING(")$"));
JSObject* re = JS_NewUCRegExpObjectNoStatics(ctx, reinterpret_cast<jschar*>
(aPattern.BeginWriting()),
aPattern.Length(), 0);
NS_ENSURE_TRUE(re, PR_TRUE);
jsval rval = JSVAL_NULL;
size_t idx = 0;
JSBool res;
res = JS_ExecuteRegExpNoStatics(ctx, re, reinterpret_cast<jschar*>
(aValue.BeginWriting()),
aValue.Length(), &idx, JS_TRUE, &rval);
return res == JS_FALSE || rval != JSVAL_NULL;
}

Просмотреть файл

@ -1596,6 +1596,10 @@ nsDocument::~nsDocument()
mStyleSheetSetList->Disconnect();
}
if (mAnimationController) {
mAnimationController->Disconnect();
}
mParentDocument = nsnull;
// Kill the subdocument map, doing this will release its strong
@ -5527,7 +5531,7 @@ nsDocument::GetAnimationController()
if (!NS_SMILEnabled() || mLoadedAsData || mLoadedAsInteractiveData)
return nsnull;
mAnimationController = NS_NewSMILAnimationController(this);
mAnimationController = new nsSMILAnimationController(this);
// If there's a presContext then check the animation mode and pause if
// necessary.
@ -8338,21 +8342,21 @@ nsDocument::CreateTouch(nsIDOMAbstractView* aView,
PRInt32 aRadiusY,
float aRotationAngle,
float aForce,
nsIDOMTouchPoint** aRetVal)
nsIDOMTouch** aRetVal)
{
NS_ADDREF(*aRetVal = new nsDOMTouchPoint(aTarget,
aIdentifier,
aPageX,
aPageY,
aScreenX,
aScreenY,
aClientX,
aClientY,
aRadiusX,
aRadiusY,
aRotationAngle,
aForce));
return NS_OK;;
NS_ADDREF(*aRetVal = new nsDOMTouch(aTarget,
aIdentifier,
aPageX,
aPageY,
aScreenX,
aScreenY,
aClientX,
aClientY,
aRadiusX,
aRadiusY,
aRotationAngle,
aForce));
return NS_OK;
}
NS_IMETHODIMP
@ -8367,7 +8371,7 @@ nsDocument::CreateTouchList(nsIVariant* aPoints,
type == nsIDataType::VTYPE_INTERFACE_IS) {
nsCOMPtr<nsISupports> data;
aPoints->GetAsISupports(getter_AddRefs(data));
nsCOMPtr<nsIDOMTouchPoint> point = do_QueryInterface(data);
nsCOMPtr<nsIDOMTouch> point = do_QueryInterface(data);
if (point) {
retval->Append(point);
}
@ -8382,7 +8386,7 @@ nsDocument::CreateTouchList(nsIVariant* aPoints,
nsISupports** values = static_cast<nsISupports**>(rawArray);
for (PRUint32 i = 0; i < valueCount; ++i) {
nsCOMPtr<nsISupports> supports = dont_AddRef(values[i]);
nsCOMPtr<nsIDOMTouchPoint> point = do_QueryInterface(supports);
nsCOMPtr<nsIDOMTouch> point = do_QueryInterface(supports);
if (point) {
retval->Append(point);
}

Просмотреть файл

@ -42,98 +42,98 @@
#include "nsIXPCScriptable.h"
#include "nsContentUtils.h"
DOMCI_DATA(TouchPoint, nsDOMTouchPoint)
DOMCI_DATA(Touch, nsDOMTouch)
NS_IMPL_CYCLE_COLLECTION_1(nsDOMTouchPoint, mTarget)
NS_IMPL_CYCLE_COLLECTION_1(nsDOMTouch, mTarget)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouchPoint)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTouchPoint)
NS_INTERFACE_MAP_ENTRY(nsIDOMTouchPoint)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TouchPoint)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouch)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTouch)
NS_INTERFACE_MAP_ENTRY(nsIDOMTouch)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Touch)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTouchPoint)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTouchPoint)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTouch)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTouch)
NS_IMETHODIMP
nsDOMTouchPoint::GetIdentifier(PRInt32* aIdentifier)
nsDOMTouch::GetIdentifier(PRInt32* aIdentifier)
{
*aIdentifier = mIdentifier;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetTarget(nsIDOMEventTarget** aTarget)
nsDOMTouch::GetTarget(nsIDOMEventTarget** aTarget)
{
NS_IF_ADDREF(*aTarget = mTarget);
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetScreenX(PRInt32* aScreenX)
nsDOMTouch::GetScreenX(PRInt32* aScreenX)
{
*aScreenX = mScreenX;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetScreenY(PRInt32* aScreenY)
nsDOMTouch::GetScreenY(PRInt32* aScreenY)
{
*aScreenY = mScreenY;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetClientX(PRInt32* aClientX)
nsDOMTouch::GetClientX(PRInt32* aClientX)
{
*aClientX = mClientX;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetClientY(PRInt32* aClientY)
nsDOMTouch::GetClientY(PRInt32* aClientY)
{
*aClientY = mClientY;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetPageX(PRInt32* aPageX)
nsDOMTouch::GetPageX(PRInt32* aPageX)
{
*aPageX = mPageX;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetPageY(PRInt32* aPageY)
nsDOMTouch::GetPageY(PRInt32* aPageY)
{
*aPageY = mPageY;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetRadiusX(PRInt32* aRadiusX)
nsDOMTouch::GetRadiusX(PRInt32* aRadiusX)
{
*aRadiusX = mRadiusX;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetRadiusY(PRInt32* aRadiusY)
nsDOMTouch::GetRadiusY(PRInt32* aRadiusY)
{
*aRadiusY = mRadiusY;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetRotationAngle(float* aRotationAngle)
nsDOMTouch::GetRotationAngle(float* aRotationAngle)
{
*aRotationAngle = mRotationAngle;
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchPoint::GetForce(float* aForce)
nsDOMTouch::GetForce(float* aForce)
{
*aForce = mForce;
return NS_OK;
@ -170,17 +170,18 @@ nsDOMTouchList::GetLength(PRUint32* aLength)
}
NS_IMETHODIMP
nsDOMTouchList::Item(PRUint32 aIndex, nsIDOMTouchPoint** aRetVal)
nsDOMTouchList::Item(PRUint32 aIndex, nsIDOMTouch** aRetVal)
{
NS_IF_ADDREF(*aRetVal = mPoints.SafeObjectAt(aIndex));
return NS_OK;
}
NS_IMETHODIMP
nsDOMTouchList::IdentifiedPoint(PRInt32 aIdentifier, nsIDOMTouchPoint** aRetVal)
nsDOMTouchList::IdentifiedTouch(PRInt32 aIdentifier, nsIDOMTouch** aRetVal)
{
*aRetVal = nsnull;
for (PRInt32 i = 0; i < mPoints.Count(); ++i) {
nsCOMPtr<nsIDOMTouchPoint> point = mPoints[i];
nsCOMPtr<nsIDOMTouch> point = mPoints[i];
PRInt32 identifier;
if (point && NS_SUCCEEDED(point->GetIdentifier(&identifier)) &&
aIdentifier == identifier) {

Просмотреть файл

@ -42,21 +42,21 @@
#include "nsString.h"
#include "nsCOMArray.h"
class nsDOMTouchPoint : public nsIDOMTouchPoint
class nsDOMTouch : public nsIDOMTouch
{
public:
nsDOMTouchPoint(nsIDOMEventTarget* aTarget,
PRInt32 aIdentifier,
PRInt32 aPageX,
PRInt32 aPageY,
PRInt32 aScreenX,
PRInt32 aScreenY,
PRInt32 aClientX,
PRInt32 aClientY,
PRInt32 aRadiusX,
PRInt32 aRadiusY,
float aRotationAngle,
float aForce)
nsDOMTouch(nsIDOMEventTarget* aTarget,
PRInt32 aIdentifier,
PRInt32 aPageX,
PRInt32 aPageY,
PRInt32 aScreenX,
PRInt32 aScreenY,
PRInt32 aClientX,
PRInt32 aClientY,
PRInt32 aRadiusX,
PRInt32 aRadiusY,
float aRotationAngle,
float aForce)
: mTarget(aTarget),
mIdentifier(aIdentifier),
mPageX(aPageX),
@ -71,8 +71,8 @@ public:
mForce(aForce)
{}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMTouchPoint)
NS_DECL_NSIDOMTOUCHPOINT
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMTouch)
NS_DECL_NSIDOMTOUCH
protected:
nsCOMPtr<nsIDOMEventTarget> mTarget;
PRInt32 mIdentifier;
@ -95,17 +95,17 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMTouchList)
NS_DECL_NSIDOMTOUCHLIST
void Append(nsIDOMTouchPoint* aPoint)
void Append(nsIDOMTouch* aPoint)
{
mPoints.AppendObject(aPoint);
}
nsIDOMTouchPoint* GetItemAt(PRUint32 aIndex)
nsIDOMTouch* GetItemAt(PRUint32 aIndex)
{
return mPoints.SafeObjectAt(aIndex);
}
protected:
nsCOMArray<nsIDOMTouchPoint> mPoints;
nsCOMArray<nsIDOMTouch> mPoints;
};
class nsDOMTouchEvent : public nsDOMUIEvent,

Просмотреть файл

@ -3813,7 +3813,7 @@ nsHTMLInputElement::HasPatternMismatch() const
return PR_FALSE;
}
return !IsPatternMatching(value, pattern, doc);
return !nsContentUtils::IsPatternMatching(value, pattern, doc);
}
void
@ -4095,40 +4095,6 @@ nsHTMLInputElement::IsValidEmailAddress(const nsAString& aValue)
return PR_TRUE;
}
//static
PRBool
nsHTMLInputElement::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
nsIDocument* aDocument)
{
NS_ASSERTION(aDocument, "aDocument should be a valid pointer (not null)");
NS_ENSURE_TRUE(aDocument->GetScriptGlobalObject(), PR_TRUE);
JSContext* ctx = (JSContext*) aDocument->GetScriptGlobalObject()->
GetContext()->GetNativeContext();
NS_ENSURE_TRUE(ctx, PR_TRUE);
JSAutoRequest ar(ctx);
// The pattern has to match the entire value.
aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0);
aPattern.Append(NS_LITERAL_STRING(")$"));
JSObject* re = JS_NewUCRegExpObjectNoStatics(ctx, reinterpret_cast<jschar*>
(aPattern.BeginWriting()),
aPattern.Length(), 0);
NS_ENSURE_TRUE(re, PR_TRUE);
jsval rval = JSVAL_NULL;
size_t idx = 0;
JSBool res;
res = JS_ExecuteRegExpNoStatics(ctx, re, reinterpret_cast<jschar*>
(aValue.BeginWriting()),
aValue.Length(), &idx, JS_TRUE, &rval);
return res == JS_FALSE || rval != JSVAL_NULL;
}
NS_IMETHODIMP_(PRBool)
nsHTMLInputElement::IsSingleLineTextControl() const
{

Просмотреть файл

@ -368,23 +368,6 @@ protected:
*/
static PRBool IsValidEmailAddressList(const nsAString& aValue);
/**
* This helper method returns true if the aPattern pattern matches aValue.
* aPattern should not contain leading and trailing slashes (/).
* The pattern has to match the entire value not just a subset.
* aDocument must be a valid pointer (not null).
*
* This is following the HTML5 specification:
* http://dev.w3.org/html5/spec/forms.html#attr-input-pattern
*
* @param aValue the string to check.
* @param aPattern the string defining the pattern.
* @param aDocument the owner document of the element.
* @result whether the given string is matches the pattern.
*/
static PRBool IsPatternMatching(nsAString& aValue, nsAString& aPattern,
nsIDocument* aDocument);
// Helper method
nsresult SetValueInternal(const nsAString& aValue,
PRBool aUserInput,

Просмотреть файл

@ -55,64 +55,22 @@ using namespace mozilla::dom;
//----------------------------------------------------------------------
// nsSMILAnimationController implementation
// Helper method
static nsRefreshDriver*
GetRefreshDriverForDoc(nsIDocument* aDoc)
{
nsIPresShell* shell = aDoc->GetShell();
if (!shell) {
return nsnull;
}
nsPresContext* context = shell->GetPresContext();
return context ? context->RefreshDriver() : nsnull;
}
//----------------------------------------------------------------------
// ctors, dtors, factory methods
nsSMILAnimationController::nsSMILAnimationController()
nsSMILAnimationController::nsSMILAnimationController(nsIDocument* aDoc)
: mAvgTimeBetweenSamples(0),
mResampleNeeded(PR_FALSE),
mDeferredStartSampling(PR_FALSE),
mRunningSample(PR_FALSE),
mDocument(nsnull)
mDocument(aDoc)
{
NS_ABORT_IF_FALSE(aDoc, "need a non-null document");
mAnimationElementTable.Init();
mChildContainerTable.Init();
}
nsSMILAnimationController::~nsSMILAnimationController()
{
StopSampling(GetRefreshDriverForDoc(mDocument));
NS_ASSERTION(mAnimationElementTable.Count() == 0,
"Animation controller shouldn't be tracking any animation"
" elements when it dies");
}
nsSMILAnimationController* NS_NewSMILAnimationController(nsIDocument* aDoc)
{
nsSMILAnimationController* animationController =
new nsSMILAnimationController();
NS_ENSURE_TRUE(animationController, nsnull);
nsresult rv = animationController->Init(aDoc);
if (NS_FAILED(rv)) {
delete animationController;
animationController = nsnull;
}
return animationController;
}
nsresult
nsSMILAnimationController::Init(nsIDocument* aDoc)
{
NS_ENSURE_ARG_POINTER(aDoc);
// Keep track of document, so we can traverse its set of animation elements
mDocument = aDoc;
nsRefreshDriver* refreshDriver = GetRefreshDriverForDoc(mDocument);
nsRefreshDriver* refreshDriver = GetRefreshDriver();
if (refreshDriver) {
mStartTime = refreshDriver->MostRecentRefresh();
} else {
@ -121,8 +79,25 @@ nsSMILAnimationController::Init(nsIDocument* aDoc)
mCurrentSampleTime = mStartTime;
Begin();
}
return NS_OK;
nsSMILAnimationController::~nsSMILAnimationController()
{
NS_ASSERTION(mAnimationElementTable.Count() == 0,
"Animation controller shouldn't be tracking any animation"
" elements when it dies");
}
void
nsSMILAnimationController::Disconnect()
{
NS_ABORT_IF_FALSE(mDocument, "disconnecting when we weren't connected...?");
NS_ABORT_IF_FALSE(mRefCnt.get() == 1,
"Expecting to disconnect when doc is sole remaining owner");
StopSampling(GetRefreshDriver());
mDocument = nsnull; // (raw pointer)
}
//----------------------------------------------------------------------
@ -135,7 +110,7 @@ nsSMILAnimationController::Pause(PRUint32 aType)
if (mPauseState) {
mDeferredStartSampling = PR_FALSE;
StopSampling(GetRefreshDriverForDoc(mDocument));
StopSampling(GetRefreshDriver());
}
}
@ -151,7 +126,7 @@ nsSMILAnimationController::Resume(PRUint32 aType)
if (wasPaused && !mPauseState && mChildContainerTable.Count()) {
Sample(); // Run the first sample manually
MaybeStartSampling(GetRefreshDriverForDoc(mDocument));
MaybeStartSampling(GetRefreshDriver());
}
}
@ -230,7 +205,7 @@ nsSMILAnimationController::RegisterAnimationElement(
NS_ABORT_IF_FALSE(mAnimationElementTable.Count() == 1,
"we shouldn't have deferred sampling if we already had "
"animations registered");
StartSampling(GetRefreshDriverForDoc(mDocument));
StartSampling(GetRefreshDriver());
} // else, don't sample until a time container is registered (via AddChild)
}
}
@ -319,8 +294,8 @@ nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver)
NS_ASSERTION(!mDeferredStartSampling,
"Started sampling but the deferred start flag is still set");
if (aRefreshDriver) {
NS_ABORT_IF_FALSE(!GetRefreshDriverForDoc(mDocument) ||
aRefreshDriver == GetRefreshDriverForDoc(mDocument),
NS_ABORT_IF_FALSE(!GetRefreshDriver() ||
aRefreshDriver == GetRefreshDriver(),
"Starting sampling with wrong refresh driver");
// We're effectively resuming from a pause so update our current sample time
// or else it will confuse our "average time between samples" calculations.
@ -335,8 +310,8 @@ nsSMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver)
if (aRefreshDriver) {
// NOTE: The document might already have been detached from its PresContext
// (and RefreshDriver), which would make GetRefreshDriverForDoc return null.
NS_ABORT_IF_FALSE(!GetRefreshDriverForDoc(mDocument) ||
aRefreshDriver == GetRefreshDriverForDoc(mDocument),
NS_ABORT_IF_FALSE(!GetRefreshDriver() ||
aRefreshDriver == GetRefreshDriver(),
"Stopping sampling with wrong refresh driver");
aRefreshDriver->RemoveRefreshObserver(this, Flush_Style);
}
@ -412,6 +387,11 @@ nsSMILAnimationController::DoSample()
void
nsSMILAnimationController::DoSample(PRBool aSkipUnchangedContainers)
{
if (!mDocument) {
NS_ERROR("Shouldn't be sampling after document has disconnected");
return;
}
mResampleNeeded = PR_FALSE;
// Set running sample flag -- do this before flushing styles so that when we
// flush styles we don't end up requesting extra samples
@ -836,7 +816,7 @@ nsSMILAnimationController::AddChild(nsSMILTimeContainer& aChild)
if (!mPauseState && mChildContainerTable.Count() == 1) {
Sample(); // Run the first sample manually
MaybeStartSampling(GetRefreshDriverForDoc(mDocument));
MaybeStartSampling(GetRefreshDriver());
}
return NS_OK;
@ -848,6 +828,24 @@ nsSMILAnimationController::RemoveChild(nsSMILTimeContainer& aChild)
mChildContainerTable.RemoveEntry(&aChild);
if (!mPauseState && mChildContainerTable.Count() == 0) {
StopSampling(GetRefreshDriverForDoc(mDocument));
StopSampling(GetRefreshDriver());
}
}
// Helper method
nsRefreshDriver*
nsSMILAnimationController::GetRefreshDriver()
{
if (!mDocument) {
NS_ERROR("Requesting refresh driver after document has disconnected!");
return nsnull;
}
nsIPresShell* shell = mDocument->GetShell();
if (!shell) {
return nsnull;
}
nsPresContext* context = shell->GetPresContext();
return context ? context->RefreshDriver() : nsnull;
}

Просмотреть файл

@ -70,11 +70,13 @@ class nsIDocument;
class nsSMILAnimationController : public nsSMILTimeContainer,
public nsARefreshObserver
{
protected:
nsSMILAnimationController();
public:
nsSMILAnimationController(nsIDocument* aDoc);
~nsSMILAnimationController();
// Clears mDocument pointer. (Called by our nsIDocument when it's going away)
void Disconnect();
// nsSMILContainer
virtual void Pause(PRUint32 aType);
virtual void Resume(PRUint32 aType);
@ -149,15 +151,13 @@ protected:
nsSMILMilestone mMilestone;
};
// Factory methods
friend nsSMILAnimationController*
NS_NewSMILAnimationController(nsIDocument* aDoc);
nsresult Init(nsIDocument* aDoc);
// Cycle-collection implementation helpers
PR_STATIC_CALLBACK(PLDHashOperator) CompositorTableEntryTraverse(
nsSMILCompositor* aCompositor, void* aArg);
// Returns mDocument's refresh driver, if it's got one.
nsRefreshDriver* GetRefreshDriver();
// Methods for controlling whether we're sampling
void StartSampling(nsRefreshDriver* aRefreshDriver);
void StopSampling(nsRefreshDriver* aRefreshDriver);
@ -243,6 +243,4 @@ protected:
nsAutoPtr<nsSMILCompositorTable> mLastCompositorTable;
};
nsSMILAnimationController* NS_NewSMILAnimationController(nsIDocument *doc);
#endif // NS_SMILANIMATIONCONTROLLER_H_

Просмотреть файл

@ -261,6 +261,14 @@ public:
return SVGPathData::CopyFrom(rhs);
}
PRBool IsIdentity() const {
if (!mElement) {
NS_ABORT_IF_FALSE(IsEmpty(), "target element propagation failure");
return PR_TRUE;
}
return PR_FALSE;
}
/**
* Exposed so that SVGPathData baseVals can be copied to
* SVGPathDataAndOwner objects. Note that callers should also call

Просмотреть файл

@ -37,8 +37,14 @@
#include "SVGPathSegListSMILType.h"
#include "nsSMILValue.h"
#include "SVGPathData.h"
#include "mozilla/Util.h"
#include <math.h>
// Indices of boolean flags within 'arc' segment chunks in path-data arrays
// (where '0' would correspond to the index of the encoded segment type):
#define LARGE_ARC_FLAG_IDX 4
#define SWEEP_FLAG_IDX 5
namespace mozilla {
/*static*/ SVGPathSegListSMILType SVGPathSegListSMILType::sSingleton;
@ -100,8 +106,8 @@ ArcFlagsDiffer(SVGPathDataAndOwner::const_iterator aPathData1,
(SVGPathSegUtils::IsArcType(SVGPathSegUtils::DecodeType(aPathData2[0])),
"ArcFlagsDiffer called with non-arc segment");
return aPathData1[4] != aPathData2[4] || // large arc flag
aPathData1[5] != aPathData2[5]; // sweep flag
return aPathData1[LARGE_ARC_FLAG_IDX] != aPathData2[LARGE_ARC_FLAG_IDX] ||
aPathData1[SWEEP_FLAG_IDX] != aPathData2[SWEEP_FLAG_IDX];
}
enum PathInterpolationResult {
@ -114,7 +120,7 @@ static PathInterpolationResult
CanInterpolate(const SVGPathDataAndOwner& aStart,
const SVGPathDataAndOwner& aEnd)
{
if (aStart.IsEmpty()) {
if (aStart.IsIdentity()) {
return eCanInterpolate;
}
@ -161,39 +167,6 @@ CanInterpolate(const SVGPathDataAndOwner& aStart,
return result;
}
static void
InterpolatePathSegmentData(SVGPathDataAndOwner::const_iterator& aStart,
SVGPathDataAndOwner::const_iterator& aEnd,
SVGPathDataAndOwner::iterator& aResult,
float aUnitDistance)
{
PRUint32 startType = SVGPathSegUtils::DecodeType(*aStart);
PRUint32 endType = SVGPathSegUtils::DecodeType(*aEnd);
NS_ABORT_IF_FALSE
(startType == endType,
"InterpolatePathSegmentData expects segment types to be the same!");
NS_ABORT_IF_FALSE
(!(SVGPathSegUtils::IsArcType(startType) && ArcFlagsDiffer(aStart, aEnd)),
"InterpolatePathSegmentData cannot interpolate arc segments with different flag values!");
PRUint32 argCount = SVGPathSegUtils::ArgCountForType(startType);
// Copy over segment type.
*aResult++ = *aStart++;
++aEnd;
// Interpolate the arguments.
SVGPathDataAndOwner::const_iterator startSegEnd = aStart + argCount;
while (aStart != startSegEnd) {
*aResult = *aStart + (*aEnd - *aStart) * aUnitDistance;
++aStart;
++aEnd;
++aResult;
}
}
enum RelativenessAdjustmentType {
eAbsoluteToRelative,
eRelativeToAbsolute
@ -213,6 +186,134 @@ AdjustSegmentForRelativeness(RelativenessAdjustmentType aAdjustmentType,
}
}
/**
* Helper function for AddWeightedPathSegLists, to add multiples of two
* path-segments of the same type.
*
* NOTE: |aSeg1| is allowed to be nsnull, so we use |aSeg2| as the
* authoritative source of things like segment-type and boolean arc flags.
*
* @param aCoeff1 The coefficient to use on the first segment.
* @param aSeg1 An iterator pointing to the first segment. This can be
* null, which is treated as identity (zero).
* @param aCoeff2 The coefficient to use on the second segment.
* @param aSeg2 An iterator pointing to the second segment.
* @param [out] aResultSeg An iterator pointing to where we should write the
* result of this operation.
*/
static inline void
AddWeightedPathSegs(double aCoeff1,
SVGPathDataAndOwner::const_iterator& aSeg1,
double aCoeff2,
SVGPathDataAndOwner::const_iterator& aSeg2,
SVGPathDataAndOwner::iterator& aResultSeg)
{
NS_ABORT_IF_FALSE(aSeg2, "2nd segment must be non-null");
NS_ABORT_IF_FALSE(aResultSeg, "result segment must be non-null");
PRUint32 segType = SVGPathSegUtils::DecodeType(aSeg2[0]);
NS_ABORT_IF_FALSE(!aSeg1 || SVGPathSegUtils::DecodeType(*aSeg1) == segType,
"unexpected segment type");
// FIRST: Directly copy the arguments that don't make sense to add.
aResultSeg[0] = aSeg2[0]; // encoded segment type
PRBool isArcType = SVGPathSegUtils::IsArcType(segType);
if (isArcType) {
// Copy boolean arc flags.
NS_ABORT_IF_FALSE(!aSeg1 || !ArcFlagsDiffer(aSeg1, aSeg2),
"Expecting arc flags to match");
aResultSeg[LARGE_ARC_FLAG_IDX] = aSeg2[LARGE_ARC_FLAG_IDX];
aResultSeg[SWEEP_FLAG_IDX] = aSeg2[SWEEP_FLAG_IDX];
}
// SECOND: Add the arguments that are supposed to be added.
// (The 1's below are to account for segment type)
PRUint32 numArgs = SVGPathSegUtils::ArgCountForType(segType);
for (PRUint32 i = 1; i < 1 + numArgs; ++i) {
// Need to skip arc flags for arc-type segments. (already handled them)
if (!(isArcType && (i == LARGE_ARC_FLAG_IDX || i == SWEEP_FLAG_IDX))) {
aResultSeg[i] = (aSeg1 ? aCoeff1 * aSeg1[i] : 0.0) + aCoeff2 * aSeg2[i];
}
}
// FINALLY: Shift iterators forward. ("1+" is to include seg-type)
if (aSeg1) {
aSeg1 += 1 + numArgs;
}
aSeg2 += 1 + numArgs;
aResultSeg += 1 + numArgs;
}
/**
* Helper function for Add & Interpolate, to add multiples of two path-segment
* lists.
*
* NOTE: aList1 and aList2 are assumed to have their segment-types and
* segment-count match exactly (unless aList1 is an identity value).
*
* NOTE: aResult, the output list, is expected to either be an identity value
* (in which case we'll grow it) *or* to already have the exactly right length
* (e.g. in cases where aList1 and aResult are actually the same list).
*
* @param aCoeff1 The coefficient to use on the first path segment list.
* @param aList1 The first path segment list. Allowed to be identity.
* @param aCoeff2 The coefficient to use on the second path segment list.
* @param aList2 The second path segment list.
* @param [out] aResultSeg The resulting path segment list. Allowed to be
* identity, in which case we'll grow it to the right
* size. Also allowed to be the same list as aList1.
*/
static void
AddWeightedPathSegLists(double aCoeff1, const SVGPathDataAndOwner& aList1,
double aCoeff2, const SVGPathDataAndOwner& aList2,
SVGPathDataAndOwner& aResult)
{
NS_ABORT_IF_FALSE(aCoeff1 >= 0.0 && aCoeff2 >= 0.0,
"expecting non-negative coefficients");
NS_ABORT_IF_FALSE(!aList2.IsIdentity(),
"expecting 2nd list to be non-identity");
NS_ABORT_IF_FALSE(aList1.IsIdentity() || aList1.Length() == aList2.Length(),
"expecting 1st list to be identity or to have same "
"length as 2nd list");
NS_ABORT_IF_FALSE(aResult.IsIdentity() || aResult.Length() == aList2.Length(),
"expecting result list to be identity or to have same "
"length as 2nd list");
SVGPathDataAndOwner::const_iterator iter1, end1;
if (aList1.IsIdentity()) {
iter1 = end1 = nsnull; // indicate that this is an identity list
} else {
iter1 = aList1.begin();
end1 = aList1.end();
}
SVGPathDataAndOwner::const_iterator iter2 = aList2.begin();
SVGPathDataAndOwner::const_iterator end2 = aList2.end();
// Grow |aResult| if necessary. (NOTE: It's possible that aResult and aList1
// are the same list, so this may implicitly resize aList1. That's fine,
// because in that case, we will have already set iter1 to nsnull above, to
// record that our first operand is an identity value.)
if (aResult.IsIdentity()) {
DebugOnly<PRBool> success = aResult.SetLength(aList2.Length());
NS_ABORT_IF_FALSE(success, "infallible nsTArray::SetLength should succeed");
aResult.SetElement(aList2.Element()); // propagate target element info!
}
SVGPathDataAndOwner::iterator resultIter = aResult.begin();
while ((!iter1 || iter1 != end1) &&
iter2 != end2) {
AddWeightedPathSegs(aCoeff1, iter1,
aCoeff2, iter2,
resultIter);
}
NS_ABORT_IF_FALSE((!iter1 || iter1 == end1) &&
iter2 == end2 &&
resultIter == aResult.end(),
"Very, very bad - path data corrupt");
}
static void
ConvertPathSegmentData(SVGPathDataAndOwner::const_iterator& aStart,
SVGPathDataAndOwner::const_iterator& aEnd,
@ -336,40 +437,32 @@ SVGPathSegListSMILType::Add(nsSMILValue& aDest,
const SVGPathDataAndOwner& valueToAdd =
*static_cast<const SVGPathDataAndOwner*>(aValueToAdd.mU.mPtr);
// Allow addition to empty dest.
if (dest.IsEmpty()) {
return dest.CopyFrom(valueToAdd);
if (valueToAdd.IsIdentity()) { // Adding identity value - no-op
return NS_OK;
}
PathInterpolationResult check = CanInterpolate(dest, valueToAdd);
if (!dest.IsIdentity()) {
// Neither value is identity; make sure they're compatible.
NS_ABORT_IF_FALSE(dest.Element() == valueToAdd.Element(),
"adding values from different elements...?");
if (check == eCannotInterpolate) {
// nsSVGUtils::ReportToConsole - can't add path segment lists with different
// numbers of segments, with arcs with different flag values, or with
// incompatible segment types.
return NS_ERROR_FAILURE;
}
if (check == eRequiresConversion) {
ConvertAllPathSegmentData(dest.begin(), dest.end(),
valueToAdd.begin(), valueToAdd.end(),
dest.begin());
}
PRUint32 i = 0;
while (i < dest.Length()) {
PRUint32 type = SVGPathSegUtils::DecodeType(dest[i]);
i++;
PRUint32 segEnd = i + SVGPathSegUtils::ArgCountForType(type);
for (; i < segEnd; ++i) {
dest[i] += valueToAdd[i] * aCount;
PathInterpolationResult check = CanInterpolate(dest, valueToAdd);
if (check == eCannotInterpolate) {
// nsSVGUtils::ReportToConsole - can't add path segment lists with
// different numbers of segments, with arcs that have different flag
// values, or with incompatible segment types.
return NS_ERROR_FAILURE;
}
if (check == eRequiresConversion) {
// Convert dest, in-place, to match the types in valueToAdd:
ConvertAllPathSegmentData(dest.begin(), dest.end(),
valueToAdd.begin(), valueToAdd.end(),
dest.begin());
}
}
NS_ABORT_IF_FALSE(i == dest.Length(), "Very, very bad - path data corrupt");
AddWeightedPathSegLists(1.0, dest, aCount, valueToAdd, dest);
// For now we only support pure 'to' animation.
// nsSVGUtils::ReportToConsole
return NS_OK;
}
@ -405,6 +498,8 @@ SVGPathSegListSMILType::Interpolate(const nsSMILValue& aStartVal,
*static_cast<const SVGPathDataAndOwner*>(aEndVal.mU.mPtr);
SVGPathDataAndOwner& result =
*static_cast<SVGPathDataAndOwner*>(aResult.mU.mPtr);
NS_ABORT_IF_FALSE(result.IsIdentity(),
"expecting outparam to start out as identity");
PathInterpolationResult check = CanInterpolate(start, end);
@ -415,57 +510,22 @@ SVGPathSegListSMILType::Interpolate(const nsSMILValue& aStartVal,
return NS_ERROR_FAILURE;
}
if (!result.SetLength(end.Length())) {
return NS_ERROR_OUT_OF_MEMORY;
const SVGPathDataAndOwner* startListToUse = &start;
if (check == eRequiresConversion) {
// Can't convert |start| in-place, since it's const. Instead, we copy it
// into |result|, converting the types as we go, and use that as our start.
DebugOnly<PRBool> success = result.SetLength(end.Length());
NS_ABORT_IF_FALSE(success, "infallible nsTArray::SetLength should succeed");
result.SetElement(end.Element()); // propagate target element info!
ConvertAllPathSegmentData(start.begin(), start.end(),
end.begin(), end.end(),
result.begin());
startListToUse = &result;
}
if (start.IsEmpty()) { // identity path
PRUint32 i = 0;
while (i < end.Length()) {
PRUint32 type = SVGPathSegUtils::DecodeType(end[i]);
result[i] = end[i];
i++;
PRUint32 segEnd = i + SVGPathSegUtils::ArgCountForType(type);
if (SVGPathSegUtils::IsArcType(type)) {
result[i] = end[i] * aUnitDistance;
result[i+1] = end[i+1] * aUnitDistance;
result[i+2] = end[i+2] * aUnitDistance;
// boolean args largeArcFlag and sweepFlag must be the same
result[i+3] = end[i+3];
result[i+4] = end[i+4];
result[i+5] = end[i+5] * aUnitDistance;
result[i+6] = end[i+6] * aUnitDistance;
i = segEnd;
} else {
for (; i < segEnd; ++i) {
result[i] = end[i] * aUnitDistance;
}
}
}
NS_ABORT_IF_FALSE(i == end.Length() && i == result.Length(),
"Very, very bad - path data corrupt");
} else {
SVGPathDataAndOwner::const_iterator pStart = start.begin();
SVGPathDataAndOwner::const_iterator pStartDataEnd = start.end();
SVGPathDataAndOwner::const_iterator pEnd = end.begin();
SVGPathDataAndOwner::const_iterator pEndDataEnd = end.end();
SVGPathDataAndOwner::iterator pResult = result.begin();
if (check == eRequiresConversion) {
ConvertAllPathSegmentData(pStart, pStartDataEnd, pEnd, pEndDataEnd,
pResult);
pStart = pResult;
pStartDataEnd = result.end();
}
while (pStart != pStartDataEnd && pEnd != pEndDataEnd) {
InterpolatePathSegmentData(pStart, pEnd, pResult, aUnitDistance);
}
NS_ABORT_IF_FALSE(pStart == pStartDataEnd && pEnd == pEndDataEnd &&
pResult == result.end(),
"Very, very bad - path data corrupt");
}
AddWeightedPathSegLists(1.0 - aUnitDistance, *startListToUse,
aUnitDistance, end, result);
return NS_OK;
}

Просмотреть файл

@ -388,6 +388,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULDocument, nsXMLDocument)
tmp->mPendingOverlayLoadNotifications.EnumerateRead(TraverseObservers, &cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULDocument, nsXMLDocument)
delete tmp->mTemplateBuilderTable;
tmp->mTemplateBuilderTable = nsnull;
//XXX We should probably unlink all the objects we traverse.
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ADDREF_INHERITED(nsXULDocument, nsXMLDocument)
NS_IMPL_RELEASE_INHERITED(nsXULDocument, nsXMLDocument)
@ -1842,6 +1848,9 @@ nsXULDocument::SetTemplateBuilderFor(nsIContent* aContent,
nsIXULTemplateBuilder* aBuilder)
{
if (! mTemplateBuilderTable) {
if (!aBuilder) {
return NS_OK;
}
mTemplateBuilderTable = new BuilderTable;
if (! mTemplateBuilderTable || !mTemplateBuilderTable->Init()) {
mTemplateBuilderTable = nsnull;

Просмотреть файл

@ -202,8 +202,7 @@ public:
nsIAtom* aAttrName,
void* aData);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsXULDocument,
nsXMLDocument)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULDocument, nsXMLDocument)
virtual nsXPCClassInfo* GetClassInfo();
protected:

Просмотреть файл

@ -90,7 +90,8 @@ public:
// nsINativeTreeView: Untrusted code can use us
NS_IMETHOD EnsureNative() { return NS_OK; }
virtual void NodeWillBeDestroyed(const nsINode* aNode);
// nsIMutationObserver
NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
protected:
friend nsresult

Просмотреть файл

@ -45,6 +45,9 @@
var body = "This frame was navigated.";
var target_url = "data:text/html,<html><body>" + body + "</body></html>";
var popup_body = "This is a popup";
var target_popup_url = "data:text/html,<html><body>" + popup_body + "</body></html>";
///////////////////////////////////////////////////////////////////////////
// Functions that navigate frames
///////////////////////////////////////////////////////////////////////////
@ -208,10 +211,12 @@ function xpcWaitForFinishedFrames(callback, numFrames) {
}
function searchForFinishedFrames(win) {
if (escape(unescape(win.location)) == escape(target_url) &&
if ((escape(unescape(win.location)) == escape(target_url) ||
escape(unescape(win.location)) == escape(target_popup_url)) &&
win.document &&
win.document.body &&
win.document.body.textContent == body &&
(win.document.body.textContent == body ||
win.document.body.textContent == popup_body) &&
win.document.readyState == "complete") {
if (!contains(win, finishedWindows)) {
finishedWindows.push(win);

Просмотреть файл

@ -28,7 +28,7 @@ window.onload = function () {
xpcCleanupWindows();
SimpleTest.finish();
}, 3);
}, 6);
}
//opener0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window0", "_blank", "width=10,height=10");

Просмотреть файл

@ -51,8 +51,11 @@
//
// Basic (virtual) BarProp class implementation
//
nsBarProp::nsBarProp() : mBrowserChrome(nsnull)
nsBarProp::nsBarProp(nsGlobalWindow *aWindow)
{
mDOMWindow = aWindow;
nsISupports *supwin = static_cast<nsIScriptGlobalObject *>(aWindow);
mDOMWindowWeakref = do_GetWeakReference(supwin);
}
nsBarProp::~nsBarProp()
@ -73,25 +76,19 @@ NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(nsBarProp)
NS_IMPL_RELEASE(nsBarProp)
NS_IMETHODIMP
nsBarProp::SetWebBrowserChrome(nsIWebBrowserChrome* aBrowserChrome)
{
mBrowserChrome = aBrowserChrome;
return NS_OK;
}
NS_IMETHODIMP
nsBarProp::GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag)
{
*aVisible = PR_FALSE;
NS_ENSURE_TRUE(mBrowserChrome, NS_OK);
nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
NS_ENSURE_TRUE(browserChrome, NS_OK);
PRUint32 chromeFlags;
NS_ENSURE_SUCCESS(mBrowserChrome->GetChromeFlags(&chromeFlags),
NS_ENSURE_SUCCESS(browserChrome->GetChromeFlags(&chromeFlags),
NS_ERROR_FAILURE);
if(chromeFlags & aChromeFlag)
if (chromeFlags & aChromeFlag)
*aVisible = PR_TRUE;
return NS_OK;
@ -100,9 +97,10 @@ nsBarProp::GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag)
NS_IMETHODIMP
nsBarProp::SetVisibleByFlag(PRBool aVisible, PRUint32 aChromeFlag)
{
NS_ENSURE_TRUE(mBrowserChrome, NS_OK);
nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
NS_ENSURE_TRUE(browserChrome, NS_OK);
PRBool enabled = PR_FALSE;
PRBool enabled = PR_FALSE;
nsCOMPtr<nsIScriptSecurityManager>
securityManager(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
@ -113,23 +111,37 @@ nsBarProp::SetVisibleByFlag(PRBool aVisible, PRUint32 aChromeFlag)
PRUint32 chromeFlags;
NS_ENSURE_SUCCESS(mBrowserChrome->GetChromeFlags(&chromeFlags),
NS_ENSURE_SUCCESS(browserChrome->GetChromeFlags(&chromeFlags),
NS_ERROR_FAILURE);
if(aVisible)
if (aVisible)
chromeFlags |= aChromeFlag;
else
chromeFlags &= ~aChromeFlag;
NS_ENSURE_SUCCESS(mBrowserChrome->SetChromeFlags(chromeFlags),
NS_ENSURE_SUCCESS(browserChrome->SetChromeFlags(chromeFlags),
NS_ERROR_FAILURE);
return NS_OK;
}
already_AddRefed<nsIWebBrowserChrome>
nsBarProp::GetBrowserChrome()
{
// Check that the window is still alive.
nsCOMPtr<nsIDOMWindow> domwin(do_QueryReferent(mDOMWindowWeakref));
if (!domwin)
return nsnull;
nsIWebBrowserChrome *browserChrome = nsnull;
mDOMWindow->GetWebBrowserChrome(&browserChrome);
return browserChrome;
}
//
// MenubarProp class implementation
//
nsMenubarProp::nsMenubarProp()
nsMenubarProp::nsMenubarProp(nsGlobalWindow *aWindow)
: nsBarProp(aWindow)
{
}
@ -155,7 +167,8 @@ nsMenubarProp::SetVisible(PRBool aVisible)
// ToolbarProp class implementation
//
nsToolbarProp::nsToolbarProp()
nsToolbarProp::nsToolbarProp(nsGlobalWindow *aWindow)
: nsBarProp(aWindow)
{
}
@ -181,7 +194,8 @@ nsToolbarProp::SetVisible(PRBool aVisible)
// LocationbarProp class implementation
//
nsLocationbarProp::nsLocationbarProp()
nsLocationbarProp::nsLocationbarProp(nsGlobalWindow *aWindow)
: nsBarProp(aWindow)
{
}
@ -209,7 +223,8 @@ nsLocationbarProp::SetVisible(PRBool aVisible)
// PersonalbarProp class implementation
//
nsPersonalbarProp::nsPersonalbarProp()
nsPersonalbarProp::nsPersonalbarProp(nsGlobalWindow *aWindow)
: nsBarProp(aWindow)
{
}
@ -237,7 +252,8 @@ nsPersonalbarProp::SetVisible(PRBool aVisible)
// StatusbarProp class implementation
//
nsStatusbarProp::nsStatusbarProp()
nsStatusbarProp::nsStatusbarProp(nsGlobalWindow *aWindow)
: nsBarProp(aWindow)
{
}
@ -264,10 +280,8 @@ nsStatusbarProp::SetVisible(PRBool aVisible)
//
nsScrollbarsProp::nsScrollbarsProp(nsGlobalWindow *aWindow)
: nsBarProp(aWindow)
{
mDOMWindow = aWindow;
nsISupports *supwin = static_cast<nsIScriptGlobalObject *>(aWindow);
mDOMWindowWeakref = do_GetWeakReference(supwin);
}
nsScrollbarsProp::~nsScrollbarsProp()
@ -341,7 +355,7 @@ nsScrollbarsProp::SetVisible(PRBool aVisible)
}
/* Notably absent is the part where we notify the chrome window using
mBrowserChrome->SetChromeFlags(). Given the possibility of multiple
GetBrowserChrome()->SetChromeFlags(). Given the possibility of multiple
DOM windows (multiple top-level windows, even) within a single
chrome window, the historical concept of a single "has scrollbars"
flag in the chrome is inapplicable, and we can't tell at this level

Просмотреть файл

@ -56,26 +56,34 @@ class nsIWebBrowserChrome;
class nsBarProp : public nsIDOMBarProp
{
public:
nsBarProp();
explicit nsBarProp(nsGlobalWindow *aWindow);
virtual ~nsBarProp();
NS_DECL_ISUPPORTS
NS_IMETHOD SetWebBrowserChrome(nsIWebBrowserChrome* aBrowserChrome);
NS_IMETHOD GetVisibleByFlag(PRBool *aVisible, PRUint32 aChromeFlag);
NS_IMETHOD SetVisibleByFlag(PRBool aVisible, PRUint32 aChromeFlag);
protected:
// Weak Reference
nsIWebBrowserChrome* mBrowserChrome;
already_AddRefed<nsIWebBrowserChrome> GetBrowserChrome();
nsGlobalWindow *mDOMWindow;
nsCOMPtr<nsIWeakReference> mDOMWindowWeakref;
/* Note the odd double reference to the owning global window.
Since the corresponding DOM window nominally owns this object,
but refcounted ownership of this object can be handed off to
owners unknown, we need a weak ref back to the DOM window.
However we also need access to properties of the DOM Window
that aren't available through interfaces. Then it's either
a weak ref and some skanky casting, or this funky double ref.
Funky beats skanky, so here we are. */
};
// Script "menubar" object
class nsMenubarProp : public nsBarProp
{
public:
nsMenubarProp();
explicit nsMenubarProp(nsGlobalWindow *aWindow);
virtual ~nsMenubarProp();
NS_DECL_NSIDOMBARPROP
@ -85,7 +93,7 @@ public:
class nsToolbarProp : public nsBarProp
{
public:
nsToolbarProp();
explicit nsToolbarProp(nsGlobalWindow *aWindow);
virtual ~nsToolbarProp();
NS_DECL_NSIDOMBARPROP
@ -95,7 +103,7 @@ public:
class nsLocationbarProp : public nsBarProp
{
public:
nsLocationbarProp();
explicit nsLocationbarProp(nsGlobalWindow *aWindow);
virtual ~nsLocationbarProp();
NS_DECL_NSIDOMBARPROP
@ -105,7 +113,7 @@ public:
class nsPersonalbarProp : public nsBarProp
{
public:
nsPersonalbarProp();
explicit nsPersonalbarProp(nsGlobalWindow *aWindow);
virtual ~nsPersonalbarProp();
NS_DECL_NSIDOMBARPROP
@ -115,31 +123,20 @@ public:
class nsStatusbarProp : public nsBarProp
{
public:
nsStatusbarProp();
explicit nsStatusbarProp(nsGlobalWindow *aWindow);
virtual ~nsStatusbarProp();
NS_DECL_NSIDOMBARPROP
};
// Script "scrollbars" object
class nsScrollbarsProp : public nsBarProp {
class nsScrollbarsProp : public nsBarProp
{
public:
nsScrollbarsProp(nsGlobalWindow *aWindow);
explicit nsScrollbarsProp(nsGlobalWindow *aWindow);
virtual ~nsScrollbarsProp();
NS_DECL_NSIDOMBARPROP
private:
nsGlobalWindow *mDOMWindow;
nsCOMPtr<nsIWeakReference> mDOMWindowWeakref;
/* Note the odd double reference to the owning global window.
Since the corresponding DOM window nominally owns this object,
yet refcounted ownership of this object can be handed off to
owners unknown, we need a weak ref to back to the DOM window.
However we also need access to properties of the DOM Window
that aren't available through interfaces. Then it's either
a weak ref and some skanky casting, or this funky double ref.
Funky beats skanky, so here we are. */
};
#endif /* nsBarProps_h___ */

Просмотреть файл

@ -1502,7 +1502,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(EventException, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(TouchPoint, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(Touch, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(TouchList, nsDOMTouchListSH,
ARRAY_SCRIPTABLE_FLAGS)
@ -4321,9 +4321,9 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIException)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(TouchPoint, nsIDOMTouchPoint,
DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(Touch, nsIDOMTouch,
!nsDOMTouchEvent::PrefEnabled())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMTouchPoint)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMTouch)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(TouchList, nsIDOMTouchList,

Просмотреть файл

@ -513,7 +513,7 @@ DOMCI_CLASS(IDBDatabaseException)
DOMCI_CLASS(EventException)
DOMCI_CLASS(TouchPoint)
DOMCI_CLASS(Touch)
DOMCI_CLASS(TouchList)
DOMCI_CLASS(TouchEvent)

Просмотреть файл

@ -2428,28 +2428,6 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
if (mScreen)
mScreen->SetDocShell(aDocShell);
// tell our member elements about the new browserwindow
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
GetWebBrowserChrome(getter_AddRefs(browserChrome));
if (mMenubar) {
mMenubar->SetWebBrowserChrome(browserChrome);
}
if (mToolbar) {
mToolbar->SetWebBrowserChrome(browserChrome);
}
if (mLocationbar) {
mLocationbar->SetWebBrowserChrome(browserChrome);
}
if (mPersonalbar) {
mPersonalbar->SetWebBrowserChrome(browserChrome);
}
if (mStatusbar) {
mStatusbar->SetWebBrowserChrome(browserChrome);
}
if (mScrollbars) {
mScrollbars->SetWebBrowserChrome(browserChrome);
}
if (!mDocShell) {
MaybeForgiveSpamCount();
CleanUp(PR_FALSE);
@ -3084,15 +3062,10 @@ nsGlobalWindow::GetMenubar(nsIDOMBarProp** aMenubar)
*aMenubar = nsnull;
if (!mMenubar) {
mMenubar = new nsMenubarProp();
mMenubar = new nsMenubarProp(this);
if (!mMenubar) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
GetWebBrowserChrome(getter_AddRefs(browserChrome));
mMenubar->SetWebBrowserChrome(browserChrome);
}
NS_ADDREF(*aMenubar = mMenubar);
@ -3108,15 +3081,10 @@ nsGlobalWindow::GetToolbar(nsIDOMBarProp** aToolbar)
*aToolbar = nsnull;
if (!mToolbar) {
mToolbar = new nsToolbarProp();
mToolbar = new nsToolbarProp(this);
if (!mToolbar) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
GetWebBrowserChrome(getter_AddRefs(browserChrome));
mToolbar->SetWebBrowserChrome(browserChrome);
}
NS_ADDREF(*aToolbar = mToolbar);
@ -3132,15 +3100,10 @@ nsGlobalWindow::GetLocationbar(nsIDOMBarProp** aLocationbar)
*aLocationbar = nsnull;
if (!mLocationbar) {
mLocationbar = new nsLocationbarProp();
mLocationbar = new nsLocationbarProp(this);
if (!mLocationbar) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
GetWebBrowserChrome(getter_AddRefs(browserChrome));
mLocationbar->SetWebBrowserChrome(browserChrome);
}
NS_ADDREF(*aLocationbar = mLocationbar);
@ -3156,15 +3119,10 @@ nsGlobalWindow::GetPersonalbar(nsIDOMBarProp** aPersonalbar)
*aPersonalbar = nsnull;
if (!mPersonalbar) {
mPersonalbar = new nsPersonalbarProp();
mPersonalbar = new nsPersonalbarProp(this);
if (!mPersonalbar) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
GetWebBrowserChrome(getter_AddRefs(browserChrome));
mPersonalbar->SetWebBrowserChrome(browserChrome);
}
NS_ADDREF(*aPersonalbar = mPersonalbar);
@ -3180,15 +3138,10 @@ nsGlobalWindow::GetStatusbar(nsIDOMBarProp** aStatusbar)
*aStatusbar = nsnull;
if (!mStatusbar) {
mStatusbar = new nsStatusbarProp();
mStatusbar = new nsStatusbarProp(this);
if (!mStatusbar) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
GetWebBrowserChrome(getter_AddRefs(browserChrome));
mStatusbar->SetWebBrowserChrome(browserChrome);
}
NS_ADDREF(*aStatusbar = mStatusbar);
@ -3208,11 +3161,6 @@ nsGlobalWindow::GetScrollbars(nsIDOMBarProp** aScrollbars)
if (!mScrollbars) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
GetWebBrowserChrome(getter_AddRefs(browserChrome));
mScrollbars->SetWebBrowserChrome(browserChrome);
}
NS_ADDREF(*aScrollbars = mScrollbars);

Просмотреть файл

@ -589,6 +589,7 @@ private:
protected:
friend class HashchangeCallback;
friend class nsBarProp;
// Object Management
virtual ~nsGlobalWindow();

Просмотреть файл

@ -42,8 +42,8 @@ interface nsIVariant;
* @see http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html
*/
[scriptable, uuid(f9f200ad-228f-4879-bc9e-a13bd6bb82ef)]
interface nsIDOMTouchPoint : nsISupports {
[scriptable, uuid(98bc0f7d-5bff-4387-9c42-58af54b48dd5)]
interface nsIDOMTouch : nsISupports {
readonly attribute long identifier;
readonly attribute nsIDOMEventTarget target;
readonly attribute long pageX;
@ -61,8 +61,8 @@ interface nsIDOMTouchPoint : nsISupports {
[scriptable, uuid(60706eb7-d50d-4379-b01c-e78e6af84213)]
interface nsIDOMTouchList : nsISupports {
readonly attribute unsigned long length;
nsIDOMTouchPoint item(in unsigned long index);
nsIDOMTouchPoint identifiedPoint(in long identifier);
nsIDOMTouch item(in unsigned long index);
nsIDOMTouch identifiedTouch(in long identifier);
};
[scriptable, uuid(df94b20b-7998-4f00-935c-ee2c6b179711)]
@ -90,19 +90,19 @@ interface nsIDOMTouchEvent : nsIDOMUIEvent {
[scriptable, uuid(922e0f11-28b9-4560-9fb8-869fe143845f)]
interface nsIDOMDocumentTouch : nsISupports {
nsIDOMTouchPoint createTouch([optional] in nsIDOMAbstractView view,
[optional] in nsIDOMEventTarget target,
[optional] in long identifier,
[optional] in long pageX,
[optional] in long pageY,
[optional] in long screenX,
[optional] in long screenY,
[optional] in long clientX,
[optional] in long clientY,
[optional] in long radiusX,
[optional] in long radiusY,
[optional] in float rotationAngle,
[optional] in float force);
nsIDOMTouch createTouch([optional] in nsIDOMAbstractView view,
[optional] in nsIDOMEventTarget target,
[optional] in long identifier,
[optional] in long pageX,
[optional] in long pageY,
[optional] in long screenX,
[optional] in long screenY,
[optional] in long clientX,
[optional] in long clientY,
[optional] in long radiusX,
[optional] in long radiusY,
[optional] in float rotationAngle,
[optional] in float force);
nsIDOMTouchList createTouchList([optional] in nsIVariant aPoints);

Просмотреть файл

@ -284,10 +284,9 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
TakeMinidump(getter_AddRefs(crashDump)) &&
CrashReporter::GetIDFromMinidump(crashDump, dumpID);
if (!dumpID.IsEmpty()) {
props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"),
dumpID);
props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
if (!dumpID.IsEmpty()) {
CrashReporter::AnnotationTable notes;
notes.Init();
notes.Put(NS_LITERAL_CSTRING("ProcessType"), NS_LITERAL_CSTRING("content"));

Просмотреть файл

@ -19,7 +19,7 @@
'Subject implements nsIPropertyBag2.');
if ('nsICrashReporter' in Components.interfaces) {
ok(subject.getPropertyAsAString('dumpID'), "dumpID is present");
ok(subject.getPropertyAsAString('dumpID'), "dumpID is present and not an empty string");
}
Services.obs.removeObserver(crashObserver, 'ipc:content-shutdown');

Просмотреть файл

@ -58,6 +58,7 @@ PEGroupRuleEOF=end of @media or @-moz-document rule
PEGroupRuleNestedAtRule=%1$S rule not allowed within @media or @-moz-document rule.
PEMozDocRuleBadFunc=Expected url(), url-prefix(), or domain() in @-moz-document rule but found '%1$S'.
PEMozDocRuleNotURI=Expected URI in @-moz-document rule but found '%1$S'.
PEMozDocRuleNotString=Expected string in @-moz-document rule regexp() function but found '%1$S'.
PEAtNSPrefixEOF=namespace prefix in @namespace rule
PEAtNSURIEOF=namespace URI in @namespace rule
PEAtNSUnexpected=Unexpected token within @namespace: '%1$S'.

Просмотреть файл

@ -104,6 +104,8 @@ child:
returns (nullable PPluginScriptableObject value, NPError result);
rpc NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result);
rpc NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId()
returns (nsCString plug_id, NPError result);
rpc NPP_HandleEvent(NPRemoteEvent event)
returns (int16_t handled);

Просмотреть файл

@ -586,6 +586,35 @@ PluginInstanceChild::AnswerNPP_GetValue_NPPVpluginScriptableNPObject(
return true;
}
bool
PluginInstanceChild::AnswerNPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId(
nsCString* aPlugId,
NPError* aResult)
{
AssertPluginThread();
#if MOZ_ACCESSIBILITY_ATK
char* plugId = NULL;
NPError result = NPERR_GENERIC_ERROR;
if (mPluginIface->getvalue) {
result = mPluginIface->getvalue(GetNPP(),
NPPVpluginNativeAccessibleAtkPlugId,
&plugId);
}
*aPlugId = nsCString(plugId);
*aResult = result;
return true;
#else
NS_RUNTIMEABORT("shouldn't be called on non-ATK platforms");
return false;
#endif
}
bool
PluginInstanceChild::AnswerNPP_SetValue_NPNVprivateModeBool(const bool& value,
NPError* result)

Просмотреть файл

@ -92,7 +92,9 @@ protected:
virtual bool
AnswerNPP_GetValue_NPPVpluginScriptableNPObject(PPluginScriptableObjectChild** value,
NPError* result);
virtual bool
AnswerNPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId(nsCString* aPlugId,
NPError* aResult);
virtual bool
AnswerNPP_SetValue_NPNVprivateModeBool(const bool& value, NPError* result);

Просмотреть файл

@ -961,6 +961,23 @@ PluginInstanceParent::NPP_GetValue(NPPVariable aVariable,
return NPERR_NO_ERROR;
}
#ifdef MOZ_ACCESSIBILITY_ATK
case NPPVpluginNativeAccessibleAtkPlugId: {
nsCString plugId;
NPError rv;
if (!CallNPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId(&plugId, &rv)) {
return NPERR_GENERIC_ERROR;
}
if (NPERR_NO_ERROR != rv) {
return rv;
}
(*(nsCString*)_retval) = plugId;
return NPERR_NO_ERROR;
}
#endif
default:
PR_LOG(gPluginLog, PR_LOG_WARNING,
("In PluginInstanceParent::NPP_GetValue: Unhandled NPPVariable %i (%s)",

Просмотреть файл

@ -101,11 +101,7 @@ nsDOMDesktopNotification::nsDOMDesktopNotification(const nsAString & title,
nsIURI* uri)
: mTitle(title)
, mDescription(description)
#ifdef ANDROID
, mIconURL((PRUnichar*)L"drawable://desktop_notification")
#else
, mIconURL(iconURL)
#endif
, mURI(uri)
, mAllow(PR_FALSE)
, mShowHasBeenCalled(PR_FALSE)

Просмотреть файл

@ -138,6 +138,8 @@ _TEST_FILES = \
test_bug633133.html \
test_bug642026.html \
test_bug648465.html \
test_window_bar.html \
file_window_bar.html \
$(NULL)
libs:: $(_TEST_FILES)

Просмотреть файл

@ -0,0 +1,7 @@
<html>
<body onload='opener.testWindow(window)'>
Nothing to see here!
</body>
</html>

Просмотреть файл

@ -0,0 +1,80 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=642338
-->
<head>
<title>Test for Bug 642338</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=642338">Mozilla Bug 642338</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/* Test that the following window properties work:
menubar
toolbar
locationbar
personalbar
statusbar
scrollbars
*/
var numWindows = 0;
/* Called when our popup loads. */
function testWindow(w)
{
// w.location.search == '?true' if we expect the bars to be on, and
// '?false' otherwise.
var e = w.location.search == '?true';
is(w.menubar.visible, e, "menubar");
is(w.toolbar.visible, e, "toolbar");
is(w.personalbar.visible, e, "personalbar");
is(w.scrollbars.visible, e, "scrollbars");
// You can't turn these off even if you try, so check that they're true.
is(w.locationbar.visible, true, "locationbar");
is(w.statusbar.visible, true, "statusbar");
w.close();
numWindows++;
if (numWindows == 2) {
// We're done!
SimpleTest.finish();
}
}
SimpleTest.waitForExplicitFinish();
// These will call back into testWindow when they open.
var allBarsWindow =
window.open('file_window_bar.html?true', 'all-bars',
'menubar=yes,toolbar=yes,location=yes,' +
'personalbar=yes,status=yes,scrollbars=yes',
true);
var noBarsWindow =
window.open('file_window_bar.html?false', 'no-bars',
'menubar=no,toolbar=no,location=no,' +
'personalbar=no,status=no,scrollbars=no',
false);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -130,6 +130,8 @@
#include "prmem.h"
#include "nsStreamUtils.h"
#include "nsIPrincipal.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
const PRUnichar nbsp = 160;
@ -1306,12 +1308,21 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
// Try to determine whether we should use a sanitizing fragment sink
PRBool isSafe = PR_FALSE;
if (aSourceDoc) {
nsCOMPtr<nsIDOMDocument> destdomdoc;
rv = GetDocument(getter_AddRefs(destdomdoc));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> destdoc = do_QueryInterface(destdomdoc);
NS_ASSERTION(destdoc, "Where is our destination doc?");
nsCOMPtr<nsIDOMDocument> destdomdoc;
rv = GetDocument(getter_AddRefs(destdomdoc));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> destdoc = do_QueryInterface(destdomdoc);
NS_ASSERTION(destdoc, "Where is our destination doc?");
nsCOMPtr<nsISupports> container = destdoc->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> dsti(do_QueryInterface(container));
nsCOMPtr<nsIDocShellTreeItem> root;
if (dsti)
dsti->GetRootTreeItem(getter_AddRefs(root));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(root));
PRUint32 appType;
if (docShell && NS_SUCCEEDED(docShell->GetAppType(&appType)))
isSafe = appType == nsIDocShell::APP_TYPE_EDITOR;
if (!isSafe && aSourceDoc) {
nsCOMPtr<nsIDocument> srcdoc = do_QueryInterface(aSourceDoc);
NS_ASSERTION(srcdoc, "Where is our source doc?");

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: Java; tab-width: 20; indent-tabs-mode: nil; -*-
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -40,7 +40,11 @@ package org.mozilla.gecko;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.graphics.*;
import android.net.Uri;
import android.util.Log;
import android.widget.RemoteViews;
import java.net.*;
import java.text.NumberFormat;
public class AlertNotification
@ -56,6 +60,7 @@ public class AlertNotification
double mPrevPercent = -1;
String mPrevAlertText = "";
static final double UPDATE_THRESHOLD = .01;
Uri mIconUri = null;
public AlertNotification(Context aContext, int aNotificationId, int aIcon,
String aTitle, String aText, long aWhen) {
@ -80,10 +85,31 @@ public class AlertNotification
mNotificationManager.notify(mId, this);
}
public void setCustomIcon(Uri aIconUri) {
mIconUri = aIconUri;
// Custom view
int layout = R.layout.notification_icon_text;
RemoteViews view = new RemoteViews(GeckoApp.mAppContext.getPackageName(), layout);
try {
URL url = new URL(aIconUri.toString());
Bitmap bm = BitmapFactory.decodeStream(url.openStream());
view.setImageViewBitmap(R.id.notificationImage, bm);
view.setTextViewText(R.id.notificationTitle, mTitle);
if (mText.length() > 0) {
view.setTextViewText(R.id.notificationText, mText);
}
contentView = view;
mNotificationManager.notify(mId, this);
} catch(Exception ex) {
Log.e("GeckoAlert", "failed to create bitmap", ex);
}
}
public void updateProgress(String aAlertText, long aProgress, long aProgressMax) {
if (!mProgressStyle) {
// Custom view
int layout = aAlertText.length() > 0 ? R.layout.notification_progress_text : R.layout.notification_progress;
int layout = aAlertText.length() > 0 ? R.layout.notification_progress_text : R.layout.notification_progress;
RemoteViews view = new RemoteViews(GeckoApp.mAppContext.getPackageName(), layout);
view.setImageViewResource(R.id.notificationImage, mIcon);

Просмотреть файл

@ -265,7 +265,10 @@ abstract public class GeckoApp
}
boolean IsUnsupportedDevice() {
// We don't currently support devices with less than 512Mb of RAM, warn on first run
// We don't currently support devices with less than 512Mb of RAM,
// and want to warn if run on such devices. Most 512Mb devices
// report about 350Mb available, so we check - somewhat arbitrarily -
// for a minimum of 300Mb here.
File meminfo = new File("/proc/meminfo");
try {
BufferedReader br = new BufferedReader(new FileReader(meminfo));
@ -277,7 +280,7 @@ abstract public class GeckoApp
totalMem = st.nextToken();
Log.i("GeckoMemory", "MemTotal: " + Integer.parseInt(totalMem));
return Integer.parseInt(totalMem) <= 524288L;
return Integer.parseInt(totalMem) < 300000L;
} catch (Exception ex) {
// Will catch NullPointerException if totalMem isn't found,
// a NumberFormatException if the token isn't parsible

Просмотреть файл

@ -829,6 +829,7 @@ public class GeckoAppShell
Field f = drawableClass.getField(resource);
icon = f.getInt(null);
} catch (Exception e) {} // just means the resource doesn't exist
imageUri = null;
}
int notificationID = aAlertName.hashCode();
@ -836,8 +837,10 @@ public class GeckoAppShell
// Remove the old notification with the same ID, if any
removeNotification(notificationID);
AlertNotification notification = new AlertNotification(GeckoApp.mAppContext,
notificationID, icon, aAlertTitle, aAlertText, System.currentTimeMillis());
AlertNotification notification =
new AlertNotification(GeckoApp.mAppContext,notificationID, icon,
aAlertTitle, aAlertText,
System.currentTimeMillis());
// The intent to launch when the user clicks the expanded notification
Intent notificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLICK);
@ -850,7 +853,7 @@ public class GeckoAppShell
PendingIntent contentIntent = PendingIntent.getBroadcast(GeckoApp.mAppContext, 0, notificationIntent, 0);
notification.setLatestEventInfo(GeckoApp.mAppContext, aAlertTitle, aAlertText, contentIntent);
notification.setCustomIcon(imageUri);
// The intent to execute when the status entry is deleted by the user with the "Clear All Notifications" button
Intent clearNotificationIntent = new Intent(GeckoApp.ACTION_ALERT_CLEAR);
clearNotificationIntent.setClassName(GeckoApp.mAppContext,

Просмотреть файл

@ -106,6 +106,7 @@ endif
RES_LAYOUT = \
res/layout/notification_progress.xml \
res/layout/notification_progress_text.xml \
res/layout/notification_icon_text.xml \
$(NULL)
RES_VALUES = res/values/colors.xml res/values/themes.xml

Просмотреть файл

@ -0,0 +1,34 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="5dp"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView android:id="@+id/notificationImage"
android:layout_width="25dp"
android:layout_height="25dp"
android:scaleType="fitCenter" />
<TextView android:id="@+id/notificationTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:textStyle="bold"
android:textSize="18sp"
android:paddingLeft="4dp"
android:textColor="#ff000000" />
</LinearLayout>
<TextView android:id="@+id/notificationText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:textColor="#ff000000" />
</LinearLayout>

Просмотреть файл

@ -56,6 +56,9 @@
#include "ThebesLayerBuffer.h"
#include "nsIWidget.h"
#include "ReadbackProcessor.h"
#ifdef MOZ_X11
#include "gfxXlibSurface.h"
#endif
#include "GLContext.h"
@ -1624,12 +1627,6 @@ public:
mShadow = aShadow;
}
virtual void SetBackBufferImage(gfxSharedImageSurface* aBuffer)
{
NS_RUNTIMEABORT("if this default impl is called, |aBuffer| leaks");
}
virtual PRBool SupportsSurfaceDescriptor() const { return PR_FALSE; }
virtual void SetBackBuffer(const SurfaceDescriptor& aBuffer)
{
NS_RUNTIMEABORT("if this default impl is called, |aBuffer| leaks");
@ -1735,12 +1732,6 @@ BasicShadowableContainerLayer::RemoveChild(Layer* aChild)
BasicContainerLayer::RemoveChild(aChild);
}
static PRBool
IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface)
{
return SurfaceDescriptor::T__None != aSurface.type();
}
class BasicShadowableThebesLayer : public BasicThebesLayer,
public BasicShadowableLayer
{
@ -1770,8 +1761,6 @@ public:
virtual ShadowableLayer* AsShadowableLayer() { return this; }
virtual bool MustRetainContent() { return HasShadow(); }
virtual PRBool SupportsSurfaceDescriptor() const { return PR_TRUE; }
void SetBackBufferAndAttrs(const ThebesBuffer& aBuffer,
const nsIntRegion& aValidRegion,
float aXResolution, float aYResolution,
@ -1955,8 +1944,8 @@ public:
}
virtual ~BasicShadowableImageLayer()
{
if (mBackSurface) {
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackSurface);
if (IsSurfaceDescriptorValid(mBackBuffer)) {
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
}
MOZ_COUNT_DTOR(BasicShadowableImageLayer);
}
@ -1971,14 +1960,14 @@ public:
virtual Layer* AsLayer() { return this; }
virtual ShadowableLayer* AsShadowableLayer() { return this; }
virtual void SetBackBufferImage(gfxSharedImageSurface* aBuffer)
virtual void SetBackBuffer(const SurfaceDescriptor& aBuffer)
{
mBackSurface = aBuffer;
mBackBuffer = aBuffer;
}
virtual void Disconnect()
{
mBackSurface = nsnull;
mBackBuffer = SurfaceDescriptor();
BasicShadowableLayer::Disconnect();
}
@ -1988,7 +1977,7 @@ private:
return static_cast<BasicShadowLayerManager*>(mManager);
}
nsRefPtr<gfxSharedImageSurface> mBackSurface;
SurfaceDescriptor mBackBuffer;
};
void
@ -2000,20 +1989,18 @@ BasicShadowableImageLayer::Paint(gfxContext* aContext)
return;
if (oldSize != mSize) {
if (mBackSurface) {
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackSurface);
mBackSurface = nsnull;
if (IsSurfaceDescriptorValid(mBackBuffer)) {
BasicManager()->DestroyedImageBuffer(BasicManager()->Hold(this));
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
}
nsRefPtr<gfxSharedImageSurface> tmpFrontSurface;
SurfaceDescriptor tmpFrontSurface;
// XXX error handling?
if (!BasicManager()->AllocDoubleBuffer(
mSize,
(GetContentFlags() & CONTENT_OPAQUE) ?
gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA,
getter_AddRefs(tmpFrontSurface), getter_AddRefs(mBackSurface)))
&tmpFrontSurface, &mBackBuffer))
NS_RUNTIMEABORT("creating ImageLayer 'front buffer' failed!");
BasicManager()->CreatedImageBuffer(BasicManager()->Hold(this),
@ -2021,13 +2008,15 @@ BasicShadowableImageLayer::Paint(gfxContext* aContext)
tmpFrontSurface);
}
nsRefPtr<gfxContext> tmpCtx = new gfxContext(mBackSurface);
nsRefPtr<gfxASurface> backSurface =
BasicManager()->OpenDescriptor(mBackBuffer);
nsRefPtr<gfxContext> tmpCtx = new gfxContext(backSurface);
PaintContext(pat,
nsIntRegion(nsIntRect(0, 0, mSize.width, mSize.height)),
nsnull, 1.0, tmpCtx);
BasicManager()->PaintedImage(BasicManager()->Hold(this),
mBackSurface);
mBackBuffer);
}
@ -2070,8 +2059,8 @@ public:
}
virtual ~BasicShadowableCanvasLayer()
{
if (mBackBuffer) {
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackBuffer);
if (IsSurfaceDescriptorValid(mBackBuffer)) {
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
}
MOZ_COUNT_DTOR(BasicShadowableCanvasLayer);
}
@ -2087,14 +2076,14 @@ public:
virtual Layer* AsLayer() { return this; }
virtual ShadowableLayer* AsShadowableLayer() { return this; }
virtual void SetBackBufferImage(gfxSharedImageSurface* aBuffer)
virtual void SetBackBuffer(const SurfaceDescriptor& aBuffer)
{
mBackBuffer = aBuffer;
}
virtual void Disconnect()
{
mBackBuffer = nsnull;
mBackBuffer = SurfaceDescriptor();
BasicShadowableLayer::Disconnect();
}
@ -2104,7 +2093,7 @@ private:
return static_cast<BasicShadowLayerManager*>(mManager);
}
nsRefPtr<gfxSharedImageSurface> mBackBuffer;
SurfaceDescriptor mBackBuffer;
};
void
@ -2116,20 +2105,20 @@ BasicShadowableCanvasLayer::Initialize(const Data& aData)
// XXX won't get here currently; need to figure out what to do on
// canvas resizes
if (mBackBuffer) {
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackBuffer);
mBackBuffer = nsnull;
if (IsSurfaceDescriptorValid(mBackBuffer)) {
BasicManager()->ShadowLayerForwarder::DestroySharedSurface(&mBackBuffer);
BasicManager()->DestroyedCanvasBuffer(BasicManager()->Hold(this));
}
nsRefPtr<gfxSharedImageSurface> tmpFrontBuffer;
SurfaceDescriptor tmpFrontBuffer;
// XXX error handling?
if (!BasicManager()->AllocDoubleBuffer(
gfxIntSize(aData.mSize.width, aData.mSize.height),
(GetContentFlags() & CONTENT_OPAQUE) ?
gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA,
getter_AddRefs(tmpFrontBuffer), getter_AddRefs(mBackBuffer)))
&tmpFrontBuffer, &mBackBuffer))
NS_RUNTIMEABORT("creating CanvasLayer back buffer failed!");
BasicManager()->CreatedCanvasBuffer(BasicManager()->Hold(this),
@ -2149,7 +2138,9 @@ BasicShadowableCanvasLayer::Paint(gfxContext* aContext)
// changed areas, much like we do for Thebes layers, as well as
// do all sorts of magic to swap out the surface underneath the
// canvas' thebes/cairo context.
nsRefPtr<gfxContext> tmpCtx = new gfxContext(mBackBuffer);
nsRefPtr<gfxASurface> backSurface =
BasicManager()->OpenDescriptor(mBackBuffer);
nsRefPtr<gfxContext> tmpCtx = new gfxContext(backSurface);
tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
// call BasicCanvasLayer::Paint to draw to our tmp context, because
@ -2442,17 +2433,15 @@ public:
ShadowImageLayer::Disconnect();
}
virtual PRBool Init(gfxSharedImageSurface* front, const nsIntSize& size);
virtual PRBool Init(const SurfaceDescriptor& front, const nsIntSize& size);
virtual already_AddRefed<gfxSharedImageSurface>
Swap(gfxSharedImageSurface* newFront);
virtual void Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack);
virtual void DestroyFrontBuffer()
{
if (mFrontSurface) {
BasicManager()->ShadowLayerManager::DestroySharedSurface(mFrontSurface, mAllocator);
if (IsSurfaceDescriptorValid(mFrontBuffer)) {
BasicManager()->ShadowLayerManager::DestroySharedSurface(&mFrontBuffer, mAllocator);
}
mFrontSurface = nsnull;
}
virtual void Paint(gfxContext* aContext);
@ -2463,36 +2452,36 @@ protected:
return static_cast<BasicShadowLayerManager*>(mManager);
}
// XXX ShmemImage?
nsRefPtr<gfxSharedImageSurface> mFrontSurface;
SurfaceDescriptor mFrontBuffer;
gfxIntSize mSize;
};
PRBool
BasicShadowImageLayer::Init(gfxSharedImageSurface* front,
BasicShadowImageLayer::Init(const SurfaceDescriptor& front,
const nsIntSize& size)
{
mFrontSurface = front;
mFrontBuffer = front;
mSize = gfxIntSize(size.width, size.height);
return PR_TRUE;
}
already_AddRefed<gfxSharedImageSurface>
BasicShadowImageLayer::Swap(gfxSharedImageSurface* newFront)
void
BasicShadowImageLayer::Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack)
{
already_AddRefed<gfxSharedImageSurface> tmp = mFrontSurface.forget();
mFrontSurface = newFront;
return tmp;
*aNewBack = mFrontBuffer;
mFrontBuffer = aNewFront;
}
void
BasicShadowImageLayer::Paint(gfxContext* aContext)
{
if (!mFrontSurface) {
if (!IsSurfaceDescriptorValid(mFrontBuffer)) {
return;
}
nsRefPtr<gfxPattern> pat = new gfxPattern(mFrontSurface);
nsRefPtr<gfxASurface> surface =
BasicManager()->OpenDescriptor(mFrontBuffer);
nsRefPtr<gfxPattern> pat = new gfxPattern(surface);
pat->SetFilter(mFilter);
// The visible region can extend outside the image. If we're not
@ -2546,16 +2535,15 @@ public:
}
virtual void Initialize(const Data& aData);
virtual void Init(const SurfaceDescriptor& aNewFront, const nsIntSize& aSize);
virtual already_AddRefed<gfxSharedImageSurface>
Swap(gfxSharedImageSurface* newFront);
void Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack);
virtual void DestroyFrontBuffer()
{
if (mFrontSurface) {
BasicManager()->ShadowLayerManager::DestroySharedSurface(mFrontSurface, mAllocator);
if (IsSurfaceDescriptorValid(mFrontSurface)) {
BasicManager()->ShadowLayerManager::DestroySharedSurface(&mFrontSurface, mAllocator);
}
mFrontSurface = nsnull;
}
virtual void Paint(gfxContext* aContext);
@ -2566,27 +2554,28 @@ private:
return static_cast<BasicShadowLayerManager*>(mManager);
}
nsRefPtr<gfxSharedImageSurface> mFrontSurface;
SurfaceDescriptor mFrontSurface;
};
void
BasicShadowCanvasLayer::Initialize(const Data& aData)
{
NS_ASSERTION(mFrontSurface == nsnull,
"BasicCanvasLayer::Initialize called twice!");
NS_ASSERTION(aData.mSurface && !aData.mGLContext, "no comprende OpenGL!");
mFrontSurface = static_cast<gfxSharedImageSurface*>(aData.mSurface);
mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height);
NS_RUNTIMEABORT("Incompatibe surface type");
}
already_AddRefed<gfxSharedImageSurface>
BasicShadowCanvasLayer::Swap(gfxSharedImageSurface* newFront)
void
BasicShadowCanvasLayer::Init(const SurfaceDescriptor& aNewFront, const nsIntSize& aSize)
{
already_AddRefed<gfxSharedImageSurface> tmp = mFrontSurface.forget();
mFrontSurface = newFront;
return tmp;
mFrontSurface = aNewFront;
mBounds.SetRect(0, 0, aSize.width, aSize.height);
}
void
BasicShadowCanvasLayer::Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack)
{
*aNewBack = mFrontSurface;
mFrontSurface = aNewFront;
}
void
@ -2595,11 +2584,13 @@ BasicShadowCanvasLayer::Paint(gfxContext* aContext)
NS_ASSERTION(BasicManager()->InDrawing(),
"Can only draw in drawing phase");
if (!mFrontSurface) {
if (!IsSurfaceDescriptorValid(mFrontSurface)) {
return;
}
nsRefPtr<gfxPattern> pat = new gfxPattern(mFrontSurface);
nsRefPtr<gfxASurface> surface =
BasicManager()->OpenDescriptor(mFrontSurface);
nsRefPtr<gfxPattern> pat = new gfxPattern(surface);
pat->SetFilter(mFilter);
pat->SetExtend(gfxPattern::EXTEND_PAD);
@ -2830,17 +2821,7 @@ BasicShadowLayerManager::ForwardTransaction()
const OpBufferSwap& obs = reply.get_OpBufferSwap();
const SurfaceDescriptor& descr = obs.newBackBuffer();
BasicShadowableLayer* layer = GetBasicShadowable(obs);
if (layer->SupportsSurfaceDescriptor()) {
layer->SetBackBuffer(descr);
} else {
if (SurfaceDescriptor::TShmem != descr.type()) {
NS_RUNTIMEABORT("non-Shmem surface sent to a layer that expected one!");
}
nsRefPtr<gfxASurface> imageSurf = OpenDescriptor(descr);
layer->SetBackBufferImage(
static_cast<gfxSharedImageSurface*>(imageSurf.get()));
}
GetBasicShadowable(obs)->SetBackBuffer(descr);
break;
}

Просмотреть файл

@ -102,14 +102,14 @@ struct OpDestroyThebesFrontBuffer { PLayer layer; };
struct OpCreateCanvasBuffer {
PLayer layer;
nsIntSize size;
Shmem initialFront;
SurfaceDescriptor initialFront;
};
struct OpDestroyCanvasFrontBuffer { PLayer layer; };
struct OpCreateImageBuffer {
PLayer layer;
nsIntSize size;
Shmem initialFront;
SurfaceDescriptor initialFront;
};
struct OpDestroyImageFrontBuffer { PLayer layer; };
@ -173,12 +173,12 @@ struct OpPaintThebesBuffer {
struct OpPaintCanvas {
PLayer layer;
Shmem newFrontBuffer;
SurfaceDescriptor newFrontBuffer;
};
struct OpPaintImage {
PLayer layer;
Shmem newFrontBuffer;
SurfaceDescriptor newFrontBuffer;
};

Просмотреть файл

@ -192,7 +192,7 @@ ShadowLayerForwarder::CreatedThebesBuffer(ShadowableLayer* aThebes,
const SurfaceDescriptor& aTempFrontBuffer)
{
OptionalThebesBuffer buffer = null_t();
if (SurfaceDescriptor::T__None != aTempFrontBuffer.type()) {
if (IsSurfaceDescriptorValid(aTempFrontBuffer)) {
buffer = ThebesBuffer(aTempFrontBuffer,
aBufferRect,
nsIntPoint(0, 0));
@ -207,21 +207,21 @@ ShadowLayerForwarder::CreatedThebesBuffer(ShadowableLayer* aThebes,
void
ShadowLayerForwarder::CreatedImageBuffer(ShadowableLayer* aImage,
nsIntSize aSize,
gfxSharedImageSurface* aTempFrontSurface)
const SurfaceDescriptor& aTempFrontSurface)
{
mTxn->AddEdit(OpCreateImageBuffer(NULL, Shadow(aImage),
aSize,
aTempFrontSurface->GetShmem()));
aTempFrontSurface));
}
void
ShadowLayerForwarder::CreatedCanvasBuffer(ShadowableLayer* aCanvas,
nsIntSize aSize,
gfxSharedImageSurface* aTempFrontSurface)
const SurfaceDescriptor& aTempFrontSurface)
{
mTxn->AddEdit(OpCreateCanvasBuffer(NULL, Shadow(aCanvas),
aSize,
aTempFrontSurface->GetShmem()));
aTempFrontSurface));
}
void
@ -291,17 +291,17 @@ ShadowLayerForwarder::PaintedThebesBuffer(ShadowableLayer* aThebes,
}
void
ShadowLayerForwarder::PaintedImage(ShadowableLayer* aImage,
gfxSharedImageSurface* aNewFrontSurface)
const SurfaceDescriptor& aNewFrontSurface)
{
mTxn->AddPaint(OpPaintImage(NULL, Shadow(aImage),
aNewFrontSurface->GetShmem()));
aNewFrontSurface));
}
void
ShadowLayerForwarder::PaintedCanvas(ShadowableLayer* aCanvas,
gfxSharedImageSurface* aNewFrontSurface)
const SurfaceDescriptor& aNewFrontSurface)
{
mTxn->AddPaint(OpPaintCanvas(NULL, Shadow(aCanvas),
aNewFrontSurface->GetShmem()));
aNewFrontSurface));
}
PRBool
@ -636,5 +636,11 @@ ShadowLayerManager::PlatformSyncBeforeReplyUpdate()
#endif // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
PRBool
IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface)
{
return SurfaceDescriptor::T__None != aSurface.type();
}
} // namespace layers
} // namespace mozilla

Просмотреть файл

@ -165,10 +165,10 @@ public:
*/
void CreatedImageBuffer(ShadowableLayer* aImage,
nsIntSize aSize,
gfxSharedImageSurface* aInitialFrontSurface);
const SurfaceDescriptor& aInitialFrontSurface);
void CreatedCanvasBuffer(ShadowableLayer* aCanvas,
nsIntSize aSize,
gfxSharedImageSurface* aInitialFrontSurface);
const SurfaceDescriptor& aInitialFrontSurface);
/**
* The specified layer is destroying its buffers.
@ -225,9 +225,9 @@ public:
* ImageLayers. This is slow, and will be optimized.
*/
void PaintedImage(ShadowableLayer* aImage,
gfxSharedImageSurface* aNewFrontSurface);
const SurfaceDescriptor& aNewFrontSurface);
void PaintedCanvas(ShadowableLayer* aCanvas,
gfxSharedImageSurface* aNewFrontSurface);
const SurfaceDescriptor& aNewFrontSurface);
/**
* End the current transaction and forward it to ShadowLayerManager.
@ -569,6 +569,17 @@ class ShadowCanvasLayer : public ShadowLayer,
public CanvasLayer
{
public:
/**
* CONSTRUCTION PHASE ONLY
*
* Initialize this with a (temporary) front surface with the given
* size. This is expected to be followed with a Swap() in the same
* transaction to bring in real pixels. Init() may only be called
* once.
*/
virtual void Init(const SurfaceDescriptor& front, const nsIntSize& aSize) = 0;
/**
* CONSTRUCTION PHASE ONLY
*
@ -576,8 +587,7 @@ public:
* out the old front surface (the new back surface for the remote
* layer).
*/
virtual already_AddRefed<gfxSharedImageSurface>
Swap(gfxSharedImageSurface* aNewFront) = 0;
virtual void Swap(const SurfaceDescriptor& aNewFront, SurfaceDescriptor* aNewBack) = 0;
/**
* CONSTRUCTION PHASE ONLY
@ -609,14 +619,13 @@ public:
* transaction to bring in real pixels. Init() may only be called
* once.
*/
virtual PRBool Init(gfxSharedImageSurface* aFront, const nsIntSize& aSize) = 0;
virtual PRBool Init(const SurfaceDescriptor& front, const nsIntSize& aSize) = 0;
/**
* CONSTRUCTION PHASE ONLY
* @see ShadowCanvasLayer::Swap
*/
virtual already_AddRefed<gfxSharedImageSurface>
Swap(gfxSharedImageSurface* newFront) = 0;
virtual void Swap(const SurfaceDescriptor& aFront, SurfaceDescriptor* aNewBack) = 0;
/**
* CONSTRUCTION PHASE ONLY
@ -650,6 +659,7 @@ protected:
{}
};
PRBool IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface);
} // namespace layers
} // namespace mozilla

Просмотреть файл

@ -222,13 +222,8 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const OpCreateCanvasBuffer& ocb = edit.get_OpCreateCanvasBuffer();
ShadowCanvasLayer* canvas = static_cast<ShadowCanvasLayer*>(
AsShadowLayer(ocb)->AsLayer());
nsRefPtr<gfxSharedImageSurface> front =
gfxSharedImageSurface::Open(ocb.initialFront());
CanvasLayer::Data data;
data.mSurface = front;
data.mSize = ocb.size();
canvas->Initialize(data);
canvas->Init(ocb.initialFront(), ocb.size());
break;
}
@ -239,9 +234,7 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
ShadowImageLayer* image = static_cast<ShadowImageLayer*>(
AsShadowLayer(ocb)->AsLayer());
nsRefPtr<gfxSharedImageSurface> surf =
gfxSharedImageSurface::Open(ocb.initialFront());
image->Init(surf, ocb.size());
image->Init(ocb.initialFront(), ocb.size());
break;
}
@ -416,17 +409,17 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
ShadowCanvasLayer* canvas =
static_cast<ShadowCanvasLayer*>(shadow->AsLayer());
nsRefPtr<gfxSharedImageSurface> newFront =
gfxSharedImageSurface::Open(op.newFrontBuffer());
nsRefPtr<gfxSharedImageSurface> newBack = canvas->Swap(newFront);
SurfaceDescriptor newFront = op.newFrontBuffer();
SurfaceDescriptor newBack;
canvas->Swap(op.newFrontBuffer(), &newBack);
if (newFront == newBack) {
newFront.forget();
newFront = SurfaceDescriptor();
}
canvas->Updated();
replyv.push_back(OpBufferSwap(shadow, NULL,
newBack->GetShmem()));
newBack));
break;
}
@ -438,15 +431,15 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
ShadowImageLayer* image =
static_cast<ShadowImageLayer*>(shadow->AsLayer());
nsRefPtr<gfxSharedImageSurface> newFront =
gfxSharedImageSurface::Open(op.newFrontBuffer());
nsRefPtr<gfxSharedImageSurface> newBack = image->Swap(newFront);
SurfaceDescriptor newFront = op.newFrontBuffer();
SurfaceDescriptor newBack;
image->Swap(op.newFrontBuffer(), &newBack);
if (newFront == newBack) {
newFront.forget();
newFront = SurfaceDescriptor();
}
replyv.push_back(OpBufferSwap(shadow, NULL,
newBack->GetShmem()));
newBack));
break;
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше