Merge mozilla-central to tracemonkey.
This commit is contained in:
Коммит
8d7fd7cf7b
2
.hgtags
2
.hgtags
|
@ -35,3 +35,5 @@ fe9cc55b8db7f56f7e68a246acba363743854979 UPDATE_PACKAGING_R8
|
|||
6fd4bb500d425c406c1b52f66e5b195b20ae5e0a chromium-import-r15462
|
||||
6fd4bb500d425c406c1b52f66e5b195b20ae5e0a chromium-import-latest
|
||||
376b78fc72230aaf2ca4e279a8f4ef1efd4a1d9f GECKO_1_9_2_BASE
|
||||
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R9
|
||||
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R10
|
||||
|
|
|
@ -61,10 +61,15 @@ TIERS += base
|
|||
tier_base_dirs = \
|
||||
config \
|
||||
build \
|
||||
memory \
|
||||
probes \
|
||||
$(NULL)
|
||||
|
||||
ifndef LIBXUL_SDK
|
||||
tier_base_dirs += \
|
||||
memory \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
|
||||
endif
|
||||
|
|
|
@ -55,6 +55,7 @@ XPIDLSRCS = \
|
|||
nsIAccessibilityService.idl \
|
||||
nsIAccessibleRetrieval.idl \
|
||||
nsIAccessible.idl \
|
||||
nsIAccessibleApplication.idl \
|
||||
nsIAccessibleRelation.idl \
|
||||
nsIAccessibleRole.idl \
|
||||
nsIAccessibleStates.idl \
|
||||
|
|
|
@ -56,7 +56,7 @@ interface nsIDOMCSSPrimitiveValue;
|
|||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(71a3b4e7-e83d-45cf-a20e-9ce292bcf19f)]
|
||||
[scriptable, uuid(bd458843-1895-42c6-b7f9-f0ca88eeab6b)]
|
||||
interface nsIAccessNode : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -104,11 +104,15 @@ interface nsIAccessNode : nsISupports
|
|||
readonly attribute nsIAccessNode nextSiblingNode;
|
||||
|
||||
/**
|
||||
* The nsIAccessibleDocument that this nsIAccessNode
|
||||
* resides in.
|
||||
* The document accessible that this access node resides in.
|
||||
*/
|
||||
readonly attribute nsIAccessibleDocument accessibleDocument;
|
||||
|
||||
readonly attribute nsIAccessibleDocument document;
|
||||
|
||||
/**
|
||||
* The root document accessible that this access node resides in.
|
||||
*/
|
||||
readonly attribute nsIAccessibleDocument rootDocument;
|
||||
|
||||
/**
|
||||
* The innerHTML for the DOM node
|
||||
* This is a text string of all the markup inside the DOM
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* -*- 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
|
||||
*
|
||||
|
@ -14,12 +15,12 @@
|
|||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Organization.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2002
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Robert Kaiser <KaiRo@KaiRo.at>
|
||||
* 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,86 +36,32 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* used by the about:plugins dialog */
|
||||
#include "nsISupports.idl"
|
||||
|
||||
body {
|
||||
background-color: -moz-Field;
|
||||
color: -moz-FieldText;
|
||||
font: message-box;
|
||||
}
|
||||
/**
|
||||
* This interface is implemented by top level accessible object in hierarchy and
|
||||
* provides information about application.
|
||||
*/
|
||||
[scriptable, uuid(79251626-387c-4531-89f3-680d31d6cf05)]
|
||||
interface nsIAccessibleApplication : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns the application name.
|
||||
*/
|
||||
readonly attribute DOMString appName;
|
||||
|
||||
div#outside {
|
||||
text-align: justify;
|
||||
width: 90%;
|
||||
margin-left: 5%;
|
||||
margin-right: 5%;
|
||||
}
|
||||
/**
|
||||
* Returns the application version.
|
||||
*/
|
||||
readonly attribute DOMString appVersion;
|
||||
|
||||
div#plugs {
|
||||
text-align: center;
|
||||
font-size: xx-large;
|
||||
font-weight: bold;
|
||||
}
|
||||
/**
|
||||
* Returns the platform name.
|
||||
*/
|
||||
readonly attribute DOMString platformName;
|
||||
|
||||
div#noplugs {
|
||||
font-size: x-large;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div#findmore {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
div.plugname {
|
||||
margin-top: 2em;
|
||||
margin-bottom: 1em;
|
||||
font-size: large;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
dl {
|
||||
margin: 0px 0px 3px 0px;
|
||||
}
|
||||
|
||||
table {
|
||||
background-color: -moz-Dialog;
|
||||
color: -moz-DialogText;
|
||||
font: message-box;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
border: 1px solid ThreeDShadow;
|
||||
border-spacing: 0px;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: center;
|
||||
background-color: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
th + th,
|
||||
td + td {
|
||||
border-left: 1px dotted ThreeDShadow;
|
||||
}
|
||||
|
||||
td {
|
||||
text-align: left;
|
||||
border-top: 1px dotted ThreeDShadow;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
th.type, th.suff {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
th.desc {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
th.enabled {
|
||||
width: 10%;
|
||||
}
|
||||
/**
|
||||
* Returns the platform version.
|
||||
*/
|
||||
readonly attribute DOMString platformVersion;
|
||||
};
|
|
@ -56,9 +56,14 @@ interface nsIDOMDOMStringList;
|
|||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(5f5a6f98-835d-4771-8bfe-a0c7cdc85fec)]
|
||||
[scriptable, uuid(3df14f00-7253-4b9c-97c2-b4632090da23)]
|
||||
interface nsIAccessibleRetrieval : nsISupports
|
||||
{
|
||||
/**
|
||||
* Return application accessible.
|
||||
*/
|
||||
nsIAccessible getApplicationAccessible();
|
||||
|
||||
/**
|
||||
* Return an nsIAccessible for a DOM node in pres shell 0.
|
||||
* Create a new accessible of the appropriate type if necessary,
|
||||
|
|
|
@ -1095,10 +1095,10 @@ nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
|
|||
|
||||
NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, nsnull);
|
||||
|
||||
nsRefPtr<nsApplicationAccessibleWrap> appAccWrap =
|
||||
nsApplicationAccessible *applicationAcc =
|
||||
nsAccessNode::GetApplicationAccessible();
|
||||
nsAccessibleWrap* tmpAppAccWrap =
|
||||
static_cast<nsAccessibleWrap*>(appAccWrap.get());
|
||||
static_cast<nsAccessibleWrap*>(applicationAcc);
|
||||
|
||||
if (tmpAppAccWrap != tmpAccWrap && !tmpAccWrap->IsValidObject())
|
||||
return nsnull;
|
||||
|
|
|
@ -446,11 +446,11 @@ mai_util_get_root(void)
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsRefPtr<nsApplicationAccessibleWrap> root =
|
||||
nsApplicationAccessible *applicationAcc =
|
||||
nsAccessNode::GetApplicationAccessible();
|
||||
|
||||
if (root)
|
||||
return root->GetAtkObject();
|
||||
if (applicationAcc)
|
||||
return applicationAcc->GetAtkObject();
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,6 @@ CPPSRCS = \
|
|||
|
||||
EXPORTS = \
|
||||
nsRootAccessible.h \
|
||||
nsAccEvent.h \
|
||||
nsAccessNode.h \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -679,17 +679,17 @@ nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
|
|||
};
|
||||
|
||||
/**
|
||||
* Universal states:
|
||||
* Universal (Global) states:
|
||||
* The following state rules are applied to any accessible element,
|
||||
* whether there is an ARIA role or not:
|
||||
*/
|
||||
eStateMapEntryID nsARIAMap::gWAIUnivStateMap[] = {
|
||||
eARIARequired,
|
||||
eARIAInvalid,
|
||||
eARIAHasPopup,
|
||||
eARIABusy,
|
||||
eARIADisabled,
|
||||
eARIAExpanded,
|
||||
eARIAExpanded, // Currently under spec review but precedent exists
|
||||
eARIAHasPopup, // Note this is technically a "property"
|
||||
eARIAInvalid,
|
||||
eARIARequired, // XXX not global, Bug 553117
|
||||
eARIANone
|
||||
};
|
||||
|
||||
|
@ -703,7 +703,7 @@ nsAttributeCharacteristics nsARIAMap::gWAIUnivAttrMap[] = {
|
|||
{&nsAccessibilityAtoms::aria_activedescendant, ATTR_BYPASSOBJ },
|
||||
{&nsAccessibilityAtoms::aria_atomic, ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_busy, ATTR_VALTOKEN },
|
||||
{&nsAccessibilityAtoms::aria_checked, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, /* exposes checkable obj attr */
|
||||
{&nsAccessibilityAtoms::aria_checked, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, /* exposes checkable obj attr */
|
||||
{&nsAccessibilityAtoms::aria_controls, ATTR_BYPASSOBJ },
|
||||
{&nsAccessibilityAtoms::aria_describedby, ATTR_BYPASSOBJ },
|
||||
{&nsAccessibilityAtoms::aria_disabled, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
||||
|
@ -740,27 +740,49 @@ PRUint32 nsARIAMap::gWAIUnivAttrMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIUnivA
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsStateMapEntry
|
||||
|
||||
nsStateMapEntry:: nsStateMapEntry(nsIAtom **aAttrName, eStateValueType aType,
|
||||
PRUint32 aPermanentState,
|
||||
PRUint32 aTrueState, PRUint32 aTrueExtraState,
|
||||
PRUint32 aFalseState, PRUint32 aFalseExtraState,
|
||||
PRBool aDefinedIfAbsent) :
|
||||
attributeName(aAttrName), isToken(PR_TRUE), permanentState(aPermanentState)
|
||||
nsStateMapEntry::nsStateMapEntry() :
|
||||
mAttributeName(nsnull),
|
||||
mIsToken(PR_FALSE),
|
||||
mPermanentState(0),
|
||||
mValue1(nsnull),
|
||||
mState1(0),
|
||||
mExtraState1(0),
|
||||
mValue2(nsnull),
|
||||
mState2(0),
|
||||
mExtraState2(0),
|
||||
mValue3(nsnull),
|
||||
mState3(0),
|
||||
mExtraState3(0),
|
||||
mDefaultState(0),
|
||||
mDefaultExtraState(0),
|
||||
mDefinedIfAbsent(PR_FALSE)
|
||||
{}
|
||||
|
||||
nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName, eStateValueType aType,
|
||||
PRUint32 aPermanentState,
|
||||
PRUint32 aTrueState, PRUint32 aTrueExtraState,
|
||||
PRUint32 aFalseState, PRUint32 aFalseExtraState,
|
||||
PRBool aDefinedIfAbsent) :
|
||||
mAttributeName(aAttrName),
|
||||
mIsToken(PR_TRUE),
|
||||
mPermanentState(aPermanentState),
|
||||
mValue1("false"),
|
||||
mState1(aFalseState),
|
||||
mExtraState1(aFalseExtraState),
|
||||
mValue2(nsnull),
|
||||
mState2(0),
|
||||
mExtraState2(0),
|
||||
mValue3(nsnull),
|
||||
mState3(0),
|
||||
mExtraState3(0),
|
||||
mDefaultState(aTrueState),
|
||||
mDefaultExtraState(aTrueExtraState),
|
||||
mDefinedIfAbsent(aDefinedIfAbsent)
|
||||
{
|
||||
value1 = "false";
|
||||
state1 = aFalseState;
|
||||
extraState1 = aFalseExtraState;
|
||||
|
||||
if (aType == kMixedType) {
|
||||
value2 = "mixed";
|
||||
state2 = nsIAccessibleStates::STATE_MIXED;
|
||||
extraState2 = 0;
|
||||
mValue2 = "mixed";
|
||||
mState2 = nsIAccessibleStates::STATE_MIXED;
|
||||
}
|
||||
|
||||
defaultState = aTrueState;
|
||||
defaultExtraState = aTrueExtraState;
|
||||
|
||||
definedIfAbsent = aDefinedIfAbsent;
|
||||
}
|
||||
|
||||
nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName,
|
||||
|
@ -770,11 +792,11 @@ nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName,
|
|||
PRUint32 aState2, PRUint32 aExtraState2,
|
||||
const char *aValue3,
|
||||
PRUint32 aState3, PRUint32 aExtraState3) :
|
||||
attributeName(aAttrName), isToken(PR_FALSE), permanentState(0),
|
||||
value1(aValue1), state1(aState1), extraState1(aExtraState1),
|
||||
value2(aValue2), state2(aState2), extraState2(aExtraState2),
|
||||
value3(aValue3), state3(aState3), extraState3(aExtraState3),
|
||||
defaultState(0), defaultExtraState(0), definedIfAbsent(PR_FALSE)
|
||||
mAttributeName(aAttrName), mIsToken(PR_FALSE), mPermanentState(0),
|
||||
mValue1(aValue1), mState1(aState1), mExtraState1(aExtraState1),
|
||||
mValue2(aValue2), mState2(aState2), mExtraState2(aExtraState2),
|
||||
mValue3(aValue3), mState3(aState3), mExtraState3(aExtraState3),
|
||||
mDefaultState(0), mDefaultExtraState(0), mDefinedIfAbsent(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -786,15 +808,15 @@ nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName,
|
|||
PRUint32 aState2, PRUint32 aExtraState2,
|
||||
const char *aValue3,
|
||||
PRUint32 aState3, PRUint32 aExtraState3) :
|
||||
attributeName(aAttrName), isToken(PR_TRUE), permanentState(0),
|
||||
value1(aValue1), state1(aState1), extraState1(aExtraState1),
|
||||
value2(aValue2), state2(aState2), extraState2(aExtraState2),
|
||||
value3(aValue3), state3(aState3), extraState3(aExtraState3),
|
||||
defaultState(0), defaultExtraState(0), definedIfAbsent(PR_TRUE)
|
||||
mAttributeName(aAttrName), mIsToken(PR_TRUE), mPermanentState(0),
|
||||
mValue1(aValue1), mState1(aState1), mExtraState1(aExtraState1),
|
||||
mValue2(aValue2), mState2(aState2), mExtraState2(aExtraState2),
|
||||
mValue3(aValue3), mState3(aState3), mExtraState3(aExtraState3),
|
||||
mDefaultState(0), mDefaultExtraState(0), mDefinedIfAbsent(PR_TRUE)
|
||||
{
|
||||
if (aDefaultStateRule == eUseFirstState) {
|
||||
defaultState = aState1;
|
||||
defaultExtraState = aExtraState1;
|
||||
mDefaultState = aState1;
|
||||
mDefaultExtraState = aExtraState1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -809,17 +831,17 @@ nsStateMapEntry::MapToStates(nsIContent *aContent,
|
|||
|
||||
const nsStateMapEntry& entry = nsARIAMap::gWAIStateMap[aStateMapEntryID];
|
||||
|
||||
if (entry.isToken) {
|
||||
if (entry.mIsToken) {
|
||||
// If attribute is considered as defined when it's absent then let's act
|
||||
// attribute value is "false" supposedly.
|
||||
PRBool hasAttr = aContent->HasAttr(kNameSpaceID_None, *entry.attributeName);
|
||||
if (entry.definedIfAbsent && !hasAttr) {
|
||||
if (entry.permanentState)
|
||||
*aState |= entry.permanentState;
|
||||
if (entry.state1)
|
||||
*aState |= entry.state1;
|
||||
if (aExtraState && entry.extraState1)
|
||||
*aExtraState |= entry.extraState1;
|
||||
PRBool hasAttr = aContent->HasAttr(kNameSpaceID_None, *entry.mAttributeName);
|
||||
if (entry.mDefinedIfAbsent && !hasAttr) {
|
||||
if (entry.mPermanentState)
|
||||
*aState |= entry.mPermanentState;
|
||||
if (entry.mState1)
|
||||
*aState |= entry.mState1;
|
||||
if (aExtraState && entry.mExtraState1)
|
||||
*aExtraState |= entry.mExtraState1;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -832,66 +854,66 @@ nsStateMapEntry::MapToStates(nsIContent *aContent,
|
|||
// attribute, for example: aria-label="" or aria-label="undefined", we will
|
||||
// bail out and not explore a state mapping, which is safe.
|
||||
if (!hasAttr ||
|
||||
aContent->AttrValueIs(kNameSpaceID_None, *entry.attributeName,
|
||||
aContent->AttrValueIs(kNameSpaceID_None, *entry.mAttributeName,
|
||||
nsAccessibilityAtoms::_empty, eCaseMatters) ||
|
||||
aContent->AttrValueIs(kNameSpaceID_None, *entry.attributeName,
|
||||
aContent->AttrValueIs(kNameSpaceID_None, *entry.mAttributeName,
|
||||
nsAccessibilityAtoms::_undefined, eCaseMatters)) {
|
||||
|
||||
if (entry.permanentState)
|
||||
*aState &= ~entry.permanentState;
|
||||
if (entry.mPermanentState)
|
||||
*aState &= ~entry.mPermanentState;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (entry.permanentState)
|
||||
*aState |= entry.permanentState;
|
||||
if (entry.mPermanentState)
|
||||
*aState |= entry.mPermanentState;
|
||||
}
|
||||
|
||||
nsAutoString attrValue;
|
||||
if (!aContent->GetAttr(kNameSpaceID_None, *entry.attributeName, attrValue))
|
||||
if (!aContent->GetAttr(kNameSpaceID_None, *entry.mAttributeName, attrValue))
|
||||
return PR_TRUE;
|
||||
|
||||
// Apply states for matched value. If no values was matched then apply default
|
||||
// states.
|
||||
PRBool applyDefaultStates = PR_TRUE;
|
||||
if (entry.value1) {
|
||||
if (attrValue.EqualsASCII(entry.value1)) {
|
||||
if (entry.mValue1) {
|
||||
if (attrValue.EqualsASCII(entry.mValue1)) {
|
||||
applyDefaultStates = PR_FALSE;
|
||||
|
||||
if (entry.state1)
|
||||
*aState |= entry.state1;
|
||||
if (entry.mState1)
|
||||
*aState |= entry.mState1;
|
||||
|
||||
if (aExtraState && entry.extraState1)
|
||||
*aExtraState |= entry.extraState1;
|
||||
if (aExtraState && entry.mExtraState1)
|
||||
*aExtraState |= entry.mExtraState1;
|
||||
|
||||
} else if (entry.value2) {
|
||||
if (attrValue.EqualsASCII(entry.value2)) {
|
||||
} else if (entry.mValue2) {
|
||||
if (attrValue.EqualsASCII(entry.mValue2)) {
|
||||
applyDefaultStates = PR_FALSE;
|
||||
|
||||
if (entry.state2)
|
||||
*aState |= entry.state2;
|
||||
if (entry.mState2)
|
||||
*aState |= entry.mState2;
|
||||
|
||||
if (aExtraState && entry.extraState2)
|
||||
*aExtraState |= entry.extraState2;
|
||||
if (aExtraState && entry.mExtraState2)
|
||||
*aExtraState |= entry.mExtraState2;
|
||||
|
||||
} else if (entry.value3) {
|
||||
if (attrValue.EqualsASCII(entry.value3)) {
|
||||
} else if (entry.mValue3) {
|
||||
if (attrValue.EqualsASCII(entry.mValue3)) {
|
||||
applyDefaultStates = PR_FALSE;
|
||||
|
||||
if (entry.state3)
|
||||
*aState |= entry.state3;
|
||||
if (entry.mState3)
|
||||
*aState |= entry.mState3;
|
||||
|
||||
if (aExtraState && entry.extraState3)
|
||||
*aExtraState |= entry.extraState3;
|
||||
if (aExtraState && entry.mExtraState3)
|
||||
*aExtraState |= entry.mExtraState3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (applyDefaultStates) {
|
||||
if (entry.defaultState)
|
||||
*aState |= entry.defaultState;
|
||||
if (entry.defaultExtraState && aExtraState)
|
||||
*aExtraState |= entry.defaultExtraState;
|
||||
if (entry.mDefaultState)
|
||||
*aState |= entry.mDefaultState;
|
||||
if (entry.mDefaultExtraState && aExtraState)
|
||||
*aExtraState |= entry.mDefaultExtraState;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
/**
|
||||
* Used to create stub.
|
||||
*/
|
||||
nsStateMapEntry() {}
|
||||
nsStateMapEntry();
|
||||
|
||||
/**
|
||||
* Used for ARIA attributes having boolean or mixed values.
|
||||
|
@ -240,33 +240,33 @@ public:
|
|||
|
||||
private:
|
||||
// ARIA attribute name
|
||||
nsIAtom** attributeName;
|
||||
nsIAtom** mAttributeName;
|
||||
|
||||
// Indicates if attribute is token (can be undefined)
|
||||
PRBool isToken;
|
||||
PRBool mIsToken;
|
||||
|
||||
// State applied always if attribute is defined
|
||||
PRUint32 permanentState;
|
||||
PRUint32 mPermanentState;
|
||||
|
||||
// States applied if attribute value is matched to the stored value
|
||||
const char* value1;
|
||||
PRUint32 state1;
|
||||
PRUint32 extraState1;
|
||||
const char* mValue1;
|
||||
PRUint32 mState1;
|
||||
PRUint32 mExtraState1;
|
||||
|
||||
const char* value2;
|
||||
PRUint32 state2;
|
||||
PRUint32 extraState2;
|
||||
const char* mValue2;
|
||||
PRUint32 mState2;
|
||||
PRUint32 mExtraState2;
|
||||
|
||||
const char* value3;
|
||||
PRUint32 state3;
|
||||
PRUint32 extraState3;
|
||||
const char* mValue3;
|
||||
PRUint32 mState3;
|
||||
PRUint32 mExtraState3;
|
||||
|
||||
// States applied if no stored values above are matched
|
||||
PRUint32 defaultState;
|
||||
PRUint32 defaultExtraState;
|
||||
PRUint32 mDefaultState;
|
||||
PRUint32 mDefaultExtraState;
|
||||
|
||||
// Permanent and false states are applied if attribute is absent
|
||||
PRBool definedIfAbsent;
|
||||
PRBool mDefinedIfAbsent;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -37,12 +37,10 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessNode.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
|
@ -63,7 +61,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent. nsISupports
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_2(nsAccEvent, mAccessible, mDocAccessible)
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsAccEvent, mAccessible)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleEvent)
|
||||
|
@ -138,15 +136,8 @@ nsAccEvent::GetDOMNode(nsIDOMNode **aDOMNode)
|
|||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
*aDOMNode = nsnull;
|
||||
|
||||
if (!mNode) {
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(mAccessible));
|
||||
NS_ENSURE_TRUE(accessNode, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
accessNode->GetDOMNode(getter_AddRefs(DOMNode));
|
||||
|
||||
mNode = do_QueryInterface(DOMNode);
|
||||
}
|
||||
if (!mNode)
|
||||
mNode = GetNode();
|
||||
|
||||
if (mNode)
|
||||
CallQueryInterface(mNode, aDOMNode);
|
||||
|
@ -158,21 +149,39 @@ NS_IMETHODIMP
|
|||
nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument **aDocAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocAccessible);
|
||||
*aDocAccessible = nsnull;
|
||||
|
||||
if (!mDocAccessible) {
|
||||
if (!mAccessible) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
GetAccessible(getter_AddRefs(accessible));
|
||||
}
|
||||
NS_IF_ADDREF(*aDocAccessible = GetDocAccessible());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent: public methods
|
||||
|
||||
nsINode*
|
||||
nsAccEvent::GetNode()
|
||||
{
|
||||
if (!mNode) {
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(mAccessible));
|
||||
NS_ENSURE_TRUE(accessNode, NS_ERROR_FAILURE);
|
||||
accessNode->GetAccessibleDocument(getter_AddRefs(mDocAccessible));
|
||||
if (!accessNode)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
accessNode->GetDOMNode(getter_AddRefs(DOMNode));
|
||||
|
||||
mNode = do_QueryInterface(DOMNode);
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aDocAccessible = mDocAccessible);
|
||||
return NS_OK;
|
||||
return mNode;
|
||||
}
|
||||
|
||||
nsDocAccessible*
|
||||
nsAccEvent::GetDocAccessible()
|
||||
{
|
||||
nsINode *node = GetNode();
|
||||
if (node)
|
||||
return nsAccessNode::GetDocAccessibleFor(node->GetOwnerDoc());
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -233,10 +242,10 @@ nsAccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
|||
// XXX: remove this hack during reorganization of 506907. Meanwhile we
|
||||
// want to get rid an assertion for application accessible events which
|
||||
// don't have DOM node (see bug 506206).
|
||||
nsRefPtr<nsApplicationAccessibleWrap> applicationAcc =
|
||||
nsApplicationAccessible *applicationAcc =
|
||||
nsAccessNode::GetApplicationAccessible();
|
||||
|
||||
if (mAccessible != static_cast<nsIAccessible*>(applicationAcc.get()))
|
||||
if (mAccessible != static_cast<nsIAccessible*>(applicationAcc))
|
||||
NS_ASSERTION(targetNode, "There should always be a DOM node for an event");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -41,18 +41,17 @@
|
|||
#ifndef _nsAccEvent_H_
|
||||
#define _nsAccEvent_H_
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
class nsIPresShell;
|
||||
#include "nsINode.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
class nsDocAccessible;
|
||||
|
||||
// Constants used to point whether the event is from user input.
|
||||
enum EIsFromUserInput
|
||||
|
@ -83,13 +82,20 @@ public:
|
|||
// eAllowDupes : More than one event of the same type is allowed.
|
||||
// This event will always be emitted.
|
||||
eAllowDupes,
|
||||
|
||||
// eCoalesceFromSameSubtree : For events of the same type from the same
|
||||
// subtree or the same node, only the umbrella event on the ancestor
|
||||
// will be emitted.
|
||||
eCoalesceFromSameSubtree,
|
||||
|
||||
// eCoalesceFromSameDocument : For events of the same type from the same
|
||||
// document, only the newest event will be emitted.
|
||||
eCoalesceFromSameDocument,
|
||||
|
||||
// eRemoveDupes : For repeat events, only the newest event in queue
|
||||
// will be emitted.
|
||||
eRemoveDupes,
|
||||
|
||||
// eDoNotEmit : This event is confirmed as a duplicate, do not emit it.
|
||||
eDoNotEmit
|
||||
};
|
||||
|
@ -120,6 +126,9 @@ public:
|
|||
PRBool IsFromUserInput() const { return mIsFromUserInput; }
|
||||
nsIAccessible* GetAccessible() const { return mAccessible; }
|
||||
|
||||
nsINode* GetNode();
|
||||
nsDocAccessible* GetDocAccessible();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Get an accessible from event target node.
|
||||
|
@ -139,7 +148,6 @@ protected:
|
|||
PRPackedBool mIsAsync;
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
nsCOMPtr<nsINode> mNode;
|
||||
nsCOMPtr<nsIAccessibleDocument> mDocAccessible;
|
||||
|
||||
friend class nsAccEventQueue;
|
||||
};
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsIAccessibleStates.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsHyperTextAccessible.h"
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsDocAccessible.h"
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessNode.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsHashtable.h"
|
||||
|
@ -78,9 +78,10 @@ nsIDOMNode *nsAccessNode::gLastFocusedNode = 0;
|
|||
|
||||
PRBool nsAccessNode::gIsCacheDisabled = PR_FALSE;
|
||||
PRBool nsAccessNode::gIsFormFillEnabled = PR_FALSE;
|
||||
nsAccessNodeHashtable nsAccessNode::gGlobalDocAccessibleCache;
|
||||
nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible>
|
||||
nsAccessNode::gGlobalDocAccessibleCache;
|
||||
|
||||
nsApplicationAccessibleWrap *nsAccessNode::gApplicationAccessible = nsnull;
|
||||
nsApplicationAccessible *nsAccessNode::gApplicationAccessible = nsnull;
|
||||
|
||||
/*
|
||||
* Class nsAccessNode
|
||||
|
@ -220,7 +221,7 @@ NS_IMETHODIMP nsAccessNode::GetOwnerWindow(void **aWindow)
|
|||
return docAccessible->GetWindowHandle(aWindow);
|
||||
}
|
||||
|
||||
already_AddRefed<nsApplicationAccessibleWrap>
|
||||
nsApplicationAccessible*
|
||||
nsAccessNode::GetApplicationAccessible()
|
||||
{
|
||||
NS_ASSERTION(!nsAccessibilityService::gIsShutdown,
|
||||
|
@ -238,13 +239,12 @@ nsAccessNode::GetApplicationAccessible()
|
|||
|
||||
nsresult rv = gApplicationAccessible->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
gApplicationAccessible->Shutdown();
|
||||
NS_RELEASE(gApplicationAccessible);
|
||||
gApplicationAccessible = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ADDREF(gApplicationAccessible); // Addref because we're a getter
|
||||
return gApplicationAccessible;
|
||||
}
|
||||
|
||||
|
@ -297,13 +297,15 @@ void nsAccessNode::ShutdownXPAccessibility()
|
|||
NS_IF_RELEASE(gKeyStringBundle);
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
|
||||
nsApplicationAccessibleWrap::Unload();
|
||||
ClearCache(gGlobalDocAccessibleCache);
|
||||
|
||||
// Release gApplicationAccessible after everything else is shutdown
|
||||
// so we don't accidently create it again while tearing down root accessibles
|
||||
NS_IF_RELEASE(gApplicationAccessible);
|
||||
gApplicationAccessible = nsnull;
|
||||
nsApplicationAccessibleWrap::Unload();
|
||||
if (gApplicationAccessible) {
|
||||
gApplicationAccessible->Shutdown();
|
||||
NS_RELEASE(gApplicationAccessible);
|
||||
}
|
||||
|
||||
NotifyA11yInitOrShutdown(PR_FALSE);
|
||||
}
|
||||
|
@ -346,12 +348,6 @@ nsPresContext* nsAccessNode::GetPresContext()
|
|||
return presShell->GetPresContext();
|
||||
}
|
||||
|
||||
// nsAccessNode protected
|
||||
already_AddRefed<nsIAccessibleDocument> nsAccessNode::GetDocAccessible()
|
||||
{
|
||||
return GetDocAccessibleFor(mWeakShell); // Addref'd
|
||||
}
|
||||
|
||||
already_AddRefed<nsRootAccessible> nsAccessNode::GetRootAccessible()
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
|
@ -432,9 +428,21 @@ nsAccessNode::GetNumChildren(PRInt32 *aNumChildren)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetAccessibleDocument(nsIAccessibleDocument **aDocAccessible)
|
||||
nsAccessNode::GetDocument(nsIAccessibleDocument **aDocument)
|
||||
{
|
||||
*aDocAccessible = GetDocAccessibleFor(mWeakShell).get();
|
||||
NS_ENSURE_ARG_POINTER(aDocument);
|
||||
|
||||
NS_IF_ADDREF(*aDocument = GetDocAccessibleFor(mWeakShell));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetRootDocument(nsIAccessibleDocument **aRootDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootDocument);
|
||||
|
||||
nsRefPtr<nsRootAccessible> rootDocument = GetRootAccessible();
|
||||
NS_IF_ADDREF(*aRootDocument = rootDocument.get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -643,19 +651,14 @@ nsAccessNode::GetComputedStyleCSSValue(const nsAString& aPseudoElt,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode public static
|
||||
|
||||
already_AddRefed<nsIAccessibleDocument>
|
||||
nsDocAccessible*
|
||||
nsAccessNode::GetDocAccessibleFor(nsIDocument *aDocument)
|
||||
{
|
||||
if (!aDocument) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(do_QueryInterface(
|
||||
gGlobalDocAccessibleCache.GetWeak(static_cast<void*>(aDocument))));
|
||||
return docAccessible.forget();
|
||||
return aDocument ?
|
||||
gGlobalDocAccessibleCache.GetWeak(static_cast<void*>(aDocument)) : nsnull;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessibleDocument>
|
||||
|
||||
nsDocAccessible*
|
||||
nsAccessNode::GetDocAccessibleFor(nsIWeakReference *aWeakShell)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(aWeakShell));
|
||||
|
@ -663,7 +666,7 @@ nsAccessNode::GetDocAccessibleFor(nsIWeakReference *aWeakShell)
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
return nsAccessNode::GetDocAccessibleFor(presShell->GetDocument());
|
||||
return GetDocAccessibleFor(presShell->GetDocument());
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessibleDocument>
|
||||
|
@ -675,7 +678,12 @@ nsAccessNode::GetDocAccessibleFor(nsIDocShellTreeItem *aContainer,
|
|||
NS_ASSERTION(docShell, "This method currently only supports docshells");
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
return presShell ? GetDocAccessibleFor(presShell->GetDocument()) : nsnull;
|
||||
if (!presShell)
|
||||
return nsnull;
|
||||
|
||||
nsDocAccessible *docAcc = GetDocAccessibleFor(presShell->GetDocument());
|
||||
NS_IF_ADDREF(docAcc);
|
||||
return docAcc;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node = nsCoreUtils::GetDOMNodeForContainer(aContainer);
|
||||
|
@ -692,7 +700,7 @@ nsAccessNode::GetDocAccessibleFor(nsIDocShellTreeItem *aContainer,
|
|||
return docAccessible;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessibleDocument>
|
||||
nsDocAccessible*
|
||||
nsAccessNode::GetDocAccessibleFor(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> eventShell = nsCoreUtils::GetPresShellFor(aNode);
|
||||
|
@ -778,3 +786,12 @@ nsAccessNode::GetLanguage(nsAString& aLanguage)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode protected
|
||||
|
||||
nsDocAccessible*
|
||||
nsAccessNode::GetDocAccessible() const
|
||||
{
|
||||
return GetDocAccessibleFor(mWeakShell);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class nsIAccessibleDocument;
|
|||
class nsIFrame;
|
||||
class nsIDOMNodeList;
|
||||
class nsRootAccessible;
|
||||
class nsApplicationAccessibleWrap;
|
||||
class nsApplicationAccessible;
|
||||
class nsIDocShellTreeItem;
|
||||
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
|
||||
|
@ -118,18 +118,20 @@ class nsAccessNode: public nsIAccessNode
|
|||
static void InitXPAccessibility();
|
||||
static void ShutdownXPAccessibility();
|
||||
|
||||
/**
|
||||
* Return an application accessible.
|
||||
*/
|
||||
static already_AddRefed<nsApplicationAccessibleWrap> GetApplicationAccessible();
|
||||
/**
|
||||
* Return an application accessible.
|
||||
*/
|
||||
static nsApplicationAccessible* GetApplicationAccessible();
|
||||
|
||||
// Static cache methods for global document cache
|
||||
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsIDocument *aDocument);
|
||||
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsIWeakReference *aWeakShell);
|
||||
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsIDocShellTreeItem *aContainer, PRBool aCanCreate = PR_FALSE);
|
||||
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsIDOMNode *aNode);
|
||||
/**
|
||||
* Return the document accessible for this accesnode.
|
||||
*/
|
||||
nsDocAccessible* GetDocAccessible() const;
|
||||
|
||||
already_AddRefed<nsRootAccessible> GetRootAccessible();
|
||||
/**
|
||||
* Return the root document accessible for this accessnode.
|
||||
*/
|
||||
already_AddRefed<nsRootAccessible> GetRootAccessible();
|
||||
|
||||
static nsIDOMNode *gLastFocusedNode;
|
||||
|
||||
|
@ -173,11 +175,25 @@ class nsAccessNode: public nsIAccessNode
|
|||
PRBool IsInCache();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return cached document accessible.
|
||||
*/
|
||||
static nsDocAccessible* GetDocAccessibleFor(nsIDocument *aDocument);
|
||||
static nsDocAccessible* GetDocAccessibleFor(nsIWeakReference *aWeakShell);
|
||||
static nsDocAccessible* GetDocAccessibleFor(nsIDOMNode *aNode);
|
||||
|
||||
/**
|
||||
* Return document accessible.
|
||||
*/
|
||||
static already_AddRefed<nsIAccessibleDocument>
|
||||
GetDocAccessibleFor(nsIDocShellTreeItem *aContainer,
|
||||
PRBool aCanCreate = PR_FALSE);
|
||||
|
||||
protected:
|
||||
nsresult MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode);
|
||||
|
||||
nsPresContext* GetPresContext();
|
||||
already_AddRefed<nsIAccessibleDocument> GetDocAccessible();
|
||||
|
||||
void LastRelease();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> mDOMNode;
|
||||
|
@ -199,10 +215,11 @@ protected:
|
|||
static PRBool gIsCacheDisabled;
|
||||
static PRBool gIsFormFillEnabled;
|
||||
|
||||
static nsAccessNodeHashtable gGlobalDocAccessibleCache;
|
||||
static nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible>
|
||||
gGlobalDocAccessibleCache;
|
||||
|
||||
private:
|
||||
static nsApplicationAccessibleWrap *gApplicationAccessible;
|
||||
static nsApplicationAccessible *gApplicationAccessible;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessNode,
|
||||
|
|
|
@ -960,6 +960,15 @@ nsAccessibilityService::GetCachedAccessNode(nsIDOMNode *aNode,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibleRetrieval
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::GetApplicationAccessible(nsIAccessible **aAccessibleApplication)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessibleApplication);
|
||||
|
||||
NS_IF_ADDREF(*aAccessibleApplication = nsAccessNode::GetApplicationAccessible());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
|
||||
{
|
||||
|
@ -1625,7 +1634,7 @@ nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
if (!newAcc && content->Tag() != nsAccessibilityAtoms::body && content->GetParent() &&
|
||||
((weakFrame.GetFrame() && weakFrame.GetFrame()->IsFocusable()) ||
|
||||
(isHTML && nsCoreUtils::HasClickListener(content)) ||
|
||||
HasUniversalAriaProperty(content, aWeakShell) || roleMapEntry ||
|
||||
HasUniversalAriaProperty(content) || roleMapEntry ||
|
||||
HasRelatedContent(content) || nsCoreUtils::IsXLink(content))) {
|
||||
// This content is focusable or has an interesting dynamic content accessibility property.
|
||||
// If it's interesting we need it in the accessibility hierarchy so that events or
|
||||
|
@ -1646,26 +1655,26 @@ nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsAccessibilityService::HasUniversalAriaProperty(nsIContent *aContent,
|
||||
nsIWeakReference *aWeakShell)
|
||||
nsAccessibilityService::HasUniversalAriaProperty(nsIContent *aContent)
|
||||
{
|
||||
// ARIA attributes that take token values (NMTOKEN, bool) are special cased.
|
||||
// ARIA attributes that take token values (NMTOKEN, bool) are special cased
|
||||
// because of special value "undefined" (see HasDefinedARIAToken).
|
||||
return nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_atomic) ||
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_busy) ||
|
||||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_controls) ||
|
||||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_describedby) ||
|
||||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_disabled) ||
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_dropeffect) ||
|
||||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_flowto) ||
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_grabbed) ||
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_haspopup) ||
|
||||
// purposely ignore aria-hidden; since we use gecko for detecting this anyways
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_invalid) ||
|
||||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_label) ||
|
||||
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_labelledby) ||
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_live) ||
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_owns) ||
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_relevant) ||
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_required) ||
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_sort);
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsAccessibilityAtoms::aria_relevant);
|
||||
}
|
||||
|
||||
// nsIAccessibleRetrieval
|
||||
|
@ -1990,11 +1999,11 @@ NS_IMETHODIMP nsAccessibilityService::AddNativeRootAccessible(void * aAtkAccessi
|
|||
*aRootAccessible = static_cast<nsIAccessible*>(rootAccWrap);
|
||||
NS_ADDREF(*aRootAccessible);
|
||||
|
||||
nsRefPtr<nsApplicationAccessibleWrap> appRoot =
|
||||
nsApplicationAccessible *applicationAcc =
|
||||
nsAccessNode::GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(appRoot);
|
||||
NS_ENSURE_STATE(applicationAcc);
|
||||
|
||||
appRoot->AddRootAccessible(*aRootAccessible);
|
||||
applicationAcc->AddRootAccessible(*aRootAccessible);
|
||||
|
||||
return NS_OK;
|
||||
#else
|
||||
|
@ -2008,11 +2017,11 @@ NS_IMETHODIMP nsAccessibilityService::RemoveNativeRootAccessible(nsIAccessible *
|
|||
void* atkAccessible;
|
||||
aRootAccessible->GetNativeInterface(&atkAccessible);
|
||||
|
||||
nsRefPtr<nsApplicationAccessibleWrap> appRoot =
|
||||
nsApplicationAccessible *applicationAcc =
|
||||
nsAccessNode::GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(appRoot);
|
||||
NS_ENSURE_STATE(applicationAcc);
|
||||
|
||||
appRoot->RemoveRootAccessible(aRootAccessible);
|
||||
applicationAcc->RemoveRootAccessible(aRootAccessible);
|
||||
|
||||
return NS_OK;
|
||||
#else
|
||||
|
|
|
@ -191,10 +191,9 @@ private:
|
|||
* A universal ARIA property is one that can be defined on any element even if there is no role.
|
||||
*
|
||||
* @param aContent The content node to test
|
||||
* @param aWeakShell A weak reference to the pres shell
|
||||
* @return PR_TRUE if there is a universal ARIA property set on the node
|
||||
*/
|
||||
PRBool HasUniversalAriaProperty(nsIContent *aContent, nsIWeakReference *aWeakShell);
|
||||
PRBool HasUniversalAriaProperty(nsIContent *aContent);
|
||||
|
||||
/**
|
||||
* Process the internal doc load event.
|
||||
|
|
|
@ -38,13 +38,12 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsAccessibleRelation.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessibleHyperText.h"
|
||||
#include "nsIXBLAccessible.h"
|
||||
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsAccessibleRelation.h"
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
@ -882,15 +881,10 @@ nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, PRBool aDeepestChild,
|
|||
// therefore accessible for containing block may be different from accessible
|
||||
// for DOM parent but GetFrameForPoint() should be called for containing block
|
||||
// to get an out of flow element.
|
||||
nsCOMPtr<nsIAccessibleDocument> accDocument;
|
||||
rv = GetAccessibleDocument(getter_AddRefs(accDocument));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsDocAccessible *accDocument = GetDocAccessible();
|
||||
NS_ENSURE_TRUE(accDocument, NS_ERROR_FAILURE);
|
||||
|
||||
nsRefPtr<nsAccessNode> docAccessNode =
|
||||
nsAccUtils::QueryAccessNode(accDocument);
|
||||
|
||||
nsIFrame *frame = docAccessNode->GetFrame();
|
||||
nsIFrame *frame = accDocument->GetFrame();
|
||||
NS_ENSURE_STATE(frame);
|
||||
|
||||
nsPresContext *presContext = frame->PresContext();
|
||||
|
@ -2900,7 +2894,7 @@ nsAccessible::GetParent()
|
|||
if (mParent)
|
||||
return mParent;
|
||||
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
nsDocAccessible *docAccessible = GetDocAccessible();
|
||||
NS_ASSERTION(docAccessible, "No document accessible for valid accessible!");
|
||||
|
||||
if (!docAccessible)
|
||||
|
|
|
@ -55,7 +55,8 @@ nsApplicationAccessible::nsApplicationAccessible() :
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsApplicationAccessible, nsAccessible)
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsApplicationAccessible, nsAccessible,
|
||||
nsIAccessibleApplication)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessible
|
||||
|
@ -124,6 +125,64 @@ nsApplicationAccessible::GetParent(nsIAccessible **aAccessible)
|
|||
return IsDefunct() ? NS_ERROR_FAILURE : NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibleApplication
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetAppName(nsAString& aName)
|
||||
{
|
||||
aName.Truncate();
|
||||
|
||||
if (!mAppInfo)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString cname;
|
||||
nsresult rv = mAppInfo->GetName(cname);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AppendUTF8toUTF16(cname, aName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetAppVersion(nsAString& aVersion)
|
||||
{
|
||||
aVersion.Truncate();
|
||||
|
||||
if (!mAppInfo)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString cversion;
|
||||
nsresult rv = mAppInfo->GetVersion(cversion);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AppendUTF8toUTF16(cversion, aVersion);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetPlatformName(nsAString& aName)
|
||||
{
|
||||
aName.AssignLiteral("Gecko");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetPlatformVersion(nsAString& aVersion)
|
||||
{
|
||||
aVersion.Truncate();
|
||||
|
||||
if (!mAppInfo)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString cversion;
|
||||
nsresult rv = mAppInfo->GetPlatformVersion(cversion);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AppendUTF8toUTF16(cversion, aVersion);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode public methods
|
||||
|
||||
|
@ -136,6 +195,14 @@ nsApplicationAccessible::IsDefunct()
|
|||
nsresult
|
||||
nsApplicationAccessible::Init()
|
||||
{
|
||||
mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsApplicationAccessible::Shutdown()
|
||||
{
|
||||
mAppInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,10 @@
|
|||
#define __NS_APPLICATION_ACCESSIBLE_H__
|
||||
|
||||
#include "nsAccessibleWrap.h"
|
||||
#include "nsIAccessibleApplication.h"
|
||||
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsIXULAppInfo.h"
|
||||
|
||||
/**
|
||||
* nsApplicationAccessible is for the whole application of Mozilla.
|
||||
|
@ -56,7 +59,8 @@
|
|||
* the nsApplicationAccessible instance.
|
||||
*/
|
||||
|
||||
class nsApplicationAccessible: public nsAccessibleWrap
|
||||
class nsApplicationAccessible: public nsAccessibleWrap,
|
||||
public nsIAccessibleApplication
|
||||
{
|
||||
public:
|
||||
nsApplicationAccessible();
|
||||
|
@ -72,9 +76,13 @@ public:
|
|||
|
||||
NS_IMETHOD GetParent(nsIAccessible **aAccessible);
|
||||
|
||||
// nsIAccessibleApplication
|
||||
NS_DECL_NSIACCESSIBLEAPPLICATION
|
||||
|
||||
// nsAccessNode
|
||||
virtual PRBool IsDefunct();
|
||||
virtual nsresult Init();
|
||||
virtual nsresult Shutdown();
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
|
@ -93,6 +101,9 @@ protected:
|
|||
virtual void CacheChildren();
|
||||
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
|
||||
nsresult *aError = nsnull);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIXULAppInfo> mAppInfo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsISelectionPrivate.h"
|
||||
#include "nsISelection2.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIViewManager.h"
|
||||
|
||||
class nsIWidget;
|
||||
|
||||
|
@ -327,33 +326,27 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
|
|||
presShell->GetCaret(getter_AddRefs(caret));
|
||||
NS_ENSURE_TRUE(caret, caretRect);
|
||||
|
||||
PRBool isCollapsed;
|
||||
nsIView *view;
|
||||
nsCOMPtr<nsISelection> caretSelection(do_QueryReferent(mLastUsedSelection));
|
||||
NS_ENSURE_TRUE(caretSelection, caretRect);
|
||||
|
||||
nsRect rect;
|
||||
caret->GetCaretCoordinates(nsCaret::eRenderingViewCoordinates, caretSelection,
|
||||
&rect, &isCollapsed, &view);
|
||||
if (!view || rect.IsEmpty()) {
|
||||
return nsIntRect(); // Return empty rect
|
||||
}
|
||||
|
||||
PRBool isVisible;
|
||||
caret->GetCaretVisible(&isVisible);
|
||||
if (!isVisible) {
|
||||
return nsIntRect(); // Return empty rect
|
||||
}
|
||||
nsPoint offsetFromWidget;
|
||||
*aOutWidget = view->GetNearestWidget(&offsetFromWidget);
|
||||
|
||||
nsRect rect;
|
||||
nsIFrame* frame = caret->GetGeometry(caretSelection, &rect);
|
||||
if (!frame || rect.IsEmpty()) {
|
||||
return nsIntRect(); // Return empty rect
|
||||
}
|
||||
|
||||
nsPoint offset;
|
||||
*aOutWidget = frame->GetWindowOffset(offset);
|
||||
NS_ENSURE_TRUE(*aOutWidget, nsIntRect());
|
||||
rect.MoveBy(offset);
|
||||
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, nsIntRect());
|
||||
|
||||
rect += offsetFromWidget;
|
||||
caretRect = rect.ToOutsidePixels(presContext->AppUnitsPerDevPixel());
|
||||
|
||||
caretRect = rect.ToOutsidePixels(frame->PresContext()->AppUnitsPerDevPixel());
|
||||
caretRect.MoveBy((*aOutWidget)->WidgetToScreenOffset());
|
||||
|
||||
// Correct for character size, so that caret always matches the size of the character
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsICommandManager.h"
|
||||
|
@ -1336,6 +1335,11 @@ void nsDocAccessible::ContentStatesChanged(nsIDocument* aDocument,
|
|||
nsHTMLSelectOptionAccessible::SelectionChangedIfOption(aContent2);
|
||||
}
|
||||
|
||||
void nsDocAccessible::DocumentStatesChanged(nsIDocument* aDocument,
|
||||
PRInt32 aStateMask)
|
||||
{
|
||||
}
|
||||
|
||||
void nsDocAccessible::CharacterDataWillChange(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
CharacterDataChangeInfo* aInfo)
|
||||
|
|
|
@ -329,6 +329,18 @@ nsAccEventQueue::CoalesceEvents()
|
|||
}
|
||||
} break; // case eCoalesceFromSameSubtree
|
||||
|
||||
case nsAccEvent::eCoalesceFromSameDocument:
|
||||
{
|
||||
for (PRInt32 index = 0; index < tail; index ++) {
|
||||
nsAccEvent* thisEvent = mEvents[index];
|
||||
if (thisEvent->mEventType == tailEvent->mEventType &&
|
||||
thisEvent->mEventRule == tailEvent->mEventRule &&
|
||||
thisEvent->GetDocAccessible() == tailEvent->GetDocAccessible()) {
|
||||
thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
}
|
||||
}
|
||||
} break; // case eCoalesceFromSameDocument
|
||||
|
||||
case nsAccEvent::eRemoveDupes:
|
||||
{
|
||||
// Check for repeat events.
|
||||
|
|
|
@ -39,9 +39,13 @@
|
|||
#ifndef _nsEventShell_H_
|
||||
#define _nsEventShell_H_
|
||||
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsAccEvent.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
class nsIPersistentProperties;
|
||||
|
||||
/**
|
||||
* Used for everything about events.
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
|
||||
#include "nsHTMLSelectAccessible.h"
|
||||
|
@ -518,26 +517,10 @@ nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
|||
|
||||
gLastFocusedFrameType = (focusFrame && focusFrame->GetStyleVisibility()->IsVisible()) ? focusFrame->GetType() : 0;
|
||||
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible = do_QueryInterface(finalFocusAccessible);
|
||||
if (docAccessible) {
|
||||
// Doc is gaining focus, but actual focus may be on an element within document
|
||||
nsCOMPtr<nsIDOMNode> realFocusedNode = GetCurrentFocus();
|
||||
if ((realFocusedNode != aNode || realFocusedNode == mDOMNode) &&
|
||||
!(nsAccUtils::ExtendedState(finalFocusAccessible) &
|
||||
nsIAccessibleStates::EXT_STATE_EDITABLE)) {
|
||||
// Suppress document focus, because real DOM focus will be fired next,
|
||||
// except in the case of editable documents because we can't rely on a
|
||||
// followup focus event for an element in an editable document.
|
||||
// Make sure we never fire focus for the nsRootAccessible (mDOMNode)
|
||||
|
||||
// XXX todo dig deeper on editor focus inconsistency in bug 526313
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Coalesce focus events from the same document, because DOM focus event might
|
||||
// be fired for the document node and then for the focused DOM element.
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_FOCUS,
|
||||
finalFocusNode, nsAccEvent::eRemoveDupes,
|
||||
finalFocusNode, nsAccEvent::eCoalesceFromSameDocument,
|
||||
aIsAsynch, aIsFromUserInput);
|
||||
|
||||
return PR_TRUE;
|
||||
|
@ -567,7 +550,21 @@ nsRootAccessible::FireCurrentFocusEvent()
|
|||
nsCOMPtr<nsIDOMNode> targetNode;
|
||||
accService->GetRelevantContentNodeFor(focusedNode,
|
||||
getter_AddRefs(targetNode));
|
||||
|
||||
if (targetNode) {
|
||||
// If the focused element is document element or HTML body element
|
||||
// then simulate the focus event for the document.
|
||||
nsCOMPtr<nsIContent> targetContent(do_QueryInterface(targetNode));
|
||||
if (targetContent) {
|
||||
nsCOMPtr<nsIDOMNode> document =
|
||||
do_QueryInterface(targetContent->GetOwnerDoc());
|
||||
if (targetContent == nsCoreUtils::GetRoleContent(document)) {
|
||||
HandleEventWithTarget(event, document);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise simulate the focus event for currently focused node.
|
||||
HandleEventWithTarget(event, targetNode);
|
||||
}
|
||||
}
|
||||
|
@ -943,10 +940,10 @@ void nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsIDOMNode **aTargetNo
|
|||
nsresult
|
||||
nsRootAccessible::Init()
|
||||
{
|
||||
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(root);
|
||||
nsApplicationAccessible *applicationAcc = GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(applicationAcc);
|
||||
|
||||
root->AddRootAccessible(this);
|
||||
applicationAcc->AddRootAccessible(this);
|
||||
|
||||
return nsDocAccessibleWrap::Init();
|
||||
}
|
||||
|
@ -959,10 +956,10 @@ nsRootAccessible::Shutdown()
|
|||
return NS_OK; // Already shutdown
|
||||
}
|
||||
|
||||
nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(root);
|
||||
nsApplicationAccessible *applicationAcc = GetApplicationAccessible();
|
||||
NS_ENSURE_STATE(applicationAcc);
|
||||
|
||||
root->RemoveRootAccessible(this);
|
||||
applicationAcc->RemoveRootAccessible(this);
|
||||
|
||||
mCurrentARIAMenubar = nsnull;
|
||||
|
||||
|
|
|
@ -38,7 +38,9 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentRange.h"
|
||||
|
@ -1374,7 +1376,7 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
|||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIAccessible> docAccessible = do_QueryInterface(nsCOMPtr<nsIAccessibleDocument>(GetDocAccessible()));
|
||||
nsDocAccessible *docAccessible = GetDocAccessible();
|
||||
if (docAccessible) {
|
||||
PRUint32 state, extState;
|
||||
docAccessible->GetState(&state, &extState);
|
||||
|
|
|
@ -38,8 +38,9 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
#include "nsIFrame.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -86,8 +87,7 @@ nsHTMLTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
nsresult rv = nsTextAccessible::GetStateInternal(aState, aExtraState);
|
||||
NS_ENSURE_A11Y_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAccessible> docAccessible =
|
||||
do_QueryInterface(nsCOMPtr<nsIAccessibleDocument>(GetDocAccessible()));
|
||||
nsDocAccessible *docAccessible = GetDocAccessible();
|
||||
if (docAccessible) {
|
||||
PRUint32 state, extState;
|
||||
docAccessible->GetState(&state, &extState);
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "nsIAccessibleText.h"
|
||||
#include "nsIAccessibleHyperText.h"
|
||||
#include "nsIAccessibleEditableText.h"
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsTextAttrs.h"
|
||||
|
||||
#include "nsFrameSelection.h"
|
||||
|
|
|
@ -36,9 +36,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessibleWrap.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessibleText.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsObjCExceptions.h"
|
||||
|
||||
#import "nsRoleMap.h"
|
||||
|
@ -92,8 +90,10 @@ void
|
|||
nsAccessibleWrap::GetNativeWindow (void **aOutNativeWindow)
|
||||
{
|
||||
*aOutNativeWindow = nsnull;
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
docAccessible->GetWindowHandle (aOutNativeWindow);
|
||||
|
||||
nsDocAccessible *docAcc = GetDocAccessible();
|
||||
if (docAcc)
|
||||
docAcc->GetWindowHandle (aOutNativeWindow);
|
||||
}
|
||||
|
||||
// overridden in subclasses to create the right kind of object. by default we create a generic
|
||||
|
|
|
@ -145,9 +145,11 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
|
|||
|
||||
// Can get to IAccessibleApplication from any node via QS
|
||||
if (iid == IID_IAccessibleApplication) {
|
||||
nsRefPtr<nsApplicationAccessibleWrap> app =
|
||||
GetApplicationAccessible();
|
||||
nsresult rv = app->QueryNativeInterface(iid, ppv);
|
||||
nsApplicationAccessible *applicationAcc = GetApplicationAccessible();
|
||||
if (!applicationAcc)
|
||||
return E_NOINTERFACE;
|
||||
|
||||
nsresult rv = applicationAcc->QueryNativeInterface(iid, ppv);
|
||||
return NS_SUCCEEDED(rv) ? S_OK : E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1782,8 +1782,7 @@ nsAccessibleWrap::GetHWNDFor(nsIAccessible *aAccessible)
|
|||
|
||||
if (!hWnd) {
|
||||
void* handle = nsnull;
|
||||
nsCOMPtr<nsIAccessibleDocument> accessibleDoc;
|
||||
accessNode->GetAccessibleDocument(getter_AddRefs(accessibleDoc));
|
||||
nsDocAccessible *accessibleDoc = accessNode->GetDocAccessible();
|
||||
if (!accessibleDoc)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -44,12 +44,12 @@
|
|||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
nsIXULAppInfo* nsApplicationAccessibleWrap::sAppInfo = nsnull;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsApplicationAccessibleWrap,
|
||||
nsApplicationAccessible)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
|
@ -66,6 +66,7 @@ nsApplicationAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
|
|||
return nsAccessibleWrap::QueryInterface(iid, ppv);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IAccessibleApplication
|
||||
|
||||
STDMETHODIMP
|
||||
|
@ -74,18 +75,14 @@ nsApplicationAccessibleWrap::get_appName(BSTR *aName)
|
|||
__try {
|
||||
*aName = NULL;
|
||||
|
||||
if (!sAppInfo)
|
||||
return E_FAIL;
|
||||
|
||||
nsCAutoString cname;
|
||||
nsresult rv = sAppInfo->GetName(cname);
|
||||
nsAutoString name;
|
||||
nsresult rv = GetAppName(name);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
if (cname.IsEmpty())
|
||||
if (name.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
NS_ConvertUTF8toUTF16 name(cname);
|
||||
*aName = ::SysAllocStringLen(name.get(), name.Length());
|
||||
return *aName ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
|
@ -99,18 +96,14 @@ nsApplicationAccessibleWrap::get_appVersion(BSTR *aVersion)
|
|||
__try {
|
||||
*aVersion = NULL;
|
||||
|
||||
if (!sAppInfo)
|
||||
return E_FAIL;
|
||||
|
||||
nsCAutoString cversion;
|
||||
nsresult rv = sAppInfo->GetVersion(cversion);
|
||||
nsAutoString version;
|
||||
nsresult rv = GetAppVersion(version);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
if (cversion.IsEmpty())
|
||||
if (version.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
NS_ConvertUTF8toUTF16 version(cversion);
|
||||
*aVersion = ::SysAllocStringLen(version.get(), version.Length());
|
||||
return *aVersion ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
|
@ -122,7 +115,15 @@ STDMETHODIMP
|
|||
nsApplicationAccessibleWrap::get_toolkitName(BSTR *aName)
|
||||
{
|
||||
__try {
|
||||
*aName = ::SysAllocString(L"Gecko");
|
||||
nsAutoString name;
|
||||
nsresult rv = GetPlatformName(name);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
if (name.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
*aName = ::SysAllocStringLen(name.get(), name.Length());
|
||||
return *aName ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
@ -135,18 +136,14 @@ nsApplicationAccessibleWrap::get_toolkitVersion(BSTR *aVersion)
|
|||
__try {
|
||||
*aVersion = NULL;
|
||||
|
||||
if (!sAppInfo)
|
||||
return E_FAIL;
|
||||
|
||||
nsCAutoString cversion;
|
||||
nsresult rv = sAppInfo->GetPlatformVersion(cversion);
|
||||
nsAutoString version;
|
||||
nsresult rv = GetPlatformVersion(version);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
if (cversion.IsEmpty())
|
||||
if (version.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
NS_ConvertUTF8toUTF16 version(cversion);
|
||||
*aVersion = ::SysAllocStringLen(version.get(), version.Length());
|
||||
return *aVersion ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
|
@ -154,18 +151,16 @@ __try {
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
// nsApplicationAccessibleWrap
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsApplicationAccessibleWrap public static
|
||||
|
||||
void
|
||||
nsApplicationAccessibleWrap::PreCreate()
|
||||
{
|
||||
nsresult rv = CallGetService("@mozilla.org/xre/app-info;1", &sAppInfo);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "No XUL application info service");
|
||||
}
|
||||
|
||||
void
|
||||
nsApplicationAccessibleWrap::Unload()
|
||||
{
|
||||
NS_IF_RELEASE(sAppInfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
|
||||
#include "AccessibleApplication.h"
|
||||
|
||||
#include "nsIXULAppInfo.h"
|
||||
|
||||
class nsApplicationAccessibleWrap: public nsApplicationAccessible,
|
||||
public IAccessibleApplication
|
||||
{
|
||||
|
@ -73,9 +71,6 @@ public:
|
|||
public:
|
||||
static void PreCreate();
|
||||
static void Unload();
|
||||
|
||||
private:
|
||||
static nsIXULAppInfo* sAppInfo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -283,20 +283,17 @@ struct nsSearchAccessibleInCacheArg
|
|||
};
|
||||
|
||||
static PLDHashOperator
|
||||
SearchAccessibleInCache(const void* aKey, nsAccessNode* aAccessNode,
|
||||
SearchAccessibleInCache(const void* aKey, nsDocAccessible* aDocAccessible,
|
||||
void* aUserArg)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibleDocument> accessibleDoc(do_QueryInterface(aAccessNode));
|
||||
NS_ASSERTION(accessibleDoc,
|
||||
NS_ASSERTION(aDocAccessible,
|
||||
"No doc accessible for the object in doc accessible cache!");
|
||||
|
||||
nsRefPtr<nsDocAccessible> docAccessible =
|
||||
nsAccUtils::QueryObject<nsDocAccessible>(accessibleDoc);
|
||||
if (docAccessible) {
|
||||
if (aDocAccessible) {
|
||||
nsSearchAccessibleInCacheArg* arg =
|
||||
static_cast<nsSearchAccessibleInCacheArg*>(aUserArg);
|
||||
nsAccessNode* accessNode =
|
||||
docAccessible->GetCachedAccessNode(arg->mUniqueID);
|
||||
aDocAccessible->GetCachedAccessNode(arg->mUniqueID);
|
||||
if (accessNode) {
|
||||
arg->mAccessNode = accessNode;
|
||||
return PL_DHASH_STOP;
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLWin32ObjectAccessible.h"
|
||||
#include "nsAccessibleWrap.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLWin32ObjectOwnerAccessible
|
||||
|
|
|
@ -39,7 +39,9 @@
|
|||
// NOTE: alphabetically ordered
|
||||
#include "nsTextAccessibleWrap.h"
|
||||
#include "ISimpleDOMText_i.c"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
#include "nsIFontMetrics.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsPresContext.h"
|
||||
|
@ -120,11 +122,11 @@ __try {
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(docAccessible));
|
||||
NS_ASSERTION(accessible, "There must always be a doc accessible, but there isn't");
|
||||
nsDocAccessible *docAccessible = GetDocAccessible();
|
||||
NS_ASSERTION(docAccessible,
|
||||
"There must always be a doc accessible, but there isn't. Crash!");
|
||||
|
||||
accessible->GetBounds(&docX, &docY, &docWidth, &docHeight);
|
||||
docAccessible->GetBounds(&docX, &docY, &docWidth, &docHeight);
|
||||
|
||||
nsIntRect unclippedRect(x, y, width, height);
|
||||
nsIntRect docRect(docX, docY, docWidth, docHeight);
|
||||
|
|
|
@ -315,7 +315,8 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsXFormsSelectableAccessible,
|
|||
|
||||
nsXFormsSelectableAccessible::
|
||||
nsXFormsSelectableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsXFormsEditableAccessible(aNode, aShell)
|
||||
nsXFormsEditableAccessible(aNode, aShell),
|
||||
mIsSelect1Element(nsnull)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!content)
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
// NOTE: alphabetically ordered
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIDOMXULDescriptionElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
|
|
@ -1214,13 +1214,14 @@ nsXULTreeItemAccessible::Shutdown()
|
|||
nsresult
|
||||
nsXULTreeItemAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
nsCOMPtr<nsITreeColumn> column =
|
||||
nsCoreUtils::GetFirstSensibleColumn(mTree);
|
||||
nsCOMPtr<nsITreeColumns> columns;
|
||||
mTree->GetColumns(getter_AddRefs(columns));
|
||||
NS_ENSURE_STATE(columns);
|
||||
|
||||
PRBool isPrimary = PR_FALSE;
|
||||
column->GetPrimary(&isPrimary);
|
||||
nsCOMPtr<nsITreeColumn> primaryColumn;
|
||||
columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
|
||||
|
||||
*aRole = isPrimary ?
|
||||
*aRole = primaryColumn ?
|
||||
nsIAccessibleRole::ROLE_OUTLINEITEM :
|
||||
nsIAccessibleRole::ROLE_LISTITEM;
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ _TEST_FILES =\
|
|||
test_editabletext_2.html \
|
||||
test_elm_listbox.xul \
|
||||
$(warning test_elm_media.html temporarily disabled) \
|
||||
test_elm_nsApplicationAcc.html \
|
||||
test_elm_plugin.html \
|
||||
test_invalidate_accessnode.html \
|
||||
test_name.html \
|
||||
|
@ -91,7 +92,6 @@ _TEST_FILES =\
|
|||
test_name_button.html \
|
||||
test_name_link.html \
|
||||
test_name_markup.html \
|
||||
test_name_nsApplicationAcc.html \
|
||||
test_name_nsRootAcc.xul \
|
||||
$(warning test_nsIAccessible_comboboxes.xul temporarily disabled) \
|
||||
test_nsIAccessible_selects.html \
|
||||
|
|
|
@ -22,6 +22,7 @@ const nsIAccessibleCoordinateType =
|
|||
Components.interfaces.nsIAccessibleCoordinateType;
|
||||
|
||||
const nsIAccessibleDocument = Components.interfaces.nsIAccessibleDocument;
|
||||
const nsIAccessibleApplication = Components.interfaces.nsIAccessibleApplication;
|
||||
|
||||
const nsIAccessibleText = Components.interfaces.nsIAccessibleText;
|
||||
const nsIAccessibleEditableText = Components.interfaces.nsIAccessibleEditableText;
|
||||
|
@ -261,15 +262,7 @@ function isAccessible(aAccOrElmOrID, aInterfaces)
|
|||
function getRootAccessible(aAccOrElmOrID)
|
||||
{
|
||||
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document);
|
||||
while (acc) {
|
||||
var parent = acc.parent;
|
||||
if (parent && !parent.parent)
|
||||
return acc;
|
||||
|
||||
acc = parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
return acc ? acc.rootDocument.QueryInterface(nsIAccessible) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -277,28 +270,8 @@ function getRootAccessible(aAccOrElmOrID)
|
|||
*/
|
||||
function getApplicationAccessible()
|
||||
{
|
||||
var acc = getAccessible(document), parent = null;
|
||||
while (acc) {
|
||||
|
||||
try {
|
||||
parent = acc.parent;
|
||||
} catch (e) {
|
||||
ok(false, "Can't get a parent for " + prettyName(acc));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!parent) {
|
||||
if (acc.role == ROLE_APP_ROOT)
|
||||
return acc;
|
||||
|
||||
ok(false, "No application accessible!");
|
||||
return null;
|
||||
}
|
||||
|
||||
acc = parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
return gAccRetrieval.getApplicationAccessible().
|
||||
QueryInterface(nsIAccessibleApplication);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -599,7 +599,8 @@ function synthClick(aNodeOrID, aChecker, aEventType)
|
|||
this.invoke = function synthClick_invoke()
|
||||
{
|
||||
// Scroll the node into view, otherwise synth click may fail.
|
||||
this.DOMNode.scrollIntoView(true);
|
||||
if (this.DOMNode instanceof nsIDOMNSHTMLElement)
|
||||
this.DOMNode.scrollIntoView(true);
|
||||
|
||||
synthesizeMouse(this.DOMNode, 1, 1, {});
|
||||
}
|
||||
|
@ -610,6 +611,25 @@ function synthClick(aNodeOrID, aChecker, aEventType)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mouse move invoker.
|
||||
*/
|
||||
function synthMouseMove(aNodeOrID, aChecker, aEventType)
|
||||
{
|
||||
this.__proto__ = new synthAction(aNodeOrID, aChecker, aEventType);
|
||||
|
||||
this.invoke = function synthMouseMove_invoke()
|
||||
{
|
||||
synthesizeMouse(this.DOMNode, 1, 1, { type: "mousemove" });
|
||||
synthesizeMouse(this.DOMNode, 2, 2, { type: "mousemove" });
|
||||
}
|
||||
|
||||
this.getID = function synthMouseMove_getID()
|
||||
{
|
||||
return prettyName(aNodeOrID) + " mouse move";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* General key press invoker.
|
||||
*/
|
||||
|
@ -719,6 +739,25 @@ function synthFocus(aNodeOrID, aChecker, aEventType)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Focus invoker. Focus the HTML body of content document of iframe.
|
||||
*/
|
||||
function synthFocusOnFrame(aNodeOrID, aChecker, aEventType)
|
||||
{
|
||||
this.__proto__ = new synthAction(getNode(aNodeOrID).contentDocument,
|
||||
aChecker, aEventType);
|
||||
|
||||
this.invoke = function synthFocus_invoke()
|
||||
{
|
||||
this.DOMNode.body.focus();
|
||||
}
|
||||
|
||||
this.getID = function synthFocus_getID()
|
||||
{
|
||||
return prettyName(aNodeOrID) + " frame document focus";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select all invoker.
|
||||
*/
|
||||
|
|
|
@ -35,18 +35,26 @@
|
|||
}
|
||||
}
|
||||
|
||||
function focusDocument(aFrameID)
|
||||
function focusElmWhileSubdocIsFocused(aID)
|
||||
{
|
||||
this.DOMNode = getNode(aFrameID).contentDocument;
|
||||
this.DOMNode = getNode(aID);
|
||||
|
||||
this.invoke = function focusDocument_invoke()
|
||||
this.invoke = function focusElmWhileSubdocIsFocused_invoke()
|
||||
{
|
||||
this.DOMNode.body.focus();
|
||||
this.DOMNode.focus();
|
||||
}
|
||||
|
||||
this.getID = function focusDocument_getID()
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_FOCUS, this.DOMNode)
|
||||
];
|
||||
|
||||
this.unexpectedEventSeq = [
|
||||
new invokerChecker(EVENT_FOCUS, this.DOMNode.ownerDocument)
|
||||
];
|
||||
|
||||
this.getID = function focusElmWhileSubdocIsFocused_getID()
|
||||
{
|
||||
return "Focus document of " + prettyName(aFrameID);
|
||||
return "Focus element while subdocument is focused " + prettyName(aID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +68,7 @@
|
|||
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_FOCUS);
|
||||
gQueue = new eventQueue(EVENT_FOCUS);
|
||||
|
||||
gQueue.push(new synthFocus("editablearea"));
|
||||
gQueue.push(new synthFocus("textbox"));
|
||||
|
@ -69,9 +77,11 @@
|
|||
gQueue.push(new openCloseDialog("button"));
|
||||
|
||||
var frameNode = getNode("editabledoc");
|
||||
gQueue.push(new focusDocument(frameNode));
|
||||
gQueue.push(new synthFocusOnFrame(frameNode));
|
||||
gQueue.push(new openCloseDialog(frameNode.contentDocument));
|
||||
|
||||
gQueue.push(new focusElmWhileSubdocIsFocused("button"));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -87,6 +97,11 @@
|
|||
title="focus is not fired for focused document when switching between windows">
|
||||
Mozilla Bug 551679
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=352220"
|
||||
title=" Inconsistent focus events when returning to a document frame">
|
||||
Mozilla Bug 352220
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
src="chrome://mochikit/content/MochiKit/packed.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js" />
|
||||
|
@ -18,23 +20,29 @@
|
|||
|
||||
<script type="application/javascript">
|
||||
/**
|
||||
* Focus invoker.
|
||||
* Click menu item invoker.
|
||||
*/
|
||||
function synthFocus(aNodeOrID)
|
||||
function clickMenuItem(aNodeOrID, aFocusNodeOrID)
|
||||
{
|
||||
this.DOMNode = getNode(aNodeOrID);
|
||||
this.DOMNode = getNode(aFocusNodeOrID);
|
||||
|
||||
this.invoke = function synthFocus_invoke()
|
||||
this.invoke = function clickMenuItem_invoke()
|
||||
{
|
||||
this.DOMNode.focus();
|
||||
synthesizeMouse(getNode(aNodeOrID), 1, 1, {});
|
||||
}
|
||||
|
||||
this.getID = function synthFocus_getID() { return aNodeOrID + " focus"; }
|
||||
this.getID = function clickMenuItem_getID()
|
||||
{
|
||||
return prettyName(aNodeOrID) + " click menu item";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do tests.
|
||||
*/
|
||||
|
||||
// gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
|
||||
var gQueue = null;
|
||||
|
||||
function doTests()
|
||||
|
@ -44,6 +52,11 @@
|
|||
|
||||
gQueue.push(new synthFocus("textbox"));
|
||||
gQueue.push(new synthFocus("scale"));
|
||||
gQueue.push(new synthFocusOnFrame("editabledoc"));
|
||||
gQueue.push(new synthClick("menu"));
|
||||
gQueue.push(new synthMouseMove("menuitem"));
|
||||
gQueue.push(new clickMenuItem("menuitem",
|
||||
getNode("editabledoc").contentDocument));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
@ -59,6 +72,11 @@
|
|||
title="xul:slider accessible of xul:scale is accessible illegally">
|
||||
Mozilla Bug 492518
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=552368"
|
||||
title=" fire focus event on document accessible whenever the root or body element is focused">
|
||||
Mozilla Bug 552368
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
|
@ -68,6 +86,16 @@
|
|||
<vbox flex="1">
|
||||
<textbox id="textbox" value="hello"/>
|
||||
<scale id="scale" min="0" max="9" value="5"/>
|
||||
<menubar>
|
||||
<menu id="menu" label="menu">
|
||||
<menupopup>
|
||||
<menuitem id="menuitem" label="menuitem"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menubar>
|
||||
<iframe id="editabledoc" src="focus.html"/>
|
||||
|
||||
<vbox id="eventdump"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</window>
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var XULBrowserWindow = {
|
||||
isBusy: false,
|
||||
setOverLink: function (link, b) {
|
||||
|
@ -101,7 +103,16 @@
|
|||
</menu>
|
||||
</menubar>
|
||||
|
||||
<tabbrowser type="content-primary" flex="1" id="tabBrowser"/>
|
||||
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
|
||||
tabbrowser="tabBrowser"
|
||||
flex="1"
|
||||
setfocus="false">
|
||||
<tab class="tabbrowser-tab" selected="true"/>
|
||||
</tabs>
|
||||
<tabbrowser id="tabBrowser"
|
||||
type="content-primary"
|
||||
tabcontainer="tabbrowser-tabs"
|
||||
flex="1"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
}
|
||||
|
||||
// Hack to make xul:tabbrowser work.
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
var XULBrowserWindow = {
|
||||
isBusy: false,
|
||||
setOverLink: function (link, b) {
|
||||
|
@ -109,6 +110,15 @@
|
|||
</menu>
|
||||
</menubar>
|
||||
|
||||
<tabbrowser type="content-primary" flex="1" id="content"/>
|
||||
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
|
||||
tabbrowser="content"
|
||||
flex="1"
|
||||
setfocus="false">
|
||||
<tab class="tabbrowser-tab" selected="true"/>
|
||||
</tabs>
|
||||
<tabbrowser id="content"
|
||||
type="content-primary"
|
||||
tabcontainer="tabbrowser-tabs"
|
||||
flex="1"/>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// nsIAccessible::name
|
||||
var bundleServ = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundle = bundleServ.createBundle("chrome://branding/locale/brand.properties");
|
||||
|
@ -39,6 +40,16 @@
|
|||
|
||||
is (accessible.name, applicationName, "wrong application accessible name");
|
||||
|
||||
// nsIAccessibleApplication
|
||||
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
|
||||
getService(Components.interfaces.nsIXULAppInfo);
|
||||
|
||||
is(accessible.appName, appInfo.name, "Wrong application name");
|
||||
is(accessible.appVersion, appInfo.version, "Wrong application version");
|
||||
is(accessible.platformName, "Gecko", "Wrong platform name");
|
||||
is(accessible.platformVersion, appInfo.platformVersion,
|
||||
"Wrong platform version");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.waitForExplicitFinish();
|
|
@ -102,7 +102,7 @@
|
|||
do {
|
||||
docAcc = parentDocAcc;
|
||||
parentOfDocAcc = getAccessible(docAcc.parent, [nsIAccessNode]);
|
||||
parentDocAcc = getAccessible(parentOfDocAcc.accessibleDocument,
|
||||
parentDocAcc = getAccessible(parentOfDocAcc.document,
|
||||
[nsIAccessible]);
|
||||
} while (getRole(parentDocAcc) != ROLE_CHROME_WINDOW)
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
do {
|
||||
docAcc = parentDocAcc;
|
||||
parentOfDocAcc = getAccessible(docAcc.parent, [nsIAccessNode]);
|
||||
parentDocAcc = getAccessible(parentOfDocAcc.accessibleDocument,
|
||||
parentDocAcc = getAccessible(parentOfDocAcc.document,
|
||||
[nsIAccessible]);
|
||||
} while (getRole(parentDocAcc) != ROLE_CHROME_WINDOW)
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES =\
|
||||
test_aria_globals.html \
|
||||
test_button.xul \
|
||||
test_colorpicker.xul \
|
||||
test_combobox.xul \
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test Global ARIA States and Accessible Creation</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
var accTree = {
|
||||
role: ROLE_GROUPING,
|
||||
children: [
|
||||
{ role: ROLE_TEXT_CONTAINER }, // pawn
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-atomic
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-busy
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-controls
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-describedby
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-disabled
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-dropeffect
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-flowto
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-grabbed
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-haspopup
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-invalid
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-label
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-labelledby
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-live
|
||||
{ role: ROLE_TEXT_CONTAINER }, // aria-owns
|
||||
{ role: ROLE_TEXT_CONTAINER } // aria-relevant
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("global_aria_states_and_props", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
title="Update universal ARIA attribute support to latest spec"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=551978">
|
||||
Mozilla Bug 551978
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<!-- Test that global aria states and properties are enough to cause the
|
||||
creation of accessible objects -->
|
||||
<div id="global_aria_states_and_props" role="group">
|
||||
<span id="pawn"></span>
|
||||
<span id="atomic" aria-atomic="true"></span>
|
||||
<span id="busy" aria-busy="false"></span>
|
||||
<span id="controls" aria-controls="pawn"></span>
|
||||
<span id="describedby" aria-describedby="pawn"></span>
|
||||
<span id="disabled" aria-disabled="true"></span>
|
||||
<span id="dropeffect" aria-dropeffect="move"></span>
|
||||
<span id="flowto" aria-flowto="pawn"></span>
|
||||
<span id="grabbed" aria-grabbed="false"></span>
|
||||
<span id="haspopup" aria-haspopup="false"></span>
|
||||
<!-- we use gecko to detect hidden-ness so we currently ignore aria-hidden
|
||||
we might want to special case for aria-hidden="false", but we would need
|
||||
a good case for it. aria-hidden is only in spec as an author aid to DOM
|
||||
based AT -->
|
||||
<span id="invalid" aria-invalid="false"></span>
|
||||
<span id="label" aria-label="hi"></span>
|
||||
<span id="labelledby" aria-labelledby="label"></span>
|
||||
<span id="live" aria-live="polite"></span>
|
||||
<span id="owns" aria-owns="pawn"></span>
|
||||
<span id="relevant" aria-relevant="additions"></span>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -26,6 +26,7 @@
|
|||
const Ci = Components.interfaces;
|
||||
|
||||
// Hack to make xul:tabbrowser work.
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
var XULBrowserWindow = {
|
||||
isBusy: false,
|
||||
setOverLink: function (link, b) {
|
||||
|
@ -37,14 +38,6 @@
|
|||
|
||||
function doTest()
|
||||
{
|
||||
if (LINUX) {
|
||||
// XXX: bug 540529
|
||||
|
||||
todo(false, "Failure on Linux.");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var tabBrowser = document.getElementById("tabbrowser");
|
||||
|
||||
var progressListener =
|
||||
|
@ -67,42 +60,39 @@
|
|||
|
||||
function testAccTree()
|
||||
{
|
||||
var accTree = {
|
||||
role: ROLE_PANE,
|
||||
var tabsAccTree = {
|
||||
role: ROLE_PAGETABLIST,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_TOOLTIP
|
||||
},
|
||||
{
|
||||
role: ROLE_MENUPOPUP
|
||||
},
|
||||
{
|
||||
role: ROLE_PAGETABLIST,
|
||||
role: ROLE_PAGETAB,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_PAGETAB,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_PUSHBUTTON
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
role: ROLE_PAGETAB,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_PUSHBUTTON
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
role: ROLE_PUSHBUTTON
|
||||
},
|
||||
{
|
||||
role: ROLE_PUSHBUTTON
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
role: ROLE_PAGETAB,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_PUSHBUTTON
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
role: ROLE_PUSHBUTTON
|
||||
},
|
||||
{
|
||||
role: ROLE_PUSHBUTTON
|
||||
}
|
||||
]
|
||||
};
|
||||
var tabboxAccTree = {
|
||||
role: ROLE_PANE,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_PROPERTYPAGE
|
||||
},
|
||||
|
@ -111,7 +101,8 @@
|
|||
}
|
||||
]
|
||||
};
|
||||
testAccessibleTree(getNode("tabbrowser").mTabBox, accTree);
|
||||
testAccessibleTree(getNode("tabbrowser").tabContainer, tabsAccTree);
|
||||
testAccessibleTree(getNode("tabbrowser").mTabBox, tabboxAccTree);
|
||||
|
||||
SimpleTest.finish()
|
||||
}
|
||||
|
@ -121,7 +112,7 @@
|
|||
]]>
|
||||
</script>
|
||||
|
||||
<hbox flex="1" style="overflow: auto;">
|
||||
<vbox flex="1" style="overflow: auto;">
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=540389"
|
||||
|
@ -145,8 +136,16 @@
|
|||
</menu>
|
||||
</menubar>
|
||||
|
||||
<tabbrowser type="content-primary" flex="1" id="tabbrowser"/>
|
||||
</hbox>
|
||||
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
|
||||
tabbrowser="tabbrowser"
|
||||
setfocus="false">
|
||||
<tab class="tabbrowser-tab" selected="true"/>
|
||||
</tabs>
|
||||
<tabbrowser id="tabbrowser"
|
||||
type="content-primary"
|
||||
tabcontainer="tabbrowser-tabs"
|
||||
flex="1"/>
|
||||
</vbox>
|
||||
|
||||
</window>
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ if [ "$WINCE" ]; then
|
|||
"
|
||||
fi
|
||||
|
||||
if [ "$MOZ_MEMORY" ]; then
|
||||
if [ "$MOZ_MEMORY" -a "$LIBXUL_SDK" = "" ]; then
|
||||
add_makefiles "
|
||||
memory/jemalloc/Makefile
|
||||
"
|
||||
|
|
|
@ -312,6 +312,8 @@ ifdef MOZ_DEBUG
|
|||
APP_NAME := $(APP_NAME)Debug
|
||||
endif
|
||||
|
||||
LOWER_APP_NAME = $(shell echo $(APP_NAME) | tr '[A-Z]' '[a-z]')
|
||||
|
||||
AB_CD = $(MOZ_UI_LOCALE)
|
||||
|
||||
AB := $(firstword $(subst -, ,$(AB_CD)))
|
||||
|
@ -330,8 +332,8 @@ libs repackage:: $(PROGRAM) application.ini
|
|||
rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj
|
||||
mkdir -p $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
|
||||
rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
|
||||
sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
|
||||
sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj/InfoPlist.strings
|
||||
sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" -e "s/%LOWER_APP_NAME%/$(LOWER_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
|
||||
sed -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj/InfoPlist.strings
|
||||
rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
|
||||
$(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
|
||||
ifdef LIBXUL_SDK
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<key>CFBundleIconFile</key>
|
||||
<string>firefox</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.mozilla.firefox</string>
|
||||
<string>org.mozilla.%LOWER_APP_NAME%</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
|
|
@ -240,6 +240,7 @@ pref("browser.urlbar.delay", 50);
|
|||
pref("browser.urlbar.restrict.history", "^");
|
||||
pref("browser.urlbar.restrict.bookmark", "*");
|
||||
pref("browser.urlbar.restrict.tag", "+");
|
||||
pref("browser.urlbar.restrict.openpage", "%");
|
||||
pref("browser.urlbar.restrict.typed", "~");
|
||||
pref("browser.urlbar.match.title", "#");
|
||||
pref("browser.urlbar.match.url", "@");
|
||||
|
@ -247,7 +248,8 @@ pref("browser.urlbar.match.url", "@");
|
|||
// The default behavior for the urlbar can be configured to use any combination
|
||||
// of the restrict or match filters with each additional filter restricting
|
||||
// more (intersection). Add the following values to set the behavior as the
|
||||
// default: 1: history, 2: bookmark, 4: tag, 8: title, 16: url, 32: typed
|
||||
// default: 1: history, 2: bookmark, 4: tag, 8: title, 16: url, 32: typed,
|
||||
// 64: javascript, 128: tabs
|
||||
// E.g., 0 = show all results (no filtering), 1 = only visited pages in history,
|
||||
// 2 = only bookmarks, 3 = visited bookmarks, 1+16 = history matching in the url
|
||||
pref("browser.urlbar.default.behavior", 0);
|
||||
|
@ -906,7 +908,11 @@ pref("toolbar.customization.usesheet", true);
|
|||
pref("toolbar.customization.usesheet", false);
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
pref("dom.ipc.plugins.enabled", false);
|
||||
#else
|
||||
pref("dom.ipc.plugins.enabled", true);
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifndef WINCE
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#brandName {
|
||||
font-weight: bold; font-size: larger;
|
||||
}
|
||||
}
|
||||
|
||||
#userAgent {
|
||||
direction: ltr;
|
||||
|
|
|
@ -274,7 +274,21 @@ var FullZoom = {
|
|||
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
|
||||
if (!aURI || (aIsTabSwitch && !this.siteSpecific))
|
||||
return;
|
||||
this._applyPrefToSetting(this._cps.getPref(aURI, this.name), aBrowser);
|
||||
|
||||
// Avoid the cps roundtrip and apply the default/global pref.
|
||||
if (aURI.spec == "about:blank") {
|
||||
this._applyPrefToSetting(undefined, aBrowser);
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this._cps.getPref(aURI, this.name, function(aResult) {
|
||||
// Check that we're still where we expect to be in case this took a while.
|
||||
let isSaneURI = (aBrowser && aBrowser.currentURI) ?
|
||||
aURI.equals(aBrowser.currentURI) : false;
|
||||
if (!aBrowser || isSaneURI)
|
||||
self._applyPrefToSetting(aResult, aBrowser);
|
||||
});
|
||||
},
|
||||
|
||||
// update state of zoom type menu item
|
||||
|
@ -331,7 +345,7 @@ var FullZoom = {
|
|||
gInPrintPreviewMode)
|
||||
return;
|
||||
|
||||
var browser = aBrowser || gBrowser.selectedBrowser;
|
||||
var browser = aBrowser || (gBrowser && gBrowser.selectedBrowser);
|
||||
try {
|
||||
if (browser.contentDocument instanceof Ci.nsIImageDocument ||
|
||||
this._inPrivateBrowsing)
|
||||
|
|
|
@ -632,7 +632,7 @@ var HistoryMenu = {
|
|||
iconURL = "moz-anno:favicon:" + iconURL;
|
||||
m.setAttribute("image", iconURL);
|
||||
}
|
||||
m.setAttribute("class", "menuitem-iconic bookmark-item");
|
||||
m.setAttribute("class", "menuitem-iconic bookmark-item menuitem-with-favicon");
|
||||
m.setAttribute("value", i);
|
||||
m.setAttribute("oncommand", "undoCloseTab(" + i + ");");
|
||||
|
||||
|
@ -714,7 +714,7 @@ var HistoryMenu = {
|
|||
iconURL = "moz-anno:favicon:" + iconURL;
|
||||
m.setAttribute("image", iconURL);
|
||||
}
|
||||
m.setAttribute("class", "menuitem-iconic bookmark-item");
|
||||
m.setAttribute("class", "menuitem-iconic bookmark-item menuitem-with-favicon");
|
||||
m.setAttribute("oncommand", "undoCloseWindow(" + i + ");");
|
||||
|
||||
// Set the targetURI attribute so it will be shown in tooltip and statusbar.
|
||||
|
|
|
@ -112,8 +112,8 @@
|
|||
<command id="Browser:ReloadSkipCache" oncommand="BrowserReloadSkipCache()" disabled="true">
|
||||
<observes element="Browser:Reload" attribute="disabled"/>
|
||||
</command>
|
||||
<command id="Browser:NextTab" oncommand="gBrowser.mTabContainer.advanceSelectedTab(1, true);"/>
|
||||
<command id="Browser:PrevTab" oncommand="gBrowser.mTabContainer.advanceSelectedTab(-1, true);"/>
|
||||
<command id="Browser:NextTab" oncommand="gBrowser.tabContainer.advanceSelectedTab(1, true);"/>
|
||||
<command id="Browser:PrevTab" oncommand="gBrowser.tabContainer.advanceSelectedTab(-1, true);"/>
|
||||
<command id="Browser:ShowAllTabs" oncommand="allTabs.open();"/>
|
||||
<command id="cmd_fullZoomReduce" oncommand="FullZoom.reduce()"/>
|
||||
<command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
|
||||
|
|
|
@ -202,7 +202,7 @@ var ctrlTab = {
|
|||
if (this._tabList)
|
||||
return this._tabList;
|
||||
|
||||
var list = Array.slice(gBrowser.mTabs);
|
||||
var list = Array.slice(gBrowser.tabs);
|
||||
|
||||
if (this._closing)
|
||||
this.detachTab(this._closing, list);
|
||||
|
@ -445,9 +445,9 @@ var ctrlTab = {
|
|||
} else if (!event.shiftKey) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (gBrowser.mTabs.length > 2) {
|
||||
if (gBrowser.tabs.length > 2) {
|
||||
this.open();
|
||||
} else if (gBrowser.mTabs.length == 2) {
|
||||
} else if (gBrowser.tabs.length == 2) {
|
||||
gBrowser.selectedTab = gBrowser.selectedTab.nextSibling ||
|
||||
gBrowser.selectedTab.previousSibling;
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ var allTabs = {
|
|||
return;
|
||||
this._initiated = true;
|
||||
|
||||
Array.forEach(gBrowser.mTabs, function (tab) {
|
||||
Array.forEach(gBrowser.tabs, function (tab) {
|
||||
this._addPreview(tab);
|
||||
}, this);
|
||||
|
||||
|
@ -672,15 +672,15 @@ var allTabs = {
|
|||
if (this.isOpen)
|
||||
return;
|
||||
|
||||
this._maxPanelHeight = Math.max(gBrowser.clientHeight, screen.availHeight / 2);
|
||||
this._maxPanelWidth = Math.max(gBrowser.clientWidth, screen.availWidth / 2);
|
||||
|
||||
this.filter();
|
||||
|
||||
tabPreviewPanelHelper.opening(this);
|
||||
|
||||
this.panel.popupBoxObject.setConsumeRollupEvent(Ci.nsIPopupBoxObject.ROLLUP_CONSUME);
|
||||
var estimateHeight = (this._maxHeight + parseInt(this.container.maxHeight) + 50) / 2;
|
||||
this.panel.openPopupAtScreen(screen.availLeft + (screen.availWidth - this._maxWidth) / 2,
|
||||
screen.availTop + (screen.availHeight - estimateHeight) / 2,
|
||||
false);
|
||||
this.panel.popupBoxObject.setConsumeRollupEvent(Ci.nsIPopupBoxObject.ROLLUP_NO_CONSUME);
|
||||
this.panel.openPopup(gBrowser, "overlap", 0, 0, false, true);
|
||||
},
|
||||
|
||||
close: function allTabs_close() {
|
||||
|
@ -694,6 +694,10 @@ var allTabs = {
|
|||
this.panel.addEventListener("keypress", this, false);
|
||||
this.panel.addEventListener("keypress", this, true);
|
||||
this._browserCommandSet.addEventListener("command", this, false);
|
||||
|
||||
// When the panel is open, a second click on the all tabs button should
|
||||
// close the panel but not re-open it.
|
||||
document.getElementById("Browser:ShowAllTabs").setAttribute("disabled", "true");
|
||||
},
|
||||
|
||||
suspendGUI: function allTabs_suspendGUI() {
|
||||
|
@ -706,6 +710,10 @@ var allTabs = {
|
|||
this.panel.removeEventListener("keypress", this, false);
|
||||
this.panel.removeEventListener("keypress", this, true);
|
||||
this._browserCommandSet.removeEventListener("command", this, false);
|
||||
|
||||
setTimeout(function () {
|
||||
document.getElementById("Browser:ShowAllTabs").removeAttribute("disabled");
|
||||
}, 300);
|
||||
},
|
||||
|
||||
handleEvent: function allTabs_handleEvent(event) {
|
||||
|
@ -754,8 +762,6 @@ var allTabs = {
|
|||
|
||||
_visible: 0,
|
||||
_currentFilter: null,
|
||||
get _maxWidth () screen.availWidth * .9,
|
||||
get _maxHeight () screen.availHeight * .75,
|
||||
get _stack () {
|
||||
delete this._stack;
|
||||
return this._stack = document.getElementById("allTabs-stack");
|
||||
|
@ -786,21 +792,22 @@ var allTabs = {
|
|||
_reflow: function allTabs_reflow() {
|
||||
this._updateTabCloseButton();
|
||||
|
||||
const CONTAINER_MAX_WIDTH = this._maxPanelWidth * .95;
|
||||
const CONTAINER_MAX_HEIGHT = this._maxPanelHeight - 35;
|
||||
// the size of the whole preview relative to the thumbnail
|
||||
const REL_PREVIEW_THUMBNAIL = 1.2;
|
||||
const REL_PREVIEW_HEIGHT_WIDTH = tabPreviews.height / tabPreviews.width;
|
||||
const PREVIEW_MAX_WIDTH = tabPreviews.width * REL_PREVIEW_THUMBNAIL;
|
||||
|
||||
var maxHeight = this._maxHeight;
|
||||
var maxWidth = this._maxWidth;
|
||||
var rel = tabPreviews.height / tabPreviews.width;
|
||||
var rows, previewHeight, previewWidth, outerHeight;
|
||||
var previewMaxWidth = tabPreviews.width * REL_PREVIEW_THUMBNAIL;
|
||||
this._columns = Math.floor(maxWidth / previewMaxWidth);
|
||||
this._columns = Math.floor(CONTAINER_MAX_WIDTH / PREVIEW_MAX_WIDTH);
|
||||
do {
|
||||
rows = Math.ceil(this._visible / this._columns);
|
||||
previewWidth = Math.min(previewMaxWidth, Math.round(maxWidth / this._columns));
|
||||
previewHeight = Math.round(previewWidth * rel);
|
||||
previewWidth = Math.min(PREVIEW_MAX_WIDTH,
|
||||
Math.round(CONTAINER_MAX_WIDTH / this._columns));
|
||||
previewHeight = Math.round(previewWidth * REL_PREVIEW_HEIGHT_WIDTH);
|
||||
outerHeight = previewHeight + this._previewLabelHeight;
|
||||
} while (rows * outerHeight > maxHeight && ++this._columns);
|
||||
} while (rows * outerHeight > CONTAINER_MAX_HEIGHT && ++this._columns);
|
||||
|
||||
var outerWidth = previewWidth;
|
||||
{
|
||||
|
@ -834,10 +841,10 @@ var allTabs = {
|
|||
row.appendChild(preview);
|
||||
}, this);
|
||||
|
||||
this._stack.width = maxWidth;
|
||||
this._stack.width = this._maxPanelWidth;
|
||||
this.container.width = Math.ceil(outerWidth * Math.min(this._columns, this._visible));
|
||||
this.container.left = Math.round((maxWidth - this.container.width) / 2);
|
||||
this.container.maxWidth = maxWidth - this.container.left;
|
||||
this.container.left = Math.round((this._maxPanelWidth - this.container.width) / 2);
|
||||
this.container.maxWidth = this._maxPanelWidth - this.container.left;
|
||||
this.container.maxHeight = rows * outerHeight;
|
||||
},
|
||||
|
||||
|
@ -881,19 +888,19 @@ var allTabs = {
|
|||
if (event &&
|
||||
event.target.parentNode.parentNode == this.container &&
|
||||
(event.target._tab.previousSibling || event.target._tab.nextSibling)) {
|
||||
let preview = event.target.getBoundingClientRect();
|
||||
let canvas = event.target.firstChild.getBoundingClientRect();
|
||||
let container = this.container.getBoundingClientRect();
|
||||
let tabCloseButton = this.tabCloseButton.getBoundingClientRect();
|
||||
let alignLeft = getComputedStyle(this.panel, "").direction == "rtl";
|
||||
#ifdef XP_MACOSX
|
||||
alignLeft = !alignLeft;
|
||||
#endif
|
||||
this.tabCloseButton.left = preview.left -
|
||||
this.tabCloseButton.left = canvas.left -
|
||||
container.left +
|
||||
parseInt(this.container.left) +
|
||||
(alignLeft ? 0 :
|
||||
preview.width - tabCloseButton.width);
|
||||
this.tabCloseButton.top = preview.top - container.top;
|
||||
canvas.width - tabCloseButton.width);
|
||||
this.tabCloseButton.top = canvas.top - container.top;
|
||||
this.tabCloseButton._targetPreview = event.target;
|
||||
this.tabCloseButton.style.visibility = "visible";
|
||||
event.target.setAttribute("closebuttonhover", "true");
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
<handler event="drop"><![CDATA[
|
||||
let tab = event.dataTransfer.mozGetDataAt("application/x-moz-node", 0);
|
||||
if (tab && tab.parentNode == gBrowser.tabContainer) {
|
||||
let newIndex = Array.indexOf(gBrowser.tabContainer.childNodes, this._tab);
|
||||
let newIndex = Array.indexOf(gBrowser.tabs, this._tab);
|
||||
gBrowser.moveTabTo(tab, newIndex);
|
||||
}
|
||||
]]></handler>
|
||||
|
|
|
@ -9,6 +9,14 @@ tabbrowser {
|
|||
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser");
|
||||
}
|
||||
|
||||
.tabbrowser-tabs {
|
||||
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-tabs");
|
||||
}
|
||||
|
||||
.tabbrowser-tab {
|
||||
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-tab");
|
||||
}
|
||||
|
||||
toolbar[printpreview="true"] {
|
||||
-moz-binding: url("chrome://global/content/printPreviewBindings.xml#printpreviewtoolbar");
|
||||
}
|
||||
|
@ -43,6 +51,26 @@ toolbar[mode="icons"] > #reload-button[displaystop] {
|
|||
-moz-binding: url(chrome://browser/content/urlbarBindings.xml#urlbar);
|
||||
}
|
||||
|
||||
/* Some child nodes want to be ordered based on the locale's direction, while
|
||||
everything else should be ltr. */
|
||||
#urlbar:-moz-locale-dir(rtl) > .autocomplete-textbox-container > .textbox-input-box {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
#urlbar html|*.autocomplete-textbox {
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
/* For results that are actions, their description text is shown instead of
|
||||
the URL - this needs to follow the locale's direction, unlike URLs. */
|
||||
richlistitem[type="action"]:-moz-locale-dir(rtl) > .ac-url-box {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
#urlbar:not([actiontype]) > #urlbar-display {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#wrapper-urlbar-container > #urlbar-container > #urlbar {
|
||||
-moz-user-input: disabled;
|
||||
cursor: -moz-grab;
|
||||
|
@ -106,14 +134,6 @@ toolbarbutton.bookmark-item {
|
|||
max-width: 13em;
|
||||
}
|
||||
|
||||
%ifdef MOZ_WIDGET_GTK2
|
||||
/* Bookmarks override the "images-in-menus" metric in xul.css */
|
||||
.bookmark-item > .menu-iconic-left,
|
||||
.searchbar-engine-menuitem > .menu-iconic-left {
|
||||
visibility: inherit;
|
||||
}
|
||||
%endif
|
||||
|
||||
#editBMPanel_tagsSelector {
|
||||
/* override default listbox width from xul.css */
|
||||
width: auto;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -276,9 +276,6 @@
|
|||
</panel>
|
||||
|
||||
<panel id="allTabs-panel" hidden="true" norestorefocus="true" ignorekeys="true"
|
||||
# XXX: KUI style disabled, because the transparent background slows down
|
||||
# interacting with the panel, esp. the search field.
|
||||
# class="KUI-panel"
|
||||
onmouseover="allTabs._updateTabCloseButton(event);">
|
||||
<hbox id="allTabs-meta" align="center">
|
||||
<spacer flex="1"/>
|
||||
|
@ -311,6 +308,8 @@
|
|||
style="&dialog.style;"
|
||||
hidden="true"/>
|
||||
</panel>
|
||||
|
||||
<tooltip id="tabbrowser-tab-tooltip" onpopupshowing="gBrowser.createTooltip(event);"/>
|
||||
</popupset>
|
||||
|
||||
<toolbox id="navigator-toolbox" class="toolbox-top" mode="icons"
|
||||
|
@ -405,6 +404,7 @@
|
|||
noneplaceholder="&urlbar.none.emptyText;"
|
||||
type="autocomplete"
|
||||
autocompletesearch="history"
|
||||
autocompletesearchparam="enable-actions"
|
||||
autocompletepopup="PopupAutoCompleteRichResult"
|
||||
completeselectedindex="true"
|
||||
tabscrolling="true"
|
||||
|
@ -443,6 +443,7 @@
|
|||
</hbox>
|
||||
</hbox>
|
||||
</box>
|
||||
<label id="urlbar-display" value="&urlbar.switchToTab.label;"/>
|
||||
<hbox id="urlbar-icons">
|
||||
<button type="menu"
|
||||
style="-moz-user-focus: none"
|
||||
|
@ -516,6 +517,19 @@
|
|||
</toolbaritem>
|
||||
</toolbar>
|
||||
|
||||
<toolbar id="TabsToolbar"
|
||||
fullscreentoolbar="true"
|
||||
ordinal="100"
|
||||
collapsed="true">
|
||||
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
|
||||
tabbrowser="content"
|
||||
flex="1"
|
||||
setfocus="false"
|
||||
tooltip="tabbrowser-tab-tooltip">
|
||||
<tab class="tabbrowser-tab" selected="true"/>
|
||||
</tabs>
|
||||
</toolbar>
|
||||
|
||||
<toolbarpalette id="BrowserToolbarPalette">
|
||||
|
||||
<toolbarbutton id="print-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||
|
@ -603,6 +617,7 @@
|
|||
<vbox id="appcontent" flex="1">
|
||||
<tabbrowser id="content" disablehistory="true"
|
||||
flex="1" contenttooltip="aHTMLTooltip"
|
||||
tabcontainer="tabbrowser-tabs"
|
||||
contentcontextmenu="contentAreaContextMenu"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
ondrop="contentAreaDNDObserver.onDrop(event)"
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" accelerated="11">
|
||||
<head>
|
||||
<style type="text/css"><![CDATA[
|
||||
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
.tabbrowser-tabs {
|
||||
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-tabs");
|
||||
}
|
||||
|
||||
.tabbrowser-tab {
|
||||
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-tab");
|
||||
.tabbrowser-tabbox {
|
||||
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-tabbox");
|
||||
}
|
||||
|
||||
.tabbrowser-arrowscrollbox {
|
||||
|
@ -23,16 +19,13 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.tabbrowser-tabs:not([closebuttons="noclose"]):not([closebuttons="closeatend"]) > .tabbrowser-tab[selected="true"]:not(:only-child) > .tab-close-button {
|
||||
.tabbrowser-tabs:not([closebuttons="noclose"]):not([closebuttons="closeatend"]) > .tabbrowser-tab[selected="true"] > .tab-close-button,
|
||||
.tabbrowser-tabs[closebuttons="alltabs"] > .tabbrowser-tab > .tab-close-button {
|
||||
display: -moz-box;
|
||||
}
|
||||
|
||||
.tabbrowser-tabs[closebuttons="alltabs"] > .tabbrowser-tab:not(:only-child) > .tab-close-button {
|
||||
display: -moz-box;
|
||||
}
|
||||
|
||||
.tabs-container:not([overflow="true"]) > .tabs-newtab-button,
|
||||
.tabs-container[overflow="true"] > .tabbrowser-arrowscrollbox > .tabs-newtab-button {
|
||||
.tabbrowser-tabs:not([overflow="true"]) > .tabs-newtab-button,
|
||||
.tabbrowser-tabs[overflow="true"] > .tabbrowser-arrowscrollbox > .tabs-newtab-button {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -117,6 +117,7 @@ _BROWSER_FILES = \
|
|||
browser_bug520538.js \
|
||||
browser_bug521216.js \
|
||||
browser_bug537474.js \
|
||||
browser_bug555224.js \
|
||||
browser_contextSearchTabPosition.js \
|
||||
browser_ctrlTab.js \
|
||||
browser_discovery.js \
|
||||
|
@ -150,6 +151,7 @@ _BROWSER_FILES = \
|
|||
alltabslistener.html \
|
||||
zoom_test.html \
|
||||
dummy_page.html \
|
||||
browser_tabMatchesInAwesomebar.js \
|
||||
$(NULL)
|
||||
|
||||
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
|
|
@ -32,8 +32,8 @@ function pickOne(array) {
|
|||
return array[rand(0, array.length - 1)];
|
||||
}
|
||||
function pickOneTab() {
|
||||
var tab = pickOne(gBrowser.tabContainer.childNodes);
|
||||
return [tab, Array.indexOf(gBrowser.tabContainer.childNodes, tab)];
|
||||
var tab = pickOne(gBrowser.tabs);
|
||||
return [tab, Array.indexOf(gBrowser.tabs, tab)];
|
||||
}
|
||||
function nextSequence() {
|
||||
while (gBrowser.browsers.length > 1)
|
||||
|
|
|
@ -41,87 +41,43 @@ function thirdPageLoaded() {
|
|||
zoomTest(gTab3, gLevel, "Tab 3 should have zoomed as it was loading in the background");
|
||||
|
||||
// Switching to tab 2 should update its zoom setting.
|
||||
afterZoom(function() {
|
||||
zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed");
|
||||
zoomTest(gTab2, gLevel, "Tab 2 should be zoomed now");
|
||||
zoomTest(gTab3, gLevel, "Tab 3 should still be zoomed");
|
||||
|
||||
load(gTab1, gTestImage, imageLoaded);
|
||||
});
|
||||
|
||||
gBrowser.selectedTab = gTab2;
|
||||
|
||||
zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed");
|
||||
zoomTest(gTab2, gLevel, "Tab 2 should be zoomed now");
|
||||
zoomTest(gTab3, gLevel, "Tab 3 should still be zoomed");
|
||||
|
||||
load(gTab1, gTestImage, imageLoaded);
|
||||
}
|
||||
|
||||
function imageLoaded() {
|
||||
zoomTest(gTab1, 1, "Zoom should be 1 when image was loaded in the background");
|
||||
gBrowser.selectedTab = gTab1;
|
||||
zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
|
||||
afterZoom(function() {
|
||||
zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
|
||||
|
||||
executeSoon(imageZoomSwitch);
|
||||
executeSoon(imageZoomSwitch);
|
||||
});
|
||||
gBrowser.selectedTab = gTab1;
|
||||
}
|
||||
|
||||
function imageZoomSwitch() {
|
||||
navigate(BACK, function () {
|
||||
navigate(FORWARD, function () {
|
||||
zoomTest(gTab1, 1, "Tab 1 should not be zoomed when an image loads");
|
||||
gBrowser.selectedTab = gTab2;
|
||||
zoomTest(gTab1, 1, "Tab 1 should still not be zoomed when deselected");
|
||||
|
||||
// Mac OS X does not support print preview, so skip those tests
|
||||
let isOSX = ("nsILocalFileMac" in Components.interfaces);
|
||||
if (isOSX)
|
||||
afterZoom(function() {
|
||||
zoomTest(gTab1, 1, "Tab 1 should still not be zoomed when deselected");
|
||||
finishTest();
|
||||
else
|
||||
runPrintPreviewTests();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function runPrintPreviewTests() {
|
||||
// test print preview on image document
|
||||
testPrintPreview(gTab1, function() {
|
||||
// test print preview on HTML document
|
||||
testPrintPreview(gTab2, function() {
|
||||
// test print preview on image document with siteSpecific set to false
|
||||
gPrefService.setBoolPref("browser.zoom.siteSpecific", false);
|
||||
testPrintPreview(gTab1, function() {
|
||||
// test print preview of HTML document with siteSpecific set to false
|
||||
testPrintPreview(gTab2, function() {
|
||||
if (gPrefService.prefHasUserValue("browser.zoom.siteSpecific"))
|
||||
gPrefService.clearUserPref("browser.zoom.siteSpecific");
|
||||
finishTest();
|
||||
});
|
||||
});
|
||||
gBrowser.selectedTab = gTab2;
|
||||
|
||||
finishTest();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testPrintPreview(aTab, aCallback) {
|
||||
gBrowser.selectedTab = aTab;
|
||||
FullZoom.enlarge();
|
||||
let level = ZoomManager.zoom;
|
||||
|
||||
let onEnterOrig = PrintPreviewListener.onEnter;
|
||||
PrintPreviewListener.onEnter = function () {
|
||||
PrintPreviewListener.onEnter = onEnterOrig;
|
||||
PrintPreviewListener.onEnter.apply(PrintPreviewListener, arguments);
|
||||
PrintUtils.exitPrintPreview();
|
||||
};
|
||||
|
||||
let onExitOrig = PrintPreviewListener.onExit;
|
||||
PrintPreviewListener.onExit = function () {
|
||||
PrintPreviewListener.onExit = onExitOrig;
|
||||
PrintPreviewListener.onExit.apply(PrintPreviewListener, arguments);
|
||||
|
||||
zoomTest(aTab, level, "Toggling print preview mode should not affect zoom level");
|
||||
|
||||
FullZoom.reset();
|
||||
aCallback();
|
||||
};
|
||||
|
||||
executeSoon(function () {
|
||||
document.getElementById("cmd_printPreview").doCommand();
|
||||
});
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
gBrowser.selectedTab = gTab1;
|
||||
FullZoom.reset();
|
||||
|
@ -138,20 +94,51 @@ function zoomTest(tab, val, msg) {
|
|||
}
|
||||
|
||||
function load(tab, url, cb) {
|
||||
let didLoad = didZoom = false;
|
||||
tab.linkedBrowser.addEventListener("load", function (event) {
|
||||
event.currentTarget.removeEventListener("load", arguments.callee, true);
|
||||
cb();
|
||||
didLoad = true;
|
||||
if (didZoom)
|
||||
executeSoon(cb);
|
||||
}, true);
|
||||
|
||||
afterZoom(function() {
|
||||
didZoom = true;
|
||||
if (didLoad)
|
||||
executeSoon(cb);
|
||||
});
|
||||
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
}
|
||||
|
||||
function navigate(direction, cb) {
|
||||
let didPs = didZoom = false;
|
||||
gBrowser.addEventListener("pageshow", function (event) {
|
||||
gBrowser.removeEventListener("pageshow", arguments.callee, true);
|
||||
executeSoon(cb);
|
||||
didPs = true;
|
||||
if (didZoom)
|
||||
executeSoon(cb);
|
||||
}, true);
|
||||
|
||||
afterZoom(function() {
|
||||
didZoom = true;
|
||||
if (didPs)
|
||||
executeSoon(cb);
|
||||
});
|
||||
|
||||
if (direction == BACK)
|
||||
gBrowser.goBack();
|
||||
else if (direction == FORWARD)
|
||||
gBrowser.goForward();
|
||||
}
|
||||
|
||||
function afterZoom(cb) {
|
||||
let oldAPTS = FullZoom._applyPrefToSetting;
|
||||
FullZoom._applyPrefToSetting = function(value, browser) {
|
||||
if (!value)
|
||||
value = undefined;
|
||||
oldAPTS.call(FullZoom, value, browser);
|
||||
FullZoom._applyPrefToSetting = oldAPTS;
|
||||
executeSoon(cb);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
var tabElm, zoomLevel;
|
||||
function start_test_prefNotSet() {
|
||||
tabElm.linkedBrowser.removeEventListener("load", start_test_prefNotSet, true);
|
||||
tabElm.linkedBrowser.addEventListener("load", continue_test_prefNotSet, true);
|
||||
|
||||
is(ZoomManager.zoom, 1, "initial zoom level should be 1");
|
||||
FullZoom.enlarge();
|
||||
|
||||
|
@ -10,23 +7,21 @@ function start_test_prefNotSet() {
|
|||
zoomLevel = ZoomManager.zoom;
|
||||
isnot(zoomLevel, 1, "zoom level should have changed");
|
||||
|
||||
afterZoomAndLoad(continue_test_prefNotSet);
|
||||
content.location =
|
||||
"http://mochi.test:8888/browser/browser/base/content/test/moz.png";
|
||||
}
|
||||
|
||||
function continue_test_prefNotSet () {
|
||||
tabElm.linkedBrowser.removeEventListener("load", continue_test_prefNotSet, true);
|
||||
tabElm.linkedBrowser.addEventListener("load", end_test_prefNotSet, true);
|
||||
|
||||
is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
|
||||
FullZoom.reset();
|
||||
|
||||
afterZoomAndLoad(end_test_prefNotSet);
|
||||
content.location =
|
||||
"http://mochi.test:8888/browser/browser/base/content/test/zoom_test.html";
|
||||
}
|
||||
|
||||
function end_test_prefNotSet() {
|
||||
tabElm.linkedBrowser.removeEventListener("load", end_test_prefNotSet, true);
|
||||
is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
|
||||
|
||||
// Reset the zoom so that other tests have a fresh zoom level
|
||||
|
@ -41,9 +36,28 @@ function test() {
|
|||
|
||||
tabElm = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tabElm;
|
||||
tabElm.linkedBrowser.addEventListener("load", start_test_prefNotSet, true);
|
||||
|
||||
afterZoomAndLoad(start_test_prefNotSet);
|
||||
content.location =
|
||||
"http://mochi.test:8888/browser/browser/base/content/test/zoom_test.html";
|
||||
|
||||
}
|
||||
|
||||
function afterZoomAndLoad(cb) {
|
||||
let didLoad = didZoom = false;
|
||||
tabElm.linkedBrowser.addEventListener("load", function() {
|
||||
tabElm.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
didLoad = true;
|
||||
if (didZoom)
|
||||
executeSoon(cb);
|
||||
}, true);
|
||||
let oldAPTS = FullZoom._applyPrefToSetting;
|
||||
FullZoom._applyPrefToSetting = function(value, browser) {
|
||||
if (!value)
|
||||
value = undefined;
|
||||
oldAPTS.call(FullZoom, value, browser);
|
||||
FullZoom._applyPrefToSetting = oldAPTS;
|
||||
didZoom = true;
|
||||
if (didLoad)
|
||||
executeSoon(cb);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,24 +12,38 @@ function test() {
|
|||
|
||||
FullZoom.enlarge();
|
||||
let tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser);
|
||||
|
||||
afterZoom(function() {
|
||||
let tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
|
||||
is(tab2Zoom, tab1Zoom, "Zoom should affect background tabs");
|
||||
|
||||
gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", false);
|
||||
FullZoom.reset();
|
||||
gBrowser.selectedTab = tab1;
|
||||
tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser);
|
||||
tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
|
||||
isnot(tab1Zoom, tab2Zoom, "Zoom should not affect background tabs");
|
||||
|
||||
if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
|
||||
gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
|
||||
gBrowser.removeTab(tab1);
|
||||
gBrowser.removeTab(tab2);
|
||||
finish();
|
||||
});
|
||||
gBrowser.selectedTab = tab2;
|
||||
let tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
|
||||
is(tab2Zoom, tab1Zoom, "Zoom should affect background tabs");
|
||||
|
||||
gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", false);
|
||||
FullZoom.reset();
|
||||
gBrowser.selectedTab = tab1;
|
||||
tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser);
|
||||
tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
|
||||
isnot(tab1Zoom, tab2Zoom, "Zoom should not affect background tabs");
|
||||
|
||||
if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
|
||||
gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
|
||||
gBrowser.removeTab(tab1);
|
||||
gBrowser.removeTab(tab2);
|
||||
finish();
|
||||
}), true);
|
||||
tab2.linkedBrowser.loadURI(testPage);
|
||||
}), true);
|
||||
content.location = testPage;
|
||||
}
|
||||
|
||||
function afterZoom(cb) {
|
||||
let oldAPTS = FullZoom._applyPrefToSetting;
|
||||
FullZoom._applyPrefToSetting = function(value, browser) {
|
||||
if (!value)
|
||||
value = undefined;
|
||||
oldAPTS.call(FullZoom, value, browser);
|
||||
FullZoom._applyPrefToSetting = oldAPTS;
|
||||
executeSoon(cb);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
function test() {
|
||||
var tabs = gBrowser.tabContainer.childElementCount;
|
||||
var tabCount = gBrowser.tabs.length;
|
||||
content.focus();
|
||||
browserDOMWindow.openURI(makeURI("about:blank"),
|
||||
null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
|
||||
is(gBrowser.tabContainer.childElementCount, tabs + 1,
|
||||
is(gBrowser.tabs.length, tabCount + 1,
|
||||
"'-new-tab about:blank' opens a new tab");
|
||||
is(gBrowser.selectedTab, gBrowser.tabContainer.childNodes[tabs],
|
||||
is(gBrowser.selectedTab, gBrowser.tabs[tabCount],
|
||||
"'-new-tab about:blank' selects the new tab");
|
||||
is(document.activeElement, gURLBar.inputField,
|
||||
"'-new-tab about:blank' focuses the location bar");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
var expected = ["TabOpen", "onLocationChange", "onStateChange", "onLinkIconAvailable"];
|
||||
var actual = [];
|
||||
var tabIndex = -1;
|
||||
__defineGetter__("tab", function () gBrowser.tabContainer.childNodes[tabIndex]);
|
||||
__defineGetter__("tab", function () gBrowser.tabs[tabIndex]);
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
tabIndex = gBrowser.tabContainer.childElementCount;
|
||||
tabIndex = gBrowser.tabs.length;
|
||||
gBrowser.addTabsProgressListener(progressListener);
|
||||
gBrowser.tabContainer.addEventListener("TabOpen", TabOpen, false);
|
||||
gBrowser.addTab("data:text/html,<html><head><link href='about:logo' rel='shortcut icon'>");
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/* ***** 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 Browser Test Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ryan Flint <rflint@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
const TEST_PAGE = "/browser/browser/base/content/test/dummy_page.html";
|
||||
var gTestTab, gBgTab, gTestZoom;
|
||||
|
||||
function afterZoomAndLoad(aCallback, aTab) {
|
||||
let didLoad = didZoom = false;
|
||||
aTab.linkedBrowser.addEventListener("load", function() {
|
||||
aTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
didLoad = true;
|
||||
if (didZoom)
|
||||
executeSoon(aCallback);
|
||||
}, true);
|
||||
let oldAPTS = FullZoom._applyPrefToSetting;
|
||||
FullZoom._applyPrefToSetting = function(value, browser) {
|
||||
if (!value)
|
||||
value = undefined;
|
||||
oldAPTS.call(FullZoom, value, browser);
|
||||
// Don't reset _applyPrefToSetting until we've seen the about:blank load(s)
|
||||
if (browser && (browser.currentURI.spec.indexOf("http:") != -1)) {
|
||||
FullZoom._applyPrefToSetting = oldAPTS;
|
||||
didZoom = true;
|
||||
}
|
||||
if (didLoad && didZoom)
|
||||
executeSoon(aCallback);
|
||||
};
|
||||
}
|
||||
|
||||
function testBackgroundLoad() {
|
||||
is(ZoomManager.zoom, gTestZoom, "opening a background tab should not change foreground zoom");
|
||||
|
||||
gBrowser.removeTab(gBgTab);
|
||||
|
||||
FullZoom.reset();
|
||||
gBrowser.removeTab(gTestTab);
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
function testInitialZoom() {
|
||||
is(ZoomManager.zoom, 1, "initial zoom level should be 1");
|
||||
FullZoom.enlarge();
|
||||
|
||||
gTestZoom = ZoomManager.zoom;
|
||||
isnot(gTestZoom, 1, "zoom level should have changed");
|
||||
|
||||
afterZoomAndLoad(testBackgroundLoad,
|
||||
gBgTab = gBrowser.loadOneTab("http://mochi.test:8888" + TEST_PAGE,
|
||||
{inBackground: true}));
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gTestTab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = gTestTab;
|
||||
|
||||
afterZoomAndLoad(testInitialZoom, gTestTab);
|
||||
content.location = "http://example.org" + TEST_PAGE;
|
||||
}
|
|
@ -0,0 +1,231 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim:set ts=2 sw=2 sts=2 et:
|
||||
* ***** 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 Places Test Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blair McBride <bmcbride@mozilla.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 ***** */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const TEST_URL_BASES = [
|
||||
"http://example.org/browser/browser/base/content/test/dummy_page.html#tabmatch",
|
||||
"http://example.org/browser/browser/base/content/test/moz.png#tabmatch"
|
||||
];
|
||||
|
||||
var gPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
|
||||
|
||||
var gTabWaitCount = 0;
|
||||
var gTabCounter = 0;
|
||||
|
||||
var gTestSteps = [
|
||||
function() {
|
||||
info("Running step 1");
|
||||
for (let i = 0; i < 10; i++) {
|
||||
let tab = gBrowser.addTab();
|
||||
loadTab(tab, TEST_URL_BASES[0] + (++gTabCounter));
|
||||
}
|
||||
},
|
||||
function() {
|
||||
info("Running step 2");
|
||||
gBrowser.selectTabAtIndex(1);
|
||||
gBrowser.removeCurrentTab();
|
||||
gBrowser.selectTabAtIndex(1);
|
||||
gBrowser.removeCurrentTab();
|
||||
for (let i = 1; i < gBrowser.tabs.length; i++)
|
||||
loadTab(gBrowser.tabs[i], TEST_URL_BASES[1] + (++gTabCounter));
|
||||
},
|
||||
function() {
|
||||
info("Running step 3");
|
||||
for (let i = 1; i < gBrowser.tabs.length; i++)
|
||||
loadTab(gBrowser.tabs[i], TEST_URL_BASES[0] + gTabCounter);
|
||||
},
|
||||
function() {
|
||||
info("Running step 4");
|
||||
let ps = Services.prefs;
|
||||
ps.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
ps.setBoolPref("browser.tabs.warnOnClose", false);
|
||||
|
||||
gPrivateBrowsing.privateBrowsingEnabled = true;
|
||||
|
||||
executeSoon(function() {
|
||||
ensure_opentabs_match_db();
|
||||
nextStep();
|
||||
});
|
||||
},
|
||||
function() {
|
||||
info("Running step 5");
|
||||
gPrivateBrowsing.privateBrowsingEnabled = false;
|
||||
|
||||
executeSoon(function() {
|
||||
let ps = Services.prefs;
|
||||
try {
|
||||
ps.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
} catch (ex) {}
|
||||
try {
|
||||
ps.clearUserPref("browser.tabs.warnOnClose");
|
||||
} catch (ex) {}
|
||||
|
||||
ensure_opentabs_match_db();
|
||||
nextStep()
|
||||
});
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
nextStep();
|
||||
}
|
||||
|
||||
function loadTab(tab, url) {
|
||||
tab.linkedBrowser.addEventListener("load", function (event) {
|
||||
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
if (--gTabWaitCount > 0)
|
||||
return;
|
||||
is(gTabWaitCount, 0,
|
||||
"sanity check, gTabWaitCount should not be decremented below 0");
|
||||
|
||||
try {
|
||||
ensure_opentabs_match_db();
|
||||
} catch (e) {
|
||||
ok(false, "exception from ensure_openpages_match_db: " + e);
|
||||
}
|
||||
|
||||
executeSoon(nextStep);
|
||||
}, true);
|
||||
gTabWaitCount++;
|
||||
tab.linkedBrowser.loadURI(url);
|
||||
}
|
||||
|
||||
function nextStep() {
|
||||
if (gTestSteps.length == 0) {
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.selectTabAtIndex(1);
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
|
||||
waitForClearHistory(finish);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var stepFunc = gTestSteps.shift();
|
||||
stepFunc();
|
||||
}
|
||||
|
||||
function ensure_opentabs_match_db() {
|
||||
var tabs = {};
|
||||
|
||||
var winEnum = Services.wm.getEnumerator("navigator:browser");
|
||||
while (winEnum.hasMoreElements()) {
|
||||
let browserWin = winEnum.getNext();
|
||||
// skip closed-but-not-destroyed windows
|
||||
if (browserWin.closed)
|
||||
continue;
|
||||
|
||||
for (let i = 0; i < browserWin.gBrowser.tabContainer.childElementCount; i++) {
|
||||
let browser = browserWin.gBrowser.getBrowserAtIndex(i);
|
||||
let url = browser.currentURI.spec;
|
||||
if (!(url in tabs))
|
||||
tabs[url] = 1;
|
||||
else
|
||||
tabs[url]++;
|
||||
}
|
||||
}
|
||||
|
||||
var db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
|
||||
.DBConnection;
|
||||
|
||||
try {
|
||||
var stmt = db.createStatement(
|
||||
"SELECT IFNULL(p_t.url, p.url) AS url, open_count, place_id " +
|
||||
"FROM moz_openpages_temp " +
|
||||
"LEFT JOIN moz_places p ON p.id=place_id " +
|
||||
"LEFT JOIN moz_places_temp p_t ON p_t.id=place_id");
|
||||
} catch (e) {
|
||||
ok(false, "error creating db statement: " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
var dbtabs = [];
|
||||
try {
|
||||
while (stmt.executeStep()) {
|
||||
ok(stmt.row.url in tabs,
|
||||
"url is in db, should be in tab: " + stmt.row.url);
|
||||
is(tabs[stmt.row.url], stmt.row.open_count,
|
||||
"db count (" + stmt.row.open_count + ") " +
|
||||
"should match actual open tab count " +
|
||||
"(" + tabs[stmt.row.url] + "): " + stmt.row.url);
|
||||
dbtabs.push(stmt.row.url);
|
||||
}
|
||||
} finally {
|
||||
stmt.finalize();
|
||||
}
|
||||
|
||||
for (let url in tabs) {
|
||||
// ignore URLs that should never be in the places db
|
||||
if (!is_expected_in_db(url))
|
||||
continue;
|
||||
ok(dbtabs.indexOf(url) > -1,
|
||||
"tab is open (" + tabs[url] + " times) and should recorded in db: " + url);
|
||||
}
|
||||
}
|
||||
|
||||
function is_expected_in_db(url) {
|
||||
var uri = Services.io.newURI(url, null, null);
|
||||
return PlacesUtils.history.canAddURI(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history invoking callback when done.
|
||||
*/
|
||||
function waitForClearHistory(aCallback) {
|
||||
const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
|
||||
|
||||
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
||||
}
|
|
@ -3,7 +3,7 @@ function test() {
|
|||
gBrowser.addTab();
|
||||
gBrowser.addTab();
|
||||
|
||||
var tabs = gBrowser.tabContainer.childNodes;
|
||||
var tabs = gBrowser.tabs;
|
||||
var owner;
|
||||
|
||||
is(tabs.length, 4, "4 tabs are open");
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
this.inputField.addEventListener("mousedown", this, false);
|
||||
this.inputField.addEventListener("mousemove", this, false);
|
||||
this.inputField.addEventListener("mouseout", this, false);
|
||||
this.inputField.addEventListener("overflow", this, false);
|
||||
this.inputField.addEventListener("underflow", this, false);
|
||||
this.inputField.addEventListener("overflow", this, false);
|
||||
this.inputField.addEventListener("underflow", this, false);
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
|
@ -72,10 +72,45 @@
|
|||
this.inputField.removeEventListener("mousedown", this, false);
|
||||
this.inputField.removeEventListener("mousemove", this, false);
|
||||
this.inputField.removeEventListener("mouseout", this, false);
|
||||
this.inputField.removeEventListener("overflow", this, false);
|
||||
this.inputField.removeEventListener("underflow", this, false);
|
||||
this.inputField.removeEventListener("overflow", this, false);
|
||||
this.inputField.removeEventListener("underflow", this, false);
|
||||
]]></destructor>
|
||||
|
||||
<field name="_value"></field>
|
||||
|
||||
<!--
|
||||
onBeforeValueGet is called by the base-binding's .value getter.
|
||||
It can return an object with a "value" property, to override the
|
||||
return value of the getter.
|
||||
-->
|
||||
<method name="onBeforeValueGet">
|
||||
<body><![CDATA[
|
||||
if (this.hasAttribute("actiontype"))
|
||||
return {value: this._value};
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
onBeforeValueSet is called by the base-binding's .value setter.
|
||||
It should return the value that the setter should use.
|
||||
-->
|
||||
<method name="onBeforeValueSet">
|
||||
<parameter name="aValue"/>
|
||||
<body><![CDATA[
|
||||
this._value = aValue;
|
||||
var returnValue = aValue;
|
||||
var action = this._parseActionUrl(aValue);
|
||||
if (action) {
|
||||
returnValue = action.param;
|
||||
this.setAttribute("actiontype", action.type);
|
||||
} else {
|
||||
this.removeAttribute("actiontype");
|
||||
}
|
||||
return returnValue;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="handleRevert">
|
||||
<body><![CDATA[
|
||||
var isScrolling = this.popupOpen;
|
||||
|
@ -108,6 +143,13 @@
|
|||
if (!url)
|
||||
return;
|
||||
|
||||
var action = this._parseActionUrl(url);
|
||||
if (action) {
|
||||
if (action.type == "switchtab")
|
||||
switchToTabHavingURI(action.param);
|
||||
return;
|
||||
}
|
||||
|
||||
this.value = url;
|
||||
gBrowser.userTypedValue = url;
|
||||
try {
|
||||
|
@ -216,12 +258,12 @@
|
|||
return [url, postData.value];
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="_contentIsCropped">false</field>
|
||||
|
||||
<field name="_contentIsCropped">false</field>
|
||||
|
||||
<method name="_initURLTooltip">
|
||||
<body><![CDATA[
|
||||
if (this.focused || !this._contentIsCropped)
|
||||
if (this.focused || !this._contentIsCropped)
|
||||
return;
|
||||
if (this._tooltipTimer)
|
||||
clearTimeout(this._tooltipTimer);
|
||||
|
@ -389,13 +431,13 @@
|
|||
case "mouseout":
|
||||
this._hideURLTooltip();
|
||||
break;
|
||||
case "overflow":
|
||||
this._contentIsCropped = true;
|
||||
break;
|
||||
case "underflow":
|
||||
this._contentIsCropped = false;
|
||||
this._hideURLTooltip();
|
||||
break;
|
||||
case "overflow":
|
||||
this._contentIsCropped = true;
|
||||
break;
|
||||
case "underflow":
|
||||
this._contentIsCropped = false;
|
||||
this._hideURLTooltip();
|
||||
break;
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -442,6 +484,18 @@
|
|||
this.placeholder = this.getAttribute(type + "placeholder");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_parseActionUrl">
|
||||
<parameter name="aUrl"/>
|
||||
<body><![CDATA[
|
||||
if (!/^moz-action:/.test(aUrl))
|
||||
return null;
|
||||
|
||||
// url is in the format moz-action:ACTION,PARAM
|
||||
let [, action, param] = aUrl.match(/^moz-action:([^,]+),(.*)$/);
|
||||
return {type: action, param: param};
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
|
@ -613,6 +667,15 @@
|
|||
this.closePopup();
|
||||
controller.handleEscape();
|
||||
|
||||
// Check if this is meant to be an action
|
||||
let action = this.mInput._parseActionUrl(url);
|
||||
if (action) {
|
||||
if (action.type == "switchtab")
|
||||
url = action.param;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
// respect the usual clicking subtleties
|
||||
openUILink(url, aEvent);
|
||||
}
|
||||
|
@ -640,4 +703,5 @@
|
|||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
|
@ -62,7 +62,6 @@ PARALLEL_DIRS = \
|
|||
certerror \
|
||||
dirprovider \
|
||||
feeds \
|
||||
microsummaries \
|
||||
places \
|
||||
preferences \
|
||||
privatebrowsing \
|
||||
|
|
|
@ -43,7 +43,6 @@ endif
|
|||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
../feeds/src/$(LIB_PREFIX)browser_feeds_s.$(LIB_SUFFIX) \
|
||||
../places/src/$(LIB_PREFIX)browserplaces_s.$(LIB_SUFFIX) \
|
||||
../privatebrowsing/src/$(LIB_PREFIX)privatebrowsing_s.$(LIB_SUFFIX) \
|
||||
../about/$(LIB_PREFIX)browserabout_s.$(LIB_SUFFIX) \
|
||||
../dirprovider/$(LIB_PREFIX)browserdir_s.$(LIB_SUFFIX) \
|
||||
|
|
|
@ -91,13 +91,6 @@
|
|||
#define NS_ABOUTFEEDS_CID \
|
||||
{ 0x12ff56ec, 0x58be, 0x402c, { 0xb0, 0x57, 0x1, 0xf9, 0x61, 0xde, 0x96, 0x9b } }
|
||||
|
||||
// 6fb0c970-e1b1-11db-8314-0800200c9a66
|
||||
#define NS_PLACESIMPORTEXPORTSERVICE_CID \
|
||||
{ 0x6fb0c970, 0xe1b1, 0x11db, { 0x83, 0x14, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } }
|
||||
|
||||
#define NS_PLACESIMPORTEXPORTSERVICE_CONTRACTID \
|
||||
"@mozilla.org/browser/places/import-export-service;1"
|
||||
|
||||
// 136e2c4d-c5a4-477c-b131-d93d7d704f64
|
||||
#define NS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID \
|
||||
{ 0x136e2c4d, 0xc5a4, 0x477c, { 0xb1, 0x31, 0xd9, 0x3d, 0x7d, 0x70, 0x4f, 0x64 } }
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
#include "nsBrowserCompsCID.h"
|
||||
#include "DirectoryProvider.h"
|
||||
#include "nsPlacesImportExportService.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#include "nsWindowsShellService.h"
|
||||
|
@ -86,7 +85,6 @@ using namespace mozilla::browser;
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(DirectoryProvider)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlacesImportExportService)
|
||||
#if defined(XP_WIN)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService)
|
||||
#elif defined(XP_MACOSX)
|
||||
|
@ -148,12 +146,6 @@ static const nsModuleComponentInfo components[] =
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
{ "Places Import/Export Service",
|
||||
NS_PLACESIMPORTEXPORTSERVICE_CID,
|
||||
NS_PLACESIMPORTEXPORTSERVICE_CONTRACTID,
|
||||
nsPlacesImportExportServiceConstructor},
|
||||
|
||||
{ "Feed Sniffer",
|
||||
NS_FEEDSNIFFER_CID,
|
||||
NS_FEEDSNIFFER_CONTRACTID,
|
||||
|
|
|
@ -99,15 +99,6 @@ DirectoryProvider::GetFile(const char *aKey, PRBool *aPersist, nsIFile* *aResult
|
|||
file.swap(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
else if (!strcmp(aKey, NS_APP_USER_MICROSUMMARY_DIR)) {
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
|
||||
getter_AddRefs(file));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
file->AppendNative(NS_LITERAL_CSTRING("microsummary-generators"));
|
||||
file.swap(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -54,10 +54,4 @@
|
|||
|
||||
#define NS_APP_EXISTING_PREF_OVERRIDE "ExistingPrefOverride"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Files and directories that exist on a per-profile basis.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define NS_APP_USER_MICROSUMMARY_DIR "UsrMicsumGens"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,25 +34,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function test_usr_micsum() {
|
||||
let mdir = gProfD.clone();
|
||||
mdir.append("microsummary-generators");
|
||||
|
||||
let tmdir = gDirSvc.get("UsrMicsumGens", Ci.nsIFile);
|
||||
do_check_true(tmdir.equals(mdir));
|
||||
|
||||
if (!tmdir.exists())
|
||||
tmdir.create(Ci.nsIFile.DIRECTORY_TYPE, 0777);
|
||||
|
||||
do_check_true(tmdir.isWritable());
|
||||
|
||||
let tfile = writeTestFile(tmdir, "usrmicsum");
|
||||
do_check_true(tfile.exists());
|
||||
|
||||
mdir.append(tfile.leafName);
|
||||
do_check_true(mdir.exists());
|
||||
}
|
||||
|
||||
function test_bookmarkhtml() {
|
||||
let bmarks = gProfD.clone();
|
||||
bmarks.append("bookmarks.html");
|
||||
|
@ -70,8 +51,7 @@ function test_prefoverride() {
|
|||
}
|
||||
|
||||
function run_test() {
|
||||
[test_usr_micsum,
|
||||
test_bookmarkhtml,
|
||||
[test_bookmarkhtml,
|
||||
test_prefoverride
|
||||
].forEach(function(f) {
|
||||
do_test_pending();
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Microsummarizer.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Myk Melez <myk@mozilla.org>
|
||||
#
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -1,49 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Microsummarizer.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Myk Melez <myk@mozilla.org>
|
||||
#
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = microsummaries
|
||||
XPIDL_MODULE = microsummaries
|
||||
|
||||
XPIDLSRCS = nsIMicrosummaryService.idl
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -210,6 +210,13 @@ BrowserGlue.prototype = {
|
|||
// Customization has finished, we don't need the customizer anymore.
|
||||
delete this._distributionCustomizer;
|
||||
break;
|
||||
case "bookmarks-restore-success":
|
||||
case "bookmarks-restore-failed":
|
||||
this._observerService.removeObserver(this, "bookmarks-restore-success");
|
||||
this._observerService.removeObserver(this, "bookmarks-restore-failed");
|
||||
if (topic == "bookmarks-restore-success" && data == "html-initial")
|
||||
this.ensurePlacesDefaultQueriesInitialized();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -677,13 +684,16 @@ BrowserGlue.prototype = {
|
|||
}
|
||||
}
|
||||
|
||||
// If bookmarks are not imported, then initialize smart bookmarks. This
|
||||
// happens during a common startup.
|
||||
// Otherwise, if any kind of import runs, smart bookmarks creation should be
|
||||
// delayed till the import operations has finished. Not doing so would
|
||||
// cause them to be overwritten by the newly imported bookmarks.
|
||||
if (!importBookmarks) {
|
||||
// Call it here for Fx3 profiles created before the Places folder
|
||||
// has been added, otherwise it's called during import.
|
||||
this.ensurePlacesDefaultQueriesInitialized();
|
||||
}
|
||||
else {
|
||||
// ensurePlacesDefaultQueriesInitialized() is called by import.
|
||||
// An import operation is about to run.
|
||||
// Don't try to recreate smart bookmarks if autoExportHTML is true or
|
||||
// smart bookmarks are disabled.
|
||||
var autoExportHTML = false;
|
||||
|
@ -711,7 +721,12 @@ BrowserGlue.prototype = {
|
|||
bookmarksFile = dirService.get("BMarks", Ci.nsILocalFile);
|
||||
|
||||
if (bookmarksFile.exists()) {
|
||||
// import the file
|
||||
// Add an import observer. It will ensure that smart bookmarks are
|
||||
// created once the operation is complete.
|
||||
this._observerService.addObserver(this, "bookmarks-restore-success", false);
|
||||
this._observerService.addObserver(this, "bookmarks-restore-failed", false);
|
||||
|
||||
// Import from bookmarks.html file.
|
||||
try {
|
||||
var importer = Cc["@mozilla.org/browser/places/import-export-service;1"].
|
||||
getService(Ci.nsIPlacesImportExportService);
|
||||
|
@ -719,6 +734,8 @@ BrowserGlue.prototype = {
|
|||
} catch (err) {
|
||||
// Report the error, but ignore it.
|
||||
Cu.reportError("Bookmarks.html file could be corrupt. " + err);
|
||||
this._observerService.removeObserver(this, "bookmarks-restore-success");
|
||||
this._observerService.removeObserver(this, "bookmarks-restore-failed");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -147,7 +147,7 @@ PlacesTreeView.prototype = {
|
|||
* node which isn't supposed to be in the tree (e.g. separators in
|
||||
* sorted trees).
|
||||
* @param [optional] aForceBuild
|
||||
* @see isPlainContainer.
|
||||
* @see _isPlainContainer.
|
||||
* If true, the row will be computed even if the node still isn't set
|
||||
* in our rows array.
|
||||
* @param [optional] aParentRow
|
||||
|
@ -255,8 +255,6 @@ PlacesTreeView.prototype = {
|
|||
return this._rows[aRow] = parent.getChild(aRow - parentRow - 1);
|
||||
},
|
||||
|
||||
_rootNode: null,
|
||||
|
||||
/**
|
||||
* This takes a container and recursively appends our rows array per its
|
||||
* contents. Assumes that the rows arrays has no rows for the given
|
||||
|
@ -284,9 +282,8 @@ PlacesTreeView.prototype = {
|
|||
// iteration.
|
||||
let cc = aContainer.childCount;
|
||||
let newElements = new Array(cc);
|
||||
this._rows =
|
||||
this._rows.slice(0, aFirstChildRow).concat(newElements)
|
||||
.concat(this._rows.slice(aFirstChildRow, this._rows.length));
|
||||
this._rows = this._rows.splice(0, aFirstChildRow)
|
||||
.concat(newElements, this._rows);
|
||||
|
||||
if (this._isPlainContainer(aContainer))
|
||||
return cc;
|
||||
|
@ -295,12 +292,12 @@ PlacesTreeView.prototype = {
|
|||
const trueLiteral = PlacesUIUtils.RDF.GetLiteral("true");
|
||||
let sortingMode = this._result.sortingMode;
|
||||
|
||||
let rowsInsertedCounter = 0;
|
||||
let rowsInserted = 0;
|
||||
for (let i = 0; i < cc; i++) {
|
||||
let curChild = aContainer.getChild(i);
|
||||
let curChildType = curChild.type;
|
||||
|
||||
let row = aFirstChildRow + rowsInsertedCounter;
|
||||
let row = aFirstChildRow + rowsInserted;
|
||||
|
||||
// Don't display separators when sorted.
|
||||
if (curChildType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
|
||||
|
@ -314,7 +311,7 @@ PlacesTreeView.prototype = {
|
|||
}
|
||||
|
||||
this._rows[row] = curChild;
|
||||
rowsInsertedCounter++;
|
||||
rowsInserted++;
|
||||
|
||||
// Recursively do containers.
|
||||
if (!this._flatList &&
|
||||
|
@ -327,12 +324,12 @@ PlacesTreeView.prototype = {
|
|||
if (isopen != curChild.containerOpen)
|
||||
aToOpen.push(curChild);
|
||||
else if (curChild.containerOpen && curChild.childCount > 0)
|
||||
rowsAddedCounter += this._buildVisibleSection(curChild, aToOpen,
|
||||
row + 1);
|
||||
rowsInserted += this._buildVisibleSection(curChild, aToOpen,
|
||||
row + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return rowsInsertedCounter;
|
||||
return rowsInserted;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -343,9 +340,9 @@ PlacesTreeView.prototype = {
|
|||
function PTV__countVisibleRowsForNodeAtRow(aNodeRow) {
|
||||
let node = this._rows[aNodeRow];
|
||||
|
||||
// If it's not listed yet, we know that it's a leaf node.
|
||||
if (node === undefined ||
|
||||
!(node instanceof Ci.nsINavHistoryContainerResultNode))
|
||||
// If it's not listed yet, we know that it's a leaf node (instanceof also
|
||||
// null-checks).
|
||||
if (!(node instanceof Ci.nsINavHistoryContainerResultNode))
|
||||
return 1;
|
||||
|
||||
let outerLevel = node.indentLevel;
|
||||
|
@ -415,12 +412,16 @@ PlacesTreeView.prototype = {
|
|||
let parent = aOldNode.parent;
|
||||
if (parent) {
|
||||
// If the node's parent is still set, the node is not obsolete
|
||||
// and we should just find out its new position. However, if the node's
|
||||
// parent is closed, the node is invisible.
|
||||
if (parent.containerOpen)
|
||||
return this._getRowForNode(aOldNode, true);
|
||||
// and we should just find out its new position.
|
||||
// However, if any of the node's ancestor is closed, the node is
|
||||
// invisible.
|
||||
let ancestors = PlacesUtils.nodeAncestors(aOldNode);
|
||||
for (let ancestor in ancestors) {
|
||||
if (!ancestor.containerOpen)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return this._getRowForNode(aOldNode, true);
|
||||
}
|
||||
|
||||
// There's a broken edge case here.
|
||||
|
@ -472,7 +473,7 @@ PlacesTreeView.prototype = {
|
|||
|
||||
// If only one node was previously selected and there's no selection now,
|
||||
// select the node at its old row, if any.
|
||||
if (aNodesInfo.length == 1 && selection.getRangeCount() == 0) {
|
||||
if (aNodesInfo.length == 1 && selection.count == 0) {
|
||||
let row = Math.min(aNodesInfo[0].oldRow, this._rows.length - 1);
|
||||
selection.rangedSelect(row, row, true);
|
||||
if (aNodesInfo[0].wasVisible && scrollToRow == -1)
|
||||
|
@ -1105,7 +1106,7 @@ PlacesTreeView.prototype = {
|
|||
isContainer: function PTV_isContainer(aRow) {
|
||||
// Only leaf nodes aren't listed in the rows array.
|
||||
let node = this._rows[aRow];
|
||||
if (!node)
|
||||
if (node === undefined)
|
||||
return false;
|
||||
|
||||
if (PlacesUtils.nodeIsContainer(node)) {
|
||||
|
@ -1568,6 +1569,7 @@ function PlacesTreeView(aFlatList, aOnOpenFlatContainer) {
|
|||
this._tree = null;
|
||||
this._result = null;
|
||||
this._selection = null;
|
||||
this._rootNode = null;
|
||||
this._rows = [];
|
||||
this._flatList = aFlatList;
|
||||
this._openContainerCallback = aOnOpenFlatContainer;
|
||||
|
|
|
@ -1021,7 +1021,7 @@ var PlacesUIUtils = {
|
|||
else {
|
||||
if (PlacesUtils.uriTypes.indexOf(type) != -1) {
|
||||
element = document.createElement("menuitem");
|
||||
element.className = "menuitem-iconic bookmark-item";
|
||||
element.className = "menuitem-iconic bookmark-item menuitem-with-favicon";
|
||||
element.setAttribute("scheme", this.guessUrlSchemeForUI(aNode.uri));
|
||||
}
|
||||
else if (PlacesUtils.containerTypes.indexOf(type) != -1) {
|
||||
|
|
|
@ -46,8 +46,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
MODULE = browserplaces
|
||||
XPIDL_MODULE = browserplaces
|
||||
|
||||
XPIDLSRCS = nsIPlacesImportExportService.idl \
|
||||
nsIPlacesTransactionsService.idl \
|
||||
XPIDLSRCS = nsIPlacesTransactionsService.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -44,17 +44,6 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = browserplaces
|
||||
LIBRARY_NAME = browserplaces_s
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
ifndef MOZ_MEMORY
|
||||
USE_STATIC_LIBS = 1
|
||||
endif
|
||||
|
||||
|
||||
CPPSRCS = nsPlacesImportExportService.cpp
|
||||
|
||||
EXTRA_COMPONENTS = \
|
||||
nsPlacesTransactionsService.js \
|
||||
PlacesProtocolHandler.js \
|
||||
|
|
|
@ -41,6 +41,32 @@
|
|||
* database is corrupt and one backup is available.
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "bs",
|
||||
"@mozilla.org/browser/nav-bookmarks-service;1",
|
||||
"nsINavBookmarksService");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "anno",
|
||||
"@mozilla.org/browser/annotation-service;1",
|
||||
"nsIAnnotationService");
|
||||
|
||||
let bookmarksObserver = {
|
||||
onBeginUpdateBatch: function() {},
|
||||
onEndUpdateBatch: function() {
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
|
||||
do_check_neq(itemId, -1);
|
||||
if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
|
||||
continue_test();
|
||||
},
|
||||
onItemAdded: function() {},
|
||||
onBeforeItemRemoved: function(id) {},
|
||||
onItemRemoved: function(id, folder, index, itemType) {},
|
||||
onItemChanged: function() {},
|
||||
onItemVisited: function(id, visitID, time) {},
|
||||
onItemMoved: function() {},
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
|
@ -74,30 +100,15 @@ function run_test() {
|
|||
// nsBrowserGlue uses databaseStatus to manage initialization.
|
||||
do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CORRUPT);
|
||||
|
||||
// Wait for restore to finish.
|
||||
let os = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
os.removeObserver(observer, "bookmarks-restore-success");
|
||||
os.removeObserver(observer, "bookmarks-restore-failed");
|
||||
do_check_eq(aTopic, "bookmarks-restore-success");
|
||||
do_check_eq(aData, "json");
|
||||
continue_test();
|
||||
}
|
||||
}
|
||||
os.addObserver(observer, "bookmarks-restore-success", false);
|
||||
os.addObserver(observer, "bookmarks-restore-failed", false);
|
||||
// The test will continue once restore has finished and smart bookmarks
|
||||
// have been created.
|
||||
bs.addObserver(bookmarksObserver, false);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
|
||||
// Check that JSON backup has been restored.
|
||||
// Notice restore from JSON notification is fired before smart bookmarks creation.
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
|
||||
do_check_neq(itemId, -1);
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR);
|
||||
do_check_eq(bs.getItemTitle(itemId), "examplejson");
|
||||
|
||||
remove_bookmarks_html();
|
||||
|
|
|
@ -41,6 +41,32 @@
|
|||
* is corrupt but a JSON backup is not available.
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "bs",
|
||||
"@mozilla.org/browser/nav-bookmarks-service;1",
|
||||
"nsINavBookmarksService");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "anno",
|
||||
"@mozilla.org/browser/annotation-service;1",
|
||||
"nsIAnnotationService");
|
||||
|
||||
let bookmarksObserver = {
|
||||
onBeginUpdateBatch: function() {},
|
||||
onEndUpdateBatch: function() {
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
|
||||
do_check_neq(itemId, -1);
|
||||
if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
|
||||
continue_test();
|
||||
},
|
||||
onItemAdded: function() {},
|
||||
onBeforeItemRemoved: function(id) {},
|
||||
onItemRemoved: function(id, folder, index, itemType) {},
|
||||
onItemChanged: function() {},
|
||||
onItemVisited: function(id, visitID, time) {},
|
||||
onItemMoved: function() {},
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
|
@ -72,30 +98,14 @@ function run_test() {
|
|||
// nsBrowserGlue uses databaseStatus to manage initialization.
|
||||
do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CORRUPT);
|
||||
|
||||
// Wait for restore to finish.
|
||||
let os = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
os.removeObserver(observer, "bookmarks-restore-success");
|
||||
os.removeObserver(observer, "bookmarks-restore-failed");
|
||||
do_check_eq(aTopic, "bookmarks-restore-success");
|
||||
do_check_eq(aData, "html-initial");
|
||||
continue_test();
|
||||
}
|
||||
}
|
||||
os.addObserver(observer, "bookmarks-restore-success", false);
|
||||
os.addObserver(observer, "bookmarks-restore-failed", false);
|
||||
// The test will continue once import has finished and smart bookmarks
|
||||
// have been created.
|
||||
bs.addObserver(bookmarksObserver, false);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
|
||||
// Check that bookmarks html has been restored.
|
||||
// Notice restore from HTML notification is fired after smart bookmarks creation.
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR);
|
||||
do_check_neq(itemId, -1);
|
||||
do_check_eq(bs.getItemTitle(itemId), "example");
|
||||
|
||||
remove_bookmarks_html();
|
||||
|
|
|
@ -41,6 +41,32 @@
|
|||
* corrupt, nor a JSON backup nor bookmarks.html are available.
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "bs",
|
||||
"@mozilla.org/browser/nav-bookmarks-service;1",
|
||||
"nsINavBookmarksService");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "anno",
|
||||
"@mozilla.org/browser/annotation-service;1",
|
||||
"nsIAnnotationService");
|
||||
|
||||
let bookmarksObserver = {
|
||||
onBeginUpdateBatch: function() {},
|
||||
onEndUpdateBatch: function() {
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
|
||||
do_check_neq(itemId, -1);
|
||||
if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
|
||||
continue_test();
|
||||
},
|
||||
onItemAdded: function() {},
|
||||
onBeforeItemRemoved: function(id) {},
|
||||
onItemRemoved: function(id, folder, index, itemType) {},
|
||||
onItemChanged: function() {},
|
||||
onItemVisited: function(id, visitID, time) {},
|
||||
onItemMoved: function() {},
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
|
@ -72,26 +98,12 @@ function run_test() {
|
|||
// nsBrowserGlue uses databaseStatus to manage initialization.
|
||||
do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CORRUPT);
|
||||
|
||||
// Wait for restore to finish.
|
||||
let os = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
os.removeObserver(observer, "bookmarks-restore-success");
|
||||
os.removeObserver(observer, "bookmarks-restore-failed");
|
||||
do_check_eq(aTopic, "bookmarks-restore-success");
|
||||
do_check_eq(aData, "html-initial");
|
||||
continue_test();
|
||||
}
|
||||
}
|
||||
os.addObserver(observer, "bookmarks-restore-success", false);
|
||||
os.addObserver(observer, "bookmarks-restore-failed", false);
|
||||
// The test will continue once import has finished and smart bookmarks
|
||||
// have been created.
|
||||
bs.addObserver(bookmarksObserver, false);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
|
||||
// Check that default bookmarks have been restored.
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR);
|
||||
do_check_true(itemId > 0);
|
||||
|
|
|
@ -42,9 +42,37 @@
|
|||
* bookmark on init, we should not try to import.
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "bs",
|
||||
"@mozilla.org/browser/nav-bookmarks-service;1",
|
||||
"nsINavBookmarksService");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "anno",
|
||||
"@mozilla.org/browser/annotation-service;1",
|
||||
"nsIAnnotationService");
|
||||
|
||||
let bookmarksObserver = {
|
||||
onBeginUpdateBatch: function() {},
|
||||
onEndUpdateBatch: function() {
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
|
||||
do_check_neq(itemId, -1);
|
||||
if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
|
||||
continue_test();
|
||||
},
|
||||
onItemAdded: function() {},
|
||||
onBeforeItemRemoved: function(id) {},
|
||||
onItemRemoved: function(id, folder, index, itemType) {},
|
||||
onItemChanged: function() {},
|
||||
onItemVisited: function(id, visitID, time) {},
|
||||
onItemMoved: function() {},
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
|
||||
};
|
||||
|
||||
const PREF_SMART_BOOKMARKS_VERSION = "browser.places.smartBookmarksVersion";
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
// Create our bookmarks.html copying bookmarks.glue.html to the profile
|
||||
// folder. It will be ignored.
|
||||
create_bookmarks_html("bookmarks.glue.html");
|
||||
|
@ -57,11 +85,6 @@ function run_test() {
|
|||
do_check_false(db.exists());
|
||||
}
|
||||
|
||||
// Disable Smart Bookmarks creation.
|
||||
let ps = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
ps.setIntPref(PREF_SMART_BOOKMARKS_VERSION, -1);
|
||||
|
||||
// Initialize Places through the History Service.
|
||||
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
|
@ -71,8 +94,6 @@ function run_test() {
|
|||
|
||||
// A migrator would run before nsBrowserGlue, so we mimic that behavior
|
||||
// adding a bookmark.
|
||||
let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
bs.insertBookmark(bs.bookmarksMenuFolder, uri("http://mozilla.org/"),
|
||||
bs.DEFAULT_INDEX, "migrated");
|
||||
|
||||
|
@ -80,23 +101,19 @@ function run_test() {
|
|||
let bg = Cc["@mozilla.org/browser/browserglue;1"].
|
||||
getService(Ci.nsIBrowserGlue);
|
||||
|
||||
// Import could take some time, usually less than 1s, but to be sure we will
|
||||
// check after 3s.
|
||||
do_test_pending();
|
||||
do_timeout(3000, continue_test);
|
||||
// The test will continue once import has finished and smart bookmarks
|
||||
// have been created.
|
||||
bs.addObserver(bookmarksObserver, false);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
|
||||
// Check the created bookmarks still exist.
|
||||
let itemId = bs.getIdForItemAt(bs.bookmarksMenuFolder, 0);
|
||||
let itemId = bs.getIdForItemAt(bs.bookmarksMenuFolder, SMART_BOOKMARKS_ON_MENU);
|
||||
do_check_eq(bs.getItemTitle(itemId), "migrated");
|
||||
|
||||
// Check that we have not imported any new bookmark.
|
||||
do_check_eq(bs.getIdForItemAt(bs.bookmarksMenuFolder, 1), -1);
|
||||
do_check_eq(bs.getIdForItemAt(bs.toolbarFolder, 0), -1);
|
||||
do_check_eq(bs.getIdForItemAt(bs.bookmarksMenuFolder, SMART_BOOKMARKS_ON_MENU + 1), -1);
|
||||
do_check_eq(bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_MENU), -1);
|
||||
|
||||
remove_bookmarks_html();
|
||||
|
||||
|
|
|
@ -41,6 +41,32 @@
|
|||
* database has been created and one backup is available.
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "bs",
|
||||
"@mozilla.org/browser/nav-bookmarks-service;1",
|
||||
"nsINavBookmarksService");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "anno",
|
||||
"@mozilla.org/browser/annotation-service;1",
|
||||
"nsIAnnotationService");
|
||||
|
||||
let bookmarksObserver = {
|
||||
onBeginUpdateBatch: function() {},
|
||||
onEndUpdateBatch: function() {
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
|
||||
do_check_neq(itemId, -1);
|
||||
if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
|
||||
continue_test();
|
||||
},
|
||||
onItemAdded: function() {},
|
||||
onBeforeItemRemoved: function(id) {},
|
||||
onItemRemoved: function(id, folder, index, itemType) {},
|
||||
onItemChanged: function() {},
|
||||
onItemVisited: function(id, visitID, time) {},
|
||||
onItemMoved: function() {},
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
|
@ -70,29 +96,15 @@ function run_test() {
|
|||
// nsBrowserGlue uses databaseStatus to manage initialization.
|
||||
do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CREATE);
|
||||
|
||||
// Wait for restore to finish.
|
||||
let os = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
os.removeObserver(observer, "bookmarks-restore-success");
|
||||
os.removeObserver(observer, "bookmarks-restore-failed");
|
||||
do_check_eq(aTopic, "bookmarks-restore-success");
|
||||
do_check_eq(aData, "json");
|
||||
continue_test();
|
||||
}
|
||||
}
|
||||
os.addObserver(observer, "bookmarks-restore-success", false);
|
||||
os.addObserver(observer, "bookmarks-restore-failed", false);
|
||||
// The test will continue once restore has finished and smart bookmarks
|
||||
// have been created.
|
||||
bs.addObserver(bookmarksObserver, false);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||
getService(Ci.nsINavBookmarksService);
|
||||
|
||||
// Check that JSON backup has been restored.
|
||||
// Notice restore from JSON notification is fired before smart bookmarks creation.
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
|
||||
let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR);
|
||||
do_check_eq(bs.getItemTitle(itemId), "examplejson");
|
||||
|
||||
remove_bookmarks_html();
|
||||
|
|
|
@ -579,12 +579,11 @@ PrivateBrowsingService.prototype = {
|
|||
|
||||
// Cookies
|
||||
let (cm = Cc["@mozilla.org/cookiemanager;1"].
|
||||
getService(Ci.nsICookieManager)) {
|
||||
let enumerator = cm.enumerator;
|
||||
getService(Ci.nsICookieManager2)) {
|
||||
let enumerator = cm.getCookiesFromHost(aDomain);
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
|
||||
if (cookie.host.hasRootDomain(aDomain))
|
||||
cm.remove(cookie.host, cookie.name, cookie.path, false);
|
||||
cm.remove(cookie.host, cookie.name, cookie.path, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче