зеркало из https://github.com/mozilla/gecko-dev.git
Merge trunk into HTML5 repo
This commit is contained in:
Коммит
f857815fde
|
@ -58,7 +58,6 @@ XPIDLSRCS = \
|
|||
nsIAccessibleRelation.idl \
|
||||
nsIAccessibleRole.idl \
|
||||
nsIAccessibleStates.idl \
|
||||
nsPIAccessible.idl \
|
||||
nsIAccessibleDocument.idl \
|
||||
nsPIAccessibleDocument.idl \
|
||||
nsIAccessibleProvider.idl \
|
||||
|
|
|
@ -1,119 +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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Original Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*
|
||||
* 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 "nsISupports.idl"
|
||||
|
||||
interface nsIAccessible;
|
||||
interface nsIAccessibleEvent;
|
||||
%{C++
|
||||
struct nsRoleMapEntry;
|
||||
%}
|
||||
[ptr] native nsRoleMapEntryPtr(nsRoleMapEntry);
|
||||
|
||||
[uuid(ed61e5cd-283a-42df-9599-765e0e27f4d9)]
|
||||
interface nsPIAccessible : nsISupports
|
||||
{
|
||||
/**
|
||||
* Set accessible parent.
|
||||
*/
|
||||
void setParent(in nsIAccessible aAccParent);
|
||||
|
||||
/**
|
||||
* Set first accessible child.
|
||||
*/
|
||||
void setFirstChild(in nsIAccessible aAccFirstChild);
|
||||
|
||||
/**
|
||||
* Set next sibling accessible.
|
||||
*/
|
||||
void setNextSibling(in nsIAccessible aAccNextSibling);
|
||||
|
||||
/**
|
||||
* Return parent accessible only if cached.
|
||||
*/
|
||||
void getCachedParent(out nsIAccessible aAccParent);
|
||||
|
||||
/**
|
||||
* Return first child accessible only if cached.
|
||||
*/
|
||||
void getCachedFirstChild(out nsIAccessible aAccFirstChild);
|
||||
|
||||
/**
|
||||
* Set the child count to -1 (unknown) and null out cached child pointers
|
||||
*/
|
||||
void invalidateChildren();
|
||||
|
||||
/**
|
||||
* Fire accessible event.
|
||||
*/
|
||||
void fireAccessibleEvent(in nsIAccessibleEvent aAccEvent);
|
||||
|
||||
/**
|
||||
* Return true if there are accessible children in anonymous content
|
||||
*/
|
||||
readonly attribute boolean allowsAnonChildAccessibles;
|
||||
|
||||
/**
|
||||
* Assert if child not in parent's cache.
|
||||
*/
|
||||
void testChildCache(in nsIAccessible aCachedChild);
|
||||
|
||||
/**
|
||||
* Returns text of accessible if accessible has text role otherwise empty
|
||||
* string.
|
||||
*/
|
||||
void appendTextTo(out AString aString, in unsigned long aStartOffset,
|
||||
in unsigned long aLength);
|
||||
|
||||
/**
|
||||
* Set the ARIA role map entry for a new accessible.
|
||||
* For a newly created accessible, specify which role map entry should be used.
|
||||
* @param aRoleMapEntry The ARIA nsRoleMapEntry* for the accessible, or
|
||||
* nsnull if none.
|
||||
*/
|
||||
void setRoleMapEntry(in nsRoleMapEntryPtr aRoleMapEntry);
|
||||
|
||||
/**
|
||||
* Maps ARIA state attributes to state of accessible. Note the given state
|
||||
* argument should hold states for accessible before you pass it into this
|
||||
* method.
|
||||
* @param in/out where to fill the states into.
|
||||
*/
|
||||
void getARIAState(out unsigned long aState);
|
||||
};
|
||||
|
|
@ -91,6 +91,7 @@ endif
|
|||
|
||||
EXPORTS = \
|
||||
nsAccessNodeWrap.h \
|
||||
nsARIAGridAccessibleWrap.h \
|
||||
nsAccessibleWrap.h \
|
||||
nsDocAccessibleWrap.h \
|
||||
nsRootAccessibleWrap.h \
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -15,11 +17,12 @@
|
|||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -35,32 +38,12 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nspluginroot.idl"
|
||||
#ifndef _NSARIAGRIDACCESSIBLEWRAP_H
|
||||
#define _NSARIAGRIDACCESSIBLEWRAP_H
|
||||
|
||||
%{C++
|
||||
#include "nsplugindefs.h"
|
||||
%}
|
||||
#include "nsARIAGridAccessible.h"
|
||||
|
||||
typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
|
||||
|
||||
#endif
|
||||
|
||||
[uuid(a447ddf0-1a99-11d2-815f-006008119d7a)]
|
||||
interface nsIEventHandler : nsISupports
|
||||
{
|
||||
/**
|
||||
* Handles an event. An nsIEventHandler can also get registered with with
|
||||
* nsIPluginManager2::RegisterWindow and will be called whenever an event
|
||||
* comes in for that window.
|
||||
*
|
||||
* Note that for Unix and Mac the nsPluginEvent structure is different
|
||||
* from the old NPEvent structure -- it's no longer the native event
|
||||
* record, but is instead a struct. This was done for future extensibility,
|
||||
* and so that the Mac could receive the window argument too. For Windows
|
||||
* and OS2, it's always been a struct, so there's no change for them.
|
||||
*
|
||||
* (Corresponds to NPP_HandleEvent.)
|
||||
*
|
||||
* @param aEvent - the event to be handled
|
||||
* @param aHandled - set to PR_TRUE if event was handled
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void handleEvent(in nsPluginEventPtr aEvent, out boolean aHandled);
|
||||
};
|
|
@ -1106,7 +1106,7 @@ nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
|
|||
return tmpAccWrap;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
nsresult rv = nsAccessible::FireAccessibleEvent(aEvent);
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#include "nsIAccessibleStates.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "nsPIAccessible.h"
|
||||
|
||||
#include "nsAccessibleEventData.h"
|
||||
#include "nsHyperTextAccessible.h"
|
||||
|
@ -280,20 +279,23 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
|||
ancestor->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_relevant, relevant))
|
||||
SetAccAttr(aAttributes, nsAccessibilityAtoms::containerRelevant, relevant);
|
||||
|
||||
// container-live attribute
|
||||
// container-live, and container-live-role attributes
|
||||
if (live.IsEmpty()) {
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(ancestor));
|
||||
nsRoleMapEntry *role = GetRoleMapEntry(node);
|
||||
if (nsAccUtils::HasDefinedARIAToken(ancestor,
|
||||
nsAccessibilityAtoms::aria_live)) {
|
||||
ancestor->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_live,
|
||||
live);
|
||||
} else if (role) {
|
||||
GetLiveAttrValue(role->liveAttRule, live);
|
||||
}
|
||||
if (!live.IsEmpty()) {
|
||||
SetAccAttr(aAttributes, nsAccessibilityAtoms::containerLive, live);
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(ancestor));
|
||||
nsRoleMapEntry *role = GetRoleMapEntry(node);
|
||||
if (role) {
|
||||
nsAutoString live;
|
||||
GetLiveAttrValue(role->liveAttRule, live);
|
||||
SetAccAttr(aAttributes, nsAccessibilityAtoms::containerLive, live);
|
||||
nsAccUtils::SetAccAttr(aAttributes,
|
||||
nsAccessibilityAtoms::containerLiveRole,
|
||||
NS_ConvertASCIItoUTF16(role->roleString));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -340,14 +342,13 @@ nsAccUtils::FireAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible,
|
|||
{
|
||||
NS_ENSURE_ARG(aAccessible);
|
||||
|
||||
nsCOMPtr<nsPIAccessible> pAccessible(do_QueryInterface(aAccessible));
|
||||
NS_ASSERTION(pAccessible, "Accessible doesn't implement nsPIAccessible");
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(aAccessible));
|
||||
|
||||
nsCOMPtr<nsIAccessibleEvent> event =
|
||||
new nsAccEvent(aEventType, aAccessible, aIsAsynch);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return pAccessible->FireAccessibleEvent(event);
|
||||
return acc->FireAccessibleEvent(event);
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
@ -719,11 +720,21 @@ nsAccUtils::GetLiveAttrValue(PRUint32 aRule, nsAString& aValue)
|
|||
already_AddRefed<nsAccessible>
|
||||
nsAccUtils::QueryAccessible(nsIAccessible *aAccessible)
|
||||
{
|
||||
nsAccessible* accessible = nsnull;
|
||||
nsAccessible* acc = nsnull;
|
||||
if (aAccessible)
|
||||
CallQueryInterface(aAccessible, &accessible);
|
||||
|
||||
return accessible;
|
||||
CallQueryInterface(aAccessible, &acc);
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccessible>
|
||||
nsAccUtils::QueryAccessible(nsIAccessNode *aAccessNode)
|
||||
{
|
||||
nsAccessible* acc = nsnull;
|
||||
if (aAccessNode)
|
||||
CallQueryInterface(aAccessNode, &acc);
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
already_AddRefed<nsHTMLTableAccessible>
|
||||
|
@ -797,10 +808,10 @@ nsAccUtils::TextLength(nsIAccessible *aAccessible)
|
|||
// text. They don't have their own frame.
|
||||
// XXX In the future, list bullets may have frame and anon content, so
|
||||
// we should be able to remove this at that point
|
||||
nsCOMPtr<nsPIAccessible> pAcc(do_QueryInterface(aAccessible));
|
||||
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(aAccessible));
|
||||
|
||||
nsAutoString text;
|
||||
pAcc->AppendTextTo(text, 0, PR_UINT32_MAX); // Get all the text
|
||||
acc->AppendTextTo(text, 0, PR_UINT32_MAX); // Get all the text
|
||||
return text.Length();
|
||||
}
|
||||
|
||||
|
|
|
@ -329,6 +329,12 @@ public:
|
|||
static already_AddRefed<nsAccessible>
|
||||
QueryAccessible(nsIAccessible *aAccessible);
|
||||
|
||||
/**
|
||||
* Query nsAccessible from the given nsIAccessNode.
|
||||
*/
|
||||
static already_AddRefed<nsAccessible>
|
||||
QueryAccessible(nsIAccessNode *aAccessNode);
|
||||
|
||||
/**
|
||||
* Query nsHTMLTableAccessible from the given nsIAccessibleTable.
|
||||
*/
|
||||
|
|
|
@ -164,6 +164,7 @@ ACCESSIBILITY_ATOM(_class, "class")
|
|||
ACCESSIBILITY_ATOM(cycles, "cycles") // used for XUL cycler attribute
|
||||
ACCESSIBILITY_ATOM(curpos, "curpos") // XUL
|
||||
ACCESSIBILITY_ATOM(data, "data")
|
||||
ACCESSIBILITY_ATOM(draggable, "draggable")
|
||||
ACCESSIBILITY_ATOM(droppable, "droppable") // XUL combo box
|
||||
ACCESSIBILITY_ATOM(editable, "editable")
|
||||
ACCESSIBILITY_ATOM(_for, "for")
|
||||
|
@ -259,6 +260,7 @@ ACCESSIBILITY_ATOM(tableCellIndex, "table-cell-index")
|
|||
ACCESSIBILITY_ATOM(containerAtomic, "container-atomic")
|
||||
ACCESSIBILITY_ATOM(containerBusy, "container-busy")
|
||||
ACCESSIBILITY_ATOM(containerLive, "container-live")
|
||||
ACCESSIBILITY_ATOM(containerLiveRole, "container-live-role")
|
||||
ACCESSIBILITY_ATOM(containerRelevant, "container-relevant")
|
||||
ACCESSIBILITY_ATOM(level, "level")
|
||||
ACCESSIBILITY_ATOM(live, "live")
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsAccessibilityService.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsARIAGridAccessible.h"
|
||||
#include "nsARIAGridAccessibleWrap.h"
|
||||
#include "nsARIAMap.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsCURILoader.h"
|
||||
|
@ -458,12 +458,11 @@ nsAccessibilityService::CreateRootAccessible(nsIPresShell *aShell,
|
|||
if (!*aRootAcc)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsRefPtr<nsAccessNode> rootAcc = nsAccUtils::QueryAccessNode(*aRootAcc);
|
||||
nsRefPtr<nsAccessible> rootAcc = nsAccUtils::QueryAccessible(*aRootAcc);
|
||||
rootAcc->Init();
|
||||
|
||||
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(rootNode);
|
||||
nsCOMPtr<nsPIAccessible> privateAccessible(do_QueryInterface(*aRootAcc));
|
||||
privateAccessible->SetRoleMapEntry(roleMapEntry);
|
||||
rootAcc->SetRoleMapEntry(roleMapEntry);
|
||||
|
||||
NS_ADDREF(*aRootAcc);
|
||||
|
||||
|
@ -1266,13 +1265,11 @@ nsresult nsAccessibilityService::InitAccessible(nsIAccessible *aAccessibleIn,
|
|||
}
|
||||
NS_ASSERTION(aAccessibleOut && !*aAccessibleOut, "Out param should already be cleared out");
|
||||
|
||||
nsRefPtr<nsAccessNode> acc = nsAccUtils::QueryAccessNode(aAccessibleIn);
|
||||
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(aAccessibleIn);
|
||||
nsresult rv = acc->Init(); // Add to cache, etc.
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsPIAccessible> privateAccessible =
|
||||
do_QueryInterface(aAccessibleIn);
|
||||
privateAccessible->SetRoleMapEntry(aRoleMapEntry);
|
||||
acc->SetRoleMapEntry(aRoleMapEntry);
|
||||
NS_ADDREF(*aAccessibleOut = aAccessibleIn);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1554,16 +1551,21 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
tryTagNameOrFrame = PR_FALSE;
|
||||
}
|
||||
|
||||
if (roleMapEntry && (!partOfHTMLTable || !tryTagNameOrFrame ||
|
||||
frameType != nsAccessibilityAtoms::tableOuterFrame)) {
|
||||
// Try to create ARIA grid/treegrid accessibles.
|
||||
if (roleMapEntry->role == nsIAccessibleRole::ROLE_TABLE ||
|
||||
roleMapEntry->role == nsIAccessibleRole::ROLE_TREE_TABLE) {
|
||||
newAcc = new nsARIAGridAccessible(aNode, aWeakShell);
|
||||
} else if (roleMapEntry->role == nsIAccessibleRole::ROLE_GRID_CELL ||
|
||||
roleMapEntry->role == nsIAccessibleRole::ROLE_ROWHEADER ||
|
||||
roleMapEntry->role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
|
||||
newAcc = new nsARIAGridCellAccessible(aNode, aWeakShell);
|
||||
if (roleMapEntry) {
|
||||
// Create ARIA grid/treegrid accessibles if node is not of a child or
|
||||
// valid child of HTML table and is not a HTML table.
|
||||
if ((!partOfHTMLTable || !tryTagNameOrFrame) &&
|
||||
frameType != nsAccessibilityAtoms::tableOuterFrame) {
|
||||
|
||||
if (roleMapEntry->role == nsIAccessibleRole::ROLE_TABLE ||
|
||||
roleMapEntry->role == nsIAccessibleRole::ROLE_TREE_TABLE) {
|
||||
newAcc = new nsARIAGridAccessibleWrap(aNode, aWeakShell);
|
||||
|
||||
} else if (roleMapEntry->role == nsIAccessibleRole::ROLE_GRID_CELL ||
|
||||
roleMapEntry->role == nsIAccessibleRole::ROLE_ROWHEADER ||
|
||||
roleMapEntry->role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
|
||||
newAcc = new nsARIAGridCellAccessible(aNode, aWeakShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1719,10 +1721,9 @@ nsAccessibilityService::GetRelevantContentNodeFor(nsIDOMNode *aNode,
|
|||
rv = GetAccessibleByType(bindingNode, getter_AddRefs(accessible));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsPIAccessible> paccessible(do_QueryInterface(accessible));
|
||||
if (paccessible) {
|
||||
PRBool allowsAnonChildren = PR_FALSE;
|
||||
paccessible->GetAllowsAnonChildAccessibles(&allowsAnonChildren);
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(accessible));
|
||||
if (acc) {
|
||||
PRBool allowsAnonChildren = acc->GetAllowsAnonChildAccessibles();
|
||||
if (!allowsAnonChildren) {
|
||||
NS_ADDREF(*aRelevantNode = bindingNode);
|
||||
return NS_OK;
|
||||
|
|
|
@ -180,12 +180,6 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if(aIID.Equals(NS_GET_IID(nsPIAccessible))) {
|
||||
*aInstancePtr = static_cast<nsPIAccessible*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsAccessible))) {
|
||||
*aInstancePtr = static_cast<nsAccessible*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
|
@ -267,10 +261,10 @@ nsAccessible::~nsAccessible()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
|
||||
void
|
||||
nsAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
|
||||
{
|
||||
mRoleMapEntry = aRoleMapEntry;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -489,34 +483,32 @@ nsAccessible::GetKeyboardShortcut(nsAString& aAccessKey)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetParent(nsIAccessible *aParent)
|
||||
void
|
||||
nsAccessible::SetParent(nsIAccessible *aParent)
|
||||
{
|
||||
if (mParent != aParent) {
|
||||
// Adopt a child -- we allow this now. the new parent
|
||||
// may be a dom node which wasn't previously accessible but now is.
|
||||
// The old parent's children now need to be invalidated, since
|
||||
// it no longer owns the child, the new parent does
|
||||
nsCOMPtr<nsPIAccessible> privOldParent = do_QueryInterface(mParent);
|
||||
if (privOldParent) {
|
||||
privOldParent->InvalidateChildren();
|
||||
}
|
||||
nsRefPtr<nsAccessible> oldParent = nsAccUtils::QueryAccessible(mParent);
|
||||
if (oldParent)
|
||||
oldParent->InvalidateChildren();
|
||||
}
|
||||
|
||||
mParent = aParent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetFirstChild(nsIAccessible *aFirstChild)
|
||||
void
|
||||
nsAccessible::SetFirstChild(nsIAccessible *aFirstChild)
|
||||
{
|
||||
mFirstChild = aFirstChild;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetNextSibling(nsIAccessible *aNextSibling)
|
||||
void
|
||||
nsAccessible::SetNextSibling(nsIAccessible *aNextSibling)
|
||||
{
|
||||
mNextSibling = aNextSibling;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -528,15 +520,16 @@ nsAccessible::Shutdown()
|
|||
// sure none of its children point to this parent
|
||||
InvalidateChildren();
|
||||
if (mParent) {
|
||||
nsCOMPtr<nsPIAccessible> privateParent(do_QueryInterface(mParent));
|
||||
privateParent->InvalidateChildren();
|
||||
nsRefPtr<nsAccessible> parent(nsAccUtils::QueryAccessible(mParent));
|
||||
parent->InvalidateChildren();
|
||||
mParent = nsnull;
|
||||
}
|
||||
|
||||
return nsAccessNodeWrap::Shutdown();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::InvalidateChildren()
|
||||
void
|
||||
nsAccessible::InvalidateChildren()
|
||||
{
|
||||
// Document has transformed, reset our invalid children and child count
|
||||
|
||||
|
@ -544,25 +537,29 @@ NS_IMETHODIMP nsAccessible::InvalidateChildren()
|
|||
// CacheChildren() is called.
|
||||
// Note: we don't want to start creating accessibles at this point,
|
||||
// so don't use GetNextSibling() here. (bug 387252)
|
||||
nsAccessible* child = static_cast<nsAccessible*>(mFirstChild.get());
|
||||
nsRefPtr<nsAccessible> child = nsAccUtils::QueryAccessible(mFirstChild);
|
||||
while (child) {
|
||||
child->mParent = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> next = child->mNextSibling;
|
||||
child->mNextSibling = nsnull;
|
||||
child = static_cast<nsAccessible*>(next.get());
|
||||
child = nsAccUtils::QueryAccessible(next);
|
||||
}
|
||||
|
||||
mAccChildCount = eChildCountUninitialized;
|
||||
mFirstChild = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetParent(nsIAccessible ** aParent)
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetParent(nsIAccessible **aParent)
|
||||
{
|
||||
nsresult rv = GetCachedParent(aParent);
|
||||
if (NS_FAILED(rv) || *aParent) {
|
||||
return rv;
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIAccessible> cachedParent = GetCachedParent();
|
||||
if (cachedParent) {
|
||||
cachedParent.swap(*aParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
|
@ -571,26 +568,24 @@ NS_IMETHODIMP nsAccessible::GetParent(nsIAccessible ** aParent)
|
|||
return docAccessible->GetAccessibleInParentChain(mDOMNode, PR_TRUE, aParent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetCachedParent(nsIAccessible ** aParent)
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccessible::GetCachedParent()
|
||||
{
|
||||
*aParent = nsnull;
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_IF_ADDREF(*aParent = mParent);
|
||||
return NS_OK;
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> cachedParent = mParent;
|
||||
return cachedParent.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetCachedFirstChild(nsIAccessible ** aFirstChild)
|
||||
already_AddRefed<nsIAccessible>
|
||||
nsAccessible::GetCachedFirstChild()
|
||||
{
|
||||
*aFirstChild = nsnull;
|
||||
if (!mWeakShell) {
|
||||
// This node has been shut down
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_IF_ADDREF(*aFirstChild = mFirstChild);
|
||||
return NS_OK;
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> cachedFirstChild = mFirstChild;
|
||||
return cachedFirstChild.forget();
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible nextSibling; */
|
||||
|
@ -660,10 +655,9 @@ NS_IMETHODIMP nsAccessible::GetFirstChild(nsIAccessible * *aFirstChild)
|
|||
GetChildCount(&numChildren); // Make sure we cache all of the children
|
||||
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsPIAccessible> firstChild(do_QueryInterface(mFirstChild));
|
||||
nsRefPtr<nsAccessible> firstChild(nsAccUtils::QueryAccessible(mFirstChild));
|
||||
if (firstChild) {
|
||||
nsCOMPtr<nsIAccessible> realParent;
|
||||
firstChild->GetCachedParent(getter_AddRefs(realParent));
|
||||
nsCOMPtr<nsIAccessible> realParent = firstChild->GetCachedParent();
|
||||
NS_ASSERTION(!realParent || realParent == this,
|
||||
"Two accessibles have the same first child accessible.");
|
||||
}
|
||||
|
@ -752,34 +746,33 @@ void nsAccessible::CacheChildren()
|
|||
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
mAccChildCount = 0;// Prevent reentry
|
||||
PRBool allowsAnonChildren = PR_FALSE;
|
||||
GetAllowsAnonChildAccessibles(&allowsAnonChildren);
|
||||
PRBool allowsAnonChildren = GetAllowsAnonChildAccessibles();
|
||||
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, allowsAnonChildren);
|
||||
// Seed the frame hint early while we're still on a container node.
|
||||
// This is better than doing the GetPrimaryFrameFor() later on
|
||||
// a text node, because text nodes aren't in the frame map.
|
||||
walker.mState.frame = GetFrame();
|
||||
|
||||
nsCOMPtr<nsPIAccessible> privatePrevAccessible;
|
||||
nsRefPtr<nsAccessible> prevAcc;
|
||||
PRInt32 childCount = 0;
|
||||
walker.GetFirstChild();
|
||||
SetFirstChild(walker.mState.accessible);
|
||||
|
||||
while (walker.mState.accessible) {
|
||||
++ childCount;
|
||||
privatePrevAccessible = do_QueryInterface(walker.mState.accessible);
|
||||
privatePrevAccessible->SetParent(this);
|
||||
prevAcc = nsAccUtils::QueryAccessible(walker.mState.accessible);
|
||||
prevAcc->SetParent(this);
|
||||
walker.GetNextSibling();
|
||||
privatePrevAccessible->SetNextSibling(walker.mState.accessible);
|
||||
prevAcc->SetNextSibling(walker.mState.accessible);
|
||||
}
|
||||
mAccChildCount = childCount;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
PRBool
|
||||
nsAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
*aAllowsAnonChildren = PR_TRUE;
|
||||
return NS_OK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* readonly attribute long childCount; */
|
||||
|
@ -826,30 +819,29 @@ NS_IMETHODIMP nsAccessible::GetIndexInParent(PRInt32 *aIndexInParent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::TestChildCache(nsIAccessible *aCachedChild)
|
||||
void
|
||||
nsAccessible::TestChildCache(nsIAccessible *aCachedChild)
|
||||
{
|
||||
#ifndef DEBUG_A11Y
|
||||
return NS_OK;
|
||||
#else
|
||||
#ifdef DEBUG_A11Y
|
||||
// All cached accessible nodes should be in the parent
|
||||
// It will assert if not all the children were created
|
||||
// when they were first cached, and no invalidation
|
||||
// ever corrected parent accessible's child cache.
|
||||
if (mAccChildCount <= 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (mAccChildCount <= 0)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessible> sibling = mFirstChild;
|
||||
|
||||
while (sibling != aCachedChild) {
|
||||
NS_ASSERTION(sibling, "[TestChildCache] Never ran into the same child that we started from");
|
||||
if (!sibling)
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessible> tempAccessible;
|
||||
sibling->GetNextSibling(getter_AddRefs(tempAccessible));
|
||||
sibling = tempAccessible;
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1589,7 +1581,7 @@ nsAccessible::GetXULName(nsAString& aLabel)
|
|||
return nsTextEquivUtils::GetNameFromSubtree(this, aLabel);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsAccessible::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEvent);
|
||||
|
@ -1845,6 +1837,17 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
|||
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::textIndent,
|
||||
value);
|
||||
|
||||
// Expose draggable object attribute?
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> htmlElement = do_QueryInterface(content);
|
||||
if (htmlElement) {
|
||||
PRBool draggable = PR_FALSE;
|
||||
htmlElement->GetDraggable(&draggable);
|
||||
if (draggable) {
|
||||
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::draggable,
|
||||
NS_LITERAL_STRING("true"));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3104,7 +3107,7 @@ nsresult nsAccessible::GetLinkOffset(PRInt32* aStartOffset, PRInt32* aEndOffset)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength)
|
||||
{
|
||||
return NS_OK;
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "nsTextEquivUtils.h"
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsPIAccessible.h"
|
||||
#include "nsIAccessibleHyperLink.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIAccessibleValue.h"
|
||||
|
@ -104,16 +103,15 @@ private:
|
|||
|
||||
|
||||
#define NS_ACCESSIBLE_IMPL_CID \
|
||||
{ /* 16917f1e-6cee-4cde-be3f-8bb5943f506c */ \
|
||||
0x16917f1e, \
|
||||
0x6cee, \
|
||||
0x4cde, \
|
||||
{ 0xbe, 0x3f, 0x8b, 0xb5, 0x94, 0x3F, 0x50, 0x6c } \
|
||||
{ /* 53cfa871-be42-47fc-b416-0033653b3151 */ \
|
||||
0x53cfa871, \
|
||||
0xbe42, \
|
||||
0x47fc, \
|
||||
{ 0xb4, 0x16, 0x00, 0x33, 0x65, 0x3b, 0x31, 0x51 } \
|
||||
}
|
||||
|
||||
class nsAccessible : public nsAccessNodeWrap,
|
||||
public nsIAccessible,
|
||||
public nsPIAccessible,
|
||||
public nsIAccessibleHyperLink,
|
||||
public nsIAccessibleSelectable,
|
||||
public nsIAccessibleValue
|
||||
|
@ -126,7 +124,6 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsAccessible, nsAccessNode)
|
||||
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
NS_DECL_NSPIACCESSIBLE
|
||||
NS_DECL_NSIACCESSIBLEHYPERLINK
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
NS_DECL_NSIACCESSIBLEVALUE
|
||||
|
@ -145,6 +142,15 @@ public:
|
|||
*/
|
||||
nsresult GetARIAName(nsAString& aName);
|
||||
|
||||
/**
|
||||
* Maps ARIA state attributes to state of accessible. Note the given state
|
||||
* argument should hold states for accessible before you pass it into this
|
||||
* method.
|
||||
*
|
||||
* @param [in/out] where to fill the states into.
|
||||
*/
|
||||
virtual nsresult GetARIAState(PRUint32 *aState);
|
||||
|
||||
/**
|
||||
* Returns the accessible name provided by native markup. It doesn't take
|
||||
* into account ARIA markup used to specify the name.
|
||||
|
@ -191,6 +197,78 @@ public:
|
|||
PRBool aDeepestChild,
|
||||
nsIAccessible **aChild);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Initializing and cache methods
|
||||
|
||||
/**
|
||||
* Set accessible parent.
|
||||
* XXX: shouldn't be virtual, bug 496783
|
||||
*/
|
||||
virtual void SetParent(nsIAccessible *aParent);
|
||||
|
||||
/**
|
||||
* Set first accessible child.
|
||||
*/
|
||||
void SetFirstChild(nsIAccessible *aFirstChild);
|
||||
|
||||
/**
|
||||
* Set next sibling accessible.
|
||||
*/
|
||||
void SetNextSibling(nsIAccessible *aNextSibling);
|
||||
|
||||
/**
|
||||
* Set the ARIA role map entry for a new accessible.
|
||||
* For a newly created accessible, specify which role map entry should be used.
|
||||
*
|
||||
* @param aRoleMapEntry The ARIA nsRoleMapEntry* for the accessible, or
|
||||
* nsnull if none.
|
||||
*/
|
||||
virtual void SetRoleMapEntry(nsRoleMapEntry *aRoleMapEntry);
|
||||
|
||||
/**
|
||||
* Set the child count to -1 (unknown) and null out cached child pointers
|
||||
*/
|
||||
virtual void InvalidateChildren();
|
||||
|
||||
/**
|
||||
* Return parent accessible only if cached.
|
||||
*/
|
||||
already_AddRefed<nsIAccessible> GetCachedParent();
|
||||
|
||||
/**
|
||||
* Return first child accessible only if cached.
|
||||
*/
|
||||
already_AddRefed<nsIAccessible> GetCachedFirstChild();
|
||||
|
||||
/**
|
||||
* Assert if child not in parent's cache.
|
||||
*/
|
||||
void TestChildCache(nsIAccessible *aCachedChild);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Miscellaneous methods.
|
||||
|
||||
/**
|
||||
* Fire accessible event.
|
||||
*/
|
||||
virtual nsresult FireAccessibleEvent(nsIAccessibleEvent *aAccEvent);
|
||||
|
||||
/**
|
||||
* Return true if there are accessible children in anonymous content
|
||||
*/
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
|
||||
/**
|
||||
* Returns text of accessible if accessible has text role otherwise empty
|
||||
* string.
|
||||
*
|
||||
* @param aText returned text of the accessible
|
||||
* @param aStartOffset start offset inside of the accesible
|
||||
* @param aLength required lenght of text
|
||||
*/
|
||||
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Helper methods
|
||||
|
||||
|
|
|
@ -236,20 +236,21 @@ nsApplicationAccessible::CacheChildren()
|
|||
|
||||
nsCOMPtr<nsIWeakReference> childWeakRef;
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsCOMPtr<nsPIAccessible> previousAccessible;
|
||||
nsRefPtr<nsAccessible> prevAcc;
|
||||
PRBool hasMoreElements;
|
||||
while(NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreElements))
|
||||
&& hasMoreElements) {
|
||||
|
||||
while(NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreElements)) &&
|
||||
hasMoreElements) {
|
||||
enumerator->GetNext(getter_AddRefs(childWeakRef));
|
||||
accessible = do_QueryReferent(childWeakRef);
|
||||
if (accessible) {
|
||||
if (previousAccessible)
|
||||
previousAccessible->SetNextSibling(accessible);
|
||||
if (prevAcc)
|
||||
prevAcc->SetNextSibling(accessible);
|
||||
else
|
||||
SetFirstChild(accessible);
|
||||
|
||||
previousAccessible = do_QueryInterface(accessible);
|
||||
previousAccessible->SetParent(this);
|
||||
prevAcc = nsAccUtils::QueryAccessible(accessible);
|
||||
prevAcc->SetParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,12 +86,11 @@ NS_IMETHODIMP nsLeafAccessible::GetChildCount(PRInt32 *_retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute boolean allowsAnonChildAccessibles; */
|
||||
NS_IMETHODIMP
|
||||
nsLeafAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
// nsAccessible::GetAllowsAnonChildAccessibles()
|
||||
PRBool
|
||||
nsLeafAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
*aAllowsAnonChildren = PR_FALSE;
|
||||
return NS_OK;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// nsAccessible::GetChildAtPoint()
|
||||
|
|
|
@ -67,13 +67,11 @@ public:
|
|||
NS_IMETHOD GetLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetChildCount(PRInt32 *_retval);
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
PRBool aDeepestChild,
|
||||
nsIAccessible **aChild);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -236,15 +236,21 @@ nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
|
||||
void
|
||||
nsDocAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocument);
|
||||
NS_ASSERTION(mDocument, "No document during initialization!");
|
||||
if (!mDocument)
|
||||
return;
|
||||
|
||||
mRoleMapEntry = aRoleMapEntry;
|
||||
|
||||
// Allow use of ARIA role from outer to override
|
||||
nsIDocument *parentDoc = mDocument->GetParentDocument();
|
||||
NS_ENSURE_TRUE(parentDoc, NS_ERROR_FAILURE);
|
||||
NS_ASSERTION(parentDoc, "No parent document during initialization!");
|
||||
if (!parentDoc)
|
||||
return;
|
||||
|
||||
nsIContent *ownerContent = parentDoc->FindContentForSubDocument(mDocument);
|
||||
nsCOMPtr<nsIDOMNode> ownerNode(do_QueryInterface(ownerContent));
|
||||
if (ownerNode) {
|
||||
|
@ -252,8 +258,6 @@ NS_IMETHODIMP nsDocAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
|
|||
if (roleMapEntry)
|
||||
mRoleMapEntry = roleMapEntry; // Override
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -323,7 +327,7 @@ nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsDocAccessible::GetARIAState(PRUint32 *aState)
|
||||
{
|
||||
// Combine with states from outer doc
|
||||
|
@ -331,9 +335,9 @@ nsDocAccessible::GetARIAState(PRUint32 *aState)
|
|||
nsresult rv = nsAccessible::GetARIAState(aState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsPIAccessible> privateParentAccessible = do_QueryInterface(mParent);
|
||||
if (privateParentAccessible) // Allow iframe/frame etc. to have final state override via ARIA
|
||||
return privateParentAccessible->GetARIAState(aState);
|
||||
nsRefPtr<nsAccessible> parent = nsAccUtils::QueryAccessible(mParent);
|
||||
if (parent) // Allow iframe/frame etc. to have final state override via ARIA
|
||||
return parent->GetARIAState(aState);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -538,14 +542,12 @@ NS_IMETHODIMP nsDocAccessible::GetCachedAccessNode(void *aUniqueID, nsIAccessNod
|
|||
// when they were first cached, and no invalidation
|
||||
// ever corrected parent accessible's child cache.
|
||||
nsCOMPtr<nsIAccessible> accessible = do_QueryInterface(*aAccessNode);
|
||||
nsCOMPtr<nsPIAccessible> privateAccessible = do_QueryInterface(accessible);
|
||||
if (privateAccessible) {
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
privateAccessible->GetCachedParent(getter_AddRefs(parent));
|
||||
nsCOMPtr<nsPIAccessible> privateParent(do_QueryInterface(parent));
|
||||
if (privateParent) {
|
||||
privateParent->TestChildCache(accessible);
|
||||
}
|
||||
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(accessible);
|
||||
if (acc) {
|
||||
nsCOMPtr<nsIAccessible> parent = acc->GetCachedParent();
|
||||
nsRefPtr<nsAccessible> parentAcc(nsAccUtils::QueryAccessible(parent));
|
||||
if (parentAcc)
|
||||
parentAcc->TestChildCache(accessible);
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
|
@ -885,11 +887,12 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
|
|||
// Need to wait until scrollable view is available
|
||||
AddScrollListener();
|
||||
nsCOMPtr<nsIAccessible> parent(nsAccessible::GetParent());
|
||||
nsCOMPtr<nsPIAccessible> privateAccessible(do_QueryInterface(parent));
|
||||
if (privateAccessible) {
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(parent));
|
||||
if (acc) {
|
||||
// Make the parent forget about the old document as a child
|
||||
privateAccessible->InvalidateChildren();
|
||||
acc->InvalidateChildren();
|
||||
}
|
||||
|
||||
if (sameTypeRoot != treeItem) {
|
||||
// Fire show/hide events to indicate frame/iframe content is new, rather than
|
||||
// doc load event which causes screen readers to act is if entire page is reloaded
|
||||
|
@ -1638,10 +1641,10 @@ NS_IMETHODIMP nsDocAccessible::FlushPendingEvents()
|
|||
|
||||
if (eventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW) {
|
||||
// For asynch show, delayed invalidatation of parent's children
|
||||
nsCOMPtr<nsPIAccessible> privateContainerAccessible =
|
||||
do_QueryInterface(containerAccessible);
|
||||
if (privateContainerAccessible)
|
||||
privateContainerAccessible->InvalidateChildren();
|
||||
nsRefPtr<nsAccessible> containerAcc =
|
||||
nsAccUtils::QueryAccessible(containerAccessible);
|
||||
if (containerAcc)
|
||||
containerAcc->InvalidateChildren();
|
||||
|
||||
// Some show events in the subtree may have been removed to
|
||||
// avoid firing redundant events. But, we still need to make sure any
|
||||
|
@ -1765,9 +1768,9 @@ void nsDocAccessible::InvalidateChildrenInSubtree(nsIDOMNode *aStartNode)
|
|||
{
|
||||
nsCOMPtr<nsIAccessNode> accessNode;
|
||||
GetCachedAccessNode(aStartNode, getter_AddRefs(accessNode));
|
||||
nsCOMPtr<nsPIAccessible> accessible(do_QueryInterface(accessNode));
|
||||
if (accessible)
|
||||
accessible->InvalidateChildren();
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(accessNode));
|
||||
if (acc)
|
||||
acc->InvalidateChildren();
|
||||
|
||||
// Invalidate accessible children in the DOM subtree
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aStartNode);
|
||||
|
@ -1805,12 +1808,11 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
|
|||
accessible);
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsPIAccessible> privateAccessible = do_QueryInterface(accessible);
|
||||
NS_ASSERTION(privateAccessible, "No nsPIAccessible for nsIAccessible");
|
||||
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(accessible);
|
||||
|
||||
nsCOMPtr<nsIAccessible> childAccessible;
|
||||
// we only need to shutdown the accessibles here if one of them has been created
|
||||
privateAccessible->GetCachedFirstChild(getter_AddRefs(childAccessible));
|
||||
// We only need to shutdown the accessibles here if one of them has been
|
||||
// created.
|
||||
nsCOMPtr<nsIAccessible> childAccessible = acc->GetCachedFirstChild();
|
||||
if (childAccessible) {
|
||||
nsCOMPtr<nsIArray> children;
|
||||
// use GetChildren() to fetch children at one time, instead of using
|
||||
|
@ -1913,7 +1915,8 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
// document and listen to these changes until after the page is first loaded
|
||||
// Leave early, and ensure mAccChildCount stays uninitialized instead of 0,
|
||||
// which it is if anyone asks for its children right now.
|
||||
return InvalidateChildren();
|
||||
InvalidateChildren();
|
||||
return NS_OK;
|
||||
}
|
||||
nsIEventStateManager *esm = presShell->GetPresContext()->EventStateManager();
|
||||
NS_ENSURE_TRUE(esm, NS_ERROR_FAILURE);
|
||||
|
@ -1926,8 +1929,11 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
if (!containerAccessible) {
|
||||
containerAccessible = this;
|
||||
}
|
||||
nsCOMPtr<nsPIAccessible> privateContainer = do_QueryInterface(containerAccessible);
|
||||
return privateContainer->InvalidateChildren();
|
||||
|
||||
nsRefPtr<nsAccessible> containerAcc =
|
||||
nsAccUtils::QueryAccessible(containerAccessible);
|
||||
containerAcc->InvalidateChildren();
|
||||
return NS_OK;
|
||||
}
|
||||
// else: user input, so we must fall through and for full handling,
|
||||
// e.g. fire the mutation events. Note: user input could cause DOM_CREATE
|
||||
|
@ -2022,11 +2028,11 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
if (!isAsynch) {
|
||||
// DOM already updated with new objects -- invalidate parent's children now
|
||||
// For asynch we must wait until layout updates before we invalidate the children
|
||||
nsCOMPtr<nsPIAccessible> privateContainerAccessible =
|
||||
do_QueryInterface(containerAccessible);
|
||||
if (privateContainerAccessible) {
|
||||
privateContainerAccessible->InvalidateChildren();
|
||||
}
|
||||
nsRefPtr<nsAccessible> containerAcc =
|
||||
nsAccUtils::QueryAccessible(containerAccessible);
|
||||
if (containerAcc)
|
||||
containerAcc->InvalidateChildren();
|
||||
|
||||
}
|
||||
// Fire EVENT_SHOW, EVENT_MENUPOPUP_START for newly visible content.
|
||||
// Fire after a short timer, because we want to make sure the view has been
|
||||
|
|
|
@ -76,10 +76,8 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
|
|||
virtual ~nsDocAccessible();
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
NS_IMETHOD GetDescription(nsAString& aDescription);
|
||||
NS_IMETHOD GetARIAState(PRUint32 *aState);
|
||||
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||
|
@ -103,6 +101,8 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
|
|||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetARIAState(PRUint32 *aState);
|
||||
virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
|
||||
|
||||
// nsIAccessibleText
|
||||
NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
|
||||
|
|
|
@ -137,17 +137,15 @@ void nsOuterDocAccessible::CacheChildren()
|
|||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
accService->GetAccessibleFor(innerNode, getter_AddRefs(innerAccessible));
|
||||
nsCOMPtr<nsPIAccessible> privateInnerAccessible =
|
||||
do_QueryInterface(innerAccessible);
|
||||
if (!privateInnerAccessible) {
|
||||
nsRefPtr<nsAccessible> innerAcc(nsAccUtils::QueryAccessible(innerAccessible));
|
||||
if (!innerAcc)
|
||||
return;
|
||||
}
|
||||
|
||||
// Success getting inner document as first child -- now we cache it.
|
||||
mAccChildCount = 1;
|
||||
SetFirstChild(innerAccessible); // weak ref
|
||||
privateInnerAccessible->SetParent(this);
|
||||
privateInnerAccessible->SetNextSibling(nsnull);
|
||||
innerAcc->SetParent(this);
|
||||
innerAcc->SetNextSibling(nsnull);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -663,8 +663,8 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
if (eventType.EqualsLiteral("popuphiding"))
|
||||
return HandlePopupHidingEvent(aTargetNode, accessible);
|
||||
|
||||
nsCOMPtr<nsPIAccessible> privAcc(do_QueryInterface(accessible));
|
||||
if (!privAcc)
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(accessible));
|
||||
if (!acc)
|
||||
return NS_OK;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
|
@ -699,7 +699,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
nsCOMPtr<nsIAccessibleStateChangeEvent> accEvent =
|
||||
new nsAccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
privAcc->FireAccessibleEvent(accEvent);
|
||||
acc->FireAccessibleEvent(accEvent);
|
||||
|
||||
if (isEnabled)
|
||||
FireAccessibleFocusEvent(accessible, aTargetNode, aEvent);
|
||||
|
@ -717,7 +717,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
|
||||
return privAcc->FireAccessibleEvent(accEvent);
|
||||
return acc->FireAccessibleEvent(accEvent);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessible> treeItemAccessible;
|
||||
|
@ -1128,9 +1128,8 @@ nsRootAccessible::HandlePopupShownEvent(nsIAccessible *aAccessible)
|
|||
PR_FALSE, PR_TRUE);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsCOMPtr<nsPIAccessible> pComboboxAcc(do_QueryInterface(comboboxAcc));
|
||||
|
||||
return pComboboxAcc->FireAccessibleEvent(event);
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(comboboxAcc));
|
||||
return acc->FireAccessibleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1173,9 +1172,8 @@ nsRootAccessible::HandlePopupHidingEvent(nsIDOMNode *aNode,
|
|||
PR_FALSE, PR_FALSE);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsCOMPtr<nsPIAccessible> pComboboxAcc(do_QueryInterface(comboboxAcc));
|
||||
|
||||
return pComboboxAcc->FireAccessibleEvent(event);
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(comboboxAcc));
|
||||
return acc->FireAccessibleEvent(event);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -53,8 +53,8 @@ nsLinkableAccessible(aDOMNode, aShell)
|
|||
// Make sure we don't support text or other irrelevant interfaces.
|
||||
// We have nsLinkableAccessible in our inheritance chain as a convenience in order to
|
||||
// get link actions and states on the text accessibles. Windows screen readers expect that.
|
||||
NS_IMPL_ISUPPORTS_INHERITED3(nsTextAccessible, nsAccessNode,
|
||||
nsAccessible, nsIAccessible, nsPIAccessible)
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsTextAccessible, nsAccessNode,
|
||||
nsAccessible, nsIAccessible)
|
||||
|
||||
/**
|
||||
* We are text
|
||||
|
@ -93,7 +93,7 @@ NS_IMETHODIMP nsTextAccessible::GetChildCount(PRInt32 *_retval)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsTextAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength)
|
||||
{
|
||||
nsIFrame *frame = GetFrame();
|
||||
|
|
|
@ -58,11 +58,10 @@ public:
|
|||
NS_IMETHOD GetLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetChildCount(PRInt32 *_retval);
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHOD AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||
PRUint32 aLength);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -531,8 +531,8 @@ nsBGColorTextAttr::GetColor(nsIFrame *aFrame, nscolor *aColor)
|
|||
{
|
||||
const nsStyleBackground *styleBackground = aFrame->GetStyleBackground();
|
||||
|
||||
if (NS_GET_A(styleBackground->mFallbackBackgroundColor) > 0) {
|
||||
*aColor = styleBackground->mFallbackBackgroundColor;
|
||||
if (NS_GET_A(styleBackground->mBackgroundColor) > 0) {
|
||||
*aColor = styleBackground->mBackgroundColor;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -177,21 +177,18 @@ void nsHTMLImageAccessible::CacheChildren()
|
|||
PRInt32 childCount = 0;
|
||||
|
||||
nsCOMPtr<nsIAccessible> areaAccessible;
|
||||
nsCOMPtr<nsPIAccessible> privatePrevAccessible;
|
||||
nsRefPtr<nsAccessible> prevAcc;
|
||||
while (childCount < (PRInt32)numMapAreas &&
|
||||
(areaAccessible = GetAreaAccessible(mapAreas, childCount)) != nsnull) {
|
||||
if (privatePrevAccessible) {
|
||||
privatePrevAccessible->SetNextSibling(areaAccessible);
|
||||
}
|
||||
else {
|
||||
if (prevAcc)
|
||||
prevAcc->SetNextSibling(areaAccessible);
|
||||
else
|
||||
SetFirstChild(areaAccessible);
|
||||
}
|
||||
|
||||
++ childCount;
|
||||
|
||||
privatePrevAccessible = do_QueryInterface(areaAccessible);
|
||||
NS_ASSERTION(privatePrevAccessible, "nsIAccessible impl's should always support nsPIAccessible as well");
|
||||
privatePrevAccessible->SetParent(this);
|
||||
prevAcc = nsAccUtils::QueryAccessible(areaAccessible);
|
||||
prevAcc->SetParent(this);
|
||||
}
|
||||
mAccChildCount = childCount;
|
||||
}
|
||||
|
|
|
@ -377,23 +377,21 @@ nsHTMLSelectListAccessible::AccessibleForOption(nsIAccessibilityService *aAccSer
|
|||
// Accessibility service will initialize & cache any accessibles created
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
aAccService->GetAccessibleInWeakShell(domNode, mWeakShell, getter_AddRefs(accessible));
|
||||
nsCOMPtr<nsPIAccessible> privateAccessible(do_QueryInterface(accessible));
|
||||
if (!privateAccessible) {
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(accessible));
|
||||
if (!acc)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
++ *aChildCount;
|
||||
privateAccessible->SetParent(this);
|
||||
nsCOMPtr<nsPIAccessible> privatePrevAccessible(do_QueryInterface(aLastGoodAccessible));
|
||||
if (privatePrevAccessible) {
|
||||
privatePrevAccessible->SetNextSibling(accessible);
|
||||
}
|
||||
if (!mFirstChild) {
|
||||
acc->SetParent(this);
|
||||
nsRefPtr<nsAccessible> prevAcc =
|
||||
nsAccUtils::QueryAccessible(aLastGoodAccessible);
|
||||
if (prevAcc)
|
||||
prevAcc->SetNextSibling(accessible);
|
||||
|
||||
if (!mFirstChild)
|
||||
mFirstChild = accessible;
|
||||
}
|
||||
nsIAccessible *returnAccessible = accessible;
|
||||
NS_ADDREF(returnAccessible);
|
||||
return returnAccessible;
|
||||
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
|
@ -431,13 +429,14 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIAccessibilityService *aAccServic
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lastGoodAccessible) {
|
||||
nsCOMPtr<nsPIAccessible> privateLastAcc =
|
||||
do_QueryInterface(lastGoodAccessible);
|
||||
privateLastAcc->SetNextSibling(nsnull);
|
||||
NS_ADDREF(aLastGoodAccessible = lastGoodAccessible);
|
||||
nsRefPtr<nsAccessible> lastAcc =
|
||||
nsAccUtils::QueryAccessible(lastGoodAccessible);
|
||||
lastAcc->SetNextSibling(nsnull);
|
||||
}
|
||||
return aLastGoodAccessible;
|
||||
|
||||
return lastGoodAccessible.forget();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -845,18 +844,14 @@ void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibl
|
|||
|
||||
nsCOMPtr<nsIAccessible> multiSelect =
|
||||
nsAccUtils::GetMultiSelectFor(optionNode);
|
||||
nsCOMPtr<nsPIAccessible> privateMultiSelect = do_QueryInterface(multiSelect);
|
||||
if (!privateMultiSelect) {
|
||||
if (!multiSelect)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
nsCOMPtr<nsIAccessible> optionAccessible;
|
||||
accService->GetAccessibleFor(optionNode, getter_AddRefs(optionAccessible));
|
||||
if (!optionAccessible) {
|
||||
GetAccService()->GetAccessibleFor(optionNode,
|
||||
getter_AddRefs(optionAccessible));
|
||||
if (!optionAccessible)
|
||||
return;
|
||||
}
|
||||
|
||||
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
|
||||
multiSelect);
|
||||
|
@ -1250,10 +1245,10 @@ void nsHTMLComboboxTextFieldAccessible::CacheChildren()
|
|||
|
||||
walker.GetFirstChild();
|
||||
SetFirstChild(walker.mState.accessible);
|
||||
nsCOMPtr<nsPIAccessible> privateChild =
|
||||
do_QueryInterface(walker.mState.accessible);
|
||||
privateChild->SetParent(this);
|
||||
privateChild->SetNextSibling(nsnull);
|
||||
nsRefPtr<nsAccessible> child =
|
||||
nsAccUtils::QueryAccessible(walker.mState.accessible);
|
||||
child->SetParent(this);
|
||||
child->SetNextSibling(nsnull);
|
||||
mAccChildCount = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,14 +420,18 @@ void nsHTMLTableAccessible::CacheChildren()
|
|||
captionAccessible->GetPreviousSibling(getter_AddRefs(beforeCaptionAccessible));
|
||||
if (beforeCaptionAccessible) {
|
||||
// Move caption accessible so that it's the first child
|
||||
nsRefPtr<nsAccessible> acc =
|
||||
nsAccUtils::QueryAccessible(beforeCaptionAccessible);
|
||||
|
||||
nsCOMPtr<nsIAccessible> afterCaptionAccessible;
|
||||
captionAccessible->GetNextSibling(getter_AddRefs(afterCaptionAccessible));
|
||||
nsCOMPtr<nsPIAccessible> privateAcc = do_QueryInterface(beforeCaptionAccessible);
|
||||
privateAcc->SetNextSibling(afterCaptionAccessible);
|
||||
acc->SetNextSibling(afterCaptionAccessible);
|
||||
|
||||
GetFirstChild(getter_AddRefs(afterCaptionAccessible));
|
||||
SetFirstChild(captionAccessible);
|
||||
privateAcc = do_QueryInterface(captionAccessible);
|
||||
privateAcc->SetNextSibling(afterCaptionAccessible);
|
||||
|
||||
acc = nsAccUtils::QueryAccessible(captionAccessible);
|
||||
acc->SetNextSibling(afterCaptionAccessible);
|
||||
}
|
||||
// Don't check for more captions, because nsAccessibilityService ensures
|
||||
// we don't create accessibles for the other captions, since only the
|
||||
|
@ -1385,7 +1389,7 @@ NS_IMETHODIMP nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForL
|
|||
PRUint32 length;
|
||||
nodeList->GetLength(&length);
|
||||
nsAutoString color, lastRowColor;
|
||||
for (PRInt32 rowCount = 0; rowCount < rows; rowCount ++) {
|
||||
for (PRInt32 rowCount = 0; rowCount < length; rowCount ++) {
|
||||
nsCOMPtr<nsIDOMNode> rowNode;
|
||||
nodeList->Item(rowCount, getter_AddRefs(rowNode));
|
||||
|
||||
|
|
|
@ -343,12 +343,11 @@ nsHTMLListBulletAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraS
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLListBulletAccessible::SetParent(nsIAccessible *aParentAccessible)
|
||||
void
|
||||
nsHTMLListBulletAccessible::SetParent(nsIAccessible *aParent)
|
||||
{
|
||||
mParent = nsnull;
|
||||
mWeakParent = aParentAccessible;
|
||||
return NS_OK;
|
||||
mWeakParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -358,7 +357,7 @@ nsHTMLListBulletAccessible::GetParent(nsIAccessible **aParentAccessible)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsHTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
|
|
|
@ -113,7 +113,6 @@ public:
|
|||
// Don't cache via unique ID -- bullet accessible shares the same dom node as
|
||||
// this LI accessible. Also, don't cache via mParent/SetParent(), prevent
|
||||
// circular reference since li holds onto us.
|
||||
NS_IMETHOD SetParent(nsIAccessible *aParentAccessible);
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParentAccessible);
|
||||
|
||||
// nsAccessNode
|
||||
|
@ -122,9 +121,9 @@ public:
|
|||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHOD AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength);
|
||||
virtual void SetParent(nsIAccessible *aParent);
|
||||
virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
protected:
|
||||
// XXX: Ideally we'd get the bullet text directly from the bullet frame via
|
||||
|
|
|
@ -231,17 +231,17 @@ void nsHyperTextAccessible::CacheChildren()
|
|||
return;
|
||||
}
|
||||
nsAccessibleTreeWalker walker(mWeakShell, editorRootDOMNode, PR_TRUE);
|
||||
nsCOMPtr<nsPIAccessible> privatePrevAccessible;
|
||||
nsRefPtr<nsAccessible> prevAcc;
|
||||
PRInt32 childCount = 0;
|
||||
walker.GetFirstChild();
|
||||
SetFirstChild(walker.mState.accessible);
|
||||
|
||||
while (walker.mState.accessible) {
|
||||
++ childCount;
|
||||
privatePrevAccessible = do_QueryInterface(walker.mState.accessible);
|
||||
privatePrevAccessible->SetParent(this);
|
||||
prevAcc = nsAccUtils::QueryAccessible(walker.mState.accessible);
|
||||
prevAcc->SetParent(this);
|
||||
walker.GetNextSibling();
|
||||
privatePrevAccessible->SetNextSibling(walker.mState.accessible);
|
||||
prevAcc->SetNextSibling(walker.mState.accessible);
|
||||
}
|
||||
mAccChildCount = childCount;
|
||||
}
|
||||
|
@ -439,9 +439,9 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
|
|||
*aText += '*'; // Show *'s only for password text
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsPIAccessible> pAcc(do_QueryInterface(accessible));
|
||||
pAcc->AppendTextTo(*aText, startOffset,
|
||||
substringEndOffset - startOffset);
|
||||
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(accessible));
|
||||
acc->AppendTextTo(*aText, startOffset,
|
||||
substringEndOffset - startOffset);
|
||||
}
|
||||
}
|
||||
if (aBoundsRect) { // Caller wants the bounds of the text
|
||||
|
|
|
@ -77,6 +77,7 @@ EXPORTS = \
|
|||
nsAccessNodeWrap.h \
|
||||
nsTextAccessibleWrap.h \
|
||||
nsAccessibleWrap.h \
|
||||
nsARIAGridAccessibleWrap.h \
|
||||
nsDocAccessibleWrap.h \
|
||||
nsRootAccessibleWrap.h \
|
||||
nsXULMenuAccessibleWrap.h \
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -15,11 +17,12 @@
|
|||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -35,44 +38,12 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* nsIJRILiveConnectPlugin
|
||||
*
|
||||
* @status DEPRECATED
|
||||
*
|
||||
* Originally published XPCOM Plugin API is now deprecated
|
||||
* Developers are welcome to use NPAPI, please refer to:
|
||||
* http://mozilla.org/projects/plugins/
|
||||
*/
|
||||
#ifndef _NSARIAGRIDACCESSIBLEWRAP_H
|
||||
#define _NSARIAGRIDACCESSIBLEWRAP_H
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nspluginroot.idl"
|
||||
#include "nsARIAGridAccessible.h"
|
||||
|
||||
%{C++
|
||||
#include "jri.h"
|
||||
%}
|
||||
typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
|
||||
|
||||
/**
|
||||
* The nsIJRILiveConnectPlugin interface defines additional entry points that a
|
||||
* plugin developer needs to implement in order for the plugin to support
|
||||
* JRI-based LiveConnect, as opposed to the standard JNI-based LiveConnect
|
||||
* (which new in 5.0).
|
||||
*
|
||||
* Plugin developers requiring this capability should implement this interface
|
||||
* in addition to the basic nsIPlugin interface.
|
||||
*/
|
||||
[uuid(c94058e0-f772-11d1-815b-006008119d7a)]
|
||||
interface nsIJRILiveConnectPlugin : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns the class of the Java instance to be associated with the
|
||||
* plugin.
|
||||
*
|
||||
* (New JNI-based entry point, roughly corresponds to NPP_GetJavaClass.)
|
||||
*
|
||||
* @param aJavaClass - a resulting reference to the Java class
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void getJavaClass(in JRIEnvPtr aEnv, out jref aJavaClass);
|
||||
};
|
||||
#endif
|
||||
|
|
@ -75,10 +75,10 @@ class nsAccessibleWrap : public nsAccessible
|
|||
void GetNativeWindow (void **aOutNativeWindow);
|
||||
|
||||
virtual nsresult Shutdown ();
|
||||
virtual nsresult InvalidateChildren ();
|
||||
virtual void InvalidateChildren();
|
||||
|
||||
virtual nsresult FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
|
||||
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
|
||||
// ignored means that the accessible might still have children, but is not displayed
|
||||
// to the user. it also has no native accessible object represented for it.
|
||||
PRBool IsIgnored();
|
||||
|
|
|
@ -159,7 +159,7 @@ nsAccessibleWrap::Shutdown ()
|
|||
return nsAccessible::Shutdown();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
@ -211,18 +211,18 @@ nsAccessibleWrap::FirePlatformEvent(nsIAccessibleEvent *aEvent)
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::InvalidateChildren ()
|
||||
void
|
||||
nsAccessibleWrap::InvalidateChildren()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (mNativeWrapper) {
|
||||
mozAccessible *object = mNativeWrapper->getNativeObject();
|
||||
[object invalidateChildren];
|
||||
}
|
||||
return nsAccessible::InvalidateChildren();
|
||||
nsAccessible::InvalidateChildren();
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
|
|
@ -74,6 +74,7 @@ CPPSRCS = \
|
|||
nsDocAccessibleWrap.cpp \
|
||||
nsRootAccessibleWrap.cpp \
|
||||
nsHTMLWin32ObjectAccessible.cpp \
|
||||
nsARIAGridAccessibleWrap.cpp \
|
||||
nsXULMenuAccessibleWrap.cpp \
|
||||
nsXULTreeAccessibleWrap.cpp \
|
||||
nsHyperTextAccessibleWrap.cpp \
|
||||
|
@ -99,6 +100,7 @@ EXPORTS = \
|
|||
nsDocAccessibleWrap.h \
|
||||
nsRootAccessibleWrap.h \
|
||||
nsHTMLWin32ObjectAccessible.h \
|
||||
nsARIAGridAccessibleWrap.h \
|
||||
nsXULMenuAccessibleWrap.h \
|
||||
nsXULTreeAccessibleWrap.h \
|
||||
nsHyperTextAccessibleWrap.h \
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsARIAGridAccessibleWrap.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsARIAGridAccessibleWrap,
|
||||
nsARIAGridAccessible)
|
||||
|
||||
IMPL_IUNKNOWN_INHERITED1(nsARIAGridAccessibleWrap,
|
||||
nsAccessibleWrap,
|
||||
CAccessibleTable);
|
|
@ -1,4 +1,6 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -15,11 +17,12 @@
|
|||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -35,25 +38,28 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _NSARIAGRIDACCESSIBLEWRAP_H
|
||||
#define _NSARIAGRIDACCESSIBLEWRAP_H
|
||||
|
||||
#include "nsARIAGridAccessible.h"
|
||||
#include "CAccessibleTable.h"
|
||||
|
||||
/**
|
||||
* Interface for exposing scriptable plugin methods to JavaScript via XPConnect.
|
||||
* Accessible for ARIA grid and treegrid implementing IAccessibleTable
|
||||
* interface.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[uuid(f1a12bba-1dd1-11b2-a95f-cdc118605e92)]
|
||||
interface nsIScriptablePlugin : nsISupports
|
||||
class nsARIAGridAccessibleWrap : public nsARIAGridAccessible,
|
||||
public CAccessibleTable
|
||||
{
|
||||
/**
|
||||
* The object to be wrapped and exposed to JavaScript. It should
|
||||
* be an XPCOM object, and it can be the same object as the plugin.
|
||||
*/
|
||||
readonly attribute nsQIResult scriptablePeer;
|
||||
public:
|
||||
nsARIAGridAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsARIAGridAccessible(aNode, aShell) {}
|
||||
|
||||
/**
|
||||
* The interface that XPConnect should use when exposing the peer
|
||||
* object to JavaScript. All scriptable methods on the interface
|
||||
* will be available to JavaScript.
|
||||
*/
|
||||
readonly attribute nsIIDPtr scriptableInterface;
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1623,9 +1623,9 @@ NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsPIAccessible
|
||||
// nsAccessible
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG(aEvent);
|
||||
|
|
|
@ -290,8 +290,8 @@ class nsAccessibleWrap : public nsAccessible,
|
|||
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
// nsAccessible
|
||||
virtual nsresult FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
|
||||
// Helper methods
|
||||
static PRInt32 GetChildIDFor(nsIAccessible* aAccessible);
|
||||
|
|
|
@ -48,7 +48,7 @@ IMPL_IUNKNOWN_INHERITED2(nsHyperTextAccessibleWrap,
|
|||
CAccessibleHypertext,
|
||||
CAccessibleEditableText);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsHyperTextAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
PRUint32 eventType;
|
||||
|
|
|
@ -60,8 +60,9 @@ public:
|
|||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
// nsAccessible
|
||||
virtual nsresult FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
|
||||
protected:
|
||||
virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,
|
||||
PRUint32 *aStartOffset,
|
||||
|
|
|
@ -75,6 +75,7 @@ CPPSRCS = \
|
|||
|
||||
EXPORTS = \
|
||||
nsAccessNodeWrap.h \
|
||||
nsARIAGridAccessibleWrap.h \
|
||||
nsTextAccessibleWrap.h \
|
||||
nsAccessibleWrap.h \
|
||||
nsDocAccessibleWrap.h \
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _NSARIAGRIDACCESSIBLEWRAP_H
|
||||
#define _NSARIAGRIDACCESSIBLEWRAP_H
|
||||
|
||||
#include "nsARIAGridAccessible.h"
|
||||
|
||||
typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
|
||||
|
||||
#endif
|
||||
|
|
@ -133,8 +133,7 @@ nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode)
|
|||
children->GetLength(&length);
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsCOMPtr<nsPIAccessible> currAccessible;
|
||||
nsCOMPtr<nsPIAccessible> prevAccessible;
|
||||
nsRefPtr<nsAccessible> currAccessible, prevAccessible;
|
||||
|
||||
PRUint32 childLength = 0;
|
||||
for (PRUint32 index = 0; index < length; index++) {
|
||||
|
@ -144,7 +143,7 @@ nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode)
|
|||
continue;
|
||||
|
||||
accService->GetAttachedAccessibleFor(child, getter_AddRefs(accessible));
|
||||
currAccessible = do_QueryInterface(accessible);
|
||||
currAccessible = nsAccUtils::QueryAccessible(accessible);
|
||||
if (!currAccessible)
|
||||
continue;
|
||||
|
||||
|
@ -247,13 +246,10 @@ nsXFormsAccessible::GetDescription(nsAString& aDescription)
|
|||
return GetBoundChildElementValue(NS_LITERAL_STRING("hint"), aDescription);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
PRBool
|
||||
nsXFormsAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAllowsAnonChildren);
|
||||
|
||||
*aAllowsAnonChildren = PR_FALSE;
|
||||
return NS_OK;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// nsXFormsContainerAccessible
|
||||
|
@ -271,13 +267,10 @@ nsXFormsContainerAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
PRBool
|
||||
nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAllowsAnonChildren);
|
||||
|
||||
*aAllowsAnonChildren = PR_TRUE;
|
||||
return NS_OK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// nsXFormsEditableAccessible
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
// Denies accessible nodes in anonymous content of xforms element by
|
||||
// always returning PR_FALSE value.
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
|
||||
protected:
|
||||
// Returns value of first child xforms element by tagname that is bound to
|
||||
|
@ -127,12 +127,12 @@ class nsXFormsContainerAccessible : public nsXFormsAccessible
|
|||
public:
|
||||
nsXFormsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
||||
// Allows accessible nodes in anonymous content of xforms element by
|
||||
// always returning PR_TRUE value.
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
|
||||
// Allows accessible nodes in anonymous content of xforms element by
|
||||
// always returning PR_TRUE value.
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -586,13 +586,10 @@ nsXFormsSelectComboboxAccessible::GetStateInternal(PRUint32 *aState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsSelectComboboxAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
PRBool
|
||||
nsXFormsSelectComboboxAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAllowsAnonChildren);
|
||||
|
||||
*aAllowsAnonChildren = PR_TRUE;
|
||||
return NS_OK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -281,13 +281,10 @@ class nsXFormsSelectComboboxAccessible : public nsXFormsSelectableAccessible
|
|||
public:
|
||||
nsXFormsSelectComboboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
||||
// Allows accessible nodes in anonymous content of xforms element by
|
||||
// always returning PR_TRUE value.
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -179,8 +179,7 @@ void nsXULButtonAccessible::CacheChildren()
|
|||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
mAccChildCount = 0; // Avoid reentry
|
||||
SetFirstChild(nsnull);
|
||||
PRBool allowsAnonChildren = PR_FALSE;
|
||||
GetAllowsAnonChildAccessibles(&allowsAnonChildren);
|
||||
PRBool allowsAnonChildren = GetAllowsAnonChildAccessibles();
|
||||
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, allowsAnonChildren);
|
||||
walker.GetFirstChild();
|
||||
nsCOMPtr<nsIAccessible> dropMarkerAccessible;
|
||||
|
@ -197,9 +196,10 @@ void nsXULButtonAccessible::CacheChildren()
|
|||
if (nsAccUtils::RoleInternal(dropMarkerAccessible) ==
|
||||
nsIAccessibleRole::ROLE_PUSHBUTTON) {
|
||||
SetFirstChild(dropMarkerAccessible);
|
||||
nsCOMPtr<nsPIAccessible> privChildAcc = do_QueryInterface(dropMarkerAccessible);
|
||||
privChildAcc->SetNextSibling(nsnull);
|
||||
privChildAcc->SetParent(this);
|
||||
nsRefPtr<nsAccessible> childAcc =
|
||||
nsAccUtils::QueryAccessible(dropMarkerAccessible);
|
||||
childAcc->SetNextSibling(nsnull);
|
||||
childAcc->SetParent(this);
|
||||
mAccChildCount = 1;
|
||||
}
|
||||
}
|
||||
|
@ -989,11 +989,10 @@ NS_IMETHODIMP nsXULTextFieldAccessible::DoAction(PRUint8 index)
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTextFieldAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
PRBool
|
||||
nsXULTextFieldAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
*aAllowsAnonChildren = PR_FALSE;
|
||||
return NS_OK;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULTextFieldAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
||||
|
|
|
@ -199,7 +199,6 @@ public:
|
|||
NS_IMETHOD GetNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
|
||||
NS_IMETHOD DoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
|
||||
// nsIAccessibleEditableText
|
||||
NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
|
||||
|
@ -207,6 +206,7 @@ public:
|
|||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
|
||||
protected:
|
||||
already_AddRefed<nsIDOMNode> GetInputField();
|
||||
|
|
|
@ -515,12 +515,11 @@ nsXULMenuitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribu
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULMenuitemAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
PRBool
|
||||
nsXULMenuitemAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
// That indicates we don't walk anonymous children for menuitems
|
||||
*aAllowsAnonChildren = PR_FALSE;
|
||||
return NS_OK;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenuitemAccessible::DoAction(PRUint8 index)
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
||||
class nsXULMenuSeparatorAccessible : public nsXULMenuitemAccessible
|
||||
|
|
|
@ -959,12 +959,11 @@ NS_IMETHODIMP nsXULListitemAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULListitemAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
PRBool
|
||||
nsXULListitemAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
// That indicates we should walk anonymous children for listitems
|
||||
*aAllowsAnonChildren = PR_TRUE;
|
||||
return NS_OK;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1106,13 +1105,13 @@ NS_IMETHODIMP nsXULComboboxAccessible::GetDescription(nsAString& aDescription)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULComboboxAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
PRBool
|
||||
nsXULComboboxAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
if (!mDOMNode)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
|
||||
NS_ASSERTION(content, "No content during accessible tree building!");
|
||||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
||||
if (content->NodeInfo()->Equals(nsAccessibilityAtoms::textbox, kNameSpaceID_XUL) ||
|
||||
content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::editable,
|
||||
|
@ -1120,13 +1119,12 @@ nsXULComboboxAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildr
|
|||
// Both the XUL <textbox type="autocomplete"> and <menulist editable="true"> widgets
|
||||
// use nsXULComboboxAccessible. We need to walk the anonymous children for these
|
||||
// so that the entry field is a child
|
||||
*aAllowsAnonChildren = PR_TRUE;
|
||||
} else {
|
||||
// Argument of PR_FALSE indicates we don't walk anonymous children for
|
||||
// menuitems
|
||||
*aAllowsAnonChildren = PR_FALSE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
// Argument of PR_FALSE indicates we don't walk anonymous children for
|
||||
// menuitems
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/** Just one action ( click ). */
|
||||
|
|
|
@ -141,13 +141,13 @@ public:
|
|||
NS_IMETHOD GetActionName(PRUint8 index, nsAString& aName);
|
||||
// Don't use XUL menuitems's description attribute
|
||||
NS_IMETHOD GetDescription(nsAString& aDesc) { return nsAccessibleWrap::GetDescription(aDesc); }
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
|
||||
protected:
|
||||
already_AddRefed<nsIAccessible> GetListAccessible();
|
||||
|
@ -183,10 +183,9 @@ public:
|
|||
nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsXULComboboxAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetValue(nsAString& _retval);
|
||||
NS_IMETHOD GetDescription(nsAString& aDescription);
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
NS_IMETHOD DoAction(PRUint8 index);
|
||||
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
|
||||
NS_IMETHOD GetActionName(PRUint8 index, nsAString& aName);
|
||||
|
@ -197,6 +196,7 @@ public:
|
|||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -188,15 +188,11 @@ nsXULSliderAccessible::SetCurrentValue(double aValue)
|
|||
return SetSliderAttr(nsAccessibilityAtoms::curpos, aValue);
|
||||
}
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHODIMP
|
||||
nsXULSliderAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
PRBool
|
||||
nsXULSliderAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAllowsAnonChildren);
|
||||
|
||||
// Do not allow anonymous xul:slider be accessible.
|
||||
*aAllowsAnonChildren = PR_FALSE;
|
||||
return NS_OK;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Utils
|
||||
|
|
|
@ -63,9 +63,7 @@ public:
|
|||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
|
||||
protected:
|
||||
already_AddRefed<nsIContent> GetSliderNode();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=475006
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=391829
|
||||
-->
|
||||
<head>
|
||||
<title>Group attributes tests</title>
|
||||
|
@ -29,6 +30,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=475006
|
|||
testAttrs("checkedOption", {"checkable" : "true"}, true);
|
||||
testAttrs("checkedRadio", {"checkable" : "true"}, true);
|
||||
testAttrs("checkedTreeitem", {"checkable" : "true"}, true);
|
||||
testAttrs("grabbed", {"grabbed" : "true"}, true);
|
||||
testAttrs("dropeffect", {"dropeffect" : "copy"}, true);
|
||||
testAttrs("sortAscending", {"sort" : "ascending"}, true);
|
||||
testAttrs("sortDescending", {"sort" : "descending"}, true);
|
||||
|
@ -39,6 +41,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=475006
|
|||
testAttrs("live", {"live" : "polite"}, true);
|
||||
testAttrs("live2", {"live" : "polite"}, true);
|
||||
testAttrs("log", {"live" : "polite"}, true);
|
||||
testAttrs("logAssertive", {"live" : "assertive"}, true);
|
||||
testAttrs("marquee", {"live" : "off"}, true);
|
||||
testAttrs("status", {"live" : "polite"}, true);
|
||||
testAttrs("timer", {"live" : "off"}, true);
|
||||
|
@ -47,13 +50,34 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=475006
|
|||
testAttrs("liveChild", {"container-live" : "polite"}, true);
|
||||
testAttrs("live2Child", {"container-live" : "polite"}, true);
|
||||
testAttrs("logChild", {"container-live" : "polite"}, true);
|
||||
testAttrs("logAssertiveChild", {"container-live" : "assertive"}, true);
|
||||
testAttrs("marqueeChild", {"container-live" : "off"}, true);
|
||||
testAttrs("statusChild", {"container-live" : "polite"}, true);
|
||||
testAttrs("timerChild", {"container-live" : "off"}, true);
|
||||
|
||||
// container-live-role object attribute
|
||||
testAttrs("log", {"container-live-role" : "log"}, true);
|
||||
testAttrs("logAssertive", {"container-live-role" : "log"}, true);
|
||||
testAttrs("marquee", {"container-live-role" : "marquee"}, true);
|
||||
testAttrs("status", {"container-live-role" : "status"}, true);
|
||||
testAttrs("timer", {"container-live-role" : "timer"}, true);
|
||||
testAttrs("logChild", {"container-live-role" : "log"}, true);
|
||||
testAttrs("logAssertive", {"container-live-role" : "log"}, true);
|
||||
testAttrs("logAssertiveChild", {"container-live-role" : "log"}, true);
|
||||
testAttrs("marqueeChild", {"container-live-role" : "marquee"}, true);
|
||||
testAttrs("statusChild", {"container-live-role" : "status"}, true);
|
||||
testAttrs("timerChild", {"container-live-role" : "timer"}, true);
|
||||
|
||||
// container that has no default live attribute
|
||||
testAttrs("liveGroup", {"live" : "polite"}, true);
|
||||
testAttrs("liveGroupChild", {"container-live" : "polite"}, true);
|
||||
testAttrs("liveGroup", {"container-live-role" : "group"}, true);
|
||||
testAttrs("liveGroupChild", {"container-live-role" : "group"}, true);
|
||||
|
||||
// html
|
||||
testAttrs("radio", {"checkable" : "true"}, true);
|
||||
testAttrs("checkbox", {"checkable" : "true"}, true);
|
||||
testAttrs("draggable", {"draggable" : "true"}, true);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
@ -68,6 +92,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=475006
|
|||
title="Extend nsARIAMap to capture ARIA attribute characteristics">
|
||||
Mozilla Bug 475006
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=391829"
|
||||
title="Add support for container-live-role to object attributes">
|
||||
Mozilla Bug 391829
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
|
@ -83,6 +112,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=475006
|
|||
<div id="checkedOption" role="option" aria-checked="true"></div>
|
||||
<div id="checkedRadio" role="radio" aria-checked="true"></div>
|
||||
<div id="checkedTreeitem" role="treeitem" aria-checked="true"></div>
|
||||
<div id="grabbed" aria-grabbed="true"></div>
|
||||
<div id="dropeffect" aria-dropeffect="copy"></div>
|
||||
<div id="sortAscending" role="columnheader" aria-sort="ascending"></div>
|
||||
<div id="sortDescending" role="columnheader" aria-sort="descending"></div>
|
||||
|
@ -92,12 +122,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=475006
|
|||
<div id="live" aria-live="polite">excuse <div id="liveChild">me</div></div>
|
||||
<div id="live2" role="marquee" aria-live="polite">excuse <div id="live2Child">me</div></div>
|
||||
<div id="log" role="log">excuse <div id="logChild">me</div></div>
|
||||
<div id="logAssertive" role="log" aria-live="assertive">excuse <div id="logAssertiveChild">me</div></div>
|
||||
<div id="marquee" role="marquee">excuse <div id="marqueeChild">me</div></div>
|
||||
<div id="status" role="status">excuse <div id="statusChild">me</div></div>
|
||||
<div id="timer" role="timer">excuse <div id="timerChild">me</div></div>
|
||||
|
||||
<!-- unusual live case -->
|
||||
<div id="liveGroup" role="group" aria-live="polite">
|
||||
excuse <div id="liveGroupChild">me</div>
|
||||
</div>
|
||||
|
||||
<!-- html -->
|
||||
<input id="radio" type="radio"/>
|
||||
<input id="checkbox" type="checkbox"/>
|
||||
<div id="draggable" draggable="true">Draggable div</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -197,7 +197,6 @@ pref("browser.startup.homepage", "resource:/browserconfig.properties"
|
|||
pref("browser.enable_automatic_image_resizing", true);
|
||||
pref("browser.chrome.site_icons", true);
|
||||
pref("browser.chrome.favicons", true);
|
||||
pref("browser.formfill.enable", true);
|
||||
pref("browser.warnOnQuit", true);
|
||||
pref("browser.warnOnRestart", true);
|
||||
pref("browser.fullscreen.autohide", true);
|
||||
|
@ -228,6 +227,10 @@ pref("browser.urlbar.maxRichResults", 12);
|
|||
// be waiting on the timeout too often without many results.
|
||||
pref("browser.urlbar.search.chunkSize", 1000);
|
||||
pref("browser.urlbar.search.timeout", 100);
|
||||
// The amount of time (ms) to wait after the user has stopped typing
|
||||
// before starting to perform autocomplete. 50 is the default set in
|
||||
// autocomplete.xml.
|
||||
pref("browser.urlbar.delay", 50);
|
||||
|
||||
// The special characters below can be typed into the urlbar to either restrict
|
||||
// the search to visited history, bookmarked, tagged pages; or force a match on
|
||||
|
|
|
@ -1077,7 +1077,8 @@ function BrowserStartup() {
|
|||
document.documentElement.setAttribute("height", defaultHeight);
|
||||
}
|
||||
|
||||
if (gURLBar && document.documentElement.getAttribute("chromehidden").indexOf("toolbar") != -1) {
|
||||
if (gURLBar &&
|
||||
document.documentElement.getAttribute("chromehidden").indexOf("toolbar") != -1) {
|
||||
gURLBar.setAttribute("readonly", "true");
|
||||
gURLBar.setAttribute("enablehistory", "false");
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
# Dan Mosedale <dmose@mozilla.org>
|
||||
# Justin Dolske <dolske@mozilla.com>
|
||||
# Kathleen Brade <brade@pearlcrescent.com>
|
||||
# Mark Smith <mcs@pearlcrescent.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
|
||||
|
@ -946,8 +948,11 @@ nsContextMenu.prototype = {
|
|||
channel.notificationCallbacks = new callbacks();
|
||||
channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE |
|
||||
Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
|
||||
if (channel instanceof Ci.nsIHttpChannel)
|
||||
if (channel instanceof Ci.nsIHttpChannel) {
|
||||
channel.referrer = doc.documentURIObject;
|
||||
if (channel instanceof Ci.nsIHttpChannelInternal)
|
||||
channel.forceAllowThirdPartyCookie = true;
|
||||
}
|
||||
|
||||
// fallback to the old way if we don't see the headers quickly
|
||||
var timeToWait =
|
||||
|
|
|
@ -295,7 +295,7 @@ function runTest(testNum) {
|
|||
*/
|
||||
|
||||
default:
|
||||
ok(false, "Unexpected invocataion of test #" + testNum);
|
||||
ok(false, "Unexpected invocation of test #" + testNum);
|
||||
subwindow.close();
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
this.clickSelectsAll = this._prefs.getBoolPref("clickSelectsAll");
|
||||
this.doubleClickSelectsAll = this._prefs.getBoolPref("doubleClickSelectsAll");
|
||||
this.completeDefaultIndex = this._prefs.getBoolPref("autoFill");
|
||||
this.timeout = this._prefs.getIntPref("delay");
|
||||
|
||||
this._urlTooltip = document.getElementById("urlTooltip");
|
||||
|
||||
|
@ -362,6 +363,9 @@
|
|||
case "autoFill":
|
||||
this.completeDefaultIndex = this._prefs.getBoolPref(aData);
|
||||
break;
|
||||
case "delay":
|
||||
this.timeout = this._prefs.getIntPref(aData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
]]></body>
|
||||
|
@ -415,6 +419,35 @@
|
|||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="draggesture" phase="capturing"><![CDATA[
|
||||
// TODO: This should use dragstart but editor code is still using
|
||||
// the old drag & drop APIs, so we have to handle draggesture.
|
||||
// This can be changed once editor code is updated to the new API.
|
||||
// See bug 499008 for details.
|
||||
|
||||
// Drag only if the gesture starts from the input field.
|
||||
if (event.originalTarget != this.inputField)
|
||||
return;
|
||||
|
||||
// Drag only if the entire value is selected and it's a valid URI.
|
||||
var isFullSelection = this.selectionStart == 0 &&
|
||||
this.selectionEnd == this.textLength;
|
||||
if (!isFullSelection ||
|
||||
this.getAttribute("pageproxystate") != "valid")
|
||||
return;
|
||||
|
||||
var urlString = content.location.href;
|
||||
var title = content.document.title || urlString;
|
||||
var htmlString = "<a href=\"" + urlString + "\">" + urlString + "</a>";
|
||||
|
||||
var dt = event.dataTransfer;
|
||||
dt.setData("text/x-moz-url", urlString + "\n" + title);
|
||||
dt.setData("text/unicode", urlString);
|
||||
dt.setData("text/html", htmlString);
|
||||
|
||||
dt.effectAllowed = "copyLink";
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
<handler event="focus" phase="capturing" action="this._hideURLTooltip();"/>
|
||||
<handler event="dragover" phase="capturing" action="nsDragAndDrop.dragOver(event, this);"/>
|
||||
<handler event="drop" phase="capturing" action="nsDragAndDrop.drop(event, this);"/>
|
||||
|
|
|
@ -752,20 +752,6 @@ function placesSetItemAnnotationTransactions(aItemId, aAnnotationObject) {
|
|||
flags: 0,
|
||||
value: null,
|
||||
expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
|
||||
|
||||
if (PlacesUtils.annotations.itemHasAnnotation(this.id, this._anno.name)) {
|
||||
// fill the old anno if it is set
|
||||
var flags = {}, expires = {}, mimeType = {}, type = {};
|
||||
PlacesUtils.annotations.getItemAnnotationInfo(this.id, this._anno.name,
|
||||
flags, expires, mimeType, type);
|
||||
this._oldAnno.flags = flags.value;
|
||||
this._oldAnno.expires = expires.value;
|
||||
this._oldAnno.mimeType = mimeType.value;
|
||||
this._oldAnno.type = type.value;
|
||||
this._oldAnno.value = PlacesUtils.annotations
|
||||
.getItemAnnotation(this.id, this._anno.name);
|
||||
}
|
||||
|
||||
this.redoTransaction = this.doTransaction;
|
||||
}
|
||||
|
||||
|
@ -773,6 +759,23 @@ placesSetItemAnnotationTransactions.prototype = {
|
|||
__proto__: placesBaseTransaction.prototype,
|
||||
|
||||
doTransaction: function PSIAT_doTransaction() {
|
||||
// Since this can be used as a child transaction this.id will be known
|
||||
// only at this point, after the external caller has set it.
|
||||
if (PlacesUtils.annotations.itemHasAnnotation(this.id, this._anno.name)) {
|
||||
// Save the old annotation if it is set.
|
||||
var flags = {}, expires = {}, mimeType = {}, type = {};
|
||||
PlacesUtils.annotations.getItemAnnotationInfo(this.id, this._anno.name,
|
||||
flags, expires, mimeType,
|
||||
type);
|
||||
this._oldAnno.flags = flags.value;
|
||||
this._oldAnno.expires = expires.value;
|
||||
this._oldAnno.mimeType = mimeType.value;
|
||||
this._oldAnno.type = type.value;
|
||||
this._oldAnno.value = PlacesUtils.annotations
|
||||
.getItemAnnotation(this.id,
|
||||
this._anno.name);
|
||||
}
|
||||
|
||||
PlacesUtils.setAnnotationsForItem(this.id, [this._anno]);
|
||||
},
|
||||
|
||||
|
|
|
@ -716,14 +716,28 @@ function run_test() {
|
|||
do_check_eq(bmsvc.getItemTitle(newBkmk3_3Id), "folder");
|
||||
|
||||
// Test creating an item with child transactions.
|
||||
var childTxns = [];
|
||||
var newDateAdded = Date.now() - 20000;
|
||||
var childTxn = ptSvc.editItemDateAdded(null, newDateAdded);
|
||||
var itemWChildTxn = ptSvc.createItem(uri("http://www.example.com"), root, bmStartIndex, "Testing1", null, null, [childTxn]);
|
||||
childTxns.push(ptSvc.editItemDateAdded(null, newDateAdded));
|
||||
var itemChildAnnoObj = { name: "testAnno/testInt",
|
||||
type: Ci.nsIAnnotationService.TYPE_INT32,
|
||||
flags: 0,
|
||||
value: 123,
|
||||
expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
|
||||
childTxns.push(ptSvc.setItemAnnotation(null, itemChildAnnoObj));
|
||||
var itemWChildTxn = ptSvc.createItem(uri("http://www.example.com"), root,
|
||||
bmStartIndex, "Testing1", null, null,
|
||||
childTxns);
|
||||
try {
|
||||
ptSvc.doTransaction(itemWChildTxn); // Also testing doTransaction
|
||||
var itemId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com"), {}))[0];
|
||||
do_check_eq(observer._itemAddedId, itemId);
|
||||
do_check_eq(newDateAdded, bmsvc.getItemDateAdded(itemId));
|
||||
do_check_eq(observer._itemChangedProperty, "testAnno/testInt");
|
||||
do_check_eq(observer._itemChanged_isAnnotationProperty, true);
|
||||
do_check_true(annosvc.itemHasAnnotation(itemId, itemChildAnnoObj.name))
|
||||
do_check_eq(annosvc.getItemAnnotation(itemId, itemChildAnnoObj.name),
|
||||
itemChildAnnoObj.value);
|
||||
itemWChildTxn.undoTransaction();
|
||||
do_check_eq(observer._itemRemovedId, itemId);
|
||||
itemWChildTxn.redoTransaction();
|
||||
|
@ -731,6 +745,11 @@ function run_test() {
|
|||
var newId = (bmsvc.getBookmarkIdsForURI(uri("http://www.example.com"), {}))[0];
|
||||
do_check_eq(newDateAdded, bmsvc.getItemDateAdded(newId));
|
||||
do_check_eq(observer._itemAddedId, newId);
|
||||
do_check_eq(observer._itemChangedProperty, "testAnno/testInt");
|
||||
do_check_eq(observer._itemChanged_isAnnotationProperty, true);
|
||||
do_check_true(annosvc.itemHasAnnotation(newId, itemChildAnnoObj.name))
|
||||
do_check_eq(annosvc.getItemAnnotation(newId, itemChildAnnoObj.name),
|
||||
itemChildAnnoObj.value);
|
||||
itemWChildTxn.undoTransaction();
|
||||
do_check_eq(observer._itemRemovedId, newId);
|
||||
} catch (ex) {
|
||||
|
|
|
@ -1182,6 +1182,9 @@ SessionStoreService.prototype = {
|
|||
}
|
||||
entry.ID = aEntry.ID;
|
||||
|
||||
if (aEntry.referrerURI)
|
||||
entry.referrer = aEntry.referrerURI.spec;
|
||||
|
||||
if (aEntry.contentType)
|
||||
entry.contentType = aEntry.contentType;
|
||||
|
||||
|
@ -2046,6 +2049,8 @@ SessionStoreService.prototype = {
|
|||
shEntry.loadType = Ci.nsIDocShellLoadInfo.loadHistory;
|
||||
if (aEntry.contentType)
|
||||
shEntry.contentType = aEntry.contentType;
|
||||
if (aEntry.referrer)
|
||||
shEntry.referrerURI = ioService.newURI(aEntry.referrer, null, null);
|
||||
|
||||
if (aEntry.cacheKey) {
|
||||
var cacheKey = Cc["@mozilla.org/supports-PRUint32;1"].
|
||||
|
|
|
@ -87,6 +87,7 @@ _BROWSER_TEST_FILES = \
|
|||
browser_485482_sample.html \
|
||||
browser_485563.js \
|
||||
browser_490040.js \
|
||||
browser_491168.js \
|
||||
browser_493467.js \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/* ***** 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 sessionstore test code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Michael Kraft <morac99-firefox@yahoo.com>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
function test() {
|
||||
/** Test for Bug 491168 **/
|
||||
|
||||
// test setup
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
const REFERRER1 = "http://www.example.net/?" + Date.now();
|
||||
const REFERRER2 = "http://www.example.net/?" + Math.random();
|
||||
|
||||
let tab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab;
|
||||
|
||||
let browser = tab.linkedBrowser;
|
||||
browser.addEventListener("load", function() {
|
||||
browser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
let tabState = JSON.parse(ss.getTabState(tab));
|
||||
is(tabState.entries[0].referrer, REFERRER1,
|
||||
"Referrer retrieved via getTabState matches referrer set via loadURI.");
|
||||
|
||||
tabState.entries[0].referrer = REFERRER2;
|
||||
ss.setTabState(tab, JSON.stringify(tabState));
|
||||
|
||||
tab.addEventListener("SSTabRestored", function() {
|
||||
tab.removeEventListener("SSTabRestored", arguments.callee, false);
|
||||
is(window.content.document.referrer, REFERRER2, "document.referrer matches referrer set via setTabState.");
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
let newTab = ss.undoCloseTab(window, 0);
|
||||
newTab.addEventListener("SSTabRestored", function() {
|
||||
newTab.removeEventListener("SSTabRestored", arguments.callee, false);
|
||||
|
||||
is(window.content.document.referrer, REFERRER2, "document.referrer is still correct after closing and reopening the tab.");
|
||||
gBrowser.removeTab(newTab);
|
||||
|
||||
finish();
|
||||
}, true);
|
||||
}, true);
|
||||
},true);
|
||||
|
||||
let referrerURI = ioService.newURI(REFERRER1, null, null);
|
||||
browser.loadURI("http://www.example.net", referrerURI, null);
|
||||
}
|
|
@ -248,6 +248,7 @@ bin/components/aboutRights.js
|
|||
bin/components/aboutRobots.js
|
||||
bin/components/aboutCertError.js
|
||||
bin/components/nsBadCertHandler.js
|
||||
bin/components/nsFormAutoComplete.js
|
||||
|
||||
; Modules
|
||||
bin/modules/*
|
||||
|
|
|
@ -254,6 +254,7 @@ bin\components\aboutRights.js
|
|||
bin\components\aboutRobots.js
|
||||
bin\components\aboutCertError.js
|
||||
bin\components\nsBadCertHandler.js
|
||||
bin\components\nsFormAutoComplete.js
|
||||
|
||||
; Modules
|
||||
bin\modules\*
|
||||
|
|
|
@ -259,6 +259,14 @@ user_pref("security.warn_viewing_mixed", false);
|
|||
|
||||
user_pref("geo.wifi.uri", "http://localhost:8888/tests/dom/tests/mochitest/geolocation/network_geolocation.sjs");
|
||||
user_pref("camino.warn_when_closing", false); // Camino-only, harmless to others
|
||||
|
||||
// Make url-classifier updates so rare that they won't affect tests
|
||||
user_pref("urlclassifier.updateinterval", 172800);
|
||||
// Point the url-classifier to the local testing server for fast failures
|
||||
user_pref("browser.safebrowsing.provider.0.gethashURL", "http://localhost:8888/safebrowsing-dummy/gethash");
|
||||
user_pref("browser.safebrowsing.provider.0.keyURL", "http://localhost:8888/safebrowsing-dummy/newkey");
|
||||
user_pref("browser.safebrowsing.provider.0.lookupURL", "http://localhost:8888/safebrowsing-dummy/lookup");
|
||||
user_pref("browser.safebrowsing.provider.0.updateURL", "http://localhost:8888/safebrowsing-dummy/update");
|
||||
"""
|
||||
|
||||
prefs.append(part)
|
||||
|
@ -577,7 +585,8 @@ def runApp(testURL, env, app, profileDir, extraArgs,
|
|||
else:
|
||||
outputPipe = subprocess.PIPE
|
||||
|
||||
proc = Process([cmd] + args, env = environment(env), stdout = outputPipe, stderr = subprocess.STDOUT)
|
||||
proc = Process([cmd] + args, env = environment(env, xrePath = xrePath),
|
||||
stdout = outputPipe, stderr = subprocess.STDOUT)
|
||||
log.info("INFO | automation.py | Application pid: %d", proc.pid)
|
||||
|
||||
if outputPipe is None:
|
||||
|
|
|
@ -160,7 +160,7 @@ int _unlink(const char *filename)
|
|||
strlen(filename)+1,
|
||||
wname,
|
||||
MAX_PATH );
|
||||
return DeleteFileW(wname);
|
||||
return DeleteFileW(wname)?0:-1;
|
||||
}
|
||||
|
||||
void abort(void)
|
||||
|
|
|
@ -109,25 +109,33 @@ clean: clobber
|
|||
clobber:
|
||||
rm $(MOZCE_TOOLS_BIN_DIR)/*.exe
|
||||
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-as.exe: $(MOZCE_TOOLS_DIR)/arm-wince-as.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
|
||||
$(MOZCE_TOOLS_BIN_DIR)/linkargs.obj: $(MOZCE_TOOLS_DIR)/linkargs.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
|
||||
mkdir -p $(MOZCE_TOOLS_BIN_DIR);
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-as.c
|
||||
$(CC) $(CFLAGS) -c -Fo$(MOZCE_TOOLS_BIN_DIR)/linkargs.obj $(MOZCE_TOOLS_DIR)/linkargs.c
|
||||
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-gcc.exe: $(MOZCE_TOOLS_DIR)/arm-wince-gcc.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
|
||||
$(MOZCE_TOOLS_BIN_DIR)/toolspath.obj: $(MOZCE_TOOLS_DIR)/toolspath.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
|
||||
mkdir -p $(MOZCE_TOOLS_BIN_DIR);
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-gcc.c
|
||||
$(CC) $(CFLAGS) -c -Fo$(MOZCE_TOOLS_BIN_DIR)/toolspath.obj $(MOZCE_TOOLS_DIR)/toolspath.c
|
||||
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-lib.exe: $(MOZCE_TOOLS_DIR)/arm-wince-lib.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-as.exe: $(MOZCE_TOOLS_DIR)/arm-wince-as.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
mkdir -p $(MOZCE_TOOLS_BIN_DIR);
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-lib.c
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-as.c -link $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-link.exe: $(MOZCE_TOOLS_DIR)/arm-wince-link.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-gcc.exe: $(MOZCE_TOOLS_DIR)/arm-wince-gcc.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile $(MOZCE_TOOLS_BIN_DIR)/linkargs.obj $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
mkdir -p $(MOZCE_TOOLS_BIN_DIR);
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-link.c
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-gcc.c -link $(MOZCE_TOOLS_BIN_DIR)/linkargs.obj $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-res.exe: $(MOZCE_TOOLS_DIR)/arm-wince-res.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-lib.exe: $(MOZCE_TOOLS_DIR)/arm-wince-lib.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
mkdir -p $(MOZCE_TOOLS_BIN_DIR);
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-res.c
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-lib.c -link $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-link.exe: $(MOZCE_TOOLS_DIR)/arm-wince-link.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile $(MOZCE_TOOLS_BIN_DIR)/linkargs.obj $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
mkdir -p $(MOZCE_TOOLS_BIN_DIR);
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-link.c -link $(MOZCE_TOOLS_BIN_DIR)/linkargs.obj $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
|
||||
$(MOZCE_TOOLS_BIN_DIR)/arm-wince-res.exe: $(MOZCE_TOOLS_DIR)/arm-wince-res.c $(MOZCE_TOOLS_DIR)/toolspath.h $(MOZCE_TOOLS_DIR)/Makefile $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
mkdir -p $(MOZCE_TOOLS_BIN_DIR);
|
||||
$(CC) $(CFLAGS) -Fo$(MOZCE_TOOLS_BIN_DIR) -Fe$@ $(MOZCE_TOOLS_DIR)/arm-wince-res.c -link $(MOZCE_TOOLS_BIN_DIR)/toolspath.obj
|
||||
|
||||
|
||||
export:: $(SDK_TOOLS)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#include "toolspath.h"
|
||||
#include "linkargs.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
|
@ -8,6 +8,8 @@ main(int argc, char **argv)
|
|||
int i = 0;
|
||||
int j = 0;
|
||||
int link = 0;
|
||||
int s = 0;
|
||||
int k = 0;
|
||||
|
||||
char* args[1000];
|
||||
char outputFileArg[1000];
|
||||
|
@ -66,29 +68,20 @@ main(int argc, char **argv)
|
|||
strcat(outputFileArg, args[startOfArgvs+j]);
|
||||
args[startOfArgvs+j] = outputFileArg;
|
||||
}
|
||||
if (strcmp(argv[j], "-link") ||
|
||||
strcmp(argv[j], "-LINK") ||
|
||||
strcmp(argv[j], "/link") ||
|
||||
strcmp(argv[j], "/LINK"))
|
||||
link = 1;
|
||||
|
||||
checkLinkArgs(&k, &s, &i, &j, args, argv);
|
||||
j++;
|
||||
}
|
||||
|
||||
if (link)
|
||||
{
|
||||
args[i++] = "/link";
|
||||
|
||||
args[i++] = "/ENTRY:main";
|
||||
|
||||
args[i++] = "/SUBSYSTEM:WINDOWSCE,5.02";
|
||||
|
||||
args[i++] = "/LIBPATH:\"" WCE_LIB "\"";
|
||||
args[i++] = "/LIBPATH:\"" WCE_CRT "\"";
|
||||
args[i++] = "/NODEFAULTLIB";
|
||||
#ifdef HAVE_SHUNT // simple test to see if we're in configure or not
|
||||
if(!getenv("NO_SHUNT")) {
|
||||
args[i++] = "/LIBPATH:\"" SHUNT_LIB "\"";
|
||||
args[i++] = "mozce_shunt.lib";
|
||||
}
|
||||
#endif
|
||||
args[i++] = "winsock.lib";
|
||||
args[i++] = "corelibc.lib";
|
||||
args[i++] = "coredll.lib";
|
||||
addLinkArgs(k, s, &i, &j, args, argv);
|
||||
}
|
||||
|
||||
args[i] = NULL;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "toolspath.h"
|
||||
#include "linkargs.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
|
@ -9,56 +10,17 @@ main(int argc, char **argv)
|
|||
int j = 0;
|
||||
int k = 0;
|
||||
int s = 0;
|
||||
args[i++] = LINK_PATH;
|
||||
|
||||
args[i++] = "/LIBPATH:\"" WCE_LIB "\"";
|
||||
args[i++] = "/LIBPATH:\"" WCE_CRT "\"";
|
||||
args[i++] = "/NODEFAULTLIB";
|
||||
|
||||
#ifdef HAVE_SHUNT // simple test to see if we're in configure or not
|
||||
if(getenv("NO_SHUNT") == NULL) {
|
||||
args[i++] = "/LIBPATH:\"" SHUNT_LIB "\"";
|
||||
args[i++] = "mozce_shunt.lib";
|
||||
}
|
||||
#endif
|
||||
|
||||
args[i++] = "corelibc.lib";
|
||||
args[i++] = "coredll.lib";
|
||||
args[i++] = "ceshell.lib";
|
||||
args[i++] = "mmtimer.lib";
|
||||
|
||||
// if -DLL is not passed, then change the entry to 'main'
|
||||
while(argv[j]) {
|
||||
|
||||
if (strncmp(argv[j], "-DLL", 4) == 0 ||
|
||||
strncmp(argv[j], "/DLL", 4) == 0) {
|
||||
k = 1;
|
||||
}
|
||||
if (strncmp(argv[j], "-entry", 6) == 0 ||
|
||||
strncmp(argv[j], "/entry", 6) == 0 ||
|
||||
strncmp(argv[j], "-ENTRY", 6) == 0 ||
|
||||
strncmp(argv[j], "/ENTRY",6 ) == 0) {
|
||||
k = 1;
|
||||
}
|
||||
if (strncmp(argv[j], "-subsystem:", 11) == 0 ||
|
||||
strncmp(argv[j], "/subsystem:", 11) == 0 ||
|
||||
strncmp(argv[j], "-SUBSYSTEM:", 11) == 0 ||
|
||||
strncmp(argv[j], "/SUBSYSTEM:", 11) == 0) {
|
||||
s = 1;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
if (k==0)
|
||||
args[i++] = "/ENTRY:main";
|
||||
|
||||
if (s==0){
|
||||
args[i++] = "/subsystem:\"WINDOWSCE,5.02\"";
|
||||
checkLinkArgs(&k, &s, &i, &j, args, argv);
|
||||
j++;
|
||||
}
|
||||
args[i++] = LINK_PATH;
|
||||
addLinkArgs(k, s, &i, &j, args, argv);
|
||||
|
||||
argpath_conv(&argv[1], &args[i]);
|
||||
|
||||
// dumpargs(args);
|
||||
|
||||
return run(args);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
#include "toolspath.h"
|
||||
#include "linkargs.h"
|
||||
|
||||
void checkLinkArgs(int* k, int* s, int* i, int* j, char** args, char** argv) {
|
||||
if (strncmp(argv[*j], "-DLL", 4) == 0 ||
|
||||
strncmp(argv[*j], "/DLL", 4) == 0) {
|
||||
*k = 1;
|
||||
}
|
||||
if (strncmp(argv[*j], "-entry", 6) == 0 ||
|
||||
strncmp(argv[*j], "/entry", 6) == 0 ||
|
||||
strncmp(argv[*j], "-ENTRY", 6) == 0 ||
|
||||
strncmp(argv[*j], "/ENTRY",6 ) == 0) {
|
||||
*k = 1;
|
||||
}
|
||||
if (strncmp(argv[*j], "-subsystem:", 11) == 0 ||
|
||||
strncmp(argv[*j], "/subsystem:", 11) == 0 ||
|
||||
strncmp(argv[*j], "-SUBSYSTEM:", 11) == 0 ||
|
||||
strncmp(argv[*j], "/SUBSYSTEM:", 11) == 0) {
|
||||
*s = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void addLinkArgs(int k, int s, int *i, int *j, char** args, char** argv) {
|
||||
args[(*i)++] = "/LIBPATH:\"" WCE_LIB "\"";
|
||||
args[(*i)++] = "/LIBPATH:\"" WCE_CRT "\"";
|
||||
args[(*i)++] = "/NODEFAULTLIB";
|
||||
|
||||
#ifdef HAVE_SHUNT // simple test to see if we're in configure or not
|
||||
if(getenv("NO_SHUNT") == NULL) {
|
||||
args[(*i)++] = "/LIBPATH:\"" SHUNT_LIB "\"";
|
||||
args[(*i)++] = "mozce_shunt.lib";
|
||||
}
|
||||
#endif
|
||||
|
||||
args[(*i)++] = "corelibc.lib";
|
||||
args[(*i)++] = "coredll.lib";
|
||||
args[(*i)++] = "ceshell.lib";
|
||||
args[(*i)++] = "mmtimer.lib";
|
||||
|
||||
if (k==0)
|
||||
args[(*i)++] = "/ENTRY:main";
|
||||
|
||||
if (s==0){
|
||||
args[(*i)++] = "/subsystem:\"WINDOWSCE,5.02\"";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef LINKARGS_H
|
||||
#define LINKARGS_H
|
||||
|
||||
void checkLinkArgs(int* k, int* s, int* i, int* j, char** args, char** argv);
|
||||
void addLinkArgs(int k, int s, int *i, int *j, char** args, char** argv);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,247 @@
|
|||
#include "toolspath.h"
|
||||
int argpath_conv(char **args_in, char **args_out)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (args_in[i])
|
||||
{
|
||||
char *offset;
|
||||
|
||||
args_out[i] = args_in[i];
|
||||
|
||||
if (args_in[i])
|
||||
{
|
||||
// First, look for the case of "Fo" and "Fe" options
|
||||
if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
|
||||
(args_out[i][1] == 'F') && ((args_out[i][2] == 'o') || (args_out[i][2] == 'e')) &&
|
||||
(args_out[i][3] == '/') && (strlen(args_out[i]) > 5) ) {
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][0] = '/';
|
||||
noleak_buffers[next_buffer][3] = noleak_buffers[next_buffer][4];
|
||||
noleak_buffers[next_buffer][4] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else if ((args_out[i][0] == '/') && (args_out[i][2] == '/'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
|
||||
noleak_buffers[next_buffer][1] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else if ((args_out[i][0] == '\\') && (args_out[i][2] == '\\'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
|
||||
noleak_buffers[next_buffer][1] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else if ((args_out[i][0] == '\\') && (args_out[i][1] == '\\') &&
|
||||
(args_out[i][3] == '\\') && (args_out[i][4] == '\\'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][0] = args_in[i][2];
|
||||
noleak_buffers[next_buffer][1] = ':';
|
||||
noleak_buffers[next_buffer][2] = '\0';
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], &args_in[i][3]);
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else if ( strstr(args_out[i], "OUT:") || strstr(args_out[i], "DEF:") )
|
||||
{
|
||||
// Deal with -OUT:/c/....
|
||||
//
|
||||
// NOTE: THERE IS A BUG IN THIS IMPLEMENTATION IF
|
||||
// THERE IS A SPACE IN THE TOPSRCDIR PATH.
|
||||
//
|
||||
// Should really check for spaces, then double-quote
|
||||
// the path if any space is found.
|
||||
// -- wolfe@lobo.us 25-Aug-08
|
||||
if ((args_out[i][5] == '/') && (args_out[i][7] == '/'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][5] = noleak_buffers[next_buffer][6];
|
||||
noleak_buffers[next_buffer][6] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
}
|
||||
// Deal with -OUT:"/c/...."
|
||||
else if ((args_out[i][6] == '/') && (args_out[i][8] == '/'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][6] = noleak_buffers[next_buffer][7];
|
||||
noleak_buffers[next_buffer][7] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
}
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *offset = strstr(args_out[i], "/cygdrive/");
|
||||
|
||||
if (offset) {
|
||||
|
||||
strcpy(offset, offset+9);
|
||||
offset[0] = offset[1];
|
||||
offset[1] = ':';
|
||||
offset[2] = '/';
|
||||
}
|
||||
|
||||
if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
|
||||
(args_out[i][1] == 'D'))
|
||||
{
|
||||
|
||||
offset = strstr(args_out[i]+2, "=");
|
||||
if (offset)
|
||||
{
|
||||
char* equalsChar = offset;
|
||||
|
||||
if (equalsChar[1] == '"')
|
||||
{
|
||||
*equalsChar = '\0';
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_out[i]);
|
||||
|
||||
*equalsChar = '=';
|
||||
|
||||
strcat(noleak_buffers[next_buffer], "=\\\"");
|
||||
strcat(noleak_buffers[next_buffer], equalsChar+1);
|
||||
strcat(noleak_buffers[next_buffer], "\\\"");
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (next_buffer > MAX_NOLEAK_BUFFERS) {
|
||||
printf("OOPS - next_buffer > MAX_NOLEAK_BUFFERS\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
args_out[i] = NULL;
|
||||
return i;
|
||||
}
|
||||
|
||||
void dumpargs(char** args)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (args[0] == NULL)
|
||||
printf(":: first element is null!\n");
|
||||
|
||||
while(args[i])
|
||||
printf("%s ", args[i++]);
|
||||
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
DWORD run(char** args)
|
||||
{
|
||||
|
||||
DWORD exitCode;
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
||||
char theArgs[1024*32] = {'\0'};
|
||||
|
||||
int totalLen = 0;
|
||||
int i, j;
|
||||
|
||||
|
||||
// Clear any link env variable that might get us tangled up
|
||||
_putenv("LINK=");
|
||||
_putenv("LIBPATH=");
|
||||
_putenv("CC=");
|
||||
|
||||
_putenv("INCLUDE=" SHUNT_INC ";" WM_SDK_INC ";" WCE_INC);
|
||||
_putenv("LIB=" WCE_LIB ";" WCE_CRT);
|
||||
|
||||
for (j=1; args[j]; j++)
|
||||
{
|
||||
int len = strlen(args[j]);
|
||||
strcat(&theArgs[totalLen], args[j]);
|
||||
totalLen += len;
|
||||
|
||||
strcat(&theArgs[totalLen], " ");
|
||||
totalLen++;
|
||||
}
|
||||
|
||||
i = strlen(args[0]);
|
||||
for (j=0; j<i; j++)
|
||||
{
|
||||
if (args[0][j] == '/')
|
||||
args[0][j] = '\\';
|
||||
}
|
||||
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
si.cb = sizeof(si);
|
||||
ZeroMemory( &pi, sizeof(pi));
|
||||
|
||||
CreateProcess(args[0],
|
||||
theArgs,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
&si, // Pointer to STARTUPINFO structure.
|
||||
&pi);
|
||||
|
||||
|
||||
// Wait until child process exits.
|
||||
WaitForSingleObject( pi.hProcess, INFINITE );
|
||||
GetExitCodeProcess(pi.hProcess, &exitCode);
|
||||
// Close process and thread handles.
|
||||
CloseHandle( pi.hProcess );
|
||||
CloseHandle( pi.hThread );
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
#ifndef TOOLPATH_H
|
||||
#define TOOLPATH_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <process.h>
|
||||
|
@ -27,253 +30,8 @@
|
|||
#define MAX_NOLEAK_BUFFERS 1000
|
||||
char noleak_buffers[MAX_NOLEAK_BUFFERS][1024];
|
||||
static int next_buffer = 0;
|
||||
int argpath_conv(char **args_in, char **args_out);
|
||||
void dumpargs(char** args);
|
||||
DWORD run(char** args);
|
||||
|
||||
int argpath_conv(char **args_in, char **args_out)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (args_in[i])
|
||||
{
|
||||
char *offset;
|
||||
|
||||
args_out[i] = args_in[i];
|
||||
|
||||
if (args_in[i])
|
||||
{
|
||||
// First, look for the case of "-Fo/c/xxxxxxx" and "/Fo/c/xxxxx"
|
||||
if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
|
||||
(args_out[i][1] == 'F') && (args_out[i][2] == 'o') &&
|
||||
(args_out[i][3] == '/') && (strlen(args_out[i]) > 5) ) {
|
||||
|
||||
//printf("ARGS_IN: -FoXXXX is %s\n",args_in[i]);
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][0] = '/';
|
||||
noleak_buffers[next_buffer][3] = noleak_buffers[next_buffer][4];
|
||||
noleak_buffers[next_buffer][4] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
|
||||
//printf("ARGS_OUT: -FoXXXX is %s\n",args_out[i]);
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else if ((args_out[i][0] == '/') && (args_out[i][2] == '/'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
|
||||
noleak_buffers[next_buffer][1] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else if ((args_out[i][0] == '\\') && (args_out[i][2] == '\\'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1];
|
||||
noleak_buffers[next_buffer][1] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else if ((args_out[i][0] == '\\') && (args_out[i][1] == '\\') &&
|
||||
(args_out[i][3] == '\\') && (args_out[i][4] == '\\'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][0] = args_in[i][2];
|
||||
noleak_buffers[next_buffer][1] = ':';
|
||||
noleak_buffers[next_buffer][2] = '\0';
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], &args_in[i][3]);
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else if ( strstr(args_out[i], "OUT:") || strstr(args_out[i], "DEF:") )
|
||||
{
|
||||
// Deal with -OUT:/c/....
|
||||
//
|
||||
// NOTE: THERE IS A BUG IN THIS IMPLEMENTATION IF
|
||||
// THERE IS A SPACE IN THE TOPSRCDIR PATH.
|
||||
//
|
||||
// Should really check for spaces, then double-quote
|
||||
// the path if any space is found.
|
||||
// -- wolfe@lobo.us 25-Aug-08
|
||||
if ((args_out[i][5] == '/') && (args_out[i][7] == '/'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][5] = noleak_buffers[next_buffer][6];
|
||||
noleak_buffers[next_buffer][6] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
}
|
||||
// Deal with -OUT:"/c/...."
|
||||
else if ((args_out[i][6] == '/') && (args_out[i][8] == '/'))
|
||||
{
|
||||
// Assume this is a pathname, and adjust accordingly
|
||||
//printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]);
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_in[i]);
|
||||
|
||||
noleak_buffers[next_buffer][6] = noleak_buffers[next_buffer][7];
|
||||
noleak_buffers[next_buffer][7] = ':';
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
//printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]);
|
||||
}
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *offset = strstr(args_out[i], "/cygdrive/");
|
||||
|
||||
if (offset) {
|
||||
|
||||
strcpy(offset, offset+9);
|
||||
offset[0] = offset[1];
|
||||
offset[1] = ':';
|
||||
offset[2] = '/';
|
||||
}
|
||||
|
||||
if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
|
||||
(args_out[i][1] == 'D'))
|
||||
{
|
||||
|
||||
offset = strstr(args_out[i]+2, "=");
|
||||
if (offset)
|
||||
{
|
||||
char* equalsChar = offset;
|
||||
|
||||
if (equalsChar[1] == '"')
|
||||
{
|
||||
*equalsChar = '\0';
|
||||
|
||||
strcpy(noleak_buffers[next_buffer], args_out[i]);
|
||||
|
||||
*equalsChar = '=';
|
||||
|
||||
strcat(noleak_buffers[next_buffer], "=\\\"");
|
||||
strcat(noleak_buffers[next_buffer], equalsChar+1);
|
||||
strcat(noleak_buffers[next_buffer], "\\\"");
|
||||
|
||||
args_out[i] = noleak_buffers[next_buffer];
|
||||
|
||||
next_buffer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (next_buffer > MAX_NOLEAK_BUFFERS) {
|
||||
printf("OOPS - next_buffer > MAX_NOLEAK_BUFFERS\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
args_out[i] = NULL;
|
||||
return i;
|
||||
}
|
||||
|
||||
void dumpargs(char** args)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (args[0] == NULL)
|
||||
printf(":: first element is null!\n");
|
||||
|
||||
while(args[i])
|
||||
printf("%s ", args[i++]);
|
||||
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
DWORD run(char** args)
|
||||
{
|
||||
|
||||
DWORD exitCode;
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
||||
char theArgs[1024*32];
|
||||
|
||||
int totalLen = 0;
|
||||
int i, j;
|
||||
|
||||
|
||||
// Clear any link env variable that might get us tangled up
|
||||
_putenv("LINK=");
|
||||
_putenv("LIBPATH=");
|
||||
_putenv("CC=");
|
||||
|
||||
_putenv("INCLUDE=" SHUNT_INC ";" WM_SDK_INC ";" WCE_INC);
|
||||
_putenv("LIB=" WCE_LIB ";" WCE_CRT);
|
||||
|
||||
for (j=1; args[j]; j++)
|
||||
{
|
||||
int len = strlen(args[j]);
|
||||
strcat(&theArgs[totalLen], args[j]);
|
||||
totalLen += len;
|
||||
|
||||
strcat(&theArgs[totalLen], " ");
|
||||
totalLen++;
|
||||
}
|
||||
|
||||
i = strlen(args[0]);
|
||||
for (j=0; j<i; j++)
|
||||
{
|
||||
if (args[0][j] == '/')
|
||||
args[0][j] = '\\';
|
||||
}
|
||||
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
si.cb = sizeof(si);
|
||||
ZeroMemory( &pi, sizeof(pi));
|
||||
|
||||
CreateProcess(args[0],
|
||||
theArgs,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
&si, // Pointer to STARTUPINFO structure.
|
||||
&pi);
|
||||
|
||||
|
||||
// Wait until child process exits.
|
||||
WaitForSingleObject( pi.hProcess, INFINITE );
|
||||
GetExitCodeProcess(pi.hProcess, &exitCode);
|
||||
// Close process and thread handles.
|
||||
CloseHandle( pi.hProcess );
|
||||
CloseHandle( pi.hThread );
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -53,13 +53,77 @@
|
|||
#include "nsHashtable.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
#include "nsPrincipal.h"
|
||||
|
||||
class nsCodeBasePrefObserver : nsIObserver
|
||||
{
|
||||
public:
|
||||
nsCodeBasePrefObserver()
|
||||
{
|
||||
NS_ASSERTION(!sObserverInstalled, "Shouldn't recreate observer\n");
|
||||
}
|
||||
~nsCodeBasePrefObserver()
|
||||
{
|
||||
sObserverInstalled = PR_FALSE;
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
nsCOMPtr<nsIPrefBranch2> prefBranch =
|
||||
do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
if (prefBranch) {
|
||||
if (NS_FAILED(prefBranch->GetBoolPref(PrefName(), &sPrefValue))) {
|
||||
sPrefValue = PR_FALSE;
|
||||
}
|
||||
if (NS_SUCCEEDED(prefBranch->AddObserver(PrefName(), this, PR_FALSE))) {
|
||||
sObserverInstalled = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
{
|
||||
NS_ASSERTION(!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID),
|
||||
"Wrong topic!");
|
||||
NS_ASSERTION(!strcmp(NS_ConvertUTF16toUTF8(aData).get(), PrefName()),
|
||||
"Wrong pref!");
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_QueryInterface(aSubject));
|
||||
if (!prefBranch ||
|
||||
NS_FAILED(prefBranch->GetBoolPref(PrefName(), &sPrefValue))) {
|
||||
sPrefValue = PR_FALSE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const char* PrefName()
|
||||
{
|
||||
static const char pref[] = "signed.applets.codebase_principal_support";
|
||||
return pref;
|
||||
}
|
||||
|
||||
static PRBool PrefValue() { return sPrefValue; }
|
||||
static PRBool Installed() { return sObserverInstalled; }
|
||||
|
||||
|
||||
protected:
|
||||
static PRBool sPrefValue;
|
||||
static PRBool sObserverInstalled;
|
||||
};
|
||||
|
||||
PRBool nsCodeBasePrefObserver::sPrefValue = PR_FALSE;
|
||||
PRBool nsCodeBasePrefObserver::sObserverInstalled = PR_FALSE;
|
||||
NS_IMPL_ISUPPORTS1(nsCodeBasePrefObserver, nsIObserver)
|
||||
|
||||
static PRBool URIIsImmutable(nsIURI* aURI)
|
||||
{
|
||||
nsCOMPtr<nsIMutable> mutableObj(do_QueryInterface(aURI));
|
||||
|
@ -113,6 +177,13 @@ nsPrincipal::nsPrincipal()
|
|||
mCodebaseImmutable(PR_FALSE),
|
||||
mDomainImmutable(PR_FALSE)
|
||||
{
|
||||
if (!nsCodeBasePrefObserver::Installed()) {
|
||||
nsRefPtr<nsCodeBasePrefObserver> obs = new nsCodeBasePrefObserver();
|
||||
if (obs)
|
||||
obs->Init();
|
||||
NS_WARN_IF_FALSE(nsCodeBasePrefObserver::Installed(),
|
||||
"Installing nsCodeBasePrefObserver failed!");
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -426,21 +497,15 @@ nsPrincipal::CanEnableCapability(const char *capability, PRInt16 *result)
|
|||
// schemes are special and may be able to get extra capabilities
|
||||
// even with the pref disabled.
|
||||
|
||||
static const char pref[] = "signed.applets.codebase_principal_support";
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch =
|
||||
do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
if (prefBranch) {
|
||||
PRBool mightEnable;
|
||||
nsresult rv = prefBranch->GetBoolPref(pref, &mightEnable);
|
||||
if (!nsCodeBasePrefObserver::PrefValue()) {
|
||||
PRBool mightEnable = PR_FALSE;
|
||||
nsresult rv = mCodebase->SchemeIs("file", &mightEnable);
|
||||
if (NS_FAILED(rv) || !mightEnable) {
|
||||
rv = mCodebase->SchemeIs("file", &mightEnable);
|
||||
rv = mCodebase->SchemeIs("resource", &mightEnable);
|
||||
if (NS_FAILED(rv) || !mightEnable) {
|
||||
rv = mCodebase->SchemeIs("resource", &mightEnable);
|
||||
if (NS_FAILED(rv) || !mightEnable) {
|
||||
*result = nsIPrincipal::ENABLE_DENIED;
|
||||
*result = nsIPrincipal::ENABLE_DENIED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -658,4 +658,6 @@ MOZ_EMBEDDING_LEVEL_MINIMAL = @MOZ_EMBEDDING_LEVEL_MINIMAL@
|
|||
HAVE_ARM_SIMD = @HAVE_ARM_SIMD@
|
||||
HAVE_ARM_NEON = @HAVE_ARM_NEON@
|
||||
|
||||
MOZ_SPLASHSCREEN = @MOZ_SPLASHSCREEN@
|
||||
|
||||
MOZ_THEME_FASTSTRIPE = @MOZ_THEME_FASTSTRIPE@
|
||||
|
|
|
@ -834,7 +834,7 @@ HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(HOST_LIBS))
|
|||
DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))
|
||||
|
||||
# Dependancies which, if modified, should cause everything to rebuild
|
||||
GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(DEPTH)/config/config.mk
|
||||
GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
|
||||
|
||||
##############################################
|
||||
ifdef PARALLEL_DIRS
|
||||
|
|
13
configure.in
13
configure.in
|
@ -4566,6 +4566,7 @@ MOZ_REFLOW_PERF=
|
|||
MOZ_SAFE_BROWSING=
|
||||
MOZ_HELP_VIEWER=
|
||||
MOZ_SPELLCHECK=1
|
||||
MOZ_SPLASHSCREEN=
|
||||
MOZ_STATIC_MAIL_BUILD=
|
||||
MOZ_STORAGE=1
|
||||
MOZ_SVG=1
|
||||
|
@ -5595,6 +5596,18 @@ linux*)
|
|||
fi
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl Splashscreen
|
||||
dnl ========================================================
|
||||
AC_ARG_ENABLE(splashscreen,
|
||||
[ --enable-splashscreen display splashscreen while loading (default=no)],
|
||||
[enable_splash="yes"],[enable_splash=""])
|
||||
if test "x$enable_splash" = "xyes"; then
|
||||
MOZ_SPLASHSCREEN=1
|
||||
AC_DEFINE(MOZ_SPLASHSCREEN)
|
||||
fi
|
||||
AC_SUBST(MOZ_SPLASHSCREEN)
|
||||
|
||||
dnl ========================================================
|
||||
dnl Permissions System
|
||||
dnl ========================================================
|
||||
|
|
|
@ -224,8 +224,9 @@ nsXHTMLContentSerializer::EscapeURI(nsIContent* aContent, const nsAString& aURI,
|
|||
nsXPIDLCString escapedURI;
|
||||
aEscapedURI.Truncate(0);
|
||||
|
||||
// Loop and escape parts by avoiding escaping reserved characters (and '%', '#' ).
|
||||
while ((end = uri.FindCharInSet("%#;/?:@&=+$,", start)) != -1) {
|
||||
// Loop and escape parts by avoiding escaping reserved characters
|
||||
// (and '%', '#', as well as '[' and ']' for IPv6 address literals).
|
||||
while ((end = uri.FindCharInSet("%#;/?:@&=+$,[]", start)) != -1) {
|
||||
part = Substring(aURI, start, (end-start));
|
||||
if (textToSubURI && !IsASCII(part)) {
|
||||
rv = textToSubURI->ConvertAndEscape(mCharset.get(), part.get(), getter_Copies(escapedURI));
|
||||
|
|
|
@ -310,6 +310,9 @@ _TEST_FILES = test_bug5141.html \
|
|||
test_bug466751.xhtml \
|
||||
test_bug461555.html \
|
||||
test_sync_xhr_timer.xhtml \
|
||||
file_htmlserializer_ipv6.html \
|
||||
file_htmlserializer_ipv6_out.html \
|
||||
test_bug498433.html \
|
||||
$(NULL)
|
||||
# Disabled; see bug 492181
|
||||
# test_plugin_freezing.html
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Testcase for IPv6 addresses</title>
|
||||
<body>
|
||||
<a href="http://[2001:4860:a003::68]/">Test</a>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Testcase for IPv6 addresses</title>
|
||||
</head><body>
|
||||
<a href="http://[2001:4860:a003::68]/">Test</a>
|
||||
</body></html>
|
|
@ -0,0 +1,94 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
-->
|
||||
<head>
|
||||
<title>Test for HTML serializer</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=498433">Mozilla Bug </a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe id="testframe" src="file_htmlserializer_ipv6.html">
|
||||
</iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
|
||||
function loadFileContent(aFile, aCharset) {
|
||||
if (aCharset == undefined)
|
||||
aCharset = 'UTF-8';
|
||||
|
||||
var baseUri = Components.classes['@mozilla.org/network/standard-url;1']
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
baseUri.spec = window.location.href;
|
||||
|
||||
var ios = Components.classes['@mozilla.org/network/io-service;1']
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chann = ios.newChannel(aFile, aCharset, baseUri);
|
||||
|
||||
var cis = Components.interfaces.nsIConverterInputStream;
|
||||
|
||||
var inputStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
|
||||
.createInstance(cis);
|
||||
inputStream.init(chann.open(), aCharset, 1024, cis.DEFAULT_REPLACEMENT_CHARACTER);
|
||||
var str = {}, content = '';
|
||||
while (inputStream.readString(4096, str) != 0) {
|
||||
content += str.value;
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
function testHtmlSerializer_1 () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const de = Components.interfaces.nsIDocumentEncoder
|
||||
var encoder = Components.classes["@mozilla.org/layout/documentEncoder;1?type=text/html"]
|
||||
.createInstance(Components.interfaces.nsIDocumentEncoder);
|
||||
|
||||
var doc = $("testframe").contentDocument;
|
||||
var out, expected;
|
||||
|
||||
// in the following tests, we must use the OutputLFLineBreak flag, to avoid
|
||||
// to have the default line break of the platform in the result, so the test
|
||||
// can pass on all platform
|
||||
|
||||
//------------ no flags
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak);
|
||||
encoder.setCharset("UTF-8");
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_ipv6_out.html");
|
||||
is(out, expected, "test no flags");
|
||||
//------------ OutputAbsoluteLinks
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputAbsoluteLinks);
|
||||
encoder.setCharset("UTF-8");
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_ipv6_out.html");
|
||||
is(out, expected, "test OutputAbsoluteLinks");
|
||||
//------------ serializing a selection
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputAbsoluteLinks);
|
||||
encoder.setNode(doc.links[0]);
|
||||
out = encoder.encodeToString();
|
||||
expected = "<a href=\"http://[2001:4860:a003::68]/\">Test</a>";
|
||||
is(out, expected, "test selection");
|
||||
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(testHtmlSerializer_1);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -39,14 +39,15 @@
|
|||
#define nsICanvasElement_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "gfxPattern.h"
|
||||
|
||||
class gfxContext;
|
||||
class nsIFrame;
|
||||
struct gfxRect;
|
||||
|
||||
// {C234660C-BD06-493e-8583-939A5A158B37}
|
||||
// {D31B3CCF-DDA3-49a8-AEF6-B95AF8E09159}
|
||||
#define NS_ICANVASELEMENT_IID \
|
||||
{ 0xc234660c, 0xbd06, 0x493e, { 0x85, 0x83, 0x93, 0x9a, 0x5a, 0x15, 0x8b, 0x37 } }
|
||||
{ 0xd31b3ccf, 0xdda3, 0x49a8, { 0xae, 0xf6, 0xb9, 0x5a, 0xf8, 0xe0, 0x91, 0x59 } }
|
||||
|
||||
class nsIRenderingContext;
|
||||
|
||||
|
@ -72,7 +73,7 @@ public:
|
|||
* Ask the canvas element to tell the contexts to render themselves
|
||||
* to the given gfxContext at the origin of its coordinate space.
|
||||
*/
|
||||
NS_IMETHOD RenderContexts (gfxContext *ctx) = 0;
|
||||
NS_IMETHOD RenderContexts (gfxContext *ctx, gfxPattern::GraphicsFilter aFilter) = 0;
|
||||
|
||||
/**
|
||||
* Determine whether the canvas is write-only.
|
||||
|
|
|
@ -41,10 +41,11 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nsICanvasElement.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "gfxPattern.h"
|
||||
|
||||
// {eab854fd-aa5e-44bb-8cc5-8d02f84b0216}
|
||||
// {ed741c16-4039-469b-91da-dca742c51a9f}
|
||||
#define NS_ICANVASRENDERINGCONTEXTINTERNAL_IID \
|
||||
{ 0xeab854fd, 0xaa5e, 0x44bb, { 0x8c, 0xc5, 0x8d, 0x02, 0xf8, 0x4b, 0x02, 0x16 } }
|
||||
{ 0xed741c16, 0x4039, 0x469b, { 0x91, 0xda, 0xdc, 0xa7, 0x42, 0xc5, 0x1a, 0x9f } }
|
||||
|
||||
class gfxContext;
|
||||
class gfxASurface;
|
||||
|
@ -62,7 +63,7 @@ public:
|
|||
NS_IMETHOD SetDimensions(PRInt32 width, PRInt32 height) = 0;
|
||||
|
||||
// Render the canvas at the origin of the given gfxContext
|
||||
NS_IMETHOD Render(gfxContext *ctx) = 0;
|
||||
NS_IMETHOD Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter) = 0;
|
||||
|
||||
// Gives you a stream containing the image represented by this context.
|
||||
// The format is given in aMimeTime, for example "image/png".
|
||||
|
|
|
@ -324,7 +324,7 @@ public:
|
|||
// nsICanvasRenderingContextInternal
|
||||
NS_IMETHOD SetCanvasElement(nsICanvasElement* aParentCanvas);
|
||||
NS_IMETHOD SetDimensions(PRInt32 width, PRInt32 height);
|
||||
NS_IMETHOD Render(gfxContext *ctx);
|
||||
NS_IMETHOD Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter);
|
||||
NS_IMETHOD GetInputStream(const char* aMimeType,
|
||||
const PRUnichar* aEncoderOptions,
|
||||
nsIInputStream **aStream);
|
||||
|
@ -984,7 +984,7 @@ nsCanvasRenderingContext2D::SetIsOpaque(PRBool isOpaque)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::Render(gfxContext *ctx)
|
||||
nsCanvasRenderingContext2D::Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -998,6 +998,8 @@ nsCanvasRenderingContext2D::Render(gfxContext *ctx)
|
|||
|
||||
nsRefPtr<gfxPattern> pat = new gfxPattern(mSurface);
|
||||
|
||||
pat->SetFilter(aFilter);
|
||||
|
||||
gfxContext::GraphicsOperator op = ctx->CurrentOperator();
|
||||
if (mOpaque)
|
||||
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
|
@ -1751,83 +1753,53 @@ nsCanvasRenderingContext2D::ArcTo(float x1, float y1, float x2, float y2, float
|
|||
if (!FloatValidate(x1,y1,x2,y2,radius))
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
|
||||
if (radius <= 0)
|
||||
if (radius < 0)
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
|
||||
/* This is an adaptation of the cairo_arc_to patch from Behdad
|
||||
* Esfahbod; once that patch is accepted, we should remove this
|
||||
* and just call cairo_arc_to() directly.
|
||||
*/
|
||||
|
||||
double angle0, angle1, angle2, angled;
|
||||
double d0, d2;
|
||||
double sin_, cos_;
|
||||
double dc;
|
||||
int forward;
|
||||
|
||||
gfxPoint p0 = mThebes->CurrentPoint();
|
||||
|
||||
angle0 = atan2 (p0.y - y1, p0.x - x1); /* angle from (x1,y1) to (p0.x,p0.y) */
|
||||
angle2 = atan2 (y2 - y1, x2 - x1); /* angle from (x1,y1) to (x2,y2) */
|
||||
angle1 = (angle0 + angle2) / 2; /* angle from (x1,y1) to (xc,yc) */
|
||||
double dir, a2, b2, c2, cosx, sinx, d, anx, any, bnx, bny, x3, y3, x4, y4, cx, cy, angle0, angle1;
|
||||
bool anticlockwise;
|
||||
|
||||
angled = angle2 - angle0; /* the angle (p0.x,p0.y)--(x1,y1)--(x2,y2) */
|
||||
|
||||
/* Shall we go forward or backward? */
|
||||
if (angled > M_PI || (angled < 0 && angled > -M_PI)) {
|
||||
angle1 += M_PI;
|
||||
angled = 2 * M_PI - angled;
|
||||
forward = 1;
|
||||
} else {
|
||||
double tmp;
|
||||
tmp = angle0;
|
||||
angle0 = angle2;
|
||||
angle2 = tmp;
|
||||
forward = 0;
|
||||
if ((x1 == p0.x && y1 == p0.y) || (x1 == x2 && y1 == y2) || radius == 0) {
|
||||
mThebes->LineTo(gfxPoint(x1, y1));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
angle0 += M_PI_2; /* angle from (xc,yc) to (p0.x,p0.y) */
|
||||
angle2 -= M_PI_2; /* angle from (xc,yc) to (x2,y2) */
|
||||
angled /= 2; /* the angle (p0.x,p0.y)--(x1,y1)--(xc,yc) */
|
||||
|
||||
|
||||
/* distance from (x1,y1) to (p0.x,p0.y) */
|
||||
d0 = sqrt ((p0.x-x1)*(p0.x-x1)+(p0.y-y1)*(p0.y-y1));
|
||||
/* distance from (x2,y2) to (p0.x,p0.y) */
|
||||
d2 = sqrt ((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
|
||||
|
||||
dc = -1;
|
||||
sin_ = sin(angled);
|
||||
cos_ = cos(angled);
|
||||
if (fabs(cos_) >= 1e-5) { /* the arc may not fit */
|
||||
/* min distance of end-points from corner */
|
||||
double min_d = d0 < d2 ? d0 : d2;
|
||||
/* max radius of an arc that fits */
|
||||
double max_r = min_d * sin_ / cos_;
|
||||
|
||||
if (radius > max_r) {
|
||||
/* arc with requested radius doesn't fit */
|
||||
radius = (float) max_r;
|
||||
dc = min_d / cos_; /* distance of (xc,yc) from (x1,y1) */
|
||||
}
|
||||
dir = (x2-x1)*(p0.y-y1) + (y2-y1)*(x1-p0.x);
|
||||
if (dir == 0) {
|
||||
mThebes->LineTo(gfxPoint(x1, y1));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (dc < 0)
|
||||
dc = radius / sin_; /* distance of (xc,yc) from (x1,y1) */
|
||||
a2 = (p0.x-x1)*(p0.x-x1) + (p0.y-y1)*(p0.y-y1);
|
||||
b2 = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
|
||||
c2 = (p0.x-x2)*(p0.x-x2) + (p0.y-y2)*(p0.y-y2);
|
||||
cosx = (a2+b2-c2)/(2*sqrt(a2*b2));
|
||||
|
||||
sinx = sqrt(1 - cosx*cosx);
|
||||
d = radius / ((1 - cosx) / sinx);
|
||||
|
||||
/* find (cx,cy), the center of the arc */
|
||||
gfxPoint c(x1 + sin(angle1) * dc, y1 + cos(angle1) * dc);
|
||||
anx = (x1-p0.x) / sqrt(a2);
|
||||
any = (y1-p0.y) / sqrt(a2);
|
||||
bnx = (x1-x2) / sqrt(b2);
|
||||
bny = (y1-y2) / sqrt(b2);
|
||||
x3 = x1 - anx*d;
|
||||
y3 = y1 - any*d;
|
||||
x4 = x1 - bnx*d;
|
||||
y4 = y1 - bny*d;
|
||||
anticlockwise = (dir < 0);
|
||||
cx = x3 + any*radius*(anticlockwise ? 1 : -1);
|
||||
cy = y3 - anx*radius*(anticlockwise ? 1 : -1);
|
||||
angle0 = atan2((y3-cy), (x3-cx));
|
||||
angle1 = atan2((y4-cy), (x4-cx));
|
||||
|
||||
/* the arc operation draws the line from current point (p0.x,p0.y)
|
||||
* to arc center too. */
|
||||
mThebes->LineTo(gfxPoint(x3, y3));
|
||||
|
||||
if (forward)
|
||||
mThebes->Arc(c, radius, angle0, angle2);
|
||||
if (anticlockwise)
|
||||
mThebes->NegativeArc(gfxPoint(cx, cy), radius, angle0, angle1);
|
||||
else
|
||||
mThebes->NegativeArc(c, radius, angle2, angle0);
|
||||
|
||||
mThebes->LineTo(gfxPoint(x2, y2));
|
||||
mThebes->Arc(gfxPoint(cx, cy), radius, angle0, angle1);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3335,7 +3307,7 @@ nsCanvasRenderingContext2D::ThebesSurfaceFromElement(nsIDOMElement *imgElt,
|
|||
gfxPlatform::GetPlatform()->CreateOffscreenSurface
|
||||
(gfxIntSize(w, h), gfxASurface::ImageFormatARGB32);
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
|
||||
rv = canvas->RenderContexts(ctx);
|
||||
rv = canvas->RenderContexts(ctx, gfxPattern::FILTER_NEAREST);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
sourceSurface = surf;
|
||||
|
@ -3375,7 +3347,7 @@ nsCanvasRenderingContext2D::ThebesSurfaceFromElement(nsIDOMElement *imgElt,
|
|||
|
||||
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
|
||||
video->Paint(ctx, gfxPattern::FILTER_GOOD, gfxRect(0, 0, videoWidth, videoHeight));
|
||||
video->Paint(ctx, gfxPattern::FILTER_NEAREST, gfxRect(0, 0, videoWidth, videoHeight));
|
||||
|
||||
*aSurface = surf.forget().get();
|
||||
*widthOut = videoWidth;
|
||||
|
|
|
@ -55,9 +55,9 @@ ctx.moveTo(50, 25);
|
|||
ctx.arcTo(50, 25, 100, 25, 1);
|
||||
ctx.stroke();
|
||||
|
||||
todo_isPixel(ctx, 50,1, 0,255,0,255, "50,1", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 50,48, 0,255,0,255, "50,48", "0,255,0,255", 0);
|
||||
isPixel(ctx, 50,1, 0,255,0,255, "50,1", "0,255,0,255", 0);
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 50,48, 0,255,0,255, "50,48", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ ctx.moveTo(-100, 25);
|
|||
ctx.arcTo(0, 25, 100, 25, 1);
|
||||
ctx.stroke();
|
||||
|
||||
todo_isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ isPixel(ctx, 73,27, 0,255,0,255, "73,27", "0,255,0,255", 0);
|
|||
isPixel(ctx, 78,36, 0,255,0,255, "78,36", "0,255,0,255", 0);
|
||||
isPixel(ctx, 79,35, 0,255,0,255, "79,35", "0,255,0,255", 0);
|
||||
isPixel(ctx, 80,44, 0,255,0,255, "80,44", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 80,45, 0,255,0,255, "80,45", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 80,46, 0,255,0,255, "80,46", "0,255,0,255", 0);
|
||||
isPixel(ctx, 80,45, 0,255,0,255, "80,45", "0,255,0,255", 0);
|
||||
isPixel(ctx, 80,46, 0,255,0,255, "80,46", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
|
|
|
@ -58,13 +58,13 @@ ctx.moveTo(10, 25);
|
|||
ctx.arcTo(75, 25, 75, 60, 20);
|
||||
ctx.stroke();
|
||||
|
||||
todo_isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 55,19, 0,255,0,255, "55,19", "0,255,0,255", 0);
|
||||
isPixel(ctx, 55,20, 0,255,0,255, "55,20", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 55,21, 0,255,0,255, "55,21", "0,255,0,255", 0);
|
||||
isPixel(ctx, 55,21, 0,255,0,255, "55,21", "0,255,0,255", 0);
|
||||
isPixel(ctx, 64,22, 0,255,0,255, "64,22", "0,255,0,255", 0);
|
||||
isPixel(ctx, 65,21, 0,255,0,255, "65,21", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 72,28, 0,255,0,255, "72,28", "0,255,0,255", 0);
|
||||
isPixel(ctx, 72,28, 0,255,0,255, "72,28", "0,255,0,255", 0);
|
||||
isPixel(ctx, 73,27, 0,255,0,255, "73,27", "0,255,0,255", 0);
|
||||
isPixel(ctx, 78,36, 0,255,0,255, "78,36", "0,255,0,255", 0);
|
||||
isPixel(ctx, 79,35, 0,255,0,255, "79,35", "0,255,0,255", 0);
|
||||
|
|
|
@ -48,10 +48,10 @@ ctx.arcTo(-100, 25, 200, 25, 10);
|
|||
ctx.stroke();
|
||||
|
||||
isPixel(ctx, 1,1, 0,255,0,255, "1,1", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 1,48, 0,255,0,255, "1,48", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 1,48, 0,255,0,255, "1,48", "0,255,0,255", 0);
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 98,1, 0,255,0,255, "98,1", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 98,48, 0,255,0,255, "98,48", "0,255,0,255", 0);
|
||||
isPixel(ctx, 98,48, 0,255,0,255, "98,48", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@ ctx.arcTo(200, 25, 200, 50, 10);
|
|||
ctx.stroke();
|
||||
|
||||
isPixel(ctx, 1,1, 0,255,0,255, "1,1", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 1,48, 0,255,0,255, "1,48", "0,255,0,255", 0);
|
||||
isPixel(ctx, 1,48, 0,255,0,255, "1,48", "0,255,0,255", 0);
|
||||
isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
||||
isPixel(ctx, 98,1, 0,255,0,255, "98,1", "0,255,0,255", 0);
|
||||
todo_isPixel(ctx, 98,48, 0,255,0,255, "98,48", "0,255,0,255", 0);
|
||||
isPixel(ctx, 98,48, 0,255,0,255, "98,48", "0,255,0,255", 0);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
|||
} catch (e) {
|
||||
_thrown_outer = true;
|
||||
}
|
||||
todo(!_thrown_outer, 'should not throw exception');
|
||||
ok(!_thrown_outer, 'should not throw exception');
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ isPixel(ctx, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 0);
|
|||
} catch (e) {
|
||||
_thrown_outer = true;
|
||||
}
|
||||
todo(!_thrown_outer, 'should not throw exception');
|
||||
ok(!_thrown_outer, 'should not throw exception');
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresCon
|
|||
nsresult
|
||||
NS_NewDOMMutationEvent(nsIDOMEvent** aResult NS_OUTPARAM, nsPresContext* aPresContext, class nsMutationEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsPopupBlockedEvent* aEvent);
|
||||
NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMTextEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsTextEvent* aEvent);
|
||||
nsresult
|
||||
|
|
|
@ -943,12 +943,6 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
|
|||
NS_ENSURE_TRUE(newEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
break;
|
||||
}
|
||||
case NS_POPUPBLOCKED_EVENT:
|
||||
{
|
||||
NS_WARNING("nsPopupBlockedEvent should never be an external event!");
|
||||
newEvent = new nsPopupBlockedEvent(PR_FALSE, msg);
|
||||
break;
|
||||
}
|
||||
case NS_BEFORE_PAGE_UNLOAD_EVENT:
|
||||
{
|
||||
newEvent = new nsBeforePageUnloadEvent(PR_FALSE, msg);
|
||||
|
|
|
@ -41,35 +41,6 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
nsDOMPopupBlockedEvent::nsDOMPopupBlockedEvent(nsPresContext* aPresContext,
|
||||
nsPopupBlockedEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent ? aEvent :
|
||||
new nsPopupBlockedEvent(PR_FALSE, 0))
|
||||
{
|
||||
NS_ASSERTION(mEvent->eventStructType == NS_POPUPBLOCKED_EVENT, "event type mismatch");
|
||||
|
||||
if (aEvent) {
|
||||
mEventIsInternal = PR_FALSE;
|
||||
}
|
||||
else {
|
||||
mEventIsInternal = PR_TRUE;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
}
|
||||
|
||||
nsDOMPopupBlockedEvent::~nsDOMPopupBlockedEvent()
|
||||
{
|
||||
if (mEventIsInternal) {
|
||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
||||
NS_IF_RELEASE(event->mPopupWindowURI);
|
||||
|
||||
delete event;
|
||||
mEvent = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMPopupBlockedEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMPopupBlockedEvent, nsDOMEvent)
|
||||
|
||||
|
@ -89,22 +60,10 @@ nsDOMPopupBlockedEvent::InitPopupBlockedEvent(const nsAString & aTypeArg,
|
|||
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
switch (mEvent->eventStructType)
|
||||
{
|
||||
case NS_POPUPBLOCKED_EVENT:
|
||||
{
|
||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
||||
event->mRequestingWindow = do_GetWeakReference(aRequestingWindow);
|
||||
event->mPopupWindowURI = aPopupWindowURI;
|
||||
NS_IF_ADDREF(event->mPopupWindowURI);
|
||||
event->mPopupWindowFeatures = aPopupWindowFeatures;
|
||||
event->mPopupWindowName = aPopupWindowName;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
mRequestingWindow = do_GetWeakReference(aRequestingWindow);
|
||||
mPopupWindowURI = aPopupWindowURI;
|
||||
mPopupWindowFeatures = aPopupWindowFeatures;
|
||||
mPopupWindowName = aPopupWindowName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -112,12 +71,8 @@ NS_IMETHODIMP
|
|||
nsDOMPopupBlockedEvent::GetRequestingWindow(nsIDOMWindow **aRequestingWindow)
|
||||
{
|
||||
*aRequestingWindow = nsnull;
|
||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
||||
if (event->mRequestingWindow) {
|
||||
CallQueryReferent(event->mRequestingWindow.get(), aRequestingWindow);
|
||||
}
|
||||
}
|
||||
if (mRequestingWindow)
|
||||
CallQueryReferent(mRequestingWindow.get(), aRequestingWindow);
|
||||
|
||||
return NS_OK; // Don't throw an exception
|
||||
}
|
||||
|
@ -126,43 +81,30 @@ NS_IMETHODIMP
|
|||
nsDOMPopupBlockedEvent::GetPopupWindowURI(nsIURI **aPopupWindowURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPopupWindowURI);
|
||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
||||
*aPopupWindowURI = event->mPopupWindowURI;
|
||||
NS_IF_ADDREF(*aPopupWindowURI);
|
||||
return NS_OK;
|
||||
}
|
||||
*aPopupWindowURI = 0;
|
||||
|
||||
*aPopupWindowURI = mPopupWindowURI;
|
||||
NS_IF_ADDREF(*aPopupWindowURI);
|
||||
return NS_OK; // Don't throw an exception
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMPopupBlockedEvent::GetPopupWindowFeatures(nsAString &aPopupWindowFeatures)
|
||||
{
|
||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
||||
aPopupWindowFeatures = event->mPopupWindowFeatures;
|
||||
return NS_OK;
|
||||
}
|
||||
aPopupWindowFeatures.Truncate();
|
||||
|
||||
aPopupWindowFeatures = mPopupWindowFeatures;
|
||||
return NS_OK; // Don't throw an exception
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMPopupBlockedEvent::GetPopupWindowName(nsAString &aPopupWindowName)
|
||||
{
|
||||
if (mEvent->eventStructType == NS_POPUPBLOCKED_EVENT) {
|
||||
nsPopupBlockedEvent* event = static_cast<nsPopupBlockedEvent*>(mEvent);
|
||||
aPopupWindowName = event->mPopupWindowName;
|
||||
return NS_OK;
|
||||
}
|
||||
aPopupWindowName.Truncate();
|
||||
aPopupWindowName = mPopupWindowName;
|
||||
return NS_OK; // Don't throw an exception
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMPopupBlockedEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsPopupBlockedEvent *aEvent)
|
||||
nsEvent *aEvent)
|
||||
{
|
||||
nsDOMPopupBlockedEvent* it = new nsDOMPopupBlockedEvent(aPresContext, aEvent);
|
||||
if (nsnull == it) {
|
||||
|
|
|
@ -41,14 +41,15 @@
|
|||
|
||||
#include "nsIDOMPopupBlockedEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
class nsDOMPopupBlockedEvent : public nsIDOMPopupBlockedEvent,
|
||||
public nsDOMEvent
|
||||
{
|
||||
public:
|
||||
|
||||
nsDOMPopupBlockedEvent(nsPresContext* aPresContext, nsPopupBlockedEvent* aEvent);
|
||||
virtual ~nsDOMPopupBlockedEvent();
|
||||
nsDOMPopupBlockedEvent(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent) {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
@ -57,6 +58,11 @@ public:
|
|||
|
||||
// nsIDOMPopupBlockedEvent Interface
|
||||
NS_DECL_NSIDOMPOPUPBLOCKEDEVENT
|
||||
protected:
|
||||
nsWeakPtr mRequestingWindow;
|
||||
nsCOMPtr<nsIURI> mPopupWindowURI;
|
||||
nsString mPopupWindowFeatures;
|
||||
nsString mPopupWindowName;
|
||||
};
|
||||
|
||||
#endif // nsDOMPopupBlockedEvent_h__
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
nsEventTargetChainItem* parent = item->mParent;
|
||||
item->~nsEventTargetChainItem();
|
||||
aAllocator->Free(item, sizeof(nsEventTargetChainItem));
|
||||
--sCurrentEtciCount;
|
||||
item = parent;
|
||||
}
|
||||
}
|
||||
|
@ -165,6 +166,13 @@ public:
|
|||
*/
|
||||
nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
|
||||
static PRUint32 MaxEtciCount() { return sMaxEtciCount; }
|
||||
|
||||
static void ResetMaxEtciCount()
|
||||
{
|
||||
NS_ASSERTION(!sCurrentEtciCount, "Wrong time to call ResetMaxEtciCount()!");
|
||||
sMaxEtciCount = 0;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMEventTarget> mTarget;
|
||||
nsEventTargetChainItem* mChild;
|
||||
|
@ -176,8 +184,14 @@ public:
|
|||
nsCOMPtr<nsPIDOMEventTarget> mNewTarget;
|
||||
// Cache mTarget's event listener manager.
|
||||
nsCOMPtr<nsIEventListenerManager> mManager;
|
||||
|
||||
static PRUint32 sMaxEtciCount;
|
||||
static PRUint32 sCurrentEtciCount;
|
||||
};
|
||||
|
||||
PRUint32 nsEventTargetChainItem::sMaxEtciCount = 0;
|
||||
PRUint32 nsEventTargetChainItem::sCurrentEtciCount = 0;
|
||||
|
||||
nsEventTargetChainItem::nsEventTargetChainItem(nsPIDOMEventTarget* aTarget,
|
||||
nsEventTargetChainItem* aChild)
|
||||
: mChild(aChild), mParent(nsnull), mFlags(0), mItemFlags(0)
|
||||
|
@ -186,6 +200,10 @@ nsEventTargetChainItem::nsEventTargetChainItem(nsPIDOMEventTarget* aTarget,
|
|||
if (mChild) {
|
||||
mChild->mParent = this;
|
||||
}
|
||||
|
||||
if (++sCurrentEtciCount > sMaxEtciCount) {
|
||||
sMaxEtciCount = sCurrentEtciCount;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -347,6 +365,8 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#define NS_CHAIN_POOL_SIZE 128
|
||||
|
||||
class ChainItemPool {
|
||||
public:
|
||||
ChainItemPool() {
|
||||
|
@ -356,7 +376,7 @@ public:
|
|||
static const size_t kBucketSizes[] = { sizeof(nsEventTargetChainItem) };
|
||||
static const PRInt32 kNumBuckets = sizeof(kBucketSizes) / sizeof(size_t);
|
||||
static const PRInt32 kInitialPoolSize =
|
||||
NS_SIZE_IN_HEAP(sizeof(nsEventTargetChainItem)) * 128;
|
||||
NS_SIZE_IN_HEAP(sizeof(nsEventTargetChainItem)) * NS_CHAIN_POOL_SIZE;
|
||||
nsresult rv = sEtciPool->Init("EventTargetChainItem Pool", kBucketSizes,
|
||||
kNumBuckets, kInitialPoolSize);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -374,9 +394,21 @@ public:
|
|||
if (sEtciPool) {
|
||||
--sEtciPoolUsers;
|
||||
}
|
||||
if (!sEtciPoolUsers) {
|
||||
if (nsEventTargetChainItem::MaxEtciCount() > NS_CHAIN_POOL_SIZE) {
|
||||
delete sEtciPool;
|
||||
sEtciPool = nsnull;
|
||||
nsEventTargetChainItem::ResetMaxEtciCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Shutdown()
|
||||
{
|
||||
if (!sEtciPoolUsers) {
|
||||
delete sEtciPool;
|
||||
sEtciPool = nsnull;
|
||||
nsEventTargetChainItem::ResetMaxEtciCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,6 +421,8 @@ public:
|
|||
nsFixedSizeAllocator* ChainItemPool::sEtciPool = nsnull;
|
||||
PRInt32 ChainItemPool::sEtciPoolUsers = 0;
|
||||
|
||||
void NS_ShutdownChainItemPool() { ChainItemPool::Shutdown(); }
|
||||
|
||||
/* static */ nsresult
|
||||
nsEventDispatcher::Dispatch(nsISupports* aTarget,
|
||||
nsPresContext* aPresContext,
|
||||
|
@ -606,10 +640,6 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
|||
case NS_DRAG_EVENT:
|
||||
return NS_NewDOMDragEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsDragEvent*>(aEvent));
|
||||
case NS_POPUPBLOCKED_EVENT:
|
||||
return NS_NewDOMPopupBlockedEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsPopupBlockedEvent*>
|
||||
(aEvent));
|
||||
case NS_TEXT_EVENT:
|
||||
return NS_NewDOMTextEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsTextEvent*>(aEvent));
|
||||
|
|
|
@ -1949,16 +1949,12 @@ nsGenericHTMLElement::MapBGColorInto(const nsMappedAttributes* aAttributes,
|
|||
if (!(aData->mSIDs & NS_STYLE_INHERIT_BIT(Background)))
|
||||
return;
|
||||
|
||||
if (aData->mColorData->mBackColor.mXValue.GetUnit() == eCSSUnit_Null &&
|
||||
if (aData->mColorData->mBackColor.GetUnit() == eCSSUnit_Null &&
|
||||
aData->mPresContext->UseDocumentColors()) {
|
||||
NS_ASSERTION(aData->mColorData->mBackColor.mYValue.GetUnit() ==
|
||||
eCSSUnit_Null,
|
||||
"half a property?");
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::bgcolor);
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
aData->mColorData->mBackColor.mXValue.SetColorValue(color);
|
||||
aData->mColorData->mBackColor.mYValue.SetColorValue(color);
|
||||
aData->mColorData->mBackColor.SetColorValue(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче