This commit is contained in:
Richard Newman 2012-01-17 11:05:57 -08:00
Родитель 2388a58761 708edb326d
Коммит d8c421b577
511 изменённых файлов: 14384 добавлений и 9150 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -39,3 +39,9 @@ js/src/tests/results-*.txt
# Java HTML5 parser classes
parser/html/java/htmlparser/
parser/html/java/javaparser/
# Ignore the files and directory that Eclipse IDE creates
/.project
/.cproject
/.settings/

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

@ -39,3 +39,9 @@ _OPT\.OBJ/
# SVN directories
\.svn/
# Ignore the files and directory that Eclipse IDE creates
^\.project$
^\.cproject$
^\.settings$

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

@ -441,13 +441,9 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
interfacesBits |= 1 << MAI_INTERFACE_VALUE;
}
//nsIAccessibleDocument
nsCOMPtr<nsIAccessibleDocument> accessInterfaceDocument;
QueryInterface(NS_GET_IID(nsIAccessibleDocument),
getter_AddRefs(accessInterfaceDocument));
if (accessInterfaceDocument) {
// document accessible
if (IsDoc())
interfacesBits |= 1 << MAI_INTERFACE_DOCUMENT;
}
if (IsImageAccessible())
interfacesBits |= 1 << MAI_INTERFACE_IMAGE;

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

@ -896,6 +896,8 @@ PreInit()
dbus_connection_set_exit_on_disconnect(bus, FALSE);
static const char* iface = "org.a11y.Status";
static const char* member = "IsEnabled";
DBusMessage *message;
message = dbus_message_new_method_call("org.a11y.Bus", "/org/a11y/bus",
"org.freedesktop.DBus.Properties",
@ -903,8 +905,6 @@ PreInit()
if (!message)
goto dbus_done;
static const char* iface = "org.a11y.Status";
static const char* member = "IsEnabled";
dbus_message_append_args(message, DBUS_TYPE_STRING, &iface,
DBUS_TYPE_STRING, &member, DBUS_TYPE_INVALID);
dbus_connection_send_with_reply(bus, message, &sPendingCall, 1000);

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

@ -37,12 +37,22 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibleWrap.h"
#include "nsMaiInterfaceDocument.h"
const char *const kDocTypeName = "W3C-doctype";
const char *const kDocUrlName = "DocURL";
const char *const kMimeTypeName = "MimeType";
#include "nsAccessibleWrap.h"
#include "nsDocAccessible.h"
static const char* const kDocTypeName = "W3C-doctype";
static const char* const kDocUrlName = "DocURL";
static const char* const kMimeTypeName = "MimeType";
// below functions are vfuncs on an ATK interface so they need to be C call
extern "C" {
static const gchar* getDocumentLocaleCB(AtkDocument* aDocument);
static AtkAttributeSet* getDocumentAttributesCB(AtkDocument* aDocument);
static const gchar* getDocumentAttributeValueCB(AtkDocument* aDocument,
const gchar* aAttrName);
void
documentInterfaceInitCB(AtkDocumentIface *aIface)
@ -64,26 +74,21 @@ documentInterfaceInitCB(AtkDocumentIface *aIface)
const gchar *
getDocumentLocaleCB(AtkDocument *aDocument)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap)
return nsnull;
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessNode> docAccessNode;
accWrap->QueryInterface(NS_GET_IID(nsIAccessNode),
getter_AddRefs(docAccessNode));
NS_ENSURE_TRUE(docAccessNode, nsnull);
nsAutoString locale;
docAccessNode->GetLanguage(locale);
if (locale.IsEmpty()) {
return nsnull;
}
return nsAccessibleWrap::ReturnString(locale);
nsAutoString locale;
accWrap->GetLanguage(locale);
return locale.IsEmpty() ? nsnull : nsAccessibleWrap::ReturnString(locale);
}
static inline GSList *
prependToList(GSList *aList, const char *const aName, const nsAutoString &aValue)
{
if (aValue.IsEmpty())
return aList;
// libspi will free these
AtkAttribute *atkAttr = (AtkAttribute *)g_malloc(sizeof(AtkAttribute));
atkAttr->name = g_strdup(aName);
@ -94,66 +99,52 @@ prependToList(GSList *aList, const char *const aName, const nsAutoString &aValue
AtkAttributeSet *
getDocumentAttributesCB(AtkDocument *aDocument)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap)
return nsnull;
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap || !accWrap->IsDoc())
return nsnull;
nsCOMPtr<nsIAccessibleDocument> accDocument;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument),
getter_AddRefs(accDocument));
NS_ENSURE_TRUE(accDocument, nsnull);
// according to atkobject.h, AtkAttributeSet is a GSList
GSList* attributes = nsnull;
nsDocAccessible* document = accWrap->AsDoc();
nsAutoString aURL;
nsresult rv = document->GetURL(aURL);
if (NS_SUCCEEDED(rv))
attributes = prependToList(attributes, kDocUrlName, aURL);
// according to atkobject.h, AtkAttributeSet is a GSList
GSList *attributes = nsnull;
nsAutoString aW3CDocType;
rv = document->GetDocType(aW3CDocType);
if (NS_SUCCEEDED(rv))
attributes = prependToList(attributes, kDocTypeName, aW3CDocType);
nsAutoString aURL;
nsresult rv = accDocument->GetURL(aURL);
if (NS_SUCCEEDED(rv)) {
attributes = prependToList(attributes, kDocUrlName, aURL);
}
nsAutoString aW3CDocType;
rv = accDocument->GetDocType(aW3CDocType);
if (NS_SUCCEEDED(rv)) {
attributes = prependToList(attributes, kDocTypeName, aW3CDocType);
}
nsAutoString aMimeType;
rv = accDocument->GetMimeType(aMimeType);
if (NS_SUCCEEDED(rv)) {
attributes = prependToList(attributes, kMimeTypeName, aMimeType);
}
return attributes;
nsAutoString aMimeType;
rv = document->GetMimeType(aMimeType);
if (NS_SUCCEEDED(rv))
attributes = prependToList(attributes, kMimeTypeName, aMimeType);
return attributes;
}
const gchar *
getDocumentAttributeValueCB(AtkDocument *aDocument,
const gchar *aAttrName)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap)
return nsnull;
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
if (!accWrap || !accWrap->IsDoc())
return nsnull;
nsCOMPtr<nsIAccessibleDocument> accDocument;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument),
getter_AddRefs(accDocument));
NS_ENSURE_TRUE(accDocument, nsnull);
nsDocAccessible* document = accWrap->AsDoc();
nsresult rv;
nsAutoString attrValue;
if (!strcasecmp(aAttrName, kDocTypeName))
rv = document->GetDocType(attrValue);
else if (!strcasecmp(aAttrName, kDocUrlName))
rv = document->GetURL(attrValue);
else if (!strcasecmp(aAttrName, kMimeTypeName))
rv = document->GetMimeType(attrValue);
else
return nsnull;
nsresult rv;
nsAutoString attrValue;
if (!g_ascii_strcasecmp(aAttrName, kDocTypeName)) {
rv = accDocument->GetDocType(attrValue);
NS_ENSURE_SUCCESS(rv, nsnull);
}
else if (!g_ascii_strcasecmp(aAttrName, kDocUrlName)) {
rv = accDocument->GetURL(attrValue);
NS_ENSURE_SUCCESS(rv, nsnull);
}
else if (!g_ascii_strcasecmp(aAttrName, kMimeTypeName)) {
rv = accDocument->GetMimeType(attrValue);
NS_ENSURE_SUCCESS(rv, nsnull);
}
else {
return nsnull;
}
return nsAccessibleWrap::ReturnString(attrValue);
NS_ENSURE_SUCCESS(rv, nsnull);
return attrValue.IsEmpty() ? nsnull : nsAccessibleWrap::ReturnString(attrValue);
}
}

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

@ -41,16 +41,11 @@
#define __MAI_INTERFACE_DOCUMENT_H__
#include "nsMai.h"
#include "nsIAccessibleDocument.h"
G_BEGIN_DECLS
/* document interface callbacks */
void documentInterfaceInitCB(AtkDocumentIface *aIface);
AtkAttributeSet* getDocumentAttributesCB(AtkDocument *aDocument);
const gchar* getDocumentLocaleCB(AtkDocument *aDocument);
const gchar* getDocumentAttributeValueCB(AtkDocument *aDocument,
const gchar *aAttrName);
G_END_DECLS

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

@ -38,7 +38,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceHypertext.h"
#include "nsIAccessibleDocument.h"
#include "nsHyperTextAccessible.h"
void

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

@ -608,15 +608,12 @@ nsAccUtils::GetLiveAttrValue(PRUint32 aRule, nsAString& aValue)
bool
nsAccUtils::IsTextInterfaceSupportCorrect(nsAccessible *aAccessible)
{
bool foundText = false;
nsCOMPtr<nsIAccessibleDocument> accDoc = do_QueryObject(aAccessible);
if (accDoc) {
// Don't test for accessible docs, it makes us create accessibles too
// early and fire mutation events before we need to
// Don't test for accessible docs, it makes us create accessibles too
// early and fire mutation events before we need to
if (aAccessible->IsDoc())
return true;
}
bool foundText = false;
PRInt32 childCount = aAccessible->GetChildCount();
for (PRint32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *child = GetChildAt(childIdx);

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

@ -41,7 +41,6 @@
#include "nsIAccessible.h"
#include "nsIAccessNode.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleRole.h"
#include "nsIAccessibleText.h"
#include "nsIAccessibleTable.h"

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

@ -47,7 +47,6 @@
#include "nsHashtable.h"
#include "nsAccessibilityService.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsIAccessibleDocument.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocument.h"

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

@ -1006,7 +1006,7 @@ NS_IMETHODIMP nsAccessible::SetSelected(bool aSelect)
return NS_ERROR_FAILURE;
if (State() & states::SELECTABLE) {
nsCOMPtr<nsIAccessible> multiSelect =
nsAccessible* multiSelect =
nsAccUtils::GetMultiSelectableContainer(mContent);
if (!multiSelect) {
return aSelect ? TakeFocus() : NS_ERROR_FAILURE;
@ -1034,12 +1034,11 @@ NS_IMETHODIMP nsAccessible::TakeSelection()
return NS_ERROR_FAILURE;
if (State() & states::SELECTABLE) {
nsCOMPtr<nsIAccessible> multiSelect =
nsAccessible* multiSelect =
nsAccUtils::GetMultiSelectableContainer(mContent);
if (multiSelect) {
nsCOMPtr<nsIAccessibleSelectable> selectable = do_QueryInterface(multiSelect);
selectable->ClearSelection();
}
if (multiSelect)
multiSelect->ClearSelection();
return SetSelected(true);
}

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

@ -41,7 +41,6 @@
#include "nsCaretAccessible.h"
#include "nsDocAccessibleWrap.h"
#include "nsIAccessibleDocument.h"
#ifdef MOZ_XUL
#include "nsXULTreeAccessible.h"
#endif

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

@ -48,7 +48,6 @@
#include "ia2AccessibleRelation.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleEvent.h"
#include "nsIAccessibleRelation.h"
#include "nsIAccessibleWin32Object.h"

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

@ -50,6 +50,7 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \
XULSelectControlAccessible.cpp \
nsXULAlertAccessible.cpp \
nsXULColorPickerAccessible.cpp \
nsXULComboboxAccessible.cpp \

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

@ -0,0 +1,309 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** 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
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2012
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jignesh Kakadiya (jigneshhk1992@gmail.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of 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 "XULSelectControlAccessible.h"
#include "nsAccessibilityService.h"
#include "nsDocAccessible.h"
#include "nsIDOMXULContainerElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULElement.h"
#include "nsIMutableArray.h"
#include "nsIServiceManager.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// XULSelectControlAccessible
////////////////////////////////////////////////////////////////////////////////
XULSelectControlAccessible::
XULSelectControlAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsAccessibleWrap(aContent, aShell)
{
mSelectControl = do_QueryInterface(aContent);
}
////////////////////////////////////////////////////////////////////////////////
// XULSelectControlAccessible: nsAccessNode
void
XULSelectControlAccessible::Shutdown()
{
mSelectControl = nsnull;
nsAccessibleWrap::Shutdown();
}
////////////////////////////////////////////////////////////////////////////////
// XULSelectControlAccessible: SelectAccessible
bool
XULSelectControlAccessible::IsSelect()
{
return !!mSelectControl;
}
// Interface methods
already_AddRefed<nsIArray>
XULSelectControlAccessible::SelectedItems()
{
nsCOMPtr<nsIMutableArray> selectedItems =
do_CreateInstance(NS_ARRAY_CONTRACTID);
if (!selectedItems)
return nsnull;
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect =
do_QueryInterface(mSelectControl);
if (xulMultiSelect) {
PRInt32 length = 0;
xulMultiSelect->GetSelectedCount(&length);
for (PRInt32 index = 0; index < length; index++) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
xulMultiSelect->GetSelectedItem(index, getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
nsAccessible* item =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
false);
}
} else { // Single select?
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
mSelectControl->GetSelectedItem(getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
if(itemNode) {
nsAccessible* item =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
false);
}
}
nsIMutableArray* items = nsnull;
selectedItems.forget(&items);
return items;
}
nsAccessible*
XULSelectControlAccessible::GetSelectedItem(PRUint32 aIndex)
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
if (multiSelectControl)
multiSelectControl->GetSelectedItem(aIndex, getter_AddRefs(itemElm));
else if (aIndex == 0)
mSelectControl->GetSelectedItem(getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
return itemNode ?
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell) : nsnull;
}
PRUint32
XULSelectControlAccessible::SelectedItemCount()
{
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl) {
PRInt32 count = 0;
multiSelectControl->GetSelectedCount(&count);
return count;
}
// For XUL single-select control/menulist
PRInt32 index;
mSelectControl->GetSelectedIndex(&index);
return (index >= 0) ? 1 : 0;
}
bool
XULSelectControlAccessible::AddItemToSelection(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
if (isItemSelected)
return true;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->AddItemToSelection(itemElm);
else
mSelectControl->SetSelectedItem(itemElm);
return true;
}
bool
XULSelectControlAccessible::RemoveItemFromSelection(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
if (!isItemSelected)
return true;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->RemoveItemFromSelection(itemElm);
else
mSelectControl->SetSelectedItem(nsnull);
return true;
}
bool
XULSelectControlAccessible::IsItemSelected(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
return isItemSelected;
}
bool
XULSelectControlAccessible::UnselectAll()
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
multiSelectControl ?
multiSelectControl->ClearSelection() : mSelectControl->SetSelectedIndex(-1);
return true;
}
bool
XULSelectControlAccessible::SelectAll()
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl) {
multiSelectControl->SelectAll();
return true;
}
// otherwise, don't support this method
return false;
}
////////////////////////////////////////////////////////////////////////////////
// XULSelectControlAccessible: Widgets
nsAccessible*
XULSelectControlAccessible::CurrentItem()
{
if (!mSelectControl)
return nsnull;
nsCOMPtr<nsIDOMXULSelectControlItemElement> currentItemElm;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->GetCurrentItem(getter_AddRefs(currentItemElm));
else
mSelectControl->GetSelectedItem(getter_AddRefs(currentItemElm));
nsCOMPtr<nsINode> DOMNode;
if (currentItemElm)
DOMNode = do_QueryInterface(currentItemElm);
if (DOMNode) {
nsDocAccessible* document = GetDocAccessible();
if (document)
return document->GetAccessible(DOMNode);
}
return nsnull;
}
void
XULSelectControlAccessible::SetCurrentItem(nsAccessible* aItem)
{
if (!mSelectControl)
return;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(aItem->GetContent());
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->SetCurrentItem(itemElm);
else
mSelectControl->SetSelectedItem(itemElm);
}

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

@ -0,0 +1,80 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** 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
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2012
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jignesh Kakadiya (jigneshhk1992@gmail.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _XULSelectControlAccessible_H_
#define _XULSelectControlAccessible_H_
#include "nsAccessibleWrap.h"
#include "nsIDOMXULSelectCntrlEl.h"
/**
* The basic implementation of accessible selection for XUL select controls.
*/
class XULSelectControlAccessible : public nsAccessibleWrap
{
public:
XULSelectControlAccessible(nsIContent *aContent, nsIWeakReference *aShell);
virtual ~XULSelectControlAccessible() {}
// nsAccessNode
virtual void Shutdown();
// SelectAccessible
virtual bool IsSelect();
virtual already_AddRefed<nsIArray> SelectedItems();
virtual PRUint32 SelectedItemCount();
virtual nsAccessible* GetSelectedItem(PRUint32 aIndex);
virtual bool IsItemSelected(PRUint32 aIndex);
virtual bool AddItemToSelection(PRUint32 aIndex);
virtual bool RemoveItemFromSelection(PRUint32 aIndex);
virtual bool SelectAll();
virtual bool UnselectAll();
// Widgets
virtual nsAccessible* CurrentItem();
virtual void SetCurrentItem(nsAccessible* aItem);
protected:
// nsIDOMXULMultiSelectControlElement inherits from this, so we'll always have
// one of these if the widget is valid and not defunct
nsCOMPtr<nsIDOMXULSelectControlElement> mSelectControl;
};
#endif

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

@ -559,7 +559,7 @@ nsXULRadioButtonAccessible::ContainerWidget() const
nsXULRadioGroupAccessible::
nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsXULSelectableAccessible(aContent, aShell)
XULSelectControlAccessible(aContent, aShell)
{
}

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

@ -43,8 +43,8 @@
// NOTE: alphabetically ordered
#include "nsAccessibleWrap.h"
#include "nsFormControlAccessible.h"
#include "nsXULMenuAccessible.h"
#include "nsHyperTextAccessibleWrap.h"
#include "XULSelectControlAccessible.h"
/**
* Used for XUL progressmeter element.
@ -173,7 +173,7 @@ public:
/**
* Used for XUL radiogroup element.
*/
class nsXULRadioGroupAccessible : public nsXULSelectableAccessible
class nsXULRadioGroupAccessible : public XULSelectControlAccessible
{
public:
nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
@ -284,5 +284,5 @@ protected:
};
#endif
#endif

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

@ -133,7 +133,7 @@ nsXULColumnItemAccessible::DoAction(PRUint8 aIndex)
nsXULListboxAccessible::
nsXULListboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsXULSelectableAccessible(aContent, aShell)
XULSelectControlAccessible(aContent, aShell)
{
nsIContent* parentContent = mContent->GetParent();
if (parentContent) {
@ -144,13 +144,13 @@ nsXULListboxAccessible::
}
}
NS_IMPL_ADDREF_INHERITED(nsXULListboxAccessible, nsXULSelectableAccessible)
NS_IMPL_RELEASE_INHERITED(nsXULListboxAccessible, nsXULSelectableAccessible)
NS_IMPL_ADDREF_INHERITED(nsXULListboxAccessible, XULSelectControlAccessible)
NS_IMPL_RELEASE_INHERITED(nsXULListboxAccessible, XULSelectControlAccessible)
nsresult
nsXULListboxAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
nsresult rv = nsXULSelectableAccessible::QueryInterface(aIID, aInstancePtr);
nsresult rv = XULSelectControlAccessible::QueryInterface(aIID, aInstancePtr);
if (*aInstancePtr)
return rv;

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

@ -45,6 +45,7 @@
#include "nsCOMPtr.h"
#include "nsXULMenuAccessible.h"
#include "nsBaseWidgetAccessible.h"
#include "XULSelectControlAccessible.h"
class nsIWeakReference;
@ -88,7 +89,7 @@ public:
/*
* A class the represents the XUL Listbox widget.
*/
class nsXULListboxAccessible : public nsXULSelectableAccessible,
class nsXULListboxAccessible : public XULSelectControlAccessible,
public nsIAccessibleTable
{
public:

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

@ -66,259 +66,6 @@
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsXULSelectableAccessible
////////////////////////////////////////////////////////////////////////////////
nsXULSelectableAccessible::
nsXULSelectableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsAccessibleWrap(aContent, aShell)
{
mSelectControl = do_QueryInterface(aContent);
}
////////////////////////////////////////////////////////////////////////////////
// nsXULSelectableAccessible: nsAccessNode
void
nsXULSelectableAccessible::Shutdown()
{
mSelectControl = nsnull;
nsAccessibleWrap::Shutdown();
}
////////////////////////////////////////////////////////////////////////////////
// nsXULSelectableAccessible: SelectAccessible
bool
nsXULSelectableAccessible::IsSelect()
{
return !!mSelectControl;
}
// Interface methods
already_AddRefed<nsIArray>
nsXULSelectableAccessible::SelectedItems()
{
nsCOMPtr<nsIMutableArray> selectedItems =
do_CreateInstance(NS_ARRAY_CONTRACTID);
if (!selectedItems)
return nsnull;
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect =
do_QueryInterface(mSelectControl);
if (xulMultiSelect) {
PRInt32 length = 0;
xulMultiSelect->GetSelectedCount(&length);
for (PRInt32 index = 0; index < length; index++) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
xulMultiSelect->GetSelectedItem(index, getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
nsAccessible* item =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
false);
}
}
else { // Single select?
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
mSelectControl->GetSelectedItem(getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
if(itemNode) {
nsAccessible* item =
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
false);
}
}
nsIMutableArray* items = nsnull;
selectedItems.forget(&items);
return items;
}
nsAccessible*
nsXULSelectableAccessible::GetSelectedItem(PRUint32 aIndex)
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
if (multiSelectControl)
multiSelectControl->GetSelectedItem(aIndex, getter_AddRefs(itemElm));
else if (aIndex == 0)
mSelectControl->GetSelectedItem(getter_AddRefs(itemElm));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
return itemNode ?
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell) : nsnull;
}
PRUint32
nsXULSelectableAccessible::SelectedItemCount()
{
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl) {
PRInt32 count = 0;
multiSelectControl->GetSelectedCount(&count);
return count;
}
// For XUL single-select control/menulist
PRInt32 index;
mSelectControl->GetSelectedIndex(&index);
return (index >= 0) ? 1 : 0;
}
bool
nsXULSelectableAccessible::AddItemToSelection(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
if (isItemSelected)
return true;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->AddItemToSelection(itemElm);
else
mSelectControl->SetSelectedItem(itemElm);
return true;
}
bool
nsXULSelectableAccessible::RemoveItemFromSelection(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
if (!isItemSelected)
return true;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->RemoveItemFromSelection(itemElm);
else
mSelectControl->SetSelectedItem(nsnull);
return true;
}
bool
nsXULSelectableAccessible::IsItemSelected(PRUint32 aIndex)
{
nsAccessible* item = GetChildAt(aIndex);
if (!item)
return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(item->GetContent());
if (!itemElm)
return false;
bool isItemSelected = false;
itemElm->GetSelected(&isItemSelected);
return isItemSelected;
}
bool
nsXULSelectableAccessible::UnselectAll()
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
multiSelectControl ?
multiSelectControl->ClearSelection() : mSelectControl->SetSelectedIndex(-1);
return true;
}
bool
nsXULSelectableAccessible::SelectAll()
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl) {
multiSelectControl->SelectAll();
return true;
}
// otherwise, don't support this method
return false;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULSelectableAccessible: Widgets
nsAccessible*
nsXULSelectableAccessible::CurrentItem()
{
if (!mSelectControl)
return nsnull;
nsCOMPtr<nsIDOMXULSelectControlItemElement> currentItemElm;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->GetCurrentItem(getter_AddRefs(currentItemElm));
else
mSelectControl->GetSelectedItem(getter_AddRefs(currentItemElm));
nsCOMPtr<nsINode> DOMNode;
if (currentItemElm)
DOMNode = do_QueryInterface(currentItemElm);
if (DOMNode) {
nsDocAccessible* document = GetDocAccessible();
if (document)
return document->GetAccessible(DOMNode);
}
return nsnull;
}
void
nsXULSelectableAccessible::SetCurrentItem(nsAccessible* aItem)
{
if (!mSelectControl)
return;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
do_QueryInterface(aItem->GetContent());
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
do_QueryInterface(mSelectControl);
if (multiSelectControl)
multiSelectControl->SetCurrentItem(itemElm);
else
mSelectControl->SetSelectedItem(itemElm);
}
////////////////////////////////////////////////////////////////////////////////
// nsXULMenuitemAccessible
////////////////////////////////////////////////////////////////////////////////
@ -708,7 +455,7 @@ nsXULMenuSeparatorAccessible::ActionCount()
nsXULMenupopupAccessible::
nsXULMenupopupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsXULSelectableAccessible(aContent, aShell)
XULSelectControlAccessible(aContent, aShell)
{
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
if (menuPopupFrame && menuPopupFrame->IsMenu())

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

@ -41,39 +41,7 @@
#include "nsAccessibleWrap.h"
#include "nsIDOMXULSelectCntrlEl.h"
/**
* The basic implementation of SelectAccessible for XUL select controls.
*/
class nsXULSelectableAccessible : public nsAccessibleWrap
{
public:
nsXULSelectableAccessible(nsIContent *aContent, nsIWeakReference *aShell);
virtual ~nsXULSelectableAccessible() {}
// nsAccessNode
virtual void Shutdown();
// SelectAccessible
virtual bool IsSelect();
virtual already_AddRefed<nsIArray> SelectedItems();
virtual PRUint32 SelectedItemCount();
virtual nsAccessible* GetSelectedItem(PRUint32 aIndex);
virtual bool IsItemSelected(PRUint32 aIndex);
virtual bool AddItemToSelection(PRUint32 aIndex);
virtual bool RemoveItemFromSelection(PRUint32 aIndex);
virtual bool SelectAll();
virtual bool UnselectAll();
// Widgets
virtual nsAccessible* CurrentItem();
virtual void SetCurrentItem(nsAccessible* aItem);
protected:
// nsIDOMXULMultiSelectControlElement inherits from this, so we'll always have
// one of these if the widget is valid and not defunct
nsCOMPtr<nsIDOMXULSelectControlElement> mSelectControl;
};
#include "XULSelectControlAccessible.h"
/**
* Used for XUL menu, menuitem elements.
@ -136,7 +104,7 @@ public:
/**
* Used for XUL menupopup and panel.
*/
class nsXULMenupopupAccessible : public nsXULSelectableAccessible
class nsXULMenupopupAccessible : public XULSelectControlAccessible
{
public:
nsXULMenupopupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
@ -174,4 +142,4 @@ public:
virtual void SetCurrentItem(nsAccessible* aItem);
};
#endif
#endif

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

@ -179,7 +179,7 @@ nsXULTabAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
nsXULTabsAccessible::
nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsXULSelectableAccessible(aContent, aShell)
XULSelectControlAccessible(aContent, aShell)
{
}

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

@ -42,6 +42,7 @@
// NOTE: alphabetically ordered
#include "nsBaseWidgetAccessible.h"
#include "nsXULMenuAccessible.h"
#include "XULSelectControlAccessible.h"
/**
* An individual tab, xul:tab element.
@ -72,7 +73,7 @@ public:
/**
* A container of tab objects, xul:tabs element.
*/
class nsXULTabsAccessible : public nsXULSelectableAccessible
class nsXULTabsAccessible : public XULSelectControlAccessible
{
public:
nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell);

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

@ -45,9 +45,10 @@ relativesrcdir = accessible/events
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
# test_docload.xul, docload_wnd.xul, test_scroll.xul disabled for misusing <tabbrowser> (bug 715857)
_TEST_FILES =\
docload_wnd.html \
docload_wnd.xul \
focus.html \
scroll.html \
test_aria_alert.html \
@ -60,7 +61,6 @@ _TEST_FILES =\
test_coalescence.html \
test_contextmenu.html \
test_docload.html \
test_docload.xul \
test_dragndrop.html \
test_flush.html \
test_focus_aria_activedescendant.html \
@ -81,7 +81,6 @@ _TEST_FILES =\
test_menu.xul \
test_mutation.html \
test_mutation.xhtml \
test_scroll.xul \
test_selection_aria.html \
test_selection.html \
test_selection.xul \

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

@ -22,6 +22,8 @@
<script type="application/javascript">
<![CDATA[
Components.utils.import("resource://gre/modules/Services.jsm");
////////////////////////////////////////////////////////////////////////////
// Helpers
@ -97,8 +99,8 @@
var gBrowserWnd = null;
function loadBrowser()
{
gBrowserWnd = window.openDialog("chrome://browser/content/", "_blank",
"chrome,all,dialog=no", gInputDocURI);
gBrowserWnd = window.openDialog(Services.prefs.getCharPref("browser.chromeURL"),
"_blank", "chrome,all,dialog=no", gInputDocURI);
addA11yLoadEvent(startTests, gBrowserWnd);
}

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

@ -45,18 +45,18 @@ relativesrcdir = accessible/name
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
# test_nsRootAcc.xul, nsRootAcc_wnd.xul disabled for misusing <tabbrowser> (bug 715857)
_TEST_FILES =\
general.css \
general.xbl \
markup.js \
nsRootAcc_wnd.xul \
test_button.html \
test_general.html \
test_general.xul \
test_link.html \
test_list.html \
test_markup.html \
test_nsRootAcc.xul \
test_tree.xul \
markuprules.xml \
$(NULL)

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

@ -45,10 +45,11 @@ relativesrcdir = accessible/relations
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
# test_tabbrowser.xul disabled for misusing <tabbrowser> (bug 715857)
_TEST_FILES =\
test_general.html \
test_general.xul \
test_tabbrowser.xul \
test_tree.xul \
test_update.html \
$(NULL)

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

@ -45,6 +45,8 @@ relativesrcdir = accessible/tree
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
# test_tabbrowser.xul disabled for misusing <tabbrowser> (bug 715857)
_TEST_FILES =\
dockids.html \
$(warning test_applicationacc.xul temporarily disabled, see bug 561508) \
@ -70,7 +72,6 @@ _TEST_FILES =\
test_media.html \
test_select.html \
test_tabbox.xul \
test_tabbrowser.xul \
test_table.html \
test_tree.xul \
test_txtcntr.html \

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

@ -237,7 +237,7 @@ pref("keyword.URL", "");
pref("general.useragent.locale", "@AB_CD@");
pref("general.skins.selectedSkin", "classic/1.0");
pref("general.smoothScroll", false);
pref("general.smoothScroll", true);
#ifdef UNIX_BUT_NOT_MAC
pref("general.autoScroll", false);
#else
@ -1033,9 +1033,6 @@ pref("devtools.styleinspector.enabled", true);
// Enable the Tilt inspector
pref("devtools.tilt.enabled", true);
// Enable the Tilt inspector even if WebGL capabilities are not detected
pref("devtools.tilt.force-enabled", false);
// Enable the rules view
pref("devtools.ruleview.enabled", true);

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

@ -341,6 +341,13 @@
key="key_sanitize"
command="Tools:Sanitize"/>
<menuseparator class="hide-if-empty-places-result"/>
#ifdef MOZ_SERVICES_SYNC
<menuitem id="appmenu_sync-tabs"
class="syncTabsMenuItem"
label="&syncTabsMenu.label;"
oncommand="BrowserOpenSyncTabs();"
disabled="true"/>
#endif
<menuitem id="appmenu_restoreLastSession"
class="restoreLastSession"
label="&historyRestoreLastSession.label;"

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

@ -90,16 +90,8 @@ let gSyncUI = {
Services.obs.addObserver(this, topic, true);
}, this);
// Find the alltabs-popup, only if there is a gBrowser
if (gBrowser) {
let popup = document.getElementById("alltabs-popup");
if (popup) {
popup.addEventListener(
"popupshowing", this.alltabsPopupShowing.bind(this), true);
}
if (Weave.Notifications.notifications.length)
this.initNotifications();
if (gBrowser && Weave.Notifications.notifications.length) {
this.initNotifications();
}
this.updateUI();
},
@ -149,34 +141,6 @@ let gSyncUI = {
button.removeAttribute("tooltiptext");
},
alltabsPopupShowing: function(event) {
// Should we show the menu item?
//XXXphilikon We should remove the check for isLoggedIn here and have
// about:sync-tabs auto-login (bug 583344)
if (!Weave.Service.isLoggedIn || !Weave.Engines.get("tabs").enabled)
return;
let label = this._stringBundle.GetStringFromName("tabs.fromOtherComputers.label");
let popup = document.getElementById("alltabs-popup");
if (!popup)
return;
let menuitem = document.createElement("menuitem");
menuitem.setAttribute("id", "sync-tabs-menuitem");
menuitem.setAttribute("label", label);
menuitem.setAttribute("class", "alltabs-item");
menuitem.setAttribute("oncommand", "BrowserOpenSyncTabs();");
// Fake the tab object on the menu entries, so that we don't have to worry
// about removing them ourselves. They will just get cleaned up by popup
// binding.
menuitem.tab = { "linkedBrowser": { "currentURI": { "spec": label } } };
let sep = document.getElementById("alltabs-popup-separator");
popup.insertBefore(menuitem, sep);
},
// Functions called by observers
onActivityStart: function SUI_onActivityStart() {

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

@ -2617,7 +2617,7 @@ function UpdateUrlbarSearchSplitterState()
}
function setUrlAndSearchBarWidthForConditionalForwardButton() {
// Woraround for bug 694084: Showing/hiding the conditional forward button resizes
// Workaround for bug 694084: Showing/hiding the conditional forward button resizes
// the search bar when the url/search bar splitter hasn't been used.
var urlbarContainer = document.getElementById("urlbar-container");
var searchbarContainer = document.getElementById("search-container");
@ -5487,7 +5487,7 @@ function updateAppButtonDisplay() {
document.getElementById("titlebar").hidden = !displayAppButton;
if (displayAppButton)
document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
document.documentElement.setAttribute("chromemargin", "0,2,2,2");
else
document.documentElement.removeAttribute("chromemargin");

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

@ -1014,8 +1014,8 @@
<toolbarbutton id="inspector-3D-button"
class="devtools-toolbarbutton"
hidden="true"
label="&inspect3DButton.label;"
accesskey="&inspect3DButton.accesskey;"
label="&inspect3DViewButton.label;"
accesskey="&inspect3DViewButton.accesskey;"
command="Inspector:Tilt"/>
<toolbarbutton id="inspector-style-button"
class="devtools-toolbarbutton"

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

@ -2847,11 +2847,9 @@
goSetCommandEnabled("cmd_ToggleTabsOnTop", visible);
if (window.TabsOnTop)
TabsOnTop.syncUI();
TabsOnTop.syncUI();
if (window.TabsInTitlebar)
TabsInTitlebar.allowedBy("tabs-visible", visible);
TabsInTitlebar.allowedBy("tabs-visible", visible);
]]></body>
</method>

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

@ -49,7 +49,6 @@
#include "nsGNOMEShellService.h"
#endif
#include "nsProfileMigrator.h"
#if defined(XP_WIN) && !defined(__MINGW32__)
#include "nsIEProfileMigrator.h"
#elif defined(XP_MACOSX)
@ -77,7 +76,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsProfileMigrator)
#if defined(XP_WIN) && !defined(__MINGW32__)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIEProfileMigrator)
#elif defined(XP_MACOSX)
@ -96,7 +94,6 @@ NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(NS_FEEDSNIFFER_CID);
NS_DEFINE_NAMED_CID(NS_BROWSER_ABOUT_REDIRECTOR_CID);
NS_DEFINE_NAMED_CID(NS_FIREFOX_PROFILEMIGRATOR_CID);
#if defined(XP_WIN) && !defined(__MINGW32__)
NS_DEFINE_NAMED_CID(NS_WINIEPROFILEMIGRATOR_CID);
#elif defined(XP_MACOSX)
@ -114,7 +111,6 @@ static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
#endif
{ &kNS_FEEDSNIFFER_CID, false, NULL, nsFeedSnifferConstructor },
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, NULL, AboutRedirector::Create },
{ &kNS_FIREFOX_PROFILEMIGRATOR_CID, false, NULL, nsProfileMigratorConstructor },
#if defined(XP_WIN) && !defined(__MINGW32__)
{ &kNS_WINIEPROFILEMIGRATOR_CID, false, NULL, nsIEProfileMigratorConstructor },
#elif defined(XP_MACOSX)
@ -148,7 +144,6 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "permissions", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_PROFILEMIGRATOR_CONTRACTID, &kNS_FIREFOX_PROFILEMIGRATOR_CID },
#if defined(XP_WIN) && !defined(__MINGW32__)
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "ie", &kNS_WINIEPROFILEMIGRATOR_CID },
#elif defined(XP_MACOSX)

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

@ -1,4 +1,6 @@
component {4cec1de4-1671-4fc3-a53e-6c539dc77a26} ChromeProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=chrome {4cec1de4-1671-4fc3-a53e-6c539dc77a26}
component {91185366-ba97-4438-acba-48deaca63386} FirefoxProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=firefox {91185366-ba97-4438-acba-48deaca63386}
component {6F8BB968-C14F-4D6F-9733-6C6737B35DCE} ProfileMigrator.js
contract @mozilla.org/toolkit/profile-migrator;1 {6F8BB968-C14F-4D6F-9733-6C6737B35DCE}
component {4cec1de4-1671-4fc3-a53e-6c539dc77a26} ChromeProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=chrome {4cec1de4-1671-4fc3-a53e-6c539dc77a26}
component {91185366-ba97-4438-acba-48deaca63386} FirefoxProfileMigrator.js
contract @mozilla.org/profile/migrator;1?app=browser&type=firefox {91185366-ba97-4438-acba-48deaca63386}

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

@ -49,8 +49,7 @@ USE_STATIC_LIBS = 1
endif
CPPSRCS = nsProfileMigrator.cpp \
nsBrowserProfileMigratorUtils.cpp \
CPPSRCS = nsBrowserProfileMigratorUtils.cpp \
$(NULL)
ifeq ($(OS_ARCH)_$(GNU_CXX),WINNT_)
@ -64,6 +63,7 @@ CPPSRCS += nsSafariProfileMigrator.cpp \
endif
EXTRA_PP_COMPONENTS = \
ProfileMigrator.js \
ChromeProfileMigrator.js \
FirefoxProfileMigrator.js \
$(NULL)

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

@ -0,0 +1,141 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
function ProfileMigrator() {
}
ProfileMigrator.prototype = {
migrate: function PM_migrate(aStartup) {
// By opening the wizard with a supplied migrator, it will automatically
// migrate from it.
let [key, migrator] = this._getDefaultMigrator();
if (!key)
return;
let params = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
params.appendElement(this._toCString(key), false);
params.appendElement(migrator, false);
params.appendElement(aStartup, false);
Services.ww.openWindow(null,
"chrome://browser/content/migration/migration.xul",
"_blank",
"chrome,dialog,modal,centerscreen,titlebar",
params);
},
_toCString: function PM__toCString(aStr) {
let cstr = Cc["@mozilla.org/supports-cstring;1"].
createInstance(Ci.nsISupportsCString);
cstr.data = aStr;
return cstr;
},
_getMigratorIfSourceExists: function PM__getMigratorIfSourceExists(aKey) {
let cid = "@mozilla.org/profile/migrator;1?app=browser&type=" + aKey;
let migrator = Cc[cid].createInstance(Ci.nsIBrowserProfileMigrator);
if (migrator.sourceExists)
return migrator;
return null;
},
// We don't yet support checking for the default browser on all platforms,
// needless to say we don't have migrators for all browsers. Thus, for each
// platform, there's a fallback list of migrators used in these cases.
_PLATFORM_FALLBACK_LIST:
#ifdef XP_WIN
["ie", "chrome", /* safari */],
#elifdef XP_MACOSX
["safari", "chrome"],
#else
["chrome"],
#endif
_getDefaultMigrator: function PM__getDefaultMigrator() {
let migratorsOrdered = Array.slice(this._PLATFORM_FALLBACK_LIST);
let defaultBrowser = "";
#ifdef XP_WIN
try {
const REG_KEY = "SOFTWARE\\Classes\\HTTP\\shell\\open\\command";
let regKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
regKey.open(regKey.ROOT_KEY_LOCAL_MACHINE, REG_KEY,
regKey.ACCESS_READ);
let value = regKey.readStringValue("").toLowerCase();
let pathMatches = value.match(/^"?(.+?\.exe)"?/);
if (!pathMatches) {
throw new Error("Could not extract path from " +
REG_KEY + "(" + value + ")");
}
// We want to find out what the default browser is but the path in and of
// itself isn't enough. Why? Because sometimes on Windows paths get
// truncated like so: C:\PROGRA~1\MOZILL~2\MOZILL~1.EXE. How do we know
// what product that is? Mozilla's file objects do nothing to 'normalize'
// the path so we need to attain an actual product descriptor from the
// file somehow, and in this case it means getting the "InternalName"
// field of the file's VERSIONINFO resource.
//
// In the file's resource segment there is a VERSIONINFO section that is
// laid out like this:
//
// VERSIONINFO
// StringFileInfo
// <TranslationID>
// InternalName "iexplore"
// VarFileInfo
// Translation <TranslationID>
//
// By Querying the VERSIONINFO section for its Tranlations, we can find
// out where the InternalName lives (A file can have more than one
// translation of its VERSIONINFO segment, but we just assume the first
// one).
let file = FileUtils.File(pathMatches[1])
.QueryInterface(Ci.nsILocalFileWin);
switch (file.getVersionInfoField("InternalName").toLowerCase()) {
case "iexplore":
defaultBrowser = "ie";
break;
case "chrome":
defaultBrowser = "chrome";
break;
}
}
catch (ex) {
Cu.reportError("Could not retrieve default browser: " + ex);
}
#endif
// If we found the default browser and we have support for that browser,
// make sure to check it before any other browser, by moving it to the head
// of the array.
if (defaultBrowser)
migratorsOrdered.sort(function(a, b) b == defaultBrowser ? 1 : 0);
for (let i = 0; i < migratorsOrdered.length; i++) {
let migrator = this._getMigratorIfSourceExists(migratorsOrdered[i]);
if (migrator)
return [migratorsOrdered[i], migrator];
}
return ["", null];
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProfileMigrator]),
classDescription: "Profile Migrator",
contractID: "@mozilla.org/toolkit/profile-migrator;1",
classID: Components.ID("6F8BB968-C14F-4D6F-9733-6C6737B35DCE")
};
let NSGetFactory = XPCOMUtils.generateNSGetFactory([ProfileMigrator]);

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

@ -1,252 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 The Browser Profile Migrator.
*
* The Initial Developer of the Original Code is Ben Goodger.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Goodger <ben@bengoodger.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsProfileMigrator.h"
#include "nsIBrowserProfileMigrator.h"
#include "nsIComponentManager.h"
#include "nsIDOMWindow.h"
#include "nsILocalFile.h"
#include "nsIObserverService.h"
#include "nsIProperties.h"
#include "nsIServiceManager.h"
#include "nsISupportsPrimitives.h"
#include "nsIMutableArray.h"
#include "nsIToolkitProfile.h"
#include "nsIToolkitProfileService.h"
#include "nsIWindowWatcher.h"
#include "nsCOMPtr.h"
#include "nsBrowserCompsCID.h"
#include "nsComponentManagerUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "nsServiceManagerUtils.h"
#include "nsStringAPI.h"
#include "nsUnicharUtils.h"
#ifdef XP_WIN
#include <windows.h>
#include "nsIWindowsRegKey.h"
#include "nsILocalFileWin.h"
#else
#include <limits.h>
#endif
#include "nsAutoPtr.h"
///////////////////////////////////////////////////////////////////////////////
// nsIProfileMigrator
#define MIGRATION_WIZARD_FE_URL "chrome://browser/content/migration/migration.xul"
#define MIGRATION_WIZARD_FE_FEATURES "chrome,dialog,modal,centerscreen,titlebar"
NS_IMETHODIMP
nsProfileMigrator::Migrate(nsIProfileStartup* aStartup)
{
nsresult rv;
nsCAutoString key;
nsCOMPtr<nsIBrowserProfileMigrator> bpm;
rv = GetDefaultBrowserMigratorKey(key, bpm);
if (NS_FAILED(rv)) return rv;
if (!bpm) {
nsCAutoString contractID(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX);
contractID.Append(key);
bpm = do_CreateInstance(contractID.get());
if (!bpm) return NS_ERROR_FAILURE;
}
bool sourceExists;
bpm->GetSourceExists(&sourceExists);
if (!sourceExists) {
#ifdef XP_WIN
// The "Default Browser" key in the registry was set to a browser for which
// no profile data exists. On Windows, this means the Default Browser settings
// in the registry are bad, and we should just fall back to IE in this case.
bpm = do_CreateInstance(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "ie");
#else
return NS_ERROR_FAILURE;
#endif
}
nsCOMPtr<nsISupportsCString> cstr
(do_CreateInstance("@mozilla.org/supports-cstring;1"));
if (!cstr) return NS_ERROR_OUT_OF_MEMORY;
cstr->SetData(key);
// By opening the Migration FE with a supplied bpm, it will automatically
// migrate from it.
nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsIMutableArray> params = do_CreateInstance(NS_ARRAY_CONTRACTID);
if (!ww || !params) return NS_ERROR_FAILURE;
params->AppendElement(cstr, false);
params->AppendElement(bpm, false);
params->AppendElement(aStartup, false);
nsCOMPtr<nsIDOMWindow> migrateWizard;
return ww->OpenWindow(nsnull,
MIGRATION_WIZARD_FE_URL,
"_blank",
MIGRATION_WIZARD_FE_FEATURES,
params,
getter_AddRefs(migrateWizard));
}
///////////////////////////////////////////////////////////////////////////////
// nsProfileMigrator
NS_IMPL_ISUPPORTS1(nsProfileMigrator, nsIProfileMigrator)
#ifdef XP_WIN
#define INTERNAL_NAME_IEXPLORE "iexplore"
#define INTERNAL_NAME_MOZILLA_SUITE "apprunner"
#define INTERNAL_NAME_CHROME "chrome"
#define INTERNAL_NAME_FIREFOX "firefox"
#endif
nsresult
nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
nsCOMPtr<nsIBrowserProfileMigrator>& bpm)
{
#if XP_WIN
nsCOMPtr<nsIWindowsRegKey> regKey =
do_CreateInstance("@mozilla.org/windows-registry-key;1");
if (!regKey)
return NS_ERROR_FAILURE;
NS_NAMED_LITERAL_STRING(kCommandKey,
"SOFTWARE\\Classes\\HTTP\\shell\\open\\command");
if (NS_FAILED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE,
kCommandKey, nsIWindowsRegKey::ACCESS_READ)))
return NS_ERROR_FAILURE;
nsAutoString value;
if (NS_FAILED(regKey->ReadStringValue(EmptyString(), value)))
return NS_ERROR_FAILURE;
PRInt32 len = value.Find(NS_LITERAL_STRING(".exe"), CaseInsensitiveCompare);
if (len == -1)
return NS_ERROR_FAILURE;
// Move past ".exe"
len += 4;
PRUint32 start = 0;
// skip an opening quotation mark if present
if (value.get()[1] != ':') {
start = 1;
--len;
}
const nsDependentSubstring filePath(Substring(value, start, len));
// We want to find out what the default browser is but the path in and of itself
// isn't enough. Why? Because sometimes on Windows paths get truncated like so:
// C:\PROGRA~1\MOZILL~2\MOZILL~1.EXE
// How do we know what product that is? Mozilla or Mozilla Firebird? etc. Mozilla's
// file objects do nothing to 'normalize' the path so we need to attain an actual
// product descriptor from the file somehow, and in this case it means getting
// the "InternalName" field of the file's VERSIONINFO resource.
//
// In the file's resource segment there is a VERSIONINFO section that is laid
// out like this:
//
// VERSIONINFO
// StringFileInfo
// <TranslationID>
// InternalName "iexplore"
// VarFileInfo
// Translation <TranslationID>
//
// By Querying the VERSIONINFO section for its Tranlations, we can find out where
// the InternalName lives. (A file can have more than one translation of its
// VERSIONINFO segment, but we just assume the first one).
nsCOMPtr<nsILocalFile> lf;
NS_NewLocalFile(filePath, true, getter_AddRefs(lf));
if (!lf)
return NS_ERROR_FAILURE;
nsCOMPtr<nsILocalFileWin> lfw = do_QueryInterface(lf);
if (!lfw)
return NS_ERROR_FAILURE;
nsAutoString internalName;
if (NS_FAILED(lfw->GetVersionInfoField("InternalName", internalName)))
return NS_ERROR_FAILURE;
if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_IEXPLORE)) {
aKey = "ie";
return NS_OK;
}
else if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_CHROME)) {
aKey = "chrome";
return NS_OK;
}
else if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_FIREFOX)) {
aKey = "firefox";
return NS_OK;
}
#else
bool exists = false;
#define CHECK_MIGRATOR(browser) do {\
bpm = do_CreateInstance(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX browser);\
if (bpm)\
bpm->GetSourceExists(&exists);\
if (exists) {\
aKey = browser;\
return NS_OK;\
}} while(0)
#if defined(XP_MACOSX)
CHECK_MIGRATOR("safari");
#endif
CHECK_MIGRATOR("chrome");
CHECK_MIGRATOR("firefox");
#undef CHECK_MIGRATOR
#endif
return NS_ERROR_FAILURE;
}

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

@ -8,6 +8,7 @@
}
.view {
color: black; /* Default text color */
background: #f0f0ff; /* Background of the editor */
padding-left: 0;
}

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

@ -751,70 +751,28 @@ StyleEditor.prototype = {
*/
_loadSourceFromCache: function SE__loadSourceFromCache(aHref)
{
try {
let cacheService = Cc["@mozilla.org/network/cache-service;1"]
.getService(Ci.nsICacheService);
let session = cacheService.createSession("HTTP", Ci.nsICache.STORE_ANYWHERE, true);
session.doomEntriesIfExpired = false;
session.asyncOpenCacheEntry(aHref, Ci.nsICache.ACCESS_READ, {
onCacheEntryAvailable: this._onCacheEntryAvailable.bind(this)
});
} catch (ex) {
this._signalError(LOAD_ERROR);
}
},
/**
* The nsICacheListener.onCacheEntryAvailable method implementation used when
* the style sheet source is loaded from the browser cache.
*
* @param nsICacheEntryDescriptor aEntry
* @param nsCacheAccessMode aMode
* @param integer aStatus
*/
_onCacheEntryAvailable: function SE__onCacheEntryAvailable(aEntry, aMode, aStatus)
{
if (!Components.isSuccessCode(aStatus)) {
return this._signalError(LOAD_ERROR);
}
let stream = aEntry.openInputStream(0);
let channel = Services.io.newChannel(aHref, null, null);
let chunks = [];
let streamListener = { // nsIStreamListener inherits nsIRequestObserver
onStartRequest: function (aRequest, aContext, aStatusCode) {
},
if (!Components.isSuccessCode(aStatusCode)) {
return this._signalError(LOAD_ERROR);
}
}.bind(this),
onDataAvailable: function (aRequest, aContext, aStream, aOffset, aCount) {
chunks.push(NetUtil.readInputStreamToString(aStream, aCount));
},
onStopRequest: function (aRequest, aContext, aStatusCode) {
if (!Components.isSuccessCode(aStatusCode)) {
return this._signalError(LOAD_ERROR);
}
this._onSourceLoad(chunks.join(""));
}.bind(this),
}.bind(this)
};
let head = aEntry.getMetaDataElement("response-head");
if (/^Content-Encoding:\s*gzip/mi.test(head)) {
let converter = Cc["@mozilla.org/streamconv;1?from=gzip&to=uncompressed"]
.createInstance(Ci.nsIStreamConverter);
converter.asyncConvertData("gzip", "uncompressed", streamListener, null);
streamListener = converter; // proxy original listener via converter
}
try {
streamListener.onStartRequest(null, null);
while (stream.available()) {
streamListener.onDataAvailable(null, null, stream, 0, stream.available());
}
streamListener.onStopRequest(null, null, 0);
} catch (ex) {
this._signalError(LOAD_ERROR);
} finally {
try {
stream.close();
} catch (ex) {
// swallow (some stream implementations can auto-close at eos)
}
aEntry.close();
}
channel.loadFlags = channel.LOAD_FROM_CACHE;
channel.asyncOpen(streamListener, null);
},
/**

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

@ -1142,7 +1142,8 @@ TextPropertyEditor.prototype = {
* {function} done:
* Called when input is committed or blurred. Called with
* current value and a boolean telling the caller whether to
* commit the change.
* commit the change. This function is called after the editor
* has been torn down.
* {string} advanceChars:
* If any characters in advanceChars are typed, focus will advance
* to the next element.
@ -1286,11 +1287,11 @@ InplaceEditor.prototype = {
*/
_onBlur: function InplaceEditor_onBlur(aEvent)
{
if (this.done) {
this.done(this.cancelled ? this.initial : this.input.value.trim(),
!this.cancelled);
}
let val = this.input.value.trim();
this._clear();
if (this.done) {
this.done(this.cancelled ? this.initial : val, !this.cancelled);
}
},
_onKeyPress: function InplaceEditor_onKeyPress(aEvent)

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

@ -81,9 +81,9 @@ StyleInspector.prototype = {
this.registrationObject = {
id: "styleinspector",
label: this.l10n("style.highlighter.button.label1"),
label: this.l10n("style.highlighter.button.label2"),
tooltiptext: this.l10n("style.highlighter.button.tooltip"),
accesskey: this.l10n("style.highlighter.accesskey1"),
accesskey: this.l10n("style.highlighter.accesskey2"),
context: this,
get isOpen() isOpen(),
onSelect: this.selectNode,

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

@ -42,3 +42,7 @@
.ruleview-computedlist:not(.styleinspector-open) {
display: none;
}
.ruleview-code {
direction: ltr;
}

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

@ -271,7 +271,7 @@ Tilt.prototype = {
get enabled()
{
return (TiltVisualizer.Prefs.enabled &&
(TiltVisualizer.Prefs.forceEnabled || TiltGL.isWebGLSupported()));
(TiltGL.isWebGLForceEnabled() || TiltGL.isWebGLSupported()));
},
/**

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

@ -37,7 +37,7 @@
*
***** END LICENSE BLOCK *****/
/*global Components, TiltMath, TiltUtils, mat4 */
/*global Components, Services, TiltMath, TiltUtils, mat4 */
"use strict";
const Cc = Components.classes;
@ -46,6 +46,7 @@ const Cu = Components.utils;
const WEBGL_CONTEXT_NAME = "experimental-webgl";
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/devtools/TiltMath.jsm");
Cu.import("resource:///modules/devtools/TiltUtils.jsm");
@ -1554,6 +1555,11 @@ TiltGL.ColorShader = {
].join("\n")
};
TiltGL.isWebGLForceEnabled = function TGL_isWebGLForceEnabled()
{
return Services.prefs.getBoolPref("webgl.force-enabled");
};
/**
* Tests if the WebGL OpenGL or Angle renderer is available using the
* GfxInfo service.

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

@ -1548,20 +1548,6 @@ TiltVisualizer.Prefs = {
this._enabled = value;
},
/**
* Specifies if Tilt should be enabled even if WebGL may not be available.
*/
get forceEnabled()
{
return this._forceEnabled;
},
set forceEnabled(value)
{
TiltUtils.Preferences.set("force-enabled", "boolean", value);
this._forceEnabled = value;
},
/**
* Loads the preferences.
*/
@ -1570,7 +1556,6 @@ TiltVisualizer.Prefs = {
let prefs = TiltUtils.Preferences;
TiltVisualizer.Prefs._enabled = prefs.get("enabled", "boolean");
TiltVisualizer.Prefs._forceEnabled = prefs.get("force-enabled", "boolean");
}
};

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

@ -51,6 +51,7 @@ _BROWSER_TEST_FILES = \
browser_tilt_03_tab_switch.js \
browser_tilt_04_initialization.js \
browser_tilt_05_destruction-esc.js \
browser_tilt_05_destruction-url.js \
browser_tilt_05_destruction.js \
browser_tilt_arcball.js \
browser_tilt_controller.js \

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

@ -31,11 +31,6 @@ function test() {
is(Tilt.visualizers[id], null,
"A instance of the visualizer shouldn't be initialized yet.");
is(typeof TiltVisualizer.Prefs.enabled, "boolean",
"The 'enabled' pref should have been loaded by now.");
is(typeof TiltVisualizer.Prefs.forceEnabled, "boolean",
"The 'force-enabled' pref should have been loaded by now.");
},
onTiltOpen: function(instance)
{

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

@ -0,0 +1,41 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/*global ok, is, info, waitForExplicitFinish, finish, gBrowser */
/*global isTiltEnabled, isWebGLSupported, createTab, createTilt */
/*global Services, EventUtils, Tilt, TiltUtils, InspectorUI, TILT_DESTROYED */
"use strict";
function test() {
if (!isTiltEnabled()) {
info("Skipping destruction test because Tilt isn't enabled.");
return;
}
if (!isWebGLSupported()) {
info("Skipping destruction test because WebGL isn't supported.");
return;
}
waitForExplicitFinish();
createTab(function() {
createTilt({
onTiltOpen: function()
{
Services.obs.addObserver(cleanup, TILT_DESTROYED, false);
window.content.location = "about:mozilla";
}
});
});
}
function cleanup() {
let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
is(Tilt.visualizers[id], null,
"The current instance of the visualizer wasn't destroyed properly.");
Services.obs.removeObserver(cleanup, TILT_DESTROYED);
gBrowser.removeCurrentTab();
finish();
}

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

@ -134,7 +134,6 @@
@BINPATH@/components/directory.xpt
@BINPATH@/components/docshell.xpt
@BINPATH@/components/dom.xpt
@BINPATH@/components/dom_apps.xpt
@BINPATH@/components/dom_base.xpt
#ifdef MOZ_B2G_RIL
@BINPATH@/components/dom_telephony.xpt
@ -389,8 +388,6 @@
#endif
@BINPATH@/components/TelemetryPing.js
@BINPATH@/components/TelemetryPing.manifest
@BINPATH@/components/Webapps.js
@BINPATH@/components/Webapps.manifest
; Modules
@BINPATH@/modules/*

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

@ -217,8 +217,13 @@ can reach it easily. -->
<!ENTITY inspectButton.label "Inspect">
<!ENTITY inspectButton.accesskey "I">
<!ENTITY inspectCloseButton.tooltiptext "Close Inspector">
<!ENTITY inspect3DButton.label "3D">
<!ENTITY inspect3DButton.accesskey "M">
<!-- LOCALIZATION NOTE (inspect3DViewButton.label): This button shows an
- alternate view for the Inspector, creating a 3D visualization of the
- webpage. -->
<!ENTITY inspect3DViewButton.label "3D View">
<!ENTITY inspect3DViewButton.accesskey "W">
<!ENTITY inspectStyleButton.label "Style">
<!ENTITY inspectStyleButton.accesskey "S">

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

@ -33,10 +33,11 @@ rule.sourceElement=element
rule.inheritedSource=Inherited from %S (%S)
# LOCALIZATION NOTE (style.highlighter.button): These strings are used inside
# sidebar of the Highlighter for the style inspector button
style.highlighter.button.label1=Properties
style.highlighter.accesskey1=P
style.highlighter.button.tooltip=Inspect element styles
# sidebar of the Highlighter for the style inspector button.
# "Computed" refers to the Computed Style of the element.
style.highlighter.button.label2=Computed
style.highlighter.accesskey2=C
style.highlighter.button.tooltip=Inspect element computed styles
# LOCALIZATION NOTE (helpLinkTitle): For each style property
# the user can hover it and get a help link button which allows one to

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

@ -2003,6 +2003,10 @@ panel[dimmed="true"] {
position: relative;
}
#devtools-sidebar-box {
background-color: -moz-Field;
}
/* Highlighter - toolbar resizers */
.inspector-resizer {

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

@ -234,10 +234,6 @@
-moz-margin-end: 5px;
}
.ruleview-expander:-moz-locale-dir(rtl) {
background-position: 16px 0;
}
.ruleview-expander.styleinspector-open {
background-position: 8px 0;
}

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

@ -2740,6 +2740,10 @@ panel[dimmed="true"] {
position: relative;
}
#devtools-sidebar-box {
background-color: -moz-Field;
}
/* Highlighter - toolbar resizers */
.inspector-resizer {

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

@ -236,10 +236,6 @@
-moz-margin-end: 5px;
}
.ruleview-expander:-moz-locale-dir(rtl) {
background-position: 16px 0;
}
.ruleview-expander.styleinspector-open {
background-position: 8px 0;
}

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

@ -2683,6 +2683,10 @@ panel[dimmed="true"] {
position: relative;
}
#devtools-sidebar-box {
background-color: -moz-Field;
}
/* Highlighter - toolbar resizers */
.inspector-resizer {

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

@ -74,7 +74,7 @@
color: hsl(200,100%,60%) !important;
}
.devtools-toolbarbutton:[checked]:hover:active {
.devtools-toolbarbutton[checked]:hover:active {
background-color: hsla(211,68%,6%,.2);
}

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

@ -234,10 +234,6 @@
-moz-margin-end: 5px;
}
.ruleview-expander:-moz-locale-dir(rtl) {
background-position: 16px 0;
}
.ruleview-expander.styleinspector-open {
background-position: 8px 0;
}

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

@ -36,6 +36,8 @@
#
# ***** END LICENSE BLOCK *****
from __future__ import with_statement
from optparse import OptionParser
import logging
import os
@ -57,14 +59,13 @@ def digest_file(filename, digest, chunk_size=1024):
if hashlib is not None:
logger.debug('Creating new %s object' % digest)
h = hashlib.new(digest)
f = open(filename, "rb")
while True:
data = f.read(chunk_size)
if not data:
logger.debug('Finished reading in file')
break
h.update(data)
f.close()
with open(filename, 'rb') as f:
while True:
data = f.read(chunk_size)
if not data:
logger.debug('Finished reading in file')
break
h.update(data)
hash = h.hexdigest()
logger.debug('Hash for %s is %s' % (filename, hash))
return hash
@ -75,15 +76,15 @@ def digest_file(filename, digest, chunk_size=1024):
return None
def process_files(files, output_filename, digest, strip):
def process_files(files, output_filename, digests, strip):
'''This function takes a list of file names, 'files'. It will then
compute the checksum for each of the files by opening the files.
Once each file is read and its checksum is computed, this function
will write the information to the file specified by 'output_filename'.
The path written in the output file will have anything specified by 'strip'
removed from the path. The output file is closed before returning nothing
The algorithm to compute checksums with can be specified by 'digest'
and needs to be a valid OpenSSL algorithm.
The algorithm to compute checksums with can be specified by 'digests'
and needs to be a list of valid OpenSSL algorithms.
The output file is written in the format:
<hash> <algorithm> <filesize> <filepath>
@ -97,25 +98,25 @@ def process_files(files, output_filename, digest, strip):
output_filename)
else:
logger.debug('Creating a new checksums file "%s"' % output_filename)
output = open(output_filename, 'w+')
for file in files:
if os.path.isdir(file):
logger.warn('%s is a directory, skipping' % file)
else:
hash = digest_file(file, digest)
if hash is None:
logger.warn('Unable to generate a hash for %s. ' +
'Using NOHASH as fallback' % file)
hash = 'NOHASH'
if file.startswith(strip):
short_file = file[len(strip):]
short_file = short_file.lstrip('/')
with open(output_filename, 'w+') as output:
for file in files:
if os.path.isdir(file):
logger.warn('%s is a directory, skipping' % file)
else:
short_file = file
print >>output, '%s %s %s %s' % (hash, digest,
os.path.getsize(file),
short_file)
output.close()
for digest in digests:
hash = digest_file(file, digest)
if hash is None:
logger.warn('Unable to generate a hash for %s. ' +
'Skipping.' % file)
continue
if file.startswith(strip):
short_file = file[len(strip):]
short_file = short_file.lstrip('/')
else:
short_file = file
print >>output, '%s %s %s %s' % (hash, digest,
os.path.getsize(file),
short_file)
def setup_logging(level=logging.DEBUG):
'''This function sets up the logging module using a speficiable logging
@ -141,7 +142,7 @@ def main():
# Parse command line arguments
parser = OptionParser()
parser.add_option('-d', '--digest', help='checksum algorithm to use',
action='store', dest='digest', default='sha1')
action='append', dest='digests')
parser.add_option('-o', '--output', help='output file to use',
action='store', dest='outfile', default='checksums')
parser.add_option('-v', '--verbose',
@ -167,11 +168,14 @@ def main():
logger = logging.getLogger('checksums.py')
# Validate the digest type to use
if not options.digests:
options.digests = ['sha1']
try:
hashlib.new(options.digest)
for digest in options.digests:
hashlib.new(digest)
except ValueError, ve:
logger.error('Could not create a "%s" hash object (%s)' %
(options.digest, ve.args[0]))
(digest, ve.args[0]))
exit(1)
# Validate the files to checksum
@ -181,7 +185,7 @@ def main():
files.append(i)
else:
logger.info('File "%s" was not found on the filesystem' % i)
process_files(files, options.outfile, options.digest, options.strip)
process_files(files, options.outfile, options.digests, options.strip)
if __name__ == '__main__':
main()

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

@ -156,7 +156,10 @@ class RemoteAutomation(Automation):
self.stdoutlen = 0
self.proc = dm.launchProcess(cmd, stdout, cwd, env, True)
if (self.proc is None):
raise Exception("unable to launch process")
if cmd[0] == 'am':
self.proc = stdout
else:
raise Exception("unable to launch process")
exepath = cmd[0]
name = exepath.split('/')[-1]
self.procName = name

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

@ -2,5 +2,6 @@
global:
NSModule;
NSGetModule;
__RLD_MAP;
local: *;
};

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

@ -2,5 +2,6 @@ EXPORTED {
global:
NSModule;
NSGetModule;
__RLD_MAP;
local: *;
};

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

@ -2536,7 +2536,7 @@ ia64*-hpux*)
# Use temp file for windres (bug 213281)
RCFLAGS='-O coff --use-temp-file'
# mingw doesn't require kernel32, user32, and advapi32 explicitly
LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
MOZ_FIX_LINK_PATHS=
DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'

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

@ -4273,15 +4273,21 @@ static const char* kNSURIs[] = {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
if (NS_UNLIKELY(cb.WantDebugInfo())) {
char name[72];
char name[512];
PRUint32 nsid = tmp->GetNameSpaceID();
nsAtomCString localName(tmp->NodeInfo()->NameAtom());
nsCAutoString uri;
if (tmp->OwnerDoc()->GetDocumentURI()) {
tmp->OwnerDoc()->GetDocumentURI()->GetSpec(uri);
}
if (nsid < ArrayLength(kNSURIs)) {
PR_snprintf(name, sizeof(name), "nsGenericElement%s %s", kNSURIs[nsid],
localName.get());
PR_snprintf(name, sizeof(name), "nsGenericElement%s %s %s", kNSURIs[nsid],
localName.get(), uri.get());
}
else {
PR_snprintf(name, sizeof(name), "nsGenericElement %s", localName.get());
PR_snprintf(name, sizeof(name), "nsGenericElement %s %s",
localName.get(), uri.get());
}
cb.DescribeRefCountedNode(tmp->mRefCnt.get(), sizeof(nsGenericElement),
name);

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

@ -161,6 +161,33 @@ nsPropertyTable::Enumerate(nsPropertyOwner aObject,
}
}
struct PropertyEnumeratorData
{
nsIAtom* mName;
NSPropertyFunc mCallBack;
void* mData;
};
static PLDHashOperator
PropertyEnumerator(PLDHashTable* aTable, PLDHashEntryHdr* aHdr,
PRUint32 aNumber, void* aArg)
{
PropertyListMapEntry* entry = static_cast<PropertyListMapEntry*>(aHdr);
PropertyEnumeratorData* data = static_cast<PropertyEnumeratorData*>(aArg);
data->mCallBack(const_cast<void*>(entry->key), data->mName, entry->value,
data->mData);
return PL_DHASH_NEXT;
}
void
nsPropertyTable::EnumerateAll(NSPropertyFunc aCallBack, void* aData)
{
for (PropertyList* prop = mPropertyList; prop; prop = prop->mNext) {
PropertyEnumeratorData data = { prop->mName, aCallBack, aData };
PL_DHashTableEnumerate(&prop->mObjectValueMap, PropertyEnumerator, &data);
}
}
void*
nsPropertyTable::GetPropertyInternal(nsPropertyOwner aObject,
nsIAtom *aPropertyName,

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

@ -181,6 +181,13 @@ class nsPropertyTable
NS_HIDDEN_(void) Enumerate(nsPropertyOwner aObject,
NSPropertyFunc aCallback, void *aData);
/**
* Enumerate all the properties.
* For every property |aCallback| will be called with arguments the owner,
* the property name, the property value and |aData|.
*/
NS_HIDDEN_(void) EnumerateAll(NSPropertyFunc aCallback, void *aData);
/**
* Deletes all of the properties for all objects in the property
* table, calling the destructor function for each property.

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

@ -292,6 +292,40 @@ nsRange::~nsRange()
DoSetRange(nsnull, 0, nsnull, 0, nsnull);
}
/* static */
nsresult
nsRange::CreateRange(nsIDOMNode* aStartParent, PRInt32 aStartOffset,
nsIDOMNode* aEndParent, PRInt32 aEndOffset,
nsRange** aRange)
{
MOZ_ASSERT(aRange);
*aRange = NULL;
nsRefPtr<nsRange> range = new nsRange();
nsresult rv = range->SetStart(aStartParent, aStartOffset);
NS_ENSURE_SUCCESS(rv, rv);
rv = range->SetEnd(aEndParent, aEndOffset);
NS_ENSURE_SUCCESS(rv, rv);
range.forget(aRange);
return NS_OK;
}
/* static */
nsresult
nsRange::CreateRange(nsIDOMNode* aStartParent, PRInt32 aStartOffset,
nsIDOMNode* aEndParent, PRInt32 aEndOffset,
nsIDOMRange** aRange)
{
nsRefPtr<nsRange> range;
nsresult rv = nsRange::CreateRange(aStartParent, aStartOffset, aEndParent,
aEndOffset, getter_AddRefs(range));
range.forget(aRange);
return rv;
}
/******************************************************
* nsISupports
******************************************************/

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

@ -66,6 +66,13 @@ public:
{}
virtual ~nsRange();
static nsresult CreateRange(nsIDOMNode* aStartParent, PRInt32 aStartOffset,
nsIDOMNode* aEndParent, PRInt32 aEndOffset,
nsRange** aRange);
static nsresult CreateRange(nsIDOMNode* aStartParent, PRInt32 aStartOffset,
nsIDOMNode* aEndParent, PRInt32 aEndOffset,
nsIDOMRange** aRange);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsRange, nsIDOMRange)

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

@ -41,7 +41,8 @@
* A class that handles loading and evaluation of <script> elements.
*/
#include "jscntxt.h"
#include "jsapi.h"
#include "jsfriendapi.h"
#include "nsScriptLoader.h"
#include "nsParserUtils.h"
#include "nsICharsetConverterManager.h"
@ -498,7 +499,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
// We re-use our knowledge of the implementation to reuse
// JSVERSION_HAS_XML as a safe version flag.
// If version has JSVERSION_UNKNOWN (-1), then this is still OK.
version |= js::VersionFlags::HAS_XML;
version = js::VersionSetXML(JSVersion(version), true);
}
}
} else {

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

@ -116,7 +116,6 @@ _TEST_FILES1 = \
test_bug364413.xhtml \
test_bug366946.html \
test_bug367164.html \
test_bug371576-1.html \
test_bug371576-2.html \
test_bug371576-3.html \
test_bug371576-4.html \

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

@ -1,32 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=371576
-->
<head id="head">
<title>Test for Bug 371576</title>
<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=371576">Mozilla Bug 371576</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
var result = "A";
var scrElem= document.createElement('script');
scrElem.setAttribute('src','data:text/javascript,result+="C";$("content").innerHTML="--";result+="D";');
$("head").appendChild(scrElem);
result += "B";
</script>
<script>result += "E"</script>
<script>result += "F"</script>
<script>is(result, "ABCDEF", "Wrong order of execution");</script>
</pre>
</body>
</html>

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

@ -40,6 +40,8 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
FAIL_ON_WARNINGS = 1
include $(DEPTH)/config/autoconf.mk
MODULE = content
@ -60,8 +62,6 @@ CPPSRCS = \
DocumentRendererChild.cpp \
$(NULL)
# Canvas 3D Pieces
ifdef MOZ_WEBGL
CPPSRCS += \

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

@ -501,9 +501,9 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
bool forceOSMesa =
Preferences::GetBool("webgl.force_osmesa", false);
#ifdef XP_WIN
bool preferEGL =
Preferences::GetBool("webgl.prefer-egl", false);
#ifdef XP_WIN
bool preferOpenGL =
Preferences::GetBool("webgl.prefer-native-gl", false);
#endif
@ -566,13 +566,18 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
}
}
#ifdef XP_WIN
if (PR_GetEnv("MOZ_WEBGL_PREFER_EGL")) {
preferEGL = true;
}
#endif
// Ask GfxInfo about what we should use
bool useOpenGL = true;
#ifdef XP_WIN
bool useANGLE = true;
#endif
if (gfxInfo && !forceEnabled) {
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL_OPENGL, &status))) {
@ -580,19 +585,23 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
useOpenGL = false;
}
}
#ifdef XP_WIN
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL_ANGLE, &status))) {
if (status != nsIGfxInfo::FEATURE_NO_INFO) {
useANGLE = false;
}
}
#endif
}
#ifdef XP_WIN
// allow forcing GL and not EGL/ANGLE
if (PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL")) {
preferEGL = false;
useANGLE = false;
useOpenGL = true;
}
#endif
// if we're forcing osmesa, do it first
if (forceOSMesa) {
@ -614,35 +623,32 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
gl->SetFlushGuaranteesResolve(true);
}
} else {
gl = nsnull;
LogMessage("Error during ANGLE OpenGL ES initialization");
return NS_ERROR_FAILURE;
}
}
}
// if it failed, then try the default provider, whatever that is
if (!gl && useOpenGL) {
gl = gl::GLContextProvider::CreateOffscreen(gfxIntSize(width, height), format);
if (gl && !InitAndValidateGL()) {
gl = nsnull;
}
}
#else
// other platforms just use whatever the default is
if (!gl && useOpenGL) {
gl = gl::GLContextProvider::CreateOffscreen(gfxIntSize(width, height), format);
if (gl && !InitAndValidateGL()) {
gl = nsnull;
}
}
#endif
// try the default provider, whatever that is
if (!gl && useOpenGL) {
gl = gl::GLContextProvider::CreateOffscreen(gfxIntSize(width, height), format);
if (gl && !InitAndValidateGL()) {
LogMessage("Error during OpenGL initialization");
return NS_ERROR_FAILURE;
}
}
// finally, try OSMesa
if (!gl) {
gl = gl::GLContextProviderOSMesa::CreateOffscreen(gfxIntSize(width, height), format);
if (!gl || !InitAndValidateGL()) {
gl = nsnull;
} else {
LogMessage("Using software rendering via OSMesa (THIS WILL BE SLOW)");
if (gl) {
if (!InitAndValidateGL()) {
LogMessage("Error during OSMesa initialization");
return NS_ERROR_FAILURE;
} else {
LogMessage("Using software rendering via OSMesa (THIS WILL BE SLOW)");
}
}
}
@ -1018,10 +1024,12 @@ WebGLContext::ForceClearFramebufferWithDefaultValues(PRUint32 mask, const nsIntR
bool initializeDepthBuffer = 0 != (mask & LOCAL_GL_DEPTH_BUFFER_BIT);
bool initializeStencilBuffer = 0 != (mask & LOCAL_GL_STENCIL_BUFFER_BIT);
// fun GL fact: no need to worry about the viewport here, glViewport is just setting up a coordinates transformation,
// it doesn't affect glClear at all
// prepare GL state for clearing
gl->fDisable(LOCAL_GL_SCISSOR_TEST);
gl->fDisable(LOCAL_GL_DITHER);
gl->PushViewportRect(viewportRect);
if (initializeColorBuffer) {
gl->fColorMask(1, 1, 1, 1);
@ -1064,8 +1072,6 @@ WebGLContext::ForceClearFramebufferWithDefaultValues(PRUint32 mask, const nsIntR
gl->fClearStencil(mStencilClearValue);
}
gl->PopViewportRect();
if (mDitherEnabled)
gl->fEnable(LOCAL_GL_DITHER);
else

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

@ -1449,7 +1449,7 @@ WebGLContext::UndoFakeVertexAttrib0()
mAttribBuffers[0].type,
mAttribBuffers[0].normalized,
mAttribBuffers[0].stride,
(const GLvoid *) mAttribBuffers[0].byteOffset);
reinterpret_cast<const GLvoid *>(mAttribBuffers[0].byteOffset));
gl->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mBoundArrayBuffer ? mBoundArrayBuffer->GLName() : 0);
}
@ -1708,7 +1708,7 @@ WebGLContext::DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, Web
return NS_OK;
SetupRobustnessTimer();
gl->fDrawElements(mode, count, type, (GLvoid*) (byteOffset));
gl->fDrawElements(mode, count, type, reinterpret_cast<GLvoid*>(byteOffset));
UndoFakeVertexAttrib0();
UnbindFakeBlackTextures();
@ -4700,7 +4700,7 @@ WebGLContext::VertexAttribPointer(WebGLuint index, WebGLint size, WebGLenum type
gl->fVertexAttribPointer(index, size, type, normalized,
stride,
(void*) (byteOffset));
reinterpret_cast<void*>(byteOffset));
return NS_OK;
}

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

@ -3081,8 +3081,6 @@ struct NS_STACK_CLASS nsCanvasBidiProcessorAzure : public nsBidiPresUtils::BidiP
DrawOptions(mState->globalAlpha, mCtx->UsedOperation()));
} else if (mOp == nsCanvasRenderingContext2DAzure::TEXT_DRAW_OPERATION_STROKE) {
RefPtr<Path> path = scaledFont->GetPathForGlyphs(buffer, mCtx->mTarget);
Matrix oldTransform = mCtx->mTarget->GetTransform();
const ContextState& state = *mState;
nsCanvasRenderingContext2DAzure::AdjustedTarget(mCtx)->

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

@ -22,8 +22,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=350471
/** Test for Bug 350471 **/
// This test depends on general.smoothScroll being off.
const minLineHeight = 10, maxLineHeight = 20;
function between(x, min, max) (min <= max) ? (min <= x && x <= max) : (max <= x && x <= min);
@ -228,6 +226,7 @@ function initPrefs()
// Disables the app level scroll acceleration
prefSvc.setIntPref("mousewheel.acceleration.start", -1);
prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
prefSvc.setBoolPref("general.smoothScroll", false);
}
function clearPrefs()
@ -236,10 +235,9 @@ function clearPrefs()
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
if (prefSvc.prefHasUserValue("mousewheel.acceleration.start"))
prefSvc.clearUserPref("mousewheel.acceleration.start");
if (prefSvc.prefHasUserValue("mousewheel.system_scroll_override_on_root_content.enabled"))
prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
prefSvc.clearUserPref("mousewheel.acceleration.start");
prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
prefSvc.clearUserPref("general.smoothScroll");
}
window.onload = function () {

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

@ -20,8 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=574663
/** Test for Bug 574663 **/
// This test depends on general.smoothScroll being off.
function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum) {
var win = scrollbox.ownerDocument.defaultView;
let event = {
@ -107,6 +105,7 @@ function initPrefs()
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
prefSvc.setBoolPref("general.smoothScroll", false);
// Disables the app level scroll acceleration
prefSvc.setIntPref("mousewheel.acceleration.start", -1);
prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
@ -120,12 +119,10 @@ function clearPrefs()
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2);
if (prefSvc.prefHasUserValue("mousewheel.acceleration.start"))
prefSvc.clearUserPref("mousewheel.acceleration.start");
if (prefSvc.prefHasUserValue("mousewheel.system_scroll_override_on_root_content.enabled"))
prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
if (prefSvc.prefHasUserValue("mousewheel.withcontrolkey.action"))
prefSvc.clearUserPref("mousewheel.withcontrolkey.action");
prefSvc.clearUserPref("general.smoothScroll");
prefSvc.clearUserPref("mousewheel.acceleration.start");
prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
prefSvc.clearUserPref("mousewheel.withcontrolkey.action");
}
window.onload = function () {

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

@ -149,7 +149,6 @@ INCLUDES += \
-I$(srcdir)/../../../../editor/libeditor/text \
-I$(srcdir) \
-I$(topsrcdir)/xpcom/ds \
-I$(srcdir)/../../../../js/xpconnect/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -503,7 +503,8 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
nsIFrame* parent = frame->GetParent();
nsPoint origin(0, 0);
if (parent && parent->GetType() == nsGkAtoms::tableOuterFrame) {
if (parent && parent->GetType() == nsGkAtoms::tableOuterFrame &&
frame->GetType() == nsGkAtoms::tableFrame) {
origin = parent->GetPositionIgnoringScrolling();
parent = parent->GetParent();
}

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

@ -140,17 +140,6 @@ nsHTMLDNSPrefetch::IsAllowed (nsIDocument *aDocument)
nsresult
nsHTMLDNSPrefetch::Prefetch(Link *aElement, PRUint16 flags)
{
if (IsNeckoChild()) {
// Instead of transporting the Link object to the other process
// we are using the hostname based function here, too. Compared to the
// IPC the performance hit should be negligible.
nsAutoString hostname;
nsresult rv = aElement->GetHostname(hostname);
NS_ENSURE_SUCCESS(rv,rv);
return Prefetch(hostname, flags);
}
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
return NS_ERROR_NOT_AVAILABLE;
@ -299,11 +288,16 @@ nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue()
hrefURI->GetAsciiHost(hostName);
if (!hostName.IsEmpty()) {
nsCOMPtr<nsICancelable> tmpOutstanding;
if (IsNeckoChild()) {
gNeckoChild->SendHTMLDNSPrefetch(NS_ConvertUTF8toUTF16(hostName),
mEntries[mTail].mFlags);
} else {
nsCOMPtr<nsICancelable> tmpOutstanding;
sDNSService->AsyncResolve(hostName,
sDNSService->AsyncResolve(hostName,
mEntries[mTail].mFlags | nsIDNSService::RESOLVE_SPECULATE,
sDNSListener, nsnull, getter_AddRefs(tmpOutstanding));
}
}
}

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

@ -1160,10 +1160,6 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
// All nsTextControlFrames are widgets
editorFlags |= nsIPlaintextEditor::eEditorWidgetMask;
// Use async reflow and painting for text widgets to improve
// performance.
editorFlags |= nsIPlaintextEditor::eEditorUseAsyncUpdatesMask;
// Spell check is diabled at creation time. It is enabled once
// the editor comes into focus.
editorFlags |= nsIPlaintextEditor::eEditorSkipSpellCheck;
@ -1314,12 +1310,7 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
// editor for us.
if (!defaultValue.IsEmpty()) {
// Avoid causing reentrant painting and reflowing by telling the editor
// that we don't want it to force immediate view refreshes or force
// immediate reflows during any editor calls.
rv = newEditor->SetFlags(editorFlags |
nsIPlaintextEditor::eEditorUseAsyncUpdatesMask);
rv = newEditor->SetFlags(editorFlags);
NS_ENSURE_SUCCESS(rv, rv);
// Now call SetValue() which will make the necessary editor calls to set
@ -1837,7 +1828,6 @@ nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput)
flags = savedFlags;
flags &= ~(nsIPlaintextEditor::eEditorDisabledMask);
flags &= ~(nsIPlaintextEditor::eEditorReadonlyMask);
flags |= nsIPlaintextEditor::eEditorUseAsyncUpdatesMask;
flags |= nsIPlaintextEditor::eEditorDontEchoPassword;
mEditor->SetFlags(flags);

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

@ -282,6 +282,7 @@ _TEST_FILES = \
test_bug677658.html \
test_bug677463.html \
test_bug682886.html \
test_bug717819.html \
file_fullscreen-api.html \
file_fullscreen-api-keys.html \
test_fullscreen-api.html \

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

@ -76,8 +76,7 @@ function run_test() {
t3('span9' ,[0,0,20,20],[1,1,20,20],[0,0,20,20],'td9');
t3('td9' ,[1,1,22,22],[15,15,24,24],[0,0,24,24],'table9');
t3('tr9' ,[0,0,24,24],[15,15,24,24],[0,0,24,22],'table9');
// t3('span10' ,[0,0,20,20],[3,30,20,20],[0,0,20,20],'table9');
t3('span10' ,[0,0,20,20],[27,450,20,20],[0,0,20,20],'body'); // bug: 'body' should be 'table9'
t3('span10' ,[0,0,20,20],[17,43,20,20],[0,0,20,20],'table9');
t3('table9',[13,13,28,34],[10,407,54,60],[0,0,54,50],'body');
t3('div9',[10,10,-1,0],[0,397,-1,20],[0,0,-1,70],'body');

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

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=717819
-->
<head>
<title>Test for Bug 717819</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.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=717819">Mozilla Bug 717819</a>
<p id="display"></p>
<div id="content">
<table style="position: relative; top: 100px;">
<tr>
<td>
<div id="test" style="position: absolute; top: 50px;"></div>
</td>
</tr>
</table>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 717819 **/
var div = document.getElementById("test");
is(div.offsetTop, 50, "The offsetTop must be calculated correctly");
is(div.offsetParent, document.querySelector("table"),
"The offset should be calculated off of the correct parent");
</script>
</pre>
</body>
</html>

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

@ -613,31 +613,6 @@ ImageDocument::HandleEvent(nsIDOMEvent* aEvent)
ShrinkToFit();
}
}
else if (eventType.EqualsLiteral("keypress")) {
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
PRUint32 charCode;
bool ctrlKey, metaKey, altKey;
keyEvent->GetCharCode(&charCode);
keyEvent->GetCtrlKey(&ctrlKey);
keyEvent->GetMetaKey(&metaKey);
keyEvent->GetAltKey(&altKey);
// plus key
if (charCode == 0x2B && !ctrlKey && !metaKey && !altKey) {
mShouldResize = false;
if (mImageIsResized) {
ResetZoomLevel();
RestoreImage();
}
}
// minus key
else if (charCode == 0x2D && !ctrlKey && !metaKey && !altKey) {
mShouldResize = true;
if (mImageIsOverflowing) {
ResetZoomLevel();
ShrinkToFit();
}
}
}
return NS_OK;
}

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

@ -90,7 +90,6 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../../layout/style \
-I$(srcdir)/../../../dom/base \
-I$(topsrcdir)/xpcom/ds \
-I$(srcdir)/../../../js/xpconnect/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -305,7 +305,7 @@ nsXBLDocGlobalObject::EnsureScriptEnvironment(PRUint32 aLangID)
if (mScriptContext)
return NS_OK; // already initialized for this lang
nsCOMPtr<nsIDOMScriptObjectFactory> factory = do_GetService(kDOMScriptObjectFactoryCID);
NS_ENSURE_TRUE(factory, nsnull);
NS_ENSURE_TRUE(factory, NS_OK);
nsresult rv;
@ -328,7 +328,7 @@ nsXBLDocGlobalObject::EnsureScriptEnvironment(PRUint32 aLangID)
rv = xpc_CreateGlobalObject(cx, &gSharedGlobalClass, principal, nsnull,
false, &mJSObject, &compartment);
NS_ENSURE_SUCCESS(rv, nsnull);
NS_ENSURE_SUCCESS(rv, NS_OK);
::JS_SetGlobalObject(cx, mJSObject);

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

@ -47,7 +47,8 @@
* see http://developer.mozilla.org/en/docs/XUL
*/
#include "jscntxt.h" // for JSVERSION_HAS_XML
#include "jsapi.h"
#include "jsfriendapi.h"
#include "nsXULContentSink.h"
#include "nsCOMPtr.h"
#include "nsForwardReference.h"
@ -1060,7 +1061,7 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
// our implementation knowledge to reuse JSVERSION_HAS_XML as a
// safe version flag. This is still OK if version is
// JSVERSION_UNKNOWN (-1),
version |= js::VersionFlags::HAS_XML;
version = js::VersionSetXML(JSVersion(version), true);
nsAutoString value;
rv = parser.GetParameter("e4x", value);
@ -1069,7 +1070,7 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
return rv;
} else {
if (value.Length() == 1 && value[0] == '0')
version &= ~js::VersionFlags::HAS_XML;
version = js::VersionSetXML(JSVersion(version), false);
}
}
}
@ -1083,7 +1084,7 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
// Even when JS version < 1.6 is specified, E4X is
// turned on in XUL.
version |= js::VersionFlags::HAS_XML;
version = js::VersionSetXML(JSVersion(version), true);
}
}
aAttributes += 2;

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

@ -4732,8 +4732,7 @@ nsDocShell::Repaint(bool aForce)
nsIViewManager* viewManager = presShell->GetViewManager();
NS_ENSURE_TRUE(viewManager, NS_ERROR_FAILURE);
// what about aForce ?
NS_ENSURE_SUCCESS(viewManager->UpdateAllViews(0), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(viewManager->InvalidateAllViews(), NS_ERROR_FAILURE);
return NS_OK;
}
@ -7324,7 +7323,7 @@ nsDocShell::RestoreFromHistory()
// call Thaw. So we issue the invalidate here.
newRootView = newVM->GetRootView();
if (newRootView) {
newVM->UpdateView(newRootView, NS_VMREFRESH_NO_SYNC);
newVM->InvalidateView(newRootView);
}
}
}

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

@ -43,7 +43,9 @@ window.onload = runTest;
var testWindow;
var testNum = 0;
var smoothScrollPref = "general.smoothScroll";
function runTest() {
SpecialPowers.setBoolPref(smoothScrollPref, false);
testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
}
@ -122,6 +124,7 @@ var step3 =function() {
"Page2Again: Ensure we can still scroll.");
testWindow.close();
SpecialPowers.clearUserPref(smoothScrollPref);
window.SimpleTest.finish();
}, true);
sendKey('DOWN', testWindow);

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

@ -52,14 +52,18 @@ EXTRA_PP_COMPONENTS = \
ConsoleAPI.manifest \
$(NULL)
EXTRA_JS_MODULES = ConsoleAPIStorage.jsm \
$(NULL)
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
EXTRA_COMPONENTS = \
Webapps.js \
Webapps.manifest \
$(NULL)
EXTRA_JS_MODULES = ConsoleAPIStorage.jsm \
Webapps.jsm \
EXTRA_JS_MODULES += Webapps.jsm \
$(NULL)
endif
XPIDLSRCS = \
nsIEntropyCollector.idl \

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

@ -42,8 +42,8 @@
// JavaScript includes
#include "jsapi.h"
#include "jsfriendapi.h"
#include "jsprvtd.h" // we are using private JS typedefs...
#include "jscntxt.h"
#include "jsdbgapi.h"
#include "WrapperFactory.h"
#include "AccessCheck.h"
@ -5385,7 +5385,7 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
}
if (id == sWrappedJSObject_id &&
xpc::AccessCheck::isChrome(cx->compartment)) {
xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))) {
obj = JS_ObjectToOuterObject(cx, obj);
*vp = OBJECT_TO_JSVAL(obj);
return NS_SUCCESS_I_DID_SOMETHING;

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

@ -761,27 +761,6 @@ nsDOMWindowUtils::CycleCollect(nsICycleCollectorListener *aListener)
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::ProcessUpdates()
{
nsPresContext* presContext = GetPresContext();
if (!presContext)
return NS_ERROR_UNEXPECTED;
nsIPresShell* shell = presContext->GetPresShell();
if (!shell)
return NS_ERROR_UNEXPECTED;
nsIViewManager *viewManager = shell->GetViewManager();
if (!viewManager)
return NS_ERROR_UNEXPECTED;
nsIViewManager::UpdateViewBatch batch;
batch.BeginUpdateViewBatch(viewManager);
batch.EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
float aX,

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

@ -257,8 +257,6 @@
#include <android/log.h>
#endif
#include "jscntxt.h" // cx->runtime->structuredCloneCallbacks
#ifdef PR_LOGGING
static PRLogModuleInfo* gDOMLeakPRLog;
#endif
@ -1406,8 +1404,9 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGlobalWindow)
if (tmp->mDoc && nsCCUncollectableMarker::InGeneration(
cb, tmp->mDoc->GetMarkedCCGeneration())) {
if ((tmp->mDoc && nsCCUncollectableMarker::InGeneration(
cb, tmp->mDoc->GetMarkedCCGeneration())) ||
(nsCCUncollectableMarker::sGeneration && tmp->IsBlack())) {
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
@ -6031,7 +6030,7 @@ PostMessageReadStructuredClone(JSContext* cx,
}
const JSStructuredCloneCallbacks* runtimeCallbacks =
cx->runtime->structuredCloneCallbacks;
js::GetContextStructuredCloneCallbacks(cx);
if (runtimeCallbacks) {
return runtimeCallbacks->read(cx, reader, tag, data, nsnull);
@ -6071,7 +6070,7 @@ PostMessageWriteStructuredClone(JSContext* cx,
}
const JSStructuredCloneCallbacks* runtimeCallbacks =
cx->runtime->structuredCloneCallbacks;
js::GetContextStructuredCloneCallbacks(cx);
if (runtimeCallbacks) {
return runtimeCallbacks->write(cx, writer, obj, nsnull);

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

@ -37,7 +37,6 @@
*
* ***** END LICENSE BLOCK ***** */
#include "jscntxt.h"
#include "nsJSEnvironment.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptObjectPrincipal.h"
@ -712,8 +711,7 @@ nsJSContext::DOMOperationCallback(JSContext *cx)
// Check if we should offer the option to debug
JSStackFrame* fp = ::JS_GetScriptedCaller(cx, NULL);
bool debugPossible = (fp != nsnull && cx->debugHooks &&
cx->debugHooks->debuggerHandler != nsnull);
bool debugPossible = fp && js::CanCallContextDebugHandler(cx);
#ifdef MOZ_JSDEBUGGER
// Get the debugger service if necessary.
if (debugPossible) {
@ -842,10 +840,7 @@ nsJSContext::DOMOperationCallback(JSContext *cx)
else if ((buttonPressed == 2) && debugPossible) {
// Debug the script
jsval rval;
switch(cx->debugHooks->debuggerHandler(cx, script, ::JS_GetFramePC(cx, fp),
&rval,
cx->debugHooks->
debuggerHandlerData)) {
switch (js::CallContextDebugHandler(cx, script, JS_GetFramePC(cx, fp), &rval)) {
case JSTRAP_RETURN:
JS_SetFrameReturnValue(cx, fp, rval);
return JS_TRUE;
@ -1131,7 +1126,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsJSContext)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsJSContext)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSContext)
NS_ASSERTION(!tmp->mContext || tmp->mContext->outstandingRequests == 0,
NS_ASSERTION(!tmp->mContext || js::GetContextOutstandingRequests(tmp->mContext) == 0,
"Trying to unlink a context with outstanding requests.");
tmp->mIsInitialized = false;
tmp->mGCOnDestruction = false;
@ -1161,7 +1156,7 @@ nsJSContext::GetCCRefcnt()
{
nsrefcnt refcnt = mRefCnt.get();
if (NS_LIKELY(mContext))
refcnt += mContext->outstandingRequests;
refcnt += js::GetContextOutstandingRequests(mContext);
return refcnt;
}

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

@ -41,7 +41,7 @@
#include "nsIJSContextStack.h"
#include "jsclone.h"
#include "jsfriendapi.h"
#include "mozilla/dom/StructuredCloneTags.h"
#include "mozilla/storage.h"
#include "nsCharSeparatedTokenizer.h"
@ -1023,7 +1023,7 @@ IDBObjectStore::StructuredCloneReadCallback(JSContext* aCx,
}
const JSStructuredCloneCallbacks* runtimeCallbacks =
aCx->runtime->structuredCloneCallbacks;
js::GetContextStructuredCloneCallbacks(aCx);
if (runtimeCallbacks) {
return runtimeCallbacks->read(aCx, aReader, aTag, aData, nsnull);
@ -1104,7 +1104,7 @@ IDBObjectStore::StructuredCloneWriteCallback(JSContext* aCx,
// try using the runtime callbacks
const JSStructuredCloneCallbacks* runtimeCallbacks =
aCx->runtime->structuredCloneCallbacks;
js::GetContextStructuredCloneCallbacks(aCx);
if (runtimeCallbacks) {
return runtimeCallbacks->write(aCx, aWriter, aObj, nsnull);
}

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

@ -39,7 +39,7 @@
#include "Key.h"
#include "nsIStreamBufferAccess.h"
#include "jsdate.h"
#include "jsfriendapi.h"
#include "nsAlgorithm.h"
#include "nsContentUtils.h"
#include "nsJSUtils.h"

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