Merge from m-c

This commit is contained in:
Doug Turner 2011-10-24 11:11:26 -07:00
commit e8670cc25d
4675 changed files with 64129 additions and 57534 deletions

View File

@ -38,6 +38,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "nsAccessible.h"
#include "nsAccessibleWrap.h"
@ -69,6 +71,7 @@
#include "nsMaiInterfaceDocument.h"
#include "nsMaiInterfaceImage.h"
using namespace mozilla;
using namespace mozilla::a11y;
nsAccessibleWrap::EAvailableAtkSignals nsAccessibleWrap::gAvailableAtkSignals =
@ -344,7 +347,7 @@ void nsAccessibleWrap::SetMaiHyperlink(MaiHyperlink* aMaiHyperlink)
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
MaiHyperlink* maiHyperlink = GetMaiHyperlink(PR_FALSE);
MaiHyperlink* maiHyperlink = GetMaiHyperlink(false);
if (!maiHyperlink && !aMaiHyperlink) {
return; // Never set and we're shutting down
}
@ -522,7 +525,7 @@ GetMaiAtkType(PRUint16 interfacesBits)
atkTypeName,
&tinfo, GTypeFlags(0));
for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(atk_if_infos); index++) {
for (PRUint32 index = 0; index < ArrayLength(atk_if_infos); index++) {
if (interfacesBits & (1 << index)) {
g_type_add_interface_static(type,
GetAtkTypeForMai((MaiInterfaceType)index),
@ -963,7 +966,7 @@ refRelationSetCB(AtkObject *aAtkObj)
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
};
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(relationTypes); i++) {
for (PRUint32 i = 0; i < ArrayLength(relationTypes); i++) {
AtkRelationType atkType = static_cast<AtkRelationType>(relationTypes[i]);
AtkRelation* atkRelation =
atk_relation_set_get_relation_by_type(relation_set, atkType);
@ -1060,7 +1063,7 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
atk_focus_tracker_notify(atkObj);
// Fire state change event for focus
nsRefPtr<AccEvent> stateChangeEvent =
new AccStateChangeEvent(accessible, states::FOCUSED, PR_TRUE);
new AccStateChangeEvent(accessible, states::FOCUSED, true);
return FireAtkStateChangeEvent(stateChangeEvent, atkObj);
}
} break;
@ -1212,10 +1215,10 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
break;
case nsIAccessibleEvent::EVENT_SHOW:
return FireAtkShowHideEvent(aEvent, atkObj, PR_TRUE);
return FireAtkShowHideEvent(aEvent, atkObj, true);
case nsIAccessibleEvent::EVENT_HIDE:
return FireAtkShowHideEvent(aEvent, atkObj, PR_FALSE);
return FireAtkShowHideEvent(aEvent, atkObj, false);
/*
* Because dealing with menu is very different between nsIAccessible
@ -1236,7 +1239,7 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_ACTIVATED\n"));
nsRootAccessible *rootAcc =
static_cast<nsRootAccessible *>(accessible);
rootAcc->mActivated = PR_TRUE;
rootAcc->mActivated = true;
guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
@ -1249,7 +1252,7 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_DEACTIVATED\n"));
nsRootAccessible *rootAcc =
static_cast<nsRootAccessible *>(accessible);
rootAcc->mActivated = PR_FALSE;
rootAcc->mActivated = false;
guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
} break;
@ -1296,14 +1299,14 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUPOPUP_START\n"));
atk_focus_tracker_notify(atkObj); // fire extra focus event
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_TRUE);
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_TRUE);
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, true);
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, true);
break;
case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUPOPUP_END\n"));
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_FALSE);
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_FALSE);
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, false);
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, false);
break;
}

View File

@ -756,7 +756,7 @@ bool
nsApplicationAccessibleWrap::AppendChild(nsAccessible *aChild)
{
if (!nsApplicationAccessible::AppendChild(aChild))
return PR_FALSE;
return false;
AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aChild);
atk_object_set_parent(atkAccessible, mAtkObject);
@ -776,7 +776,7 @@ nsApplicationAccessibleWrap::AppendChild(nsAccessible *aChild)
g_timeout_add(0, fireRootAccessibleAddedCB, eventData);
}
return PR_TRUE;
return true;
}
bool

View File

@ -49,7 +49,7 @@
nsDocAccessibleWrap::
nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
nsIWeakReference *aShell) :
nsDocAccessible(aDocument, aRootContent, aShell), mActivated(PR_FALSE)
nsDocAccessible(aDocument, aRootContent, aShell), mActivated(false)
{
}

View File

@ -257,7 +257,7 @@ getRunAttributesCB(AtkText *aText, gint aOffset,
nsCOMPtr<nsIPersistentProperties> attributes;
PRInt32 startOffset = 0, endOffset = 0;
nsresult rv = accText->GetTextAttributes(PR_FALSE, aOffset,
nsresult rv = accText->GetTextAttributes(false, aOffset,
&startOffset, &endOffset,
getter_AddRefs(attributes));
NS_ENSURE_SUCCESS(rv, nsnull);

View File

@ -103,7 +103,7 @@ AccEvent::GetDocAccessible()
{
nsINode *node = GetNode();
if (node)
return GetAccService()->GetDocAccessible(node->GetOwnerDoc());
return GetAccService()->GetDocAccessible(node->OwnerDoc());
return nsnull;
}
@ -161,7 +161,7 @@ AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
#endif
if (aIsFromUserInput != eAutoDetect) {
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? PR_TRUE : PR_FALSE;
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
return;
}

View File

@ -278,10 +278,10 @@ IDRefsIterator::IDRefsIterator(nsIContent* aContent, nsIAtom* aIDRefsAttr) :
return;
if (aContent->IsInAnonymousSubtree()) {
mXBLDocument = do_QueryInterface(aContent->GetOwnerDoc());
mXBLDocument = do_QueryInterface(aContent->OwnerDoc());
mBindingParent = do_QueryInterface(aContent->GetBindingParent());
} else {
mDocument = aContent->GetOwnerDoc();
mDocument = aContent->OwnerDoc();
}
}

View File

@ -81,7 +81,7 @@ FocusManager::IsFocused(const nsAccessible* aAccessible) const
// peculiarity we would end up with plain implementation based on
// FocusedAccessible() method call. Make sure this issue is fixed in
// bug 638465.
if (focusedNode->GetOwnerDoc() == aAccessible->GetNode()->GetOwnerDoc()) {
if (focusedNode->OwnerDoc() == aAccessible->GetNode()->OwnerDoc()) {
return aAccessible ==
GetAccService()->GetAccessibleOrContainer(focusedNode, nsnull);
}
@ -145,7 +145,7 @@ FocusManager::NotifyOfDOMFocus(nsISupports* aTarget)
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
if (targetNode) {
nsDocAccessible* document =
GetAccService()->GetDocAccessible(targetNode->GetOwnerDoc());
GetAccService()->GetDocAccessible(targetNode->OwnerDoc());
if (document) {
// Set selection listener for focused element.
if (targetNode->IsElement()) {
@ -171,8 +171,8 @@ FocusManager::NotifyOfDOMBlur(nsISupports* aTarget)
// If DOM document stays focused then fire accessible focus event to process
// the case when no element within this DOM document will be focused.
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
if (targetNode && targetNode->GetOwnerDoc() == FocusedDOMDocument()) {
nsIDocument* DOMDoc = targetNode->GetOwnerDoc();
if (targetNode && targetNode->OwnerDoc() == FocusedDOMDocument()) {
nsIDocument* DOMDoc = targetNode->OwnerDoc();
nsDocAccessible* document =
GetAccService()->GetDocAccessible(DOMDoc);
if (document) {
@ -216,7 +216,7 @@ FocusManager::ForceFocusEvent()
nsINode* focusedNode = FocusedDOMNode();
if (focusedNode) {
nsDocAccessible* document =
GetAccService()->GetDocAccessible(focusedNode->GetOwnerDoc());
GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
if (document) {
document->HandleNotification<FocusManager, nsINode>
(this, &FocusManager::ProcessDOMFocus, focusedNode);
@ -246,7 +246,7 @@ FocusManager::ProcessDOMFocus(nsINode* aTarget)
"Notification target", aTarget)
nsDocAccessible* document =
GetAccService()->GetDocAccessible(aTarget->GetOwnerDoc());
GetAccService()->GetDocAccessible(aTarget->OwnerDoc());
nsAccessible* target = document->GetAccessibleOrContainer(aTarget);
if (target) {

View File

@ -380,7 +380,7 @@ NotificationController::CoalesceEvents()
// is supported. Ignore events from different documents since we don't
// coalesce them.
if (!thisEvent->mNode ||
thisEvent->mNode->GetOwnerDoc() != tailEvent->mNode->GetOwnerDoc())
thisEvent->mNode->OwnerDoc() != tailEvent->mNode->OwnerDoc())
continue;
// Coalesce earlier event for the same target.

View File

@ -355,7 +355,7 @@ private:
static PLDHashNumber HashKey(KeyTypePointer aKey)
{ return NS_PTR_TO_INT32(aKey) >> 2; }
enum { ALLOW_MEMMOVE = PR_TRUE };
enum { ALLOW_MEMMOVE = true };
protected:
nsCOMPtr<T> mKey;

View File

@ -80,7 +80,7 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
}
// Get the text leaf accessible offset and invalidate cached offsets after it.
mTextOffset = mHyperText->GetChildOffset(mTextLeaf, PR_TRUE);
mTextOffset = mHyperText->GetChildOffset(mTextLeaf, true);
NS_ASSERTION(mTextOffset != -1,
"Text leaf hasn't offset within hyper text!");
@ -111,14 +111,14 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
if (strLen1 > 0) {
// Fire text change event for removal.
nsRefPtr<AccEvent> textRemoveEvent =
new AccTextChangeEvent(mHyperText, mTextOffset, str1, PR_FALSE);
new AccTextChangeEvent(mHyperText, mTextOffset, str1, false);
mDocument->FireDelayedAccessibleEvent(textRemoveEvent);
}
if (strLen2 > 0) {
// Fire text change event for insertion.
nsRefPtr<AccEvent> textInsertEvent =
new AccTextChangeEvent(mHyperText, mTextOffset, str2, PR_TRUE);
new AccTextChangeEvent(mHyperText, mTextOffset, str2, true);
mDocument->FireDelayedAccessibleEvent(textInsertEvent);
}

View File

@ -91,7 +91,7 @@ private:
{
nsRefPtr<AccEvent> event =
new AccTextChangeEvent(mHyperText, mTextOffset + aAddlOffset,
aText, PR_TRUE);
aText, true);
aEvents.AppendElement(event);
}
@ -103,7 +103,7 @@ private:
{
nsRefPtr<AccEvent> event =
new AccTextChangeEvent(mHyperText, mTextOffset + aAddlOffset,
aText, PR_FALSE);
aText, false);
aEvents.AppendElement(event);
}

View File

@ -319,7 +319,7 @@ NS_IMETHODIMP
nsARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -342,7 +342,7 @@ nsARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, bool *aIsSelected)
}
} while ((row = rowIter.Next()));
*aIsSelected = PR_TRUE;
*aIsSelected = true;
return NS_OK;
}
@ -350,7 +350,7 @@ NS_IMETHODIMP
nsARIAGridAccessible::IsRowSelected(PRInt32 aRow, bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -367,7 +367,7 @@ nsARIAGridAccessible::IsRowSelected(PRInt32 aRow, bool *aIsSelected)
}
}
*aIsSelected = PR_TRUE;
*aIsSelected = true;
return NS_OK;
}
@ -376,7 +376,7 @@ nsARIAGridAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -392,7 +392,7 @@ nsARIAGridAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
return NS_OK;
}
*aIsSelected = PR_TRUE;
*aIsSelected = true;
return NS_OK;
}
@ -461,7 +461,7 @@ nsARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
bool isRowSelected = true;
do {
if (!nsAccUtils::IsARIASelected(cell)) {
isRowSelected = PR_FALSE;
isRowSelected = false;
break;
}
} while ((cell = cellIter.Next()));
@ -496,14 +496,14 @@ nsARIAGridAccessible::GetSelectedCells(nsIArray **aCells)
if (nsAccUtils::IsARIASelected(row)) {
while ((cell = cellIter.Next()))
selCells->AppendElement(static_cast<nsIAccessible *>(cell), PR_FALSE);
selCells->AppendElement(static_cast<nsIAccessible *>(cell), false);
continue;
}
while ((cell = cellIter.Next())) {
if (nsAccUtils::IsARIASelected(cell))
selCells->AppendElement(static_cast<nsIAccessible *>(cell), PR_FALSE);
selCells->AppendElement(static_cast<nsIAccessible *>(cell), false);
}
}
@ -608,7 +608,7 @@ nsARIAGridAccessible::GetSelectedRowIndices(PRUint32 *arowCount,
bool isRowSelected = true;
do {
if (!nsAccUtils::IsARIASelected(cell)) {
isRowSelected = PR_FALSE;
isRowSelected = false;
break;
}
} while ((cell = cellIter.Next()));
@ -661,13 +661,13 @@ nsARIAGridAccessible::SelectColumn(PRInt32 aColumn)
nsAccessible *row = nsnull;
while ((row = rowIter.Next())) {
// Unselect all cells in the row.
nsresult rv = SetARIASelected(row, PR_FALSE);
nsresult rv = SetARIASelected(row, false);
NS_ENSURE_SUCCESS(rv, rv);
// Select cell at the column index.
nsAccessible *cell = GetCellInRowAt(row, aColumn);
if (cell) {
rv = SetARIASelected(cell, PR_TRUE);
rv = SetARIASelected(cell, true);
NS_ENSURE_SUCCESS(rv, rv);
}
}
@ -684,7 +684,7 @@ nsARIAGridAccessible::UnselectRow(PRInt32 aRow)
nsAccessible *row = GetRowAt(aRow);
NS_ENSURE_ARG(row);
return SetARIASelected(row, PR_FALSE);
return SetARIASelected(row, false);
}
NS_IMETHODIMP
@ -701,7 +701,7 @@ nsARIAGridAccessible::UnselectColumn(PRInt32 aColumn)
while ((row = rowIter.Next())) {
nsAccessible *cell = GetCellInRowAt(row, aColumn);
if (cell) {
nsresult rv = SetARIASelected(cell, PR_FALSE);
nsresult rv = SetARIASelected(cell, false);
NS_ENSURE_SUCCESS(rv, rv);
}
}
@ -713,7 +713,7 @@ NS_IMETHODIMP
nsARIAGridAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
{
NS_ENSURE_ARG_POINTER(aIsProbablyForLayout);
*aIsProbablyForLayout = PR_FALSE;
*aIsProbablyForLayout = false;
return NS_OK;
}
@ -725,7 +725,7 @@ bool
nsARIAGridAccessible::IsValidRow(PRInt32 aRow)
{
if (aRow < 0)
return PR_FALSE;
return false;
PRInt32 rowCount = 0;
GetRowCount(&rowCount);
@ -736,7 +736,7 @@ bool
nsARIAGridAccessible::IsValidColumn(PRInt32 aColumn)
{
if (aColumn < 0)
return PR_FALSE;
return false;
PRInt32 colCount = 0;
GetColumnCount(&colCount);
@ -747,12 +747,12 @@ bool
nsARIAGridAccessible::IsValidRowNColumn(PRInt32 aRow, PRInt32 aColumn)
{
if (aRow < 0 || aColumn < 0)
return PR_FALSE;
return false;
PRInt32 rowCount = 0;
GetRowCount(&rowCount);
if (aRow >= rowCount)
return PR_FALSE;
return false;
PRInt32 colCount = 0;
GetColumnCount(&colCount);
@ -822,7 +822,7 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
nsAccessible *cell = nsnull;
while ((cell = cellIter.Next())) {
rv = SetARIASelected(cell, PR_FALSE, PR_FALSE);
rv = SetARIASelected(cell, false, false);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
@ -838,14 +838,14 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
if (row && row->Role() == nsIAccessibleRole::ROLE_ROW &&
nsAccUtils::IsARIASelected(row)) {
rv = SetARIASelected(row, PR_FALSE, PR_FALSE);
rv = SetARIASelected(row, false, false);
NS_ENSURE_SUCCESS(rv, rv);
AccIterator cellIter(row, filters::GetCell);
nsAccessible *cell = nsnull;
while ((cell = cellIter.Next())) {
if (cell != aAccessible) {
rv = SetARIASelected(cell, PR_TRUE, PR_FALSE);
rv = SetARIASelected(cell, true, false);
NS_ENSURE_SUCCESS(rv, rv);
}
}
@ -882,7 +882,7 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *acolumnCount,
nsTArray<bool> isColSelArray(selColCount);
isColSelArray.AppendElements(selColCount);
for (PRInt32 i = 0; i < selColCount; i++)
isColSelArray[i] = PR_TRUE;
isColSelArray[i] = true;
do {
if (nsAccUtils::IsARIASelected(row))
@ -893,9 +893,9 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *acolumnCount,
AccIterator cellIter(row, filters::GetCell);
nsAccessible *cell = nsnull;
for (colIdx = 0; (cell = cellIter.Next()); colIdx++) {
if (isColSelArray.SafeElementAt(colIdx, PR_FALSE) &&
if (isColSelArray.SafeElementAt(colIdx, false) &&
!nsAccUtils::IsARIASelected(cell)) {
isColSelArray[colIdx] = PR_FALSE;
isColSelArray[colIdx] = false;
selColCount--;
}
}
@ -1095,7 +1095,7 @@ NS_IMETHODIMP
nsARIAGridCellAccessible::IsSelected(bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -1107,7 +1107,7 @@ nsARIAGridCellAccessible::IsSelected(bool *aIsSelected)
if (!nsAccUtils::IsARIASelected(row) && !nsAccUtils::IsARIASelected(this))
return NS_OK;
*aIsSelected = PR_TRUE;
*aIsSelected = true;
return NS_OK;
}

View File

@ -613,11 +613,11 @@ nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
// eARIACheckableBool
nsStateMapEntry(&nsGkAtoms::aria_checked, kBoolType,
states::CHECKABLE, states::CHECKED, 0, PR_TRUE),
states::CHECKABLE, states::CHECKED, 0, true),
// eARIACheckableMixed
nsStateMapEntry(&nsGkAtoms::aria_checked, kMixedType,
states::CHECKABLE, states::CHECKED, 0, PR_TRUE),
states::CHECKABLE, states::CHECKED, 0, true),
// eARIACheckedMixed
nsStateMapEntry(&nsGkAtoms::aria_checked, kMixedType,
@ -641,7 +641,7 @@ nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
// eARIAMultiline
nsStateMapEntry(&nsGkAtoms::aria_multiline, kBoolType,
0, states::MULTI_LINE, states::SINGLE_LINE, PR_TRUE),
0, states::MULTI_LINE, states::SINGLE_LINE, true),
// eARIAMultiSelectable
nsStateMapEntry(&nsGkAtoms::aria_multiselectable, kBoolType,
@ -662,7 +662,7 @@ nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
// eARIAReadonlyOrEditable
nsStateMapEntry(&nsGkAtoms::aria_readonly, kBoolType,
0, states::READONLY, states::EDITABLE, PR_TRUE),
0, states::READONLY, states::EDITABLE, true),
// eARIARequired
nsStateMapEntry(&nsGkAtoms::aria_required, kBoolType,
@ -670,7 +670,7 @@ nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
// eARIASelectable
nsStateMapEntry(&nsGkAtoms::aria_selected, kBoolType,
states::SELECTABLE, states::SELECTED, 0, PR_TRUE)
states::SELECTABLE, states::SELECTED, 0, true)
};
/**
@ -739,7 +739,7 @@ PRUint32 nsARIAMap::gWAIUnivAttrMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIUnivA
nsStateMapEntry::nsStateMapEntry() :
mAttributeName(nsnull),
mIsToken(PR_FALSE),
mIsToken(false),
mPermanentState(0),
mValue1(nsnull),
mState1(0),
@ -748,7 +748,7 @@ nsStateMapEntry::nsStateMapEntry() :
mValue3(nsnull),
mState3(0),
mDefaultState(0),
mDefinedIfAbsent(PR_FALSE)
mDefinedIfAbsent(false)
{}
nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName, eStateValueType aType,
@ -757,7 +757,7 @@ nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName, eStateValueType aType,
PRUint64 aFalseState,
bool aDefinedIfAbsent) :
mAttributeName(aAttrName),
mIsToken(PR_TRUE),
mIsToken(true),
mPermanentState(aPermanentState),
mValue1("false"),
mState1(aFalseState),
@ -778,11 +778,11 @@ nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName,
const char* aValue1, PRUint64 aState1,
const char* aValue2, PRUint64 aState2,
const char* aValue3, PRUint64 aState3) :
mAttributeName(aAttrName), mIsToken(PR_FALSE), mPermanentState(0),
mAttributeName(aAttrName), mIsToken(false), mPermanentState(0),
mValue1(aValue1), mState1(aState1),
mValue2(aValue2), mState2(aState2),
mValue3(aValue3), mState3(aState3),
mDefaultState(0), mDefinedIfAbsent(PR_FALSE)
mDefaultState(0), mDefinedIfAbsent(false)
{
}
@ -791,11 +791,11 @@ nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName,
const char* aValue1, PRUint64 aState1,
const char* aValue2, PRUint64 aState2,
const char* aValue3, PRUint64 aState3) :
mAttributeName(aAttrName), mIsToken(PR_TRUE), mPermanentState(0),
mAttributeName(aAttrName), mIsToken(true), mPermanentState(0),
mValue1(aValue1), mState1(aState1),
mValue2(aValue2), mState2(aState2),
mValue3(aValue3), mState3(aState3),
mDefaultState(0), mDefinedIfAbsent(PR_TRUE)
mDefaultState(0), mDefinedIfAbsent(true)
{
if (aDefaultStateRule == eUseFirstState)
mDefaultState = aState1;
@ -807,7 +807,7 @@ nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
{
// Return true if we should continue.
if (aStateMapEntryID == eARIANone)
return PR_FALSE;
return false;
const nsStateMapEntry& entry = nsARIAMap::gWAIStateMap[aStateMapEntryID];
@ -820,7 +820,7 @@ nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
*aState |= entry.mPermanentState;
if (entry.mState1)
*aState |= entry.mState1;
return PR_TRUE;
return true;
}
// We only have attribute state mappings for NMTOKEN (and boolean) based
@ -838,7 +838,7 @@ nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
if (entry.mPermanentState)
*aState &= ~entry.mPermanentState;
return PR_TRUE;
return true;
}
if (entry.mPermanentState)
@ -847,27 +847,27 @@ nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
nsAutoString attrValue;
if (!aContent->GetAttr(kNameSpaceID_None, *entry.mAttributeName, attrValue))
return PR_TRUE;
return true;
// Apply states for matched value. If no values was matched then apply default
// states.
bool applyDefaultStates = true;
if (entry.mValue1) {
if (attrValue.EqualsASCII(entry.mValue1)) {
applyDefaultStates = PR_FALSE;
applyDefaultStates = false;
if (entry.mState1)
*aState |= entry.mState1;
} else if (entry.mValue2) {
if (attrValue.EqualsASCII(entry.mValue2)) {
applyDefaultStates = PR_FALSE;
applyDefaultStates = false;
if (entry.mState2)
*aState |= entry.mState2;
} else if (entry.mValue3) {
if (attrValue.EqualsASCII(entry.mValue3)) {
applyDefaultStates = PR_FALSE;
applyDefaultStates = false;
if (entry.mState3)
*aState |= entry.mState3;
@ -882,5 +882,5 @@ nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
*aState |= entry.mDefaultState;
}
return PR_TRUE;
return true;
}

View File

@ -119,12 +119,12 @@ nsAccDocManager::Init()
do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID);
if (!progress)
return PR_FALSE;
return false;
progress->AddProgressListener(static_cast<nsIWebProgressListener*>(this),
nsIWebProgress::NOTIFY_STATE_DOCUMENT);
return PR_TRUE;
return true;
}
void
@ -341,7 +341,7 @@ nsAccDocManager::AddListeners(nsIDocument *aDocument,
{
nsPIDOMWindow *window = aDocument->GetWindow();
nsIDOMEventTarget *target = window->GetChromeEventHandler();
nsEventListenerManager* elm = target->GetListenerManager(PR_TRUE);
nsEventListenerManager* elm = target->GetListenerManager(true);
elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
NS_EVENT_FLAG_CAPTURE);

View File

@ -152,10 +152,10 @@ nsAccTreeWalker::PushState(nsIContent* aContent)
{
WalkState* nextToLastState = new WalkState(aContent);
if (!nextToLastState)
return PR_FALSE;
return false;
nextToLastState->prevState = mState;
mState = nextToLastState;
return PR_TRUE;
return true;
}

View File

@ -330,9 +330,9 @@ nsAccUtils::HasDefinedARIAToken(nsIContent *aContent, nsIAtom *aAtom)
nsGkAtoms::_empty, eCaseMatters) ||
aContent->AttrValueIs(kNameSpaceID_None, aAtom,
nsGkAtoms::_undefined, eCaseMatters)) {
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}
nsIAtom*
@ -593,13 +593,13 @@ nsAccUtils::GetLiveAttrValue(PRUint32 aRule, nsAString& aValue)
switch (aRule) {
case eOffLiveAttr:
aValue = NS_LITERAL_STRING("off");
return PR_TRUE;
return true;
case ePoliteLiveAttr:
aValue = NS_LITERAL_STRING("polite");
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
#ifdef DEBUG_A11Y
@ -613,14 +613,14 @@ nsAccUtils::IsTextInterfaceSupportCorrect(nsAccessible *aAccessible)
if (accDoc) {
// Don't test for accessible docs, it makes us create accessibles too
// early and fire mutation events before we need to
return PR_TRUE;
return true;
}
PRInt32 childCount = aAccessible->GetChildCount();
for (PRint32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *child = GetChildAt(childIdx);
if (IsText(child)) {
foundText = PR_TRUE;
foundText = true;
break;
}
}
@ -629,10 +629,10 @@ nsAccUtils::IsTextInterfaceSupportCorrect(nsAccessible *aAccessible)
// found text child node
nsCOMPtr<nsIAccessibleText> text = do_QueryObject(aAccessible);
if (!text)
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}
#endif
@ -726,7 +726,7 @@ nsAccUtils::GetHeaderCellsFor(nsIAccessibleTable *aTable,
role == nsIAccessibleRole::ROLE_COLUMNHEADER;
if (isHeader)
cells->AppendElement(cell, PR_FALSE);
cells->AppendElement(cell, false);
}
}

View File

@ -146,7 +146,7 @@ public:
* property is not present, or is "" or "undefined". Do not call
* this method for properties of type string, decimal, IDREF or IDREFS.
*
* Return PR_TRUE if the ARIA property is defined, otherwise PR_FALSE
* Return true if the ARIA property is defined, otherwise false
*/
static bool HasDefinedARIAToken(nsIContent *aContent, nsIAtom *aAtom);

View File

@ -106,7 +106,7 @@ nsAccessNode::
mContent(aContent), mWeakShell(aShell)
{
#ifdef DEBUG_A11Y
mIsInitialized = PR_FALSE;
mIsInitialized = false;
#endif
}
@ -138,7 +138,7 @@ nsAccessNode::IsDefunct() const
bool
nsAccessNode::Init()
{
return PR_TRUE;
return true;
}
@ -201,7 +201,7 @@ void nsAccessNode::InitXPAccessibility()
prefBranch->GetBoolPref("browser.formfill.enable", &gIsFormFillEnabled);
}
NotifyA11yInitOrShutdown(PR_TRUE);
NotifyA11yInitOrShutdown(true);
}
// nsAccessNode protected static
@ -235,7 +235,7 @@ void nsAccessNode::ShutdownXPAccessibility()
NS_RELEASE(gApplicationAccessible);
}
NotifyA11yInitOrShutdown(PR_FALSE);
NotifyA11yInitOrShutdown(false);
}
already_AddRefed<nsIPresShell>
@ -262,7 +262,7 @@ nsDocAccessible *
nsAccessNode::GetDocAccessible() const
{
return mContent ?
GetAccService()->GetDocAccessible(mContent->GetOwnerDoc()) : nsnull;
GetAccService()->GetDocAccessible(mContent->OwnerDoc()) : nsnull;
}
nsRootAccessible*
@ -437,7 +437,7 @@ nsAccessNode::GetCurrentFocus()
nsCOMPtr<nsIDOMElement> focusedElement;
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
if (fm)
fm->GetFocusedElementForWindow(win, PR_TRUE, getter_AddRefs(focusedWindow),
fm->GetFocusedElementForWindow(win, true, getter_AddRefs(focusedWindow),
getter_AddRefs(focusedElement));
nsINode *focusedNode = nsnull;
@ -465,10 +465,8 @@ nsAccessNode::GetLanguage(nsAString& aLanguage)
nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage);
if (aLanguage.IsEmpty()) { // Nothing found, so use document's language
nsIDocument *doc = mContent->GetOwnerDoc();
if (doc) {
doc->GetHeaderData(nsGkAtoms::headerContentLanguage, aLanguage);
}
mContent->OwnerDoc()->GetHeaderData(nsGkAtoms::headerContentLanguage,
aLanguage);
}
return NS_OK;

View File

@ -152,7 +152,7 @@ public:
virtual nsINode* GetNode() const { return mContent; }
nsIContent* GetContent() const { return mContent; }
virtual nsIDocument* GetDocumentNode() const
{ return mContent ? mContent->GetOwnerDoc() : nsnull; }
{ return mContent ? mContent->OwnerDoc() : nsnull; }
/**
* Return node type information of DOM node associated with the accessible.

View File

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
// NOTE: alphabetically ordered
#include "nsAccessibilityService.h"
#include "nsCoreUtils.h"
@ -111,6 +113,7 @@
#include "mozilla/FunctionTimer.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
@ -654,7 +657,7 @@ nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
NS_IMETHODIMP
nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
{
if ( aRole >= NS_ARRAY_LENGTH(kRoleNames)) {
if ( aRole >= ArrayLength(kRoleNames)) {
aString.AssignLiteral("unknown");
return NS_OK;
}
@ -785,10 +788,10 @@ NS_IMETHODIMP
nsAccessibilityService::GetStringEventType(PRUint32 aEventType,
nsAString& aString)
{
NS_ASSERTION(nsIAccessibleEvent::EVENT_LAST_ENTRY == NS_ARRAY_LENGTH(kEventTypeNames),
NS_ASSERTION(nsIAccessibleEvent::EVENT_LAST_ENTRY == ArrayLength(kEventTypeNames),
"nsIAccessibleEvent constants are out of sync to kEventTypeNames");
if (aEventType >= NS_ARRAY_LENGTH(kEventTypeNames)) {
if (aEventType >= ArrayLength(kEventTypeNames)) {
aString.AssignLiteral("unknown");
return NS_OK;
}
@ -802,7 +805,7 @@ NS_IMETHODIMP
nsAccessibilityService::GetStringRelationType(PRUint32 aRelationType,
nsAString& aString)
{
if (aRelationType >= NS_ARRAY_LENGTH(kRelationTypeNames)) {
if (aRelationType >= ArrayLength(kRelationTypeNames)) {
aString.AssignLiteral("unknown");
return NS_OK;
}
@ -861,7 +864,7 @@ nsAccessibilityService::GetAccessible(nsINode* aNode)
{
NS_PRECONDITION(aNode, "Getting an accessible for null node! Crash.");
nsDocAccessible* document = GetDocAccessible(aNode->GetOwnerDoc());
nsDocAccessible* document = GetDocAccessible(aNode->OwnerDoc());
return document ? document->GetAccessible(aNode) : nsnull;
}
@ -873,7 +876,7 @@ nsAccessibilityService::GetAccessibleOrContainer(nsINode* aNode,
return nsnull;
// XXX: weak shell is ignored until multiple shell documents are supported.
nsDocAccessible* document = GetDocAccessible(aNode->GetOwnerDoc());
nsDocAccessible* document = GetDocAccessible(aNode->OwnerDoc());
return document ? document->GetAccessibleOrContainer(aNode) : nsnull;
}
@ -881,24 +884,24 @@ static bool HasRelatedContent(nsIContent *aContent)
{
nsAutoString id;
if (!aContent || !nsCoreUtils::GetID(aContent, id) || id.IsEmpty()) {
return PR_FALSE;
return false;
}
// If the given ID is referred by relation attribute then create an accessible
// for it. Take care of HTML elements only for now.
if (aContent->IsHTML() &&
nsAccUtils::GetDocAccessibleFor(aContent)->IsDependentID(id))
return PR_TRUE;
return true;
nsIContent *ancestorContent = aContent;
while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
if (ancestorContent->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant)) {
// ancestor has activedescendant property, this content could be active
return PR_TRUE;
return true;
}
}
return PR_FALSE;
return false;
}
nsAccessible*
@ -933,7 +936,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
return nsnull;
}
if (aNode->GetOwnerDoc() != aPresShell->GetDocument()) {
if (aNode->OwnerDoc() != aPresShell->GetDocument()) {
NS_ERROR("Creating accessible for wrong pres shell");
return nsnull;
}
@ -980,7 +983,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
#endif
nsDocAccessible* docAcc =
GetAccService()->GetDocAccessible(aNode->GetOwnerDoc());
GetAccService()->GetDocAccessible(aNode->OwnerDoc());
if (!docAcc) {
NS_NOTREACHED("Node has no host document accessible!");
return nsnull;
@ -1099,20 +1102,20 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
}
// otherwise create ARIA based accessible.
tryTagNameOrFrame = PR_FALSE;
tryTagNameOrFrame = false;
break;
}
if (tableContent->Tag() == nsGkAtoms::table) {
// Stop before we are fooled by any additional table ancestors
// This table cell frameis part of a separate ancestor table.
tryTagNameOrFrame = PR_FALSE;
tryTagNameOrFrame = false;
break;
}
}
if (!tableContent)
tryTagNameOrFrame = PR_FALSE;
tryTagNameOrFrame = false;
}
if (roleMapEntry) {
@ -1227,21 +1230,21 @@ nsAccessibilityService::Init()
{
// Initialize accessible document manager.
if (!nsAccDocManager::Init())
return PR_FALSE;
return false;
// Add observers.
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (!observerService)
return PR_FALSE;
return false;
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
// Initialize accessibility.
nsAccessNodeWrap::InitAccessibility();
gIsShutdown = PR_FALSE;
return PR_TRUE;
gIsShutdown = false;
return true;
}
void
@ -1263,7 +1266,7 @@ nsAccessibilityService::Shutdown()
NS_ASSERTION(!gIsShutdown, "Accessibility was shutdown already");
gIsShutdown = PR_TRUE;
gIsShutdown = true;
nsAccessNodeWrap::ShutdownAccessibility();
}

View File

@ -273,7 +273,7 @@ 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
* @return PR_TRUE if there is a universal ARIA property set on the node
* @return true if there is a universal ARIA property set on the node
*/
bool HasUniversalAriaProperty(nsIContent *aContent);

View File

@ -272,7 +272,7 @@ nsAccessible::GetName(nsAString& aName)
}
if (rv != NS_OK_EMPTY_NAME)
aName.SetIsVoid(PR_TRUE);
aName.SetIsVoid(true);
return NS_OK;
}
@ -542,7 +542,7 @@ nsAccessible::GetChildren(nsIArray **aOutChildren)
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsIAccessible* child = GetChildAt(childIdx);
children->AppendElement(child, PR_FALSE);
children->AppendElement(child, false);
}
NS_ADDREF(*aOutChildren = children);
@ -552,7 +552,7 @@ nsAccessible::GetChildren(nsIArray **aOutChildren)
bool
nsAccessible::GetAllowsAnonChildAccessibles()
{
return PR_TRUE;
return true;
}
/* readonly attribute long childCount; */
@ -597,25 +597,25 @@ nsAccessible::IsVisible(bool* aIsOffscreen)
// otherwise it will be marked states::OFFSCREEN. The states::INVISIBLE flag
// is for elements which are programmatically hidden.
*aIsOffscreen = PR_TRUE;
*aIsOffscreen = true;
if (IsDefunct())
return PR_FALSE;
return false;
const PRUint16 kMinPixels = 12;
// Set up the variables we need, return false if we can't get at them all
nsCOMPtr<nsIPresShell> shell(GetPresShell());
if (!shell)
return PR_FALSE;
return false;
nsIFrame *frame = GetFrame();
if (!frame) {
return PR_FALSE;
return false;
}
// If visibility:hidden or visibility:collapsed then mark with STATE_INVISIBLE
if (!frame->GetStyleVisibility()->IsVisible())
{
return PR_FALSE;
return false;
}
// We don't use the more accurate GetBoundsRect, because that is more expensive
@ -649,14 +649,14 @@ nsAccessible::IsVisible(bool* aIsOffscreen)
if (isEmpty && !(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
// Consider zero area objects hidden unless they are absolutely positioned
// or floating and may have descendants that have a non-zero size
return PR_FALSE;
return false;
}
}
// The frame intersects the viewport, but we need to check the parent view chain :(
bool isVisible = nsCoreUtils::CheckVisibilityInParentChain(frame);
if (isVisible && rectVisibility == nsRectVisibility_kVisible) {
*aIsOffscreen = PR_FALSE;
*aIsOffscreen = false;
}
return isVisible;
}
@ -1036,10 +1036,10 @@ NS_IMETHODIMP nsAccessible::SetSelected(bool aSelect)
if (aSelect) {
return mContent->SetAttr(kNameSpaceID_None,
nsGkAtoms::aria_selected,
NS_LITERAL_STRING("true"), PR_TRUE);
NS_LITERAL_STRING("true"), true);
}
return mContent->UnsetAttr(kNameSpaceID_None,
nsGkAtoms::aria_selected, PR_TRUE);
nsGkAtoms::aria_selected, true);
}
}
@ -1060,7 +1060,7 @@ NS_IMETHODIMP nsAccessible::TakeSelection()
nsCOMPtr<nsIAccessibleSelectable> selectable = do_QueryInterface(multiSelect);
selectable->ClearSelection();
}
return SetSelected(PR_TRUE);
return SetSelected(true);
}
return NS_ERROR_FAILURE;
@ -1099,7 +1099,7 @@ nsAccessible::TakeFocus()
focusContent = ancestorContent;
focusContent->SetAttr(kNameSpaceID_None,
nsGkAtoms::aria_activedescendant,
id, PR_TRUE);
id, true);
}
}
}
@ -1376,7 +1376,7 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
// However, nodes in outer documents override nodes in inner documents:
// Outer doc author may want to override properties on a widget they used in an iframe
nsIContent *startContent = mContent;
while (PR_TRUE) {
while (true) {
NS_ENSURE_STATE(startContent);
nsIDocument *doc = startContent->GetDocument();
nsIContent* rootContent = nsCoreUtils::GetRoleContent(doc);
@ -1748,7 +1748,7 @@ nsAccessible::SetCurrentValue(double aValue)
nsAutoString newValue;
newValue.AppendFloat(aValue);
return mContent->SetAttr(kNameSpaceID_None,
nsGkAtoms::aria_valuenow, newValue, PR_TRUE);
nsGkAtoms::aria_valuenow, newValue, true);
}
/* void setName (in DOMString name); */
@ -2101,7 +2101,7 @@ nsAccessible::RelationByType(PRUint32 aType)
} else {
// In XUL, use first <button default="true" .../> in the document
nsCOMPtr<nsIDOMXULDocument> xulDoc =
do_QueryInterface(mContent->GetOwnerDoc());
do_QueryInterface(mContent->OwnerDoc());
nsCOMPtr<nsIDOMXULButtonElement> buttonEl;
if (xulDoc) {
nsCOMPtr<nsIDOMNodeList> possibleDefaultButtons;
@ -2176,7 +2176,7 @@ nsAccessible::GetRelations(nsIArray **aRelations)
PRUint32 targets = 0;
relation->GetTargetsCount(&targets);
if (targets)
relations->AppendElement(relation, PR_FALSE);
relations->AppendElement(relation, false);
}
}
@ -2302,7 +2302,7 @@ NS_IMETHODIMP nsAccessible::RemoveChildFromSelection(PRInt32 aIndex)
NS_IMETHODIMP nsAccessible::IsChildSelected(PRInt32 aIndex, bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct() || !IsSelect())
return NS_ERROR_FAILURE;
@ -2327,7 +2327,7 @@ NS_IMETHODIMP
nsAccessible::SelectAllSelection(bool* aIsMultiSelect)
{
NS_ENSURE_ARG_POINTER(aIsMultiSelect);
*aIsMultiSelect = PR_FALSE;
*aIsMultiSelect = false;
if (IsDefunct() || !IsSelect())
return NS_ERROR_FAILURE;
@ -2420,7 +2420,7 @@ NS_IMETHODIMP
nsAccessible::GetValid(bool *aValid)
{
NS_ENSURE_ARG_POINTER(aValid);
*aValid = PR_FALSE;
*aValid = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -2434,7 +2434,7 @@ NS_IMETHODIMP
nsAccessible::GetSelected(bool *aSelected)
{
NS_ENSURE_ARG_POINTER(aSelected);
*aSelected = PR_FALSE;
*aSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -2569,26 +2569,26 @@ bool
nsAccessible::AppendChild(nsAccessible* aChild)
{
if (!aChild)
return PR_FALSE;
return false;
if (!mChildren.AppendElement(aChild))
return PR_FALSE;
return false;
if (!nsAccUtils::IsEmbeddedObject(aChild))
SetChildrenFlag(eMixedChildren);
aChild->BindToParent(this, mChildren.Length() - 1);
return PR_TRUE;
return true;
}
bool
nsAccessible::InsertChildAt(PRUint32 aIndex, nsAccessible* aChild)
{
if (!aChild)
return PR_FALSE;
return false;
if (!mChildren.InsertElementAt(aIndex, aChild))
return PR_FALSE;
return false;
for (PRUint32 idx = aIndex + 1; idx < mChildren.Length(); idx++) {
NS_ASSERTION(mChildren[idx]->mIndexInParent == idx - 1, "Accessible child index doesn't match");
@ -2601,23 +2601,23 @@ nsAccessible::InsertChildAt(PRUint32 aIndex, nsAccessible* aChild)
mEmbeddedObjCollector = nsnull;
aChild->BindToParent(this, aIndex);
return PR_TRUE;
return true;
}
bool
nsAccessible::RemoveChild(nsAccessible* aChild)
{
if (!aChild)
return PR_FALSE;
return false;
if (aChild->mParent != this || aChild->mIndexInParent == -1)
return PR_FALSE;
return false;
PRUint32 index = static_cast<PRUint32>(aChild->mIndexInParent);
if (index >= mChildren.Length() || mChildren[index] != aChild) {
NS_ERROR("Child is bound to parent but parent hasn't this child at its index!");
aChild->UnbindFromParent();
return PR_FALSE;
return false;
}
for (PRUint32 idx = index + 1; idx < mChildren.Length(); idx++) {
@ -2629,7 +2629,7 @@ nsAccessible::RemoveChild(nsAccessible* aChild)
mChildren.RemoveElementAt(index);
mEmbeddedObjCollector = nsnull;
return PR_TRUE;
return true;
}
nsAccessible*
@ -2769,7 +2769,7 @@ nsAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
mContent->GetAttr(kNameSpaceID_XLink, nsGkAtoms::href, href);
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsCOMPtr<nsIDocument> document = mContent->GetOwnerDoc();
nsCOMPtr<nsIDocument> document = mContent->OwnerDoc();
nsIURI* anchorURI = nsnull;
NS_NewURI(&anchorURI, href,
document ? document->GetDocumentCharacterSet().get() : nsnull,
@ -2808,7 +2808,7 @@ nsAccessible::SelectedItems()
AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
nsIAccessible* selected = nsnull;
while ((selected = iter.Next()))
selectedItems->AppendElement(selected, PR_FALSE);
selectedItems->AppendElement(selected, false);
nsIMutableArray* items = nsnull;
selectedItems.forget(&items);
@ -2863,7 +2863,7 @@ nsAccessible::AddItemToSelection(PRUint32 aIndex)
index++;
if (selected)
selected->SetSelected(PR_TRUE);
selected->SetSelected(true);
return static_cast<bool>(selected);
}
@ -2878,7 +2878,7 @@ nsAccessible::RemoveItemFromSelection(PRUint32 aIndex)
index++;
if (selected)
selected->SetSelected(PR_FALSE);
selected->SetSelected(false);
return static_cast<bool>(selected);
}
@ -2892,7 +2892,7 @@ nsAccessible::SelectAll()
AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
while((selectable = iter.Next())) {
success = true;
selectable->SetSelected(PR_TRUE);
selectable->SetSelected(true);
}
return success;
}
@ -2906,7 +2906,7 @@ nsAccessible::UnselectAll()
AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
while ((selected = iter.Next())) {
success = true;
selected->SetSelected(PR_FALSE);
selected->SetSelected(false);
}
return success;
}
@ -2942,7 +2942,7 @@ nsAccessible::CurrentItem()
nsAutoString id;
if (mContent->GetAttr(kNameSpaceID_None,
nsGkAtoms::aria_activedescendant, id)) {
nsIDocument* DOMDoc = mContent->GetOwnerDoc();
nsIDocument* DOMDoc = mContent->OwnerDoc();
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
if (activeDescendantElm) {
nsDocAccessible* document = GetDocAccessible();
@ -3057,7 +3057,7 @@ nsAccessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
if (accessible)
return accessible;
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aStartNode->GetOwnerDoc());
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aStartNode->OwnerDoc());
NS_ENSURE_TRUE(domDoc, nsnull);
nsCOMPtr<nsIDOMNode> currentNode = do_QueryInterface(aStartNode);
@ -3065,7 +3065,7 @@ nsAccessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
nsCOMPtr<nsIDOMTreeWalker> walker;
domDoc->CreateTreeWalker(rootNode,
nsIDOMNodeFilter::SHOW_ELEMENT | nsIDOMNodeFilter::SHOW_TEXT,
nsnull, PR_FALSE, getter_AddRefs(walker));
nsnull, false, getter_AddRefs(walker));
NS_ENSURE_TRUE(walker, nsnull);
walker->SetCurrentNode(currentNode);

View File

@ -318,7 +318,7 @@ bool
nsApplicationAccessible::Init()
{
mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
return PR_TRUE;
return true;
}
void

View File

@ -95,8 +95,8 @@ nsLinkableAccessible::
nsLinkableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsAccessibleWrap(aContent, aShell),
mActionAcc(nsnull),
mIsLink(PR_FALSE),
mIsOnclick(PR_FALSE)
mIsLink(false),
mIsOnclick(false)
{
}
@ -186,8 +186,8 @@ nsLinkableAccessible::AccessKey() const
void
nsLinkableAccessible::Shutdown()
{
mIsLink = PR_FALSE;
mIsOnclick = PR_FALSE;
mIsLink = false;
mIsOnclick = false;
mActionAcc = nsnull;
nsAccessibleWrap::Shutdown();
}
@ -220,11 +220,11 @@ nsLinkableAccessible::BindToParent(nsAccessible* aParent,
// Cache action content.
mActionAcc = nsnull;
mIsLink = PR_FALSE;
mIsOnclick = PR_FALSE;
mIsLink = false;
mIsOnclick = false;
if (nsCoreUtils::HasClickListener(mContent)) {
mIsOnclick = PR_TRUE;
mIsOnclick = true;
return;
}
@ -235,14 +235,14 @@ nsLinkableAccessible::BindToParent(nsAccessible* aParent,
while ((walkUpAcc = walkUpAcc->Parent()) && !walkUpAcc->IsDoc()) {
if (walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
walkUpAcc->State() & states::LINKED) {
mIsLink = PR_TRUE;
mIsLink = true;
mActionAcc = walkUpAcc;
return;
}
if (nsCoreUtils::HasClickListener(walkUpAcc->GetContent())) {
mActionAcc = walkUpAcc;
mIsOnclick = PR_TRUE;
mIsOnclick = true;
return;
}
}

View File

@ -226,6 +226,10 @@ nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
printf("\nSelection changed, selection type: %s, notification %s\n",
(isNormalSelection ? "normal" : "spellcheck"),
(isIgnored ? "ignored" : "pending"));
} else {
bool isIgnored = !document || !document->IsContentLoaded();
printf("\nSelection changed, selection type: unknown, notification %s\n",
(isIgnored ? "ignored" : "pending"));
}
#endif
@ -382,11 +386,7 @@ nsCaretAccessible::GetSelectionControllerForNode(nsIContent *aContent)
if (!aContent)
return nsnull;
nsIDocument *document = aContent->GetOwnerDoc();
if (!document)
return nsnull;
nsIPresShell *presShell = document->GetShell();
nsIPresShell *presShell = aContent->OwnerDoc()->GetShell();
if (!presShell)
return nsnull;

View File

@ -77,9 +77,9 @@ static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
bool
nsCoreUtils::HasClickListener(nsIContent *aContent)
{
NS_ENSURE_TRUE(aContent, PR_FALSE);
NS_ENSURE_TRUE(aContent, false);
nsEventListenerManager* listenerManager =
aContent->GetListenerManager(PR_FALSE);
aContent->GetListenerManager(false);
return listenerManager &&
(listenerManager->HasListenersFor(NS_LITERAL_STRING("click")) ||
@ -157,13 +157,13 @@ nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType,
{
nsIFrame *frame = aContent->GetPrimaryFrame();
if (!frame)
return PR_FALSE;
return false;
// Compute x and y coordinates.
nsPoint point;
nsCOMPtr<nsIWidget> widget = frame->GetNearestWidget(point);
if (!widget)
return PR_FALSE;
return false;
nsSize size = frame->GetSize();
@ -174,7 +174,7 @@ nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType,
// Fire mouse event.
DispatchMouseEvent(aEventType, x, y, aContent, frame, aPresShell, widget);
return PR_TRUE;
return true;
}
void
@ -182,7 +182,7 @@ nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType, PRInt32 aX, PRInt32 aY,
nsIContent *aContent, nsIFrame *aFrame,
nsIPresShell *aPresShell, nsIWidget *aRootWidget)
{
nsMouseEvent event(PR_TRUE, aEventType, aRootWidget,
nsMouseEvent event(true, aEventType, aRootWidget,
nsMouseEvent::eReal, nsMouseEvent::eNormal);
event.refPoint = nsIntPoint(aX, aY);
@ -207,11 +207,7 @@ nsCoreUtils::GetAccessKeyFor(nsIContent *aContent)
if (!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::accesskey))
return 0;
nsCOMPtr<nsIDocument> doc = aContent->GetOwnerDoc();
if (!doc)
return 0;
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
nsCOMPtr<nsIPresShell> presShell = aContent->OwnerDoc()->GetShell();
if (!presShell)
return 0;
@ -285,16 +281,16 @@ nsCoreUtils::IsAncestorOf(nsINode *aPossibleAncestorNode,
nsINode *aPossibleDescendantNode,
nsINode *aRootNode)
{
NS_ENSURE_TRUE(aPossibleAncestorNode && aPossibleDescendantNode, PR_FALSE);
NS_ENSURE_TRUE(aPossibleAncestorNode && aPossibleDescendantNode, false);
nsINode *parentNode = aPossibleDescendantNode;
while ((parentNode = parentNode->GetNodeParent()) &&
parentNode != aRootNode) {
if (parentNode == aPossibleAncestorNode)
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
nsresult
@ -340,7 +336,7 @@ nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
selection->AddRange(scrollToRange);
privSel->ScrollIntoView(nsISelectionController::SELECTION_ANCHOR_REGION,
PR_TRUE, aVPercent, aHPercent);
true, aVPercent, aHPercent);
selection->CollapseToStart();
@ -439,11 +435,7 @@ nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode)
if (!aNode)
return nsnull;
nsIDocument *doc = aNode->GetOwnerDoc();
NS_ASSERTION(doc, "No document for node passed in");
NS_ENSURE_TRUE(doc, nsnull);
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsISupports> container = aNode->OwnerDoc()->GetContainer();
nsIDocShellTreeItem *docShellTreeItem = nsnull;
if (container)
CallQueryInterface(container, &docShellTreeItem);
@ -505,7 +497,7 @@ nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
bool isAboutScheme = false;
uri->SchemeIs("about", &isAboutScheme);
if (!isAboutScheme)
return PR_FALSE;
return false;
nsCAutoString path;
uri->GetPath(path);
@ -551,7 +543,7 @@ bool
nsCoreUtils::GetID(nsIContent *aContent, nsAString& aID)
{
nsIAtom *idAttribute = aContent->GetIDAttributeName();
return idAttribute ? aContent->GetAttr(kNameSpaceID_None, idAttribute, aID) : PR_FALSE;
return idAttribute ? aContent->GetAttr(kNameSpaceID_None, idAttribute, aID) : false;
}
bool
@ -564,18 +556,18 @@ nsCoreUtils::GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr, PRInt32 *aUInt)
PRInt32 integer = value.ToInteger(&error);
if (NS_SUCCEEDED(error) && integer > 0) {
*aUInt = integer;
return PR_TRUE;
return true;
}
}
return PR_FALSE;
return false;
}
bool
nsCoreUtils::IsXLink(nsIContent *aContent)
{
if (!aContent)
return PR_FALSE;
return false;
return aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
nsGkAtoms::simple, eCaseMatters) &&
@ -603,11 +595,8 @@ nsCoreUtils::GetComputedStyleDeclaration(const nsAString& aPseudoElt,
return nsnull;
// Returns number of items in style declaration
nsIDocument* document = content->GetOwnerDoc();
if (!document)
return nsnull;
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(document->GetWindow());
nsCOMPtr<nsIDOMWindow> window =
do_QueryInterface(content->OwnerDoc()->GetWindow());
if (!window)
return nsnull;

View File

@ -150,7 +150,7 @@ public:
* aPossibleAncestorNode
* @param aRootNode [in, optional] the root node that search
* search should be performed within
* @return PR_TRUE if aPossibleAncestorNode is an ancestor of
* @return true if aPossibleAncestorNode is an ancestor of
* aPossibleDescendantNode
*/
static bool IsAncestorOf(nsINode *aPossibleAncestorNode,
@ -254,8 +254,7 @@ public:
*/
static nsIPresShell *GetPresShellFor(nsINode *aNode)
{
nsIDocument *document = aNode->GetOwnerDoc();
return document ? document->GetShell() : nsnull;
return aNode->OwnerDoc()->GetShell();
}
static already_AddRefed<nsIWeakReference> GetWeakShellFor(nsINode *aNode)
{
@ -274,7 +273,7 @@ public:
* Get the ID for an element, in some types of XML this may not be the ID attribute
* @param aContent Node to get the ID for
* @param aID Where to put ID string
* @return PR_TRUE if there is an ID set for this node
* @return true if there is an ID set for this node
*/
static bool GetID(nsIContent *aContent, nsAString& aID);
@ -289,7 +288,7 @@ public:
* Check if the given element is XLink.
*
* @param aContent the given element
* @return PR_TRUE if the given element is XLink
* @return true if the given element is XLink
*/
static bool IsXLink(nsIContent *aContent);

View File

@ -77,7 +77,7 @@
#include "nsIXULDocument.h"
#endif
namespace dom = mozilla::dom;
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
@ -587,7 +587,7 @@ nsDocAccessible::Init()
nsCOMPtr<nsIPresShell> shell(GetPresShell());
mNotificationController = new NotificationController(this, shell);
if (!mNotificationController)
return PR_FALSE;
return false;
// Mark the document accessible as loaded if its DOM document was loaded at
// this point (this can happen because a11y is started late or DOM document
@ -596,7 +596,7 @@ nsDocAccessible::Init()
mLoadState |= eDOMLoaded;
AddEventListeners();
return PR_TRUE;
return true;
}
void
@ -879,7 +879,7 @@ NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic
// accessible object. See the AccStateChangeEvent constructor for details
// about this exceptional case.
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(this, states::EDITABLE, PR_TRUE);
new AccStateChangeEvent(this, states::EDITABLE, true);
FireDelayedAccessibleEvent(event);
}
@ -1182,7 +1182,7 @@ nsDocAccessible::ARIAActiveDescendantChanged(nsIContent* aElm)
if (FocusMgr()->HasDOMFocus(aElm)) {
nsAutoString id;
if (aElm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
nsIDocument* DOMDoc = aElm->GetOwnerDoc();
nsIDocument* DOMDoc = aElm->OwnerDoc();
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
if (activeDescendantElm) {
nsAccessible* activeDescendant = GetAccessible(activeDescendantElm);
@ -1213,7 +1213,7 @@ void nsDocAccessible::ContentStateChanged(nsIDocument* aDocument,
if (aStateMask.HasState(NS_EVENT_STATE_INVALID)) {
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(aContent, states::INVALID, PR_TRUE);
new AccStateChangeEvent(aContent, states::INVALID, true);
FireDelayedAccessibleEvent(event);
}
}
@ -1492,7 +1492,7 @@ nsDocAccessible::NotifyOfLoading(bool aIsReloading)
// Fire state busy change event. Use delayed event since we don't care
// actually if event isn't delivered when the document goes away like a shot.
nsRefPtr<AccEvent> stateEvent =
new AccStateChangeEvent(mDocument, states::BUSY, PR_TRUE);
new AccStateChangeEvent(mDocument, states::BUSY, true);
FireDelayedAccessibleEvent(stateEvent);
}
@ -1547,7 +1547,7 @@ nsDocAccessible::ProcessLoad()
// Fire busy state change event.
nsRefPtr<AccEvent> stateEvent =
new AccStateChangeEvent(this, states::BUSY, PR_FALSE);
new AccStateChangeEvent(this, states::BUSY, false);
nsEventShell::FireEvent(stateEvent);
}

View File

@ -188,13 +188,13 @@ nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible)
mChildren[0]->Shutdown();
if (!nsAccessible::AppendChild(aAccessible))
return PR_FALSE;
return false;
NS_LOG_ACCDOCCREATE("append document to outerdoc",
aAccessible->GetDocumentNode())
NS_LOG_ACCDOCCREATE_ACCADDRESS("outerdoc", this)
return PR_TRUE;
return true;
}
bool
@ -203,7 +203,7 @@ nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible)
nsAccessible *child = mChildren.SafeElementAt(0, nsnull);
if (child != aAccessible) {
NS_ERROR("Wrong child to remove!");
return PR_FALSE;
return false;
}
NS_LOG_ACCDOCDESTROY_FOR("remove document from outerdoc",

View File

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#define CreateEvent CreateEventA
#include "nsIDOMDocument.h"
@ -83,7 +85,7 @@
#include "nsIXULWindow.h"
#endif
namespace dom = mozilla::dom;
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
@ -255,10 +257,10 @@ nsresult nsRootAccessible::AddEventListeners()
if (nstarget) {
for (const char* const* e = docEvents,
* const* e_end = docEvents + NS_ARRAY_LENGTH(docEvents);
* const* e_end = ArrayEnd(docEvents);
e < e_end; ++e) {
nsresult rv = nstarget->AddEventListener(NS_ConvertASCIItoUTF16(*e),
this, PR_TRUE, PR_TRUE, 2);
this, true, true, 2);
NS_ENSURE_SUCCESS(rv, rv);
}
}
@ -275,9 +277,9 @@ nsresult nsRootAccessible::RemoveEventListeners()
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mDocument));
if (target) {
for (const char* const* e = docEvents,
* const* e_end = docEvents + NS_ARRAY_LENGTH(docEvents);
* const* e_end = ArrayEnd(docEvents);
e < e_end; ++e) {
nsresult rv = target->RemoveEventListener(NS_ConvertASCIItoUTF16(*e), this, PR_TRUE);
nsresult rv = target->RemoveEventListener(NS_ConvertASCIItoUTF16(*e), this, true);
NS_ENSURE_SUCCESS(rv, rv);
}
}
@ -322,7 +324,7 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
return NS_OK;
nsDocAccessible* document =
GetAccService()->GetDocAccessible(origTargetNode->GetOwnerDoc());
GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
if (document) {
#ifdef DEBUG_NOTIFICATIONS
@ -676,7 +678,7 @@ nsRootAccessible::HandlePopupShownEvent(nsAccessible* aAccessible)
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(combobox, states::EXPANDED, PR_TRUE);
new AccStateChangeEvent(combobox, states::EXPANDED, true);
if (event)
nsEventShell::FireEvent(event);
}
@ -782,7 +784,7 @@ nsRootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode)
// Fire expanded state change event.
if (notifyOf & kNotifyOfState) {
nsRefPtr<AccEvent> event =
new AccStateChangeEvent(widget, states::EXPANDED, PR_FALSE);
new AccStateChangeEvent(widget, states::EXPANDED, false);
document->FireDelayedAccessibleEvent(event);
}
}

View File

@ -234,7 +234,7 @@ nsTextAttrsMgr::GetRange(const nsTArray<nsITextAttr*>& aTextAttrArray,
for (PRUint32 attrIdx = 0; attrIdx < attrLen; attrIdx++) {
nsITextAttr *textAttr = aTextAttrArray[attrIdx];
if (!textAttr->Equal(currElm)) {
offsetFound = PR_TRUE;
offsetFound = true;
break;
}
}
@ -262,7 +262,7 @@ nsTextAttrsMgr::GetRange(const nsTArray<nsITextAttr*>& aTextAttrArray,
// Alter the end offset when text attribute changes its value and stop
// the search.
if (!textAttr->Equal(currElm)) {
offsetFound = PR_TRUE;
offsetFound = true;
break;
}
}
@ -336,19 +336,19 @@ nsCSSTextAttr::GetValueFor(nsIContent *aContent, nsAutoString *aValue)
nsCOMPtr<nsIDOMCSSStyleDeclaration> currStyleDecl =
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(), aContent);
if (!currStyleDecl)
return PR_FALSE;
return false;
NS_ConvertASCIItoUTF16 cssName(gCSSTextAttrsMap[mIndex].mCSSName);
nsresult rv = currStyleDecl->GetPropertyValue(cssName, *aValue);
if (NS_FAILED(rv))
return PR_TRUE;
return true;
const char *cssValue = gCSSTextAttrsMap[mIndex].mCSSValue;
if (cssValue != kAnyValue && !aValue->EqualsASCII(cssValue))
return PR_FALSE;
return false;
return PR_TRUE;
return true;
}
void
@ -379,7 +379,7 @@ nsBGColorTextAttr::GetValueFor(nsIContent *aContent, nscolor *aValue)
{
nsIFrame *frame = aContent->GetPrimaryFrame();
if (!frame)
return PR_FALSE;
return false;
return GetColor(frame, aValue);
}
@ -407,20 +407,20 @@ nsBGColorTextAttr::GetColor(nsIFrame *aFrame, nscolor *aColor)
if (NS_GET_A(styleBackground->mBackgroundColor) > 0) {
*aColor = styleBackground->mBackgroundColor;
return PR_TRUE;
return true;
}
nsIFrame *parentFrame = aFrame->GetParent();
if (!parentFrame) {
*aColor = aFrame->PresContext()->DefaultBackgroundColor();
return PR_TRUE;
return true;
}
// Each frame of parents chain for the initially passed 'aFrame' has
// transparent background color. So background color isn't changed from
// 'mRootFrame' to initially passed 'aFrame'.
if (parentFrame == mRootFrame)
return PR_FALSE;
return false;
return GetColor(parentFrame, aColor);
}
@ -436,11 +436,11 @@ nsFontSizeTextAttr::nsFontSizeTextAttr(nsIFrame *aRootFrame, nsIFrame *aFrame) :
mDC = aRootFrame->PresContext()->DeviceContext();
mRootNativeValue = GetFontSize(aRootFrame);
mIsRootDefined = PR_TRUE;
mIsRootDefined = true;
if (aFrame) {
mNativeValue = GetFontSize(aFrame);
mIsDefined = PR_TRUE;
mIsDefined = true;
}
}
@ -449,10 +449,10 @@ nsFontSizeTextAttr::GetValueFor(nsIContent *aContent, nscoord *aValue)
{
nsIFrame *frame = aContent->GetPrimaryFrame();
if (!frame)
return PR_FALSE;
return false;
*aValue = GetFontSize(frame);
return PR_TRUE;
return true;
}
void
@ -493,11 +493,11 @@ nsFontWeightTextAttr::nsFontWeightTextAttr(nsIFrame *aRootFrame,
nsTextAttr<PRInt32>(aFrame == nsnull)
{
mRootNativeValue = GetFontWeight(aRootFrame);
mIsRootDefined = PR_TRUE;
mIsRootDefined = true;
if (aFrame) {
mNativeValue = GetFontWeight(aFrame);
mIsDefined = PR_TRUE;
mIsDefined = true;
}
}
@ -506,10 +506,10 @@ nsFontWeightTextAttr::GetValueFor(nsIContent *aContent, PRInt32 *aValue)
{
nsIFrame *frame = aContent->GetPrimaryFrame();
if (!frame)
return PR_FALSE;
return false;
*aValue = GetFontWeight(frame);
return PR_TRUE;
return true;
}
void

View File

@ -188,10 +188,10 @@ public:
}
if (!isDefined)
return PR_FALSE;
return false;
Format(*nativeValue, aValue);
return PR_TRUE;
return true;
}
virtual bool Equal(nsIContent *aContent)
@ -200,7 +200,7 @@ public:
bool isDefined = GetValueFor(aContent, &nativeValue);
if (!mIsDefined && !isDefined)
return PR_TRUE;
return true;
if (mIsDefined && isDefined)
return nativeValue == mNativeValue;

View File

@ -120,7 +120,7 @@ nsTextEquivUtils::AppendTextEquivFromContent(nsAccessible *aInitiatorAcc,
nsCOMPtr<nsIWeakReference> shell = nsCoreUtils::GetWeakShellFor(aContent);
if (!shell) {
NS_ASSERTION(PR_TRUE, "There is no presshell!");
NS_ASSERTION(true, "There is no presshell!");
gInitiatorAcc = nsnull;
return NS_ERROR_UNEXPECTED;
}
@ -139,7 +139,7 @@ nsTextEquivUtils::AppendTextEquivFromContent(nsAccessible *aInitiatorAcc,
GetAccService()->GetAccessibleInWeakShell(aContent, shell);
if (accessible) {
rv = AppendFromAccessible(accessible, aString);
goThroughDOMSubtree = PR_FALSE;
goThroughDOMSubtree = false;
}
}
@ -167,7 +167,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
const nsStyleDisplay* display = frame->GetStyleDisplay();
if (display->IsBlockOutside() ||
display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL) {
isHTMLBlock = PR_TRUE;
isHTMLBlock = true;
if (!aString->IsEmpty()) {
aString->Append(PRUnichar(' '));
}
@ -250,7 +250,7 @@ nsTextEquivUtils::AppendFromAccessible(nsAccessible *aAccessible,
NS_ENSURE_SUCCESS(rv, rv);
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
isEmptyTextEquiv = PR_FALSE;
isEmptyTextEquiv = false;
// Implementation of g) step of text equivalent computation guide. Go down
// into subtree if accessible allows "text equivalent from subtree rule" or
@ -262,7 +262,7 @@ nsTextEquivUtils::AppendFromAccessible(nsAccessible *aAccessible,
NS_ENSURE_SUCCESS(rv, rv);
if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
isEmptyTextEquiv = PR_FALSE;
isEmptyTextEquiv = false;
}
}
@ -382,13 +382,13 @@ nsTextEquivUtils::AppendString(nsAString *aString,
{
// Insert spaces to insure that words from controls aren't jammed together.
if (aTextEquivalent.IsEmpty())
return PR_FALSE;
return false;
if (!aString->IsEmpty())
aString->Append(PRUnichar(' '));
aString->Append(aTextEquivalent);
return PR_TRUE;
return true;
}
bool

View File

@ -201,7 +201,7 @@ nsHTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
if (form) {
form->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs));
} else {
nsIDocument* doc = mContent->GetOwnerDoc();
nsIDocument* doc = mContent->OwnerDoc();
nsCOMPtr<nsIDOMDocument> document(do_QueryInterface(doc));
if (document)
document->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs));

View File

@ -167,7 +167,7 @@ nsHTMLImageAccessible::DoAction(PRUint8 aIndex)
nsresult rv = element->GetLongDesc(longDesc);
NS_ENSURE_SUCCESS(rv, rv);
nsIDocument* document = mContent->GetOwnerDoc();
nsIDocument* document = mContent->OwnerDoc();
nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow();
nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(piWindow);
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
@ -225,7 +225,7 @@ bool
nsHTMLImageAccessible::HasLongDesc()
{
if (IsDefunct())
return PR_FALSE;
return false;
return mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc);
}
@ -234,7 +234,7 @@ bool
nsHTMLImageAccessible::IsValidLongDescIndex(PRUint8 aIndex)
{
if (!HasLongDesc())
return PR_FALSE;
return false;
return aIndex == nsLinkableAccessible::ActionCount();
}

View File

@ -182,7 +182,7 @@ bool
nsHTMLLinkAccessible::IsLinked()
{
if (IsDefunct())
return PR_FALSE;
return false;
nsEventStates state = mContent->AsElement()->State();
return state.HasAtLeastOneOfStates(NS_EVENT_STATE_VISITED |

View File

@ -356,7 +356,7 @@ nsHTMLSelectOptionAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
if (childContent->NodeInfo()->Equals(mContent->NodeInfo())) {
if (!isContentFound) {
if (childContent == mContent)
isContentFound = PR_TRUE;
isContentFound = true;
posInSet++;
}

View File

@ -248,7 +248,7 @@ NS_IMETHODIMP
nsHTMLTableCellAccessible::IsSelected(bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -328,7 +328,7 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
if (headerCell && headerCell->Role() == desiredRole)
headerCells->AppendElement(static_cast<nsIAccessible*>(headerCell),
PR_FALSE);
false);
} while ((headerCellElm = iter.NextElem()));
NS_ADDREF(*aHeaderCells = headerCells);
@ -700,7 +700,7 @@ nsHTMLTableAccessible::GetSelectedCells(nsIArray **aCells)
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
nsAccessible *cell =
GetAccService()->GetAccessibleInWeakShell(cellContent, mWeakShell);
selCells->AppendElement(static_cast<nsIAccessible*>(cell), PR_FALSE);
selCells->AppendElement(static_cast<nsIAccessible*>(cell), false);
}
}
}
@ -751,10 +751,10 @@ nsHTMLTableAccessible::GetSelectedCellIndices(PRUint32 *aNumCells,
if (NS_SUCCEEDED(rv) && startRowIndex == rowIndex &&
startColIndex == columnIndex && isSelected) {
states[index] = PR_TRUE;
states[index] = true;
(*aNumCells)++;
} else {
states[index] = PR_FALSE;
states[index] = false;
}
}
}
@ -1015,7 +1015,7 @@ NS_IMETHODIMP
nsHTMLTableAccessible::IsColumnSelected(PRInt32 aColumn, bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
PRInt32 colCount = 0;
nsresult rv = GetColumnCount(&colCount);
@ -1045,7 +1045,7 @@ NS_IMETHODIMP
nsHTMLTableAccessible::IsRowSelected(PRInt32 aRow, bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
PRInt32 rowCount = 0;
nsresult rv = GetRowCount(&rowCount);
@ -1076,7 +1076,7 @@ nsHTMLTableAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
nsITableLayout *tableLayout = GetTableLayout();
NS_ENSURE_STATE(tableLayout);
@ -1104,7 +1104,7 @@ nsHTMLTableAccessible::SelectRow(PRInt32 aRow)
nsresult rv =
RemoveRowsOrColumnsFromSelection(aRow,
nsISelectionPrivate::TABLESELECTION_ROW,
PR_TRUE);
true);
NS_ENSURE_SUCCESS(rv, rv);
return AddRowOrColumnToSelection(aRow,
@ -1120,7 +1120,7 @@ nsHTMLTableAccessible::SelectColumn(PRInt32 aColumn)
nsresult rv =
RemoveRowsOrColumnsFromSelection(aColumn,
nsISelectionPrivate::TABLESELECTION_COLUMN,
PR_TRUE);
true);
NS_ENSURE_SUCCESS(rv, rv);
return AddRowOrColumnToSelection(aColumn,
@ -1136,7 +1136,7 @@ nsHTMLTableAccessible::UnselectRow(PRInt32 aRow)
return
RemoveRowsOrColumnsFromSelection(aRow,
nsISelectionPrivate::TABLESELECTION_ROW,
PR_FALSE);
false);
}
NS_IMETHODIMP
@ -1148,7 +1148,7 @@ nsHTMLTableAccessible::UnselectColumn(PRInt32 aColumn)
return
RemoveRowsOrColumnsFromSelection(aColumn,
nsISelectionPrivate::TABLESELECTION_COLUMN,
PR_FALSE);
false);
}
nsresult
@ -1305,29 +1305,29 @@ nsHTMLTableAccessible::HasDescendant(const nsAString& aTagName,
bool aAllowEmpty)
{
nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mContent));
NS_ENSURE_TRUE(tableElt, PR_FALSE);
NS_ENSURE_TRUE(tableElt, false);
nsCOMPtr<nsIDOMNodeList> nodeList;
tableElt->GetElementsByTagName(aTagName, getter_AddRefs(nodeList));
NS_ENSURE_TRUE(nodeList, PR_FALSE);
NS_ENSURE_TRUE(nodeList, false);
nsCOMPtr<nsIDOMNode> foundItem;
nodeList->Item(0, getter_AddRefs(foundItem));
if (!foundItem)
return PR_FALSE;
return false;
if (aAllowEmpty)
return PR_TRUE;
return true;
// Make sure that the item we found has contents and either has multiple
// children or the found item is not a whitespace-only text node.
nsCOMPtr<nsIContent> foundItemContent = do_QueryInterface(foundItem);
if (foundItemContent->GetChildCount() > 1)
return PR_TRUE; // Treat multiple child nodes as non-empty
return true; // Treat multiple child nodes as non-empty
nsIContent *innerItemContent = foundItemContent->GetChildAt(0);
if (innerItemContent && !innerItemContent->TextIsOnlyWhitespace())
return PR_TRUE;
return true;
// If we found more than one node then return true not depending on
// aAllowEmpty flag.
@ -1387,6 +1387,12 @@ nsHTMLTableAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
RETURN_LAYOUT_ANSWER(false, "Has role attribute, weak role, and role is table");
}
// Check if datatable attribute has "0" value.
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::datatable,
NS_LITERAL_STRING("0"), eCaseMatters)) {
RETURN_LAYOUT_ANSWER(true, "Has datatable = 0 attribute, it's for layout");
}
// Check for legitimate data table attributes.
nsAutoString summary;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, summary) &&
@ -1493,7 +1499,7 @@ nsHTMLTableAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
lastRowColor = color;
styleDecl->GetPropertyValue(NS_LITERAL_STRING("background-color"), color);
if (rowCount > 0 && PR_FALSE == lastRowColor.Equals(color)) {
if (rowCount > 0 && false == lastRowColor.Equals(color)) {
RETURN_LAYOUT_ANSWER(false, "2 styles of row background color, non-bordered");
}
}

View File

@ -46,6 +46,7 @@
#include "nsIClipboard.h"
#include "nsContentCID.h"
#include "nsFocusManager.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMDocument.h"
#include "nsIDOMRange.h"
@ -215,7 +216,7 @@ nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 a
PRInt32 startContentOffsetInFrame;
// Get the right frame continuation -- not really a child, but a sibling of
// the primary frame passed in
rv = aFrame->GetChildFrameContainingOffset(startContentOffset, PR_FALSE,
rv = aFrame->GetChildFrameContainingOffset(startContentOffset, false,
&startContentOffsetInFrame, &frame);
NS_ENSURE_SUCCESS(rv, screenRect);
@ -366,7 +367,7 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
else {
contentOffset = startOffset;
}
frame->GetChildFrameContainingOffset(contentOffset, PR_TRUE,
frame->GetChildFrameContainingOffset(contentOffset, true,
&outStartLineUnused, &frame);
if (aEndFrame) {
*aEndFrame = frame; // We ended in the current frame
@ -929,7 +930,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
break;
case BOUNDARY_WORD_START:
needsStart = PR_TRUE;
needsStart = true;
amount = eSelectWord;
break;
@ -941,7 +942,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
// Newlines are considered at the end of a line. Since getting
// the BOUNDARY_LINE_START gets the text from the line-start to the next
// line-start, the newline is included at the end of the string.
needsStart = PR_TRUE;
needsStart = true;
amount = eSelectLine;
break;
@ -954,7 +955,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
case BOUNDARY_ATTRIBUTE_RANGE:
{
nsresult rv = GetTextAttributes(PR_FALSE, aOffset,
nsresult rv = GetTextAttributes(false, aOffset,
aStartOffset, aEndOffset, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
@ -1136,7 +1137,7 @@ nsHyperTextAccessible::GetTextAttributes(bool aIncludeDefAttrs,
// default attributes if they were requested, otherwise return empty set.
if (aOffset == 0) {
if (aIncludeDefAttrs) {
nsTextAttrsMgr textAttrsMgr(this, PR_TRUE, nsnull, -1);
nsTextAttrsMgr textAttrsMgr(this, true, nsnull, -1);
return textAttrsMgr.GetAttributes(*aAttributes);
}
return NS_OK;
@ -1193,7 +1194,7 @@ nsHyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties **aAttri
NS_ADDREF(*aAttributes = attributes);
nsTextAttrsMgr textAttrsMgr(this, PR_TRUE);
nsTextAttrsMgr textAttrsMgr(this, true);
return textAttrsMgr.GetAttributes(*aAttributes);
}
@ -1352,7 +1353,7 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
if (pointInFrame.x < frameSize.width && pointInFrame.y < frameSize.height) {
// Finished
if (frame->GetType() == nsGkAtoms::textFrame) {
nsIFrame::ContentOffsets contentOffsets = frame->GetContentOffsetsFromPointExternal(pointInFrame, PR_TRUE);
nsIFrame::ContentOffsets contentOffsets = frame->GetContentOffsetsFromPointExternal(pointInFrame, true);
if (contentOffsets.IsNull() || contentOffsets.content != content) {
return NS_OK; // Not found, will return -1
}
@ -1595,11 +1596,20 @@ nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
domSel->RemoveRange(range);
}
// XXX I'm not sure this can do synchronous scrolling. If the last param is
// set to true, this calling might flush the pending reflow. See bug 418470.
return frameSelection->ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL,
nsISelectionController::SELECTION_FOCUS_REGION,
0);
// Now that selection is done, move the focus to the selection.
nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
if (DOMFocusManager) {
nsCOMPtr<nsIPresShell> shell = GetPresShell();
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc = shell->GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMWindow> window = doc->GetWindow();
nsCOMPtr<nsIDOMElement> result;
DOMFocusManager->MoveFocus(window, nsnull, nsIFocusManager::MOVEFOCUS_CARET,
nsIFocusManager::FLAG_BYMOVEFOCUS, getter_AddRefs(result));
}
return NS_OK;
}
NS_IMETHODIMP
@ -1728,7 +1738,7 @@ already_AddRefed<nsFrameSelection>
nsHyperTextAccessible::FrameSelection()
{
nsIFrame* frame = GetFrame();
return frame->GetFrameSelection();
return frame ? frame->GetFrameSelection() : nsnull;
}
void
@ -1848,7 +1858,7 @@ nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum,
*aStartOffset = 0; // Could not find start point within this hypertext, so starts before
}
DOMPointToHypertextOffset(endNode, endOffset, aEndOffset, PR_TRUE);
DOMPointToHypertextOffset(endNode, endOffset, aEndOffset, true);
return NS_OK;
}
@ -1896,7 +1906,7 @@ nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
rv = range->SetStart(startNode, startOffset);
NS_ENSURE_SUCCESS(rv, rv);
rv = isOnlyCaret ? range->Collapse(PR_TRUE) :
rv = isOnlyCaret ? range->Collapse(true) :
range->SetEnd(endNode, endOffset);
NS_ENSURE_SUCCESS(rv, rv);
@ -2031,7 +2041,7 @@ nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
vPercent, hPercent);
NS_ENSURE_SUCCESS(rv, rv);
initialScrolled = PR_TRUE;
initialScrolled = true;
} else {
// Substring was scrolled to the given point already inside its closest
// scrollable area. If there are nested scrollable areas then make
@ -2353,7 +2363,7 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode,
if (result == 1) { // range is before point
PRInt32 startHTOffset = 0;
nsresult rv = DOMRangeBoundToHypertextOffset(range, PR_FALSE, PR_TRUE,
nsresult rv = DOMRangeBoundToHypertextOffset(range, false, true,
&startHTOffset);
NS_ENSURE_SUCCESS(rv, rv);
@ -2362,7 +2372,7 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode,
} else if (result == -1) { // range is after point
PRInt32 endHTOffset = 0;
nsresult rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_FALSE,
nsresult rv = DOMRangeBoundToHypertextOffset(range, true, false,
&endHTOffset);
NS_ENSURE_SUCCESS(rv, rv);
@ -2371,12 +2381,12 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode,
} else { // point is in range
PRInt32 startHTOffset = 0;
nsresult rv = DOMRangeBoundToHypertextOffset(range, PR_TRUE, PR_TRUE,
nsresult rv = DOMRangeBoundToHypertextOffset(range, true, true,
&startHTOffset);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 endHTOffset = 0;
rv = DOMRangeBoundToHypertextOffset(range, PR_FALSE, PR_FALSE,
rv = DOMRangeBoundToHypertextOffset(range, false, false,
&endHTOffset);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -154,11 +154,11 @@ public:
* if >=0 and aNode is not text, this represents a child node offset
* @param aResultOffset - the character offset into the current
* nsHyperTextAccessible
* @param aIsEndOffset - if PR_TRUE, then then this offset is not inclusive. The character
* @param aIsEndOffset - if true, then then this offset is not inclusive. The character
* indicated by the offset returned is at [offset - 1]. This means
* if the passed-in offset is really in a descendant, then the offset returned
* will come just after the relevant embedded object characer.
* If PR_FALSE, then the offset is inclusive. The character indicated
* If false, then the offset is inclusive. The character indicated
* by the offset returned is at [offset]. If the passed-in offset in inside a
* descendant, then the returned offset will be on the relevant embedded object char.
*

View File

@ -86,6 +86,6 @@ struct AccessibleWrapper {
return (bool)[object accessibilityIsIgnored];
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(PR_FALSE);
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
}
};

View File

@ -64,16 +64,16 @@ bool
nsAccessibleWrap::Init ()
{
if (!nsAccessible::Init())
return PR_FALSE;
return false;
if (!mNativeWrapper && !AncestorIsFlat()) {
// Create our native object using the class type specified in GetNativeType().
mNativeWrapper = new AccessibleWrapper (this, GetNativeType());
if (!mNativeWrapper)
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}
NS_IMETHODIMP
@ -234,12 +234,12 @@ nsAccessibleWrap::GetUnignoredChildCount(bool aDeepCount)
if (aDeepCount) {
// recursively count the unignored children of our children since it's a deep count.
resultChildCount += childAcc->GetUnignoredChildCount(PR_TRUE);
resultChildCount += childAcc->GetUnignoredChildCount(true);
} else {
// no deep counting, but if the child is ignored, we want to substitute it for its
// children.
if (childAcc->IsIgnored())
resultChildCount += childAcc->GetUnignoredChildCount(PR_FALSE);
resultChildCount += childAcc->GetUnignoredChildCount(false);
}
}
@ -316,10 +316,10 @@ nsAccessibleWrap::AncestorIsFlat()
nsAccessible* parent = Parent();
while (parent) {
if (nsAccUtils::MustPrune(parent))
return PR_TRUE;
return true;
parent = parent->Parent();
}
// no parent was flat
return PR_FALSE;
return false;
}

View File

@ -54,7 +54,7 @@ bool
nsDocAccessibleWrap::Init ()
{
if (!nsDocAccessible::Init())
return PR_FALSE;
return false;
NS_ASSERTION(!mNativeWrapper, "nsDocAccessibleWrap::Init() called more than once!");
@ -62,8 +62,8 @@ nsDocAccessibleWrap::Init ()
// Create our native object using the class type specified in GetNativeType().
mNativeWrapper = new AccessibleWrapper (this, GetNativeType());
if (!mNativeWrapper)
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}

View File

@ -95,7 +95,7 @@ __try {
PRInt32 startOffset = 0, endOffset = 0;
nsCOMPtr<nsIPersistentProperties> attributes;
nsresult rv = textAcc->GetTextAttributes(PR_TRUE, aOffset,
nsresult rv = textAcc->GetTextAttributes(true, aOffset,
&startOffset, &endOffset,
getter_AddRefs(attributes));
if (NS_FAILED(rv))
@ -499,7 +499,7 @@ STDMETHODIMP
CAccessibleText::get_newText(IA2TextSegment *aNewText)
{
__try {
return GetModifiedText(PR_TRUE, aNewText);
return GetModifiedText(true, aNewText);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
@ -509,7 +509,7 @@ STDMETHODIMP
CAccessibleText::get_oldText(IA2TextSegment *aOldText)
{
__try {
return GetModifiedText(PR_FALSE, aOldText);
return GetModifiedText(false, aOldText);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;

View File

@ -675,7 +675,7 @@ bool nsAccessNodeWrap::IsOnlyMsaaCompatibleJawsPresent()
{
HMODULE jhookhandle = ::GetModuleHandleW(kJAWSModuleHandle);
if (!jhookhandle)
return PR_FALSE; // No JAWS, or some other screen reader, use IA2
return false; // No JAWS, or some other screen reader, use IA2
PRUnichar fileName[MAX_PATH];
::GetModuleFileNameW(jhookhandle, fileName, MAX_PATH);
@ -726,14 +726,14 @@ void nsAccessNodeWrap::TurnOffNewTabSwitchingForJawsAndWE()
}
// Value has never been set, set it.
Preferences::SetBool(CTRLTAB_DISALLOW_FOR_SCREEN_READERS_PREF, PR_TRUE);
Preferences::SetBool(CTRLTAB_DISALLOW_FOR_SCREEN_READERS_PREF, true);
}
void nsAccessNodeWrap::DoATSpecificProcessing()
{
if (IsOnlyMsaaCompatibleJawsPresent())
// All versions below 8.0.2173 are not compatible
gIsIA2Disabled = PR_TRUE;
gIsIA2Disabled = true;
TurnOffNewTabSwitchingForJawsAndWE();
}

View File

@ -759,10 +759,10 @@ __try {
xpAccessible->TakeSelection();
if (flagsSelect & SELFLAG_ADDSELECTION)
xpAccessible->SetSelected(PR_TRUE);
xpAccessible->SetSelected(true);
if (flagsSelect & SELFLAG_REMOVESELECTION)
xpAccessible->SetSelected(PR_FALSE);
xpAccessible->SetSelected(false);
if (flagsSelect & SELFLAG_EXTENDSELECTION)
xpAccessible->ExtendSelection();

View File

@ -224,8 +224,8 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
nsPoint startPoint, endPoint;
nsIFrame *startFrame = GetPointFromOffset(frame, aStartOffset, PR_TRUE, startPoint);
nsIFrame *endFrame = GetPointFromOffset(frame, aEndOffset, PR_FALSE, endPoint);
nsIFrame *startFrame = GetPointFromOffset(frame, aStartOffset, true, startPoint);
nsIFrame *endFrame = GetPointFromOffset(frame, aEndOffset, false, endPoint);
if (!startFrame || !endFrame) {
return E_FAIL;
}

View File

@ -214,7 +214,7 @@ nsXFormsAccessible::Description(nsString& aDescription)
bool
nsXFormsAccessible::GetAllowsAnonChildAccessibles()
{
return PR_FALSE;
return false;
}
@ -237,7 +237,7 @@ nsXFormsContainerAccessible::NativeRole()
bool
nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles()
{
return PR_TRUE;
return true;
}
@ -331,7 +331,7 @@ nsXFormsSelectableAccessible::SelectedItems()
nsIAccessible* item = GetAccService()->GetAccessibleInWeakShell(itemNode,
mWeakShell);
if (item)
selectedItems->AppendElement(item, PR_FALSE);
selectedItems->AppendElement(item, false);
nsIMutableArray* items = nsnull;
selectedItems.forget(&items);
@ -356,7 +356,7 @@ nsXFormsSelectableAccessible::SelectedItems()
nsIAccessible* item = GetAccService()->GetAccessibleInWeakShell(itemNode,
mWeakShell);
if (item)
selectedItems->AppendElement(item, PR_FALSE);
selectedItems->AppendElement(item, false);
}
nsIMutableArray* items = nsnull;
@ -571,7 +571,7 @@ nsXFormsSelectableItemAccessible::IsSelected()
while ((parent = parent->GetNodeParent())) {
nsCOMPtr<nsIContent> content(do_QueryInterface(parent));
if (!content)
return PR_FALSE;
return false;
nsCOMPtr<nsINodeInfo> nodeinfo = content->NodeInfo();
if (!nodeinfo->NamespaceEquals(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS)))
@ -596,6 +596,6 @@ nsXFormsSelectableItemAccessible::IsSelected()
}
}
return PR_FALSE;
return false;
}

View File

@ -89,7 +89,7 @@ public:
virtual PRUint64 NativeState();
// Denies accessible nodes in anonymous content of xforms element by
// always returning PR_FALSE value.
// always returning false value.
virtual bool GetAllowsAnonChildAccessibles();
protected:
@ -130,7 +130,7 @@ public:
virtual PRUint32 NativeRole();
// Allows accessible nodes in anonymous content of xforms element by
// always returning PR_TRUE value.
// always returning true value.
virtual bool GetAllowsAnonChildAccessibles();
};

View File

@ -591,7 +591,7 @@ nsXFormsSelectComboboxAccessible::NativeState()
bool
nsXFormsSelectComboboxAccessible::GetAllowsAnonChildAccessibles()
{
return PR_TRUE;
return true;
}

View File

@ -176,7 +176,7 @@ nsXULColorPickerAccessible::AreItemsOperable() const
void
nsXULColorPickerAccessible::CacheChildren()
{
nsAccTreeWalker walker(mWeakShell, mContent, PR_TRUE);
nsAccTreeWalker walker(mWeakShell, mContent, true);
nsAccessible* child = nsnull;
while ((child = walker.NextChild())) {

View File

@ -149,12 +149,12 @@ nsXULComboboxAccessible::GetAllowsAnonChildAccessibles()
// Both the XUL <textbox type="autocomplete"> and <menulist editable="true"> widgets
// use nsXULComboboxAccessible. We need to walk the anonymous children for these
// so that the entry field is a child
return PR_TRUE;
return true;
}
// Argument of PR_FALSE indicates we don't walk anonymous children for
// Argument of false indicates we don't walk anonymous children for
// menuitems
return PR_FALSE;
return false;
}
PRUint8
nsXULComboboxAccessible::ActionCount()

View File

@ -221,7 +221,7 @@ nsXULButtonAccessible::CacheChildren()
eCaseMatters);
bool isMenuButton = isMenu ?
PR_FALSE :
false :
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::menuButton, eCaseMatters);
@ -231,7 +231,7 @@ nsXULButtonAccessible::CacheChildren()
nsAccessible* menupopup = nsnull;
nsAccessible* button = nsnull;
nsAccTreeWalker walker(mWeakShell, mContent, PR_TRUE);
nsAccTreeWalker walker(mWeakShell, mContent, true);
nsAccessible* child = nsnull;
while ((child = walker.NextChild())) {
@ -322,7 +322,7 @@ bool nsXULDropmarkerAccessible::DropmarkerOpen(bool aToggleOpen)
NS_IMETHODIMP nsXULDropmarkerAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
if (aIndex == eAction_Click) {
if (DropmarkerOpen(PR_FALSE))
if (DropmarkerOpen(false))
aName.AssignLiteral("close");
else
aName.AssignLiteral("open");
@ -338,7 +338,7 @@ NS_IMETHODIMP nsXULDropmarkerAccessible::GetActionName(PRUint8 aIndex, nsAString
NS_IMETHODIMP nsXULDropmarkerAccessible::DoAction(PRUint8 index)
{
if (index == eAction_Click) {
DropmarkerOpen(PR_TRUE); // Reverse the open attribute
DropmarkerOpen(true); // Reverse the open attribute
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
@ -353,7 +353,7 @@ nsXULDropmarkerAccessible::NativeRole()
PRUint64
nsXULDropmarkerAccessible::NativeState()
{
return DropmarkerOpen(PR_FALSE) ? states::PRESSED : 0;
return DropmarkerOpen(false) ? states::PRESSED : 0;
}
////////////////////////////////////////////////////////////////////////////////
@ -666,7 +666,7 @@ nsXULToolbarButtonAccessible::IsSeparator(nsAccessible *aAccessible)
nsCOMPtr<nsIContent> contentDomNode(do_QueryInterface(domNode));
if (!contentDomNode)
return PR_FALSE;
return false;
return (contentDomNode->Tag() == nsGkAtoms::toolbarseparator) ||
(contentDomNode->Tag() == nsGkAtoms::toolbarspacer) ||
@ -851,7 +851,7 @@ NS_IMETHODIMP nsXULTextFieldAccessible::DoAction(PRUint8 index)
bool
nsXULTextFieldAccessible::GetAllowsAnonChildAccessibles()
{
return PR_FALSE;
return false;
}
NS_IMETHODIMP nsXULTextFieldAccessible::GetAssociatedEditor(nsIEditor **aEditor)
@ -876,7 +876,7 @@ nsXULTextFieldAccessible::CacheChildren()
if (!inputContent)
return;
nsAccTreeWalker walker(mWeakShell, inputContent, PR_FALSE);
nsAccTreeWalker walker(mWeakShell, inputContent, false);
nsAccessible* child = nsnull;
while ((child = walker.NextChild()) && AppendChild(child));
@ -890,7 +890,7 @@ nsXULTextFieldAccessible::FrameSelection()
{
nsCOMPtr<nsIContent> inputContent(GetInputField());
nsIFrame* frame = inputContent->GetPrimaryFrame();
return frame->GetFrameSelection();
return frame ? frame->GetFrameSelection() : nsnull;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -168,7 +168,7 @@ nsXULListboxAccessible::IsMulticolumn()
PRInt32 numColumns = 0;
nsresult rv = GetColumnCount(&numColumns);
if (NS_FAILED(rv))
return PR_FALSE;
return false;
return numColumns > 1;
}
@ -443,7 +443,7 @@ NS_IMETHODIMP
nsXULListboxAccessible::IsColumnSelected(PRInt32 aColumn, bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -469,7 +469,7 @@ NS_IMETHODIMP
nsXULListboxAccessible::IsRowSelected(PRInt32 aRow, bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -620,7 +620,7 @@ nsXULListboxAccessible::GetSelectedCells(nsIArray **aCells)
for (PRInt32 cellIdx = 0; cellIdx < cellCount; cellIdx++) {
nsAccessible *cell = mChildren[cellIdx];
if (cell->Role() == nsIAccessibleRole::ROLE_CELL)
selCells->AppendElement(static_cast<nsIAccessible*>(cell), PR_FALSE);
selCells->AppendElement(static_cast<nsIAccessible*>(cell), false);
}
}
}
@ -830,7 +830,7 @@ NS_IMETHODIMP
nsXULListboxAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
{
NS_ENSURE_ARG_POINTER(aIsProbablyForLayout);
*aIsProbablyForLayout = PR_FALSE;
*aIsProbablyForLayout = false;
return NS_OK;
}
@ -1033,7 +1033,7 @@ bool
nsXULListitemAccessible::GetAllowsAnonChildAccessibles()
{
// That indicates we should walk anonymous children for listitems
return PR_TRUE;
return true;
}
void
@ -1216,7 +1216,7 @@ nsXULListCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
headerCells->AppendElement(headerCell, PR_FALSE);
headerCells->AppendElement(headerCell, false);
NS_ADDREF(*aHeaderCells = headerCells);
return NS_OK;
}
@ -1251,7 +1251,7 @@ NS_IMETHODIMP
nsXULListCellAccessible::IsSelected(bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;

View File

@ -118,7 +118,7 @@ nsXULSelectableAccessible::SelectedItems()
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
PR_FALSE);
false);
}
}
else { // Single select?
@ -130,7 +130,7 @@ nsXULSelectableAccessible::SelectedItems()
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell);
if (item)
selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
PR_FALSE);
false);
}
}
@ -356,7 +356,7 @@ nsXULMenuitemAccessible::NativeState()
bool isCollapsed = false;
nsAccessible* parent = Parent();
if (parent && parent->State() & states::INVISIBLE)
isCollapsed = PR_TRUE;
isCollapsed = true;
if (isSelected) {
state |= states::SELECTED;
@ -463,11 +463,7 @@ nsXULMenuitemAccessible::KeyboardShortcut() const
if (keyElmId.IsEmpty())
return KeyBinding();
nsIDocument* document = mContent->GetOwnerDoc();
if (!document)
return KeyBinding();
nsIContent* keyElm = document->GetElementById(keyElmId);
nsIContent* keyElm = mContent->OwnerDoc()->GetElementById(keyElmId);
if (!keyElm)
return KeyBinding();
@ -565,7 +561,7 @@ bool
nsXULMenuitemAccessible::GetAllowsAnonChildAccessibles()
{
// That indicates we don't walk anonymous children for menuitems
return PR_FALSE;
return false;
}
NS_IMETHODIMP nsXULMenuitemAccessible::DoAction(PRUint8 index)

View File

@ -192,7 +192,7 @@ bool
nsXULSliderAccessible::GetAllowsAnonChildAccessibles()
{
// Do not allow anonymous xul:slider be accessible.
return PR_FALSE;
return false;
}
// Utils
@ -204,11 +204,7 @@ nsXULSliderAccessible::GetSliderNode()
return nsnull;
if (!mSliderNode) {
nsIDocument* document = mContent->GetOwnerDoc();
if (!document)
return nsnull;
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(document));
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(mContent->OwnerDoc()));
if (!xblDoc)
return nsnull;
@ -251,7 +247,7 @@ nsXULSliderAccessible::SetSliderAttr(nsIAtom *aName, const nsAString& aValue)
nsCOMPtr<nsIContent> sliderNode(GetSliderNode());
NS_ENSURE_STATE(sliderNode);
sliderNode->SetAttr(kNameSpaceID_None, aName, aValue, PR_TRUE);
sliderNode->SetAttr(kNameSpaceID_None, aName, aValue, true);
return NS_OK;
}

View File

@ -257,11 +257,11 @@ nsXULLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsIDocument* document = mContent->GetOwnerDoc();
nsIDocument* document = mContent->OwnerDoc();
nsIURI* anchorURI = nsnull;
NS_NewURI(&anchorURI, href,
document ? document->GetDocumentCharacterSet().get() : nsnull,
document->GetDocumentCharacterSet().get(),
baseURI);
return anchorURI;

View File

@ -300,7 +300,7 @@ nsXULTreeAccessible::SelectedItems()
for (PRInt32 rowIdx = firstIdx; rowIdx <= lastIdx; rowIdx++) {
nsIAccessible* item = GetTreeItemAccessible(rowIdx);
if (item)
selectedItems->AppendElement(item, PR_FALSE);
selectedItems->AppendElement(item, false);
}
}
@ -883,12 +883,7 @@ nsXULTreeItemAccessibleBase::DoAction(PRUint8 aIndex)
bool
nsXULTreeItemAccessibleBase::IsDefunct() const
{
if (nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0)
return PR_TRUE;
PRInt32 rowCount = 0;
nsresult rv = mTreeView->GetRowCount(&rowCount);
return NS_FAILED(rv) || mRow >= rowCount;
return nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0;
}
void
@ -1083,12 +1078,12 @@ nsXULTreeItemAccessibleBase::IsExpandable()
columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
if (primaryColumn &&
!nsCoreUtils::IsColumnHidden(primaryColumn))
return PR_TRUE;
return true;
}
}
}
return PR_FALSE;
return false;
}
void
@ -1169,10 +1164,10 @@ bool
nsXULTreeItemAccessible::Init()
{
if (!nsXULTreeItemAccessibleBase::Init())
return PR_FALSE;
return false;
GetName(mCachedName);
return PR_TRUE;
return true;
}
void

View File

@ -210,7 +210,7 @@ nsXULTreeGridAccessible::GetSelectedCells(nsIArray **aCells)
for (PRInt32 colIdx = 0; colIdx < columnCount; colIdx++) {
nsCOMPtr<nsIAccessible> cell;
GetCellAt(rowIdx, colIdx, getter_AddRefs(cell));
selCells->AppendElement(cell, PR_FALSE);
selCells->AppendElement(cell, false);
}
}
}
@ -494,7 +494,7 @@ nsXULTreeGridAccessible::IsColumnSelected(PRInt32 aColumnIndex,
bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -518,7 +518,7 @@ NS_IMETHODIMP
nsXULTreeGridAccessible::IsRowSelected(PRInt32 aRowIndex, bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -573,7 +573,7 @@ NS_IMETHODIMP
nsXULTreeGridAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
{
NS_ENSURE_ARG_POINTER(aIsProbablyForLayout);
*aIsProbablyForLayout = PR_FALSE;
*aIsProbablyForLayout = false;
return NS_OK;
}
@ -1083,7 +1083,7 @@ nsXULTreeGridCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
if (headerCell)
headerCells->AppendElement(static_cast<nsIAccessible*>(headerCell),
PR_FALSE);
false);
NS_ADDREF(*aHeaderCells = headerCells);
return NS_OK;
@ -1111,7 +1111,7 @@ NS_IMETHODIMP
nsXULTreeGridCellAccessible::IsSelected(bool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
*aIsSelected = false;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -1137,7 +1137,7 @@ bool
nsXULTreeGridCellAccessible::Init()
{
if (!nsLeafAccessible::Init())
return PR_FALSE;
return false;
PRInt16 type;
mColumn->GetType(&type);
@ -1146,7 +1146,7 @@ nsXULTreeGridCellAccessible::Init()
else
mTreeView->GetCellText(mRow, mColumn, mCachedTextEquiv);
return PR_TRUE;
return true;
}
bool
@ -1337,19 +1337,19 @@ nsXULTreeGridCellAccessible::IsEditable() const
bool isEditable = false;
nsresult rv = mTreeView->IsEditable(mRow, mColumn, &isEditable);
if (NS_FAILED(rv) || !isEditable)
return PR_FALSE;
return false;
nsCOMPtr<nsIDOMElement> columnElm;
mColumn->GetElement(getter_AddRefs(columnElm));
if (!columnElm)
return PR_FALSE;
return false;
nsCOMPtr<nsIContent> columnContent(do_QueryInterface(columnElm));
if (!columnContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::editable,
nsGkAtoms::_true,
eCaseMatters))
return PR_FALSE;
return false;
return mContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::editable,

View File

@ -23,6 +23,8 @@
// table with role of grid
testAbsentAttrs("table1", attr);
// table with role of grid and datatable="0"
testAbsentAttrs("table1.1", attr);
// table with landmark role
testAbsentAttrs("table2", attr);
@ -93,6 +95,9 @@
testAttrs("table21.5", attr, true);
testAttrs("table21.6", attr, true);
// layout table having datatable="0" attribute and containing data table structure (tfoot element)
testAttrs("table22", attr, true);
SimpleTest.finish();
}
@ -141,6 +146,12 @@
<td>June 12</td>
</tr>
</table>
<!-- table with role of grid and datatable="0"-->
<table id="table1.1" role="grid" datatable="0">
<tr>
<td>Cell1</td><td>cell2</td>
</tr>
</table>
<!-- table with landmark role -->
<table id="table2" role="main">
@ -411,5 +422,14 @@
</td>
</tr>
</table>
<!-- layout table with datatable="0" and tfoot element-->
<table id="table22" datatable="0">
<tfoot>
<tr>
<td>Cell1</td><td>cell2</td>
</tr>
</tfoot>
</table>
</body>
</html>

View File

@ -34,9 +34,11 @@
/**
* Invokers.
*/
function setCaretOffsetInvoker(aID, aOffset)
function setCaretOffsetInvoker(aID, aOffset, aFocusableContainerID)
{
this.target = getAccessible(aID, [nsIAccessibleText]);
this.focus = aFocusableContainerID ?
getAccessible(aFocusableContainerID) : this.target;
this.invoke = function setCaretOffsetInvoker_invoke()
{
@ -45,29 +47,47 @@
this.getID = function setCaretOffsetInvoker_getID()
{
return "nsIAccessibleText::caretOffset test";
return "Set caretOffset on " + prettyName(aID) + " at " + aOffset;
}
this.eventSeq = [
new invokerChecker(EVENT_FOCUS, this.target),
new caretMovedChecker(this.target, aOffset)
new caretMovedChecker(this.target, aOffset),
new asyncInvokerChecker(EVENT_FOCUS, this.focus)
];
}
/**
* Turn on/off the caret browsing mode.
*/
function turnCaretBrowsing(aIsOn)
{
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("accessibility.browsewithcaret", aIsOn);
}
/**
* Do tests.
*/
var gQueue = null;
// gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpToConsole = true;
function doTests()
{
turnCaretBrowsing(true);
// test caret move events and caret offsets
gQueue = new eventQueue();
gQueue.push(new setCaretOffsetInvoker("textbox", 1));
gQueue.push(new setCaretOffsetInvoker("link", 1));
gQueue.push(new setCaretOffsetInvoker("heading", 1, document));
gQueue.onFinish = function()
{
turnCaretBrowsing(false);
}
gQueue.invoke(); // Will call SimpleTest.finish();
}
@ -84,6 +104,11 @@
title="HyperText accessible should get focus when the caret is positioned inside of it, text is changed or copied into clipboard by ATs">
Mozilla Bug 524115
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=546068"
title="Position is not being updated when atk_text_set_caret_offset is used">
Mozilla Bug 546068
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -91,6 +116,7 @@
<input id="textbox" value="hello"/>
<a id="link" href="about:">about mozilla</a>
<h5 id="heading">heading</h5>
<div id="eventdump"></div>
</body>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1317659919000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1318359094000">
<emItems>
<emItem blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
<versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1">
@ -9,6 +9,8 @@
<versionRange minVersion=" " severity="1">
</versionRange>
</emItem>
<emItem blockID="i43" id="supportaccessplugin@gmail.com">
</emItem>
<emItem blockID="i38" id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
<versionRange minVersion="0.1" maxVersion="3.3.0.*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
@ -86,6 +88,8 @@
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i44" id="sigma@labs.mozilla">
</emItem>
<emItem blockID="i5" id="support@daemon-tools.cc">
<versionRange minVersion=" " maxVersion="1.0.0.5">
</versionRange>

View File

@ -103,7 +103,7 @@ static bool IsArg(const char* arg, const char* s)
return !strcasecmp(++arg, s);
#endif
return PR_FALSE;
return false;
}
/**
@ -143,10 +143,10 @@ static int do_main(const char *exePath, int argc, char* argv[])
#ifdef XP_WIN
// exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
// encoded path, so it is safe to convert it
nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false,
getter_AddRefs(appini));
#else
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false,
getter_AddRefs(appini));
#endif
if (NS_FAILED(rv)) {

View File

@ -77,7 +77,7 @@ pref("extensions.update.autoUpdateDefault", true);
// Disable add-ons installed into the shared user and shared system areas by
// default. This does not include the application directory. See the SCOPE
// constants in AddonManager.jsm for values to use here
pref("extensions.autoDisableScopes", 10);
pref("extensions.autoDisableScopes", 15);
// Dictionary download preference
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/dictionaries/");

View File

@ -83,6 +83,3 @@ endif
ifneq (,$(filter windows gtk2, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DMENUBAR_CAN_AUTOHIDE=1
endif
libs::
$(NSINSTALL) $(srcdir)/content/tabview/modules/* $(FINAL_TARGET)/modules/tabview

View File

@ -67,7 +67,8 @@
#else
title="&aboutDialog.title;"
#endif
aria-describedby="version distribution distributionId"
role="dialog"
aria-describedby="version distribution distributionId communityDesc contributeDesc trademark"
>
<script type="application/javascript" src="chrome://browser/content/aboutDialog.js"/>
@ -80,7 +81,7 @@
<label id="distribution" class="text-blurb"/>
<label id="distributionId" class="text-blurb"/>
<vbox id="detailsBox" aria-describedby="communityDesc contributeDesc">
<vbox id="detailsBox">
<vbox id="updateBox">
#ifdef MOZ_UPDATER
<deck id="updateDeck" orient="vertical">

View File

@ -52,7 +52,6 @@ let TabView = {
PREF_RESTORE_ENABLED_ONCE: "browser.panorama.session_restore_enabled_once",
GROUPS_IDENTIFIER: "tabview-groups",
VISIBILITY_IDENTIFIER: "tabview-visibility",
LAST_SESSION_GROUP_NAME_IDENTIFIER: "tabview-last-session-group-name",
// ----------
get windowTitle() {
@ -94,10 +93,9 @@ let TabView = {
// ----------
init: function TabView_init() {
// disable the ToggleTabView command for popup windows
if (!window.toolbar.visible) {
goSetCommandEnabled("Browser:ToggleTabView", false);
goSetCommandEnabled("Browser:ToggleTabView", window.toolbar.visible);
if (!window.toolbar.visible)
return;
}
if (this._initialized)
return;
@ -143,10 +141,6 @@ let TabView = {
"TabShow", this._tabShowEventListener, false);
gBrowser.tabContainer.addEventListener(
"TabClose", this._tabCloseEventListener, false);
// grab the last used group title
this._lastSessionGroupName = sessionstore.getWindowValue(window,
this.LAST_SESSION_GROUP_NAME_IDENTIFIER);
}
}
@ -279,30 +273,6 @@ let TabView = {
else
this.show();
},
getActiveGroupName: function TabView_getActiveGroupName() {
if (!this._window)
return this._lastSessionGroupName;
// We get the active group this way, instead of querying
// GroupItems.getActiveGroupItem() because the tabSelect event
// will not have happened by the time the browser tries to
// update the title.
let groupItem = null;
let activeTab = window.gBrowser.selectedTab;
let activeTabItem = activeTab._tabViewTabItem;
if (activeTab.pinned) {
// It's an app tab, so it won't have a .tabItem. However, its .parent
// will already be set as the active group.
groupItem = this._window.GroupItems.getActiveGroupItem();
} else if (activeTabItem) {
groupItem = activeTabItem.parent;
}
// groupItem may still be null, if the active tab is an orphan.
return groupItem ? groupItem.getTitle() : "";
},
// ----------
updateContextMenu: function TabView_updateContextMenu(tab, popup) {

View File

@ -2281,18 +2281,17 @@ function BrowserTryToCloseWindow()
window.close(); // WindowIsClosing does all the necessary checks
}
function loadURI(uri, referrer, postData, allowThirdPartyFixup)
{
function loadURI(uri, referrer, postData, allowThirdPartyFixup) {
if (postData === undefined)
postData = null;
var flags = nsIWebNavigation.LOAD_FLAGS_NONE;
if (allowThirdPartyFixup)
flags |= nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
try {
if (postData === undefined)
postData = null;
var flags = nsIWebNavigation.LOAD_FLAGS_NONE;
if (allowThirdPartyFixup) {
flags = nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
}
gBrowser.loadURIWithFlags(uri, flags, referrer, null, postData);
} catch (e) {
}
} catch (e) {}
}
function getShortcutOrURI(aURL, aPostDataRef, aMayInheritPrincipal) {
@ -3430,6 +3429,7 @@ const BrowserSearch = {
openLinkIn(submission.uri.spec,
useNewTab ? "tab" : "current",
{ postData: submission.postData,
inBackground: false,
relatedToCurrent: true });
},
@ -5647,7 +5647,8 @@ function middleMousePaste(event) {
// bar's behavior (stripsurroundingwhitespace)
clipboard = clipboard.replace(/\s*\n\s*/g, "");
let url = getShortcutOrURI(clipboard);
let mayInheritPrincipal = { value: false };
let url = getShortcutOrURI(clipboard, mayInheritPrincipal);
try {
makeURI(url);
} catch (ex) {
@ -5663,9 +5664,10 @@ function middleMousePaste(event) {
Cu.reportError(ex);
}
openUILink(url,
event,
true /* ignore the fact this is a middle click */);
// FIXME: Bug 631500, use openUILink directly
let where = whereToOpenLink(event, true);
openUILinkIn(url, where,
{ disallowInheritPrincipal: !mayInheritPrincipal.value });
event.stopPropagation();
}
@ -5838,11 +5840,10 @@ function stylesheetFillPopup(menuPopup) {
if (!currentStyleSheet.title)
continue;
// Skip any stylesheets that don't match the screen media type.
// Skip any stylesheets whose media attribute doesn't match.
if (currentStyleSheet.media.length > 0) {
let media = currentStyleSheet.media.mediaText.split(", ");
if (media.indexOf("screen") == -1 &&
media.indexOf("all") == -1)
let mediaQueryList = currentStyleSheet.media.mediaText;
if (!window.content.matchMedia(mediaQueryList).matches)
continue;
}

View File

@ -976,7 +976,6 @@
<toolbarbutton id="inspector-inspect-toolbutton"
label="&inspectButton.label;"
accesskey="&inspectButton.accesskey;"
class="toolbarbutton-text"
command="Inspector:Inspect"/>
<toolbarseparator />
<hbox id="inspector-tools">
@ -1012,7 +1011,7 @@
</svg:mask>
<svg:mask id="winstripe-urlbar-back-button-mask" maskContentUnits="userSpaceOnUse">
<svg:rect x="0" y="0" width="10000" height="50" fill="white"/>
<svg:circle cx="-11" cy="12" r="15"/>
<svg:circle cx="-11" cy="13" r="15"/>
</svg:mask>
</svg:svg>
#endif

View File

@ -813,12 +813,6 @@
}
} catch (e) {}
if ("TabView" in window) {
let groupName = TabView.getActiveGroupName();
if (groupName)
newTitle = groupName + sep + newTitle;
}
return newTitle;
]]>
</body>

View File

@ -40,10 +40,6 @@ srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = browser/base/content/test
DIRS += \
tabview \
$(NULL)
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
@ -249,6 +245,7 @@ _BROWSER_FILES = \
test_wyciwyg_copying.html \
authenticate.sjs \
browser_minimize.js \
browser_middleMouse_inherit.js \
$(NULL)
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))

View File

@ -0,0 +1,55 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const middleMousePastePref = "middlemouse.contentLoadURL";
const autoScrollPref = "general.autoScroll";
function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref(middleMousePastePref, true);
Services.prefs.setBoolPref(autoScrollPref, false);
let tab = gBrowser.selectedTab = gBrowser.addTab();
registerCleanupFunction(function () {
Services.prefs.clearUserPref(middleMousePastePref);
Services.prefs.clearUserPref(autoScrollPref);
gBrowser.removeTab(tab);
});
addPageShowListener(function () {
let pagePrincipal = gBrowser.contentPrincipal;
// copy javascript URI to the clipboard
let url = "javascript:1+1";
waitForClipboard(url,
function() {
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
.copyString(url);
},
function () {
// Middle click on the content area
info("Middle clicking");
EventUtils.sendMouseEvent({type: "click", button: 1}, gBrowser);
},
function() {
ok(false, "Failed to copy URL to the clipboard");
finish();
}
);
addPageShowListener(function () {
is(gBrowser.currentURI.spec, url, "url loaded by middle click");
ok(!gBrowser.contentPrincipal.equals(pagePrincipal),
"middle click load of " + url + " should produce a page with a different principal");
finish();
});
});
}
function addPageShowListener(func) {
gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
func();
});
}

View File

@ -90,6 +90,20 @@ var tests = [
copyExpected: "http://example.com/\xe9"
},
{
loadURL: "http://example.com/?%C3%B7%C3%B7",
expectedURL: "example.com/?\xf7\xf7",
copyExpected: "http://example.com/?%C3%B7%C3%B7"
},
{
copyVal: "e<xample.com/?\xf7>\xf7",
copyExpected: "xample.com/?\xf7"
},
{
copyVal: "<example.com/?\xf7>\xf7",
copyExpected: "http://example.com/?\xf7"
},
// data: and javsacript: URIs shouldn't be encoded
{
loadURL: "javascript:('%C3%A9')",

View File

@ -22,15 +22,19 @@
<link data-state="1" href="404.css" title="12" rel="alternate stylesheet" media="ALL ">
<link data-state="1" href="404.css" title="13" rel="alternate stylesheet" media="screen">
<link data-state="1" href="404.css" title="14" rel="alternate stylesheet" media=" Screen">
<link data-state="1" href="404.css" title="15" rel="alternate stylesheet" media="screen foo">
<link data-state="1" href="404.css" title="16" rel="alternate stylesheet" media="all screen">
<link data-state="1" href="404.css" title="17" rel="alternate stylesheet" media="foo bar">
<link data-state="0" href="404.css" title="15" rel="alternate stylesheet" media="screen foo">
<link data-state="0" href="404.css" title="16" rel="alternate stylesheet" media="all screen">
<link data-state="0" href="404.css" title="17" rel="alternate stylesheet" media="foo bar">
<link data-state="1" href="404.css" title="18" rel="alternate stylesheet" media="all,screen">
<link data-state="1" href="404.css" title="19" rel="alternate stylesheet" media="all, screen">
<link data-state="1" href="404.css" title="20" rel="alternate stylesheet" media="all screen">
<link data-state="0" href="404.css" title="20" rel="alternate stylesheet" media="all screen">
<link data-state="0" href="404.css" title="21" rel="alternate stylesheet" media="foo">
<link data-state="0" href="404.css" title="22" rel="alternate stylesheet" media="allscreen">
<link data-state="0" href="404.css" title="23" rel="alternate stylesheet" media="_all">
<link data-state="0" href="404.css" title="24" rel="alternate stylesheet" media="not screen">
<link data-state="1" href="404.css" title="25" rel="alternate stylesheet" media="only screen">
<link data-state="1" href="404.css" title="26" rel="alternate stylesheet" media="screen and (min-device-width: 1px)">
<link data-state="0" href="404.css" title="27" rel="alternate stylesheet" media="screen and (max-device-width: 1px)">
</head>
<body></body>
</html>

View File

@ -23,16 +23,33 @@ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
const Cc = Components.classes;
const Ci = Components.interfaces;
function openContextMenuFor(element, shiftkey) {
function openContextMenuFor(element, shiftkey, shouldWaitForFocus) {
// Context menu should be closed before we open it again.
is(contextMenu.state, "closed", "checking if popup is closed");
if (lastElement)
lastElement.blur();
element.focus();
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
//Some elements need time to focus and spellcheck before any tests are
//run on them.
if(shouldWaitForFocus)
{
if (lastElement)
lastElement.blur();
element.focus();
SimpleTest.executeSoon(function() {
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
});
}
else
{
if (lastElement)
lastElement.blur();
element.focus();
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
}
}
function closeContextMenu() {
@ -421,7 +438,7 @@ function runTest(testNum) {
"---", null,
"context-inspect", true]);
closeContextMenu();
openContextMenuFor(textarea); // Invoke context menu for next test.
openContextMenuFor(textarea, false, true); // Invoke context menu for next test, but wait for the spellcheck.
break;
case 12:

View File

@ -515,7 +515,7 @@
let uri;
try {
uri = uriFixup.createFixupURI(inputVal, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
uri = uriFixup.createFixupURI(inputVal, Ci.nsIURIFixup.FIXUP_FLAG_USE_UTF8);
} catch (e) {}
if (!uri)
return selectedVal;

View File

@ -196,6 +196,7 @@ function openLinkIn(url, where, params) {
var aReferrerURI = params.referrerURI;
var aRelatedToCurrent = params.relatedToCurrent;
var aInBackground = params.inBackground;
var aDisallowInheritPrincipal = params.disallowInheritPrincipal;
if (where == "save") {
saveURL(url, null, null, true, null, aReferrerURI);
@ -264,7 +265,12 @@ function openLinkIn(url, where, params) {
switch (where) {
case "current":
w.loadURI(url, aReferrerURI, aPostData, aAllowThirdPartyFixup);
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
if (aAllowThirdPartyFixup)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
if (aDisallowInheritPrincipal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
w.gBrowser.loadURIWithFlags(url, flags, aReferrerURI, null, aPostData);
break;
case "tabshifted":
loadInBackground = !loadInBackground;

View File

@ -49,10 +49,6 @@ browser.jar:
content/browser/sanitizeDialog.css (content/sanitizeDialog.css)
* content/browser/tabbrowser.css (content/tabbrowser.css)
* content/browser/tabbrowser.xml (content/tabbrowser.xml)
content/browser/tabview.css (content/tabview/tabview.css)
* content/browser/tabview.js (content/tabview/tabview.js)
content/browser/tabview.html (content/tabview/tabview.html)
content/browser/tabview-content.js (content/tabview/content.js)
* content/browser/urlbarBindings.xml (content/urlbarBindings.xml)
* content/browser/utilityOverlay.js (content/utilityOverlay.js)
* content/browser/web-panels.js (content/web-panels.js)

View File

@ -70,6 +70,7 @@ PARALLEL_DIRS = \
sessionstore \
shell \
sidebar/src \
tabview \
migration \
$(NULL)

View File

@ -86,7 +86,7 @@ DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult)
nsCString path;
rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path));
if (NS_SUCCEEDED(rv)) {
NS_NewNativeLocalFile(path, PR_TRUE, (nsILocalFile**)(nsIFile**) getter_AddRefs(file));
NS_NewNativeLocalFile(path, true, (nsILocalFile**)(nsIFile**) getter_AddRefs(file));
}
}
}
@ -123,7 +123,7 @@ DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult)
file->AppendNative(leafstr);
}
*aPersist = PR_TRUE;
*aPersist = true;
NS_ADDREF(*aResult = file);
return NS_OK;
@ -290,7 +290,7 @@ NS_IMPL_ISUPPORTS1(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator)
NS_IMETHODIMP
DirectoryProvider::AppendingEnumerator::HasMoreElements(bool *aResult)
{
*aResult = mNext ? PR_TRUE : PR_FALSE;
*aResult = mNext ? true : false;
return NS_OK;
}

View File

@ -133,15 +133,15 @@ bool
HasAttachmentDisposition(nsIHttpChannel* httpChannel)
{
if (!httpChannel)
return PR_FALSE;
return false;
PRUint32 disp;
nsresult rv = httpChannel->GetContentDisposition(&disp);
if (NS_SUCCEEDED(rv) && disp == nsIChannel::DISPOSITION_ATTACHMENT)
return PR_TRUE;
return true;
return PR_FALSE;
return false;
}
/**
@ -173,7 +173,7 @@ FindChar(char c, const char *begin, const char *end)
* @param end
* The end of the data being sniffed, right before the substring that
* was found.
* @returns PR_TRUE if the found substring is the documentElement, PR_FALSE
* @returns true if the found substring is the documentElement, false
* otherwise.
*/
static bool
@ -184,24 +184,24 @@ IsDocumentElement(const char *start, const char* end)
while ( (start = FindChar('<', start, end)) ) {
++start;
if (start >= end)
return PR_FALSE;
return false;
// Check to see if the character following the '<' is either '?' or '!'
// (processing instruction or doctype or comment)... these are valid nodes
// to have in the prologue.
if (*start != '?' && *start != '!')
return PR_FALSE;
return false;
// Now advance the iterator until the '>' (We do this because we don't want
// to sniff indicator substrings that are embedded within other nodes, e.g.
// comments: <!-- <rdf:RDF .. > -->
start = FindChar('>', start, end);
if (!start)
return PR_FALSE;
return false;
++start;
}
return PR_TRUE;
return true;
}
/**
@ -211,7 +211,7 @@ IsDocumentElement(const char *start, const char* end)
* The data being sniffed
* @param substring
* The substring being tested for existence and root-ness.
* @returns PR_TRUE if the substring exists and is the documentElement, PR_FALSE
* @returns true if the substring exists and is the documentElement, false
* otherwise.
*/
static bool
@ -219,7 +219,7 @@ ContainsTopLevelSubstring(nsACString& dataString, const char *substring)
{
PRInt32 offset = dataString.Find(substring);
if (offset == -1)
return PR_FALSE;
return false;
const char *begin = dataString.BeginReading();
@ -292,7 +292,7 @@ nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request,
// set the feed header as a response header, since we have good metadata
// telling us that the feed is supposed to be RSS or Atom
channel->SetResponseHeader(NS_LITERAL_CSTRING("X-Moz-Is-Feed"),
NS_LITERAL_CSTRING("1"), PR_FALSE);
NS_LITERAL_CSTRING("1"), false);
sniffedType.AssignLiteral(TYPE_MAYBE_FEED);
return NS_OK;
}

View File

@ -273,7 +273,7 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile,
NS_ENSURE_SUCCESS(rv, rv);
// Import the bookmarks into the folder.
return importer->ImportHTMLFromFileToFolder(localFile, folder, PR_FALSE);
return importer->ImportHTMLFromFileToFolder(localFile, folder, false);
}
nsresult
@ -283,7 +283,7 @@ InitializeBookmarks(nsIFile* aTargetProfile)
aTargetProfile->Clone(getter_AddRefs(bookmarksFile));
bookmarksFile->Append(BOOKMARKS_FILE_NAME);
nsresult rv = ImportBookmarksHTML(bookmarksFile, PR_TRUE, PR_TRUE, EmptyString().get());
nsresult rv = ImportBookmarksHTML(bookmarksFile, true, true, EmptyString().get());
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}

View File

@ -39,6 +39,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include <stdio.h>
#include <string.h>
#include <windows.h>
@ -109,6 +111,8 @@
#define REGISTRY_IE_SEARCHURL_KEY \
NS_LITERAL_STRING("Software\\Microsoft\\Internet Explorer\\SearchUrl")
using namespace mozilla;
const int sInitialCookieBufferSize = 1024; // but it can grow
const int sUsernameLengthLimit = 80;
const int sHostnameLengthLimit = 255;
@ -241,13 +245,13 @@ TranslateLanglist(nsIWindowsRegKey *aRegKey, const nsString& aRegValueName,
char *dest = prefStringValue,
*destEnd = dest + (MAX_PATH-2); // room for " \0"
bool skip = false,
comma = PR_FALSE;
comma = false;
while (source < sourceEnd && *source && dest < destEnd) {
if (*source == ',')
skip = PR_FALSE;
skip = false;
else if (*source == ';')
skip = PR_TRUE;
skip = true;
if (!skip) {
if (comma && *source != ' ')
*dest++ = ' ';
@ -421,7 +425,7 @@ nsIEProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup, const
bool aReplace = false;
if (aStartup) {
aReplace = PR_TRUE;
aReplace = true;
rv = aStartup->DoStartup();
NS_ENSURE_SUCCESS(rv, rv);
}
@ -469,7 +473,7 @@ NS_IMETHODIMP
nsIEProfileMigrator::GetSourceExists(bool* aResult)
{
// IE always exists.
*aResult = PR_TRUE;
*aResult = true;
return NS_OK;
}
@ -477,7 +481,7 @@ nsIEProfileMigrator::GetSourceExists(bool* aResult)
NS_IMETHODIMP
nsIEProfileMigrator::GetSourceHasMultipleProfiles(bool* aResult)
{
*aResult = PR_FALSE;
*aResult = false;
return NS_OK;
}
@ -569,33 +573,33 @@ nsIEProfileMigrator::TestForIE7()
nsCOMPtr<nsIWindowsRegKey> regKey =
do_CreateInstance("@mozilla.org/windows-registry-key;1");
if (!regKey)
return PR_FALSE;
return false;
NS_NAMED_LITERAL_STRING(key,
"Applications\\iexplore.exe\\shell\\open\\command");
if (NS_FAILED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CLASSES_ROOT,
key, nsIWindowsRegKey::ACCESS_QUERY_VALUE)))
return PR_FALSE;
return false;
nsAutoString iePath;
if (NS_FAILED(regKey->ReadStringValue(EmptyString(), iePath)))
return PR_FALSE;
return false;
// Replace embedded environment variables.
PRUint32 bufLength =
::ExpandEnvironmentStringsW(iePath.get(),
L"", 0);
if (bufLength == 0) // Error
return PR_FALSE;
return false;
nsAutoArrayPtr<PRUnichar> destination(new PRUnichar[bufLength]);
if (!destination)
return PR_FALSE;
return false;
if (!::ExpandEnvironmentStringsW(iePath.get(),
destination,
bufLength))
return PR_FALSE;
return false;
iePath = destination;
@ -607,27 +611,27 @@ nsIEProfileMigrator::TestForIE7()
}
nsCOMPtr<nsILocalFile> lf;
NS_NewLocalFile(iePath, PR_TRUE, getter_AddRefs(lf));
NS_NewLocalFile(iePath, true, getter_AddRefs(lf));
nsCOMPtr<nsILocalFileWin> lfw = do_QueryInterface(lf);
if (!lfw)
return PR_FALSE;
return false;
nsAutoString ieVersion;
if (NS_FAILED(lfw->GetVersionInfoField("FileVersion", ieVersion)))
return PR_FALSE;
return false;
if (ieVersion.Length() > 2) {
PRUint32 index = ieVersion.FindChar('.', 0);
if (index < 0)
return PR_FALSE;
return false;
ieVersion.Cut(index, ieVersion.Length());
PRInt32 ver = wcstol(ieVersion.get(), nsnull, 0);
if (ver >= 7) // Found 7 or greater major version
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
NS_IMETHODIMP
@ -641,16 +645,16 @@ nsIEProfileMigrator::RunBatched(nsISupports* aUserData)
switch (batchAction) {
case BATCH_ACTION_HISTORY:
rv = CopyHistoryBatched(PR_FALSE);
rv = CopyHistoryBatched(false);
break;
case BATCH_ACTION_HISTORY_REPLACE:
rv = CopyHistoryBatched(PR_TRUE);
rv = CopyHistoryBatched(true);
break;
case BATCH_ACTION_BOOKMARKS:
rv = CopyFavoritesBatched(PR_FALSE);
rv = CopyFavoritesBatched(false);
break;
case BATCH_ACTION_BOOKMARKS_REPLACE:
rv = CopyFavoritesBatched(PR_TRUE);
rv = CopyFavoritesBatched(true);
break;
}
NS_ENSURE_SUCCESS(rv, rv);
@ -1097,7 +1101,7 @@ nsIEProfileMigrator::KeyIsURI(const nsAString& aKey, char** aRealm)
nsCOMPtr<nsIURI> uri;
if (NS_FAILED(NS_NewURI(getter_AddRefs(uri), aKey)))
return PR_FALSE;
return false;
bool validScheme = false;
const char* schemes[] = { "http", "https" };
@ -1116,7 +1120,7 @@ nsIEProfileMigrator::KeyIsURI(const nsAString& aKey, char** aRealm)
return validScheme;
}
}
return PR_FALSE;
return false;
}
nsresult
@ -1335,8 +1339,8 @@ nsIEProfileMigrator::CopyFavorites(bool aReplace)
do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
bool batchAction = aReplace ? BATCH_ACTION_BOOKMARKS_REPLACE
: BATCH_ACTION_BOOKMARKS;
PRUint8 batchAction = aReplace ? BATCH_ACTION_BOOKMARKS_REPLACE
: BATCH_ACTION_BOOKMARKS;
nsCOMPtr<nsISupportsPRUint8> supports =
do_CreateInstance(NS_SUPPORTS_PRUINT8_CONTRACTID);
NS_ENSURE_TRUE(supports, NS_ERROR_OUT_OF_MEMORY);
@ -1431,7 +1435,7 @@ nsIEProfileMigrator::CopyFavoritesBatched(bool aReplace)
// Only try to read Favorites folder if it exists on the machine.
if (favoritesDirectory) {
rv = ParseFavoritesFolder(favoritesDirectory, folder, bms,
personalToolbarFolderName, PR_TRUE);
personalToolbarFolderName, true);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -1591,7 +1595,7 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
if (NS_FAILED(rv)) continue;
nsCOMPtr<nsILocalFile> localFile;
rv = NS_NewLocalFile(path, PR_TRUE, getter_AddRefs(localFile));
rv = NS_NewLocalFile(path, true, getter_AddRefs(localFile));
if (NS_FAILED(rv)) continue;
// Check for dir here. If path is not a dir, just continue with
@ -1633,7 +1637,7 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
rv = ParseFavoritesFolder(currFile, folderId,
aBMS, aPersonalToolbarFolderName,
PR_FALSE);
false);
if (NS_FAILED(rv)) continue;
}
else {
@ -1673,7 +1677,7 @@ nsIEProfileMigrator::CopyPreferences(bool aReplace)
{
bool regKeyOpen = false;
const regEntry *entry,
*endEntry = gRegEntries + NS_ARRAY_LENGTH(gRegEntries);
*endEntry = ArrayEnd(gRegEntries);
nsCOMPtr<nsIPrefBranch> prefs;
@ -1698,7 +1702,7 @@ nsIEProfileMigrator::CopyPreferences(bool aReplace)
if (entry->regKeyName) {
if (regKeyOpen) {
regKey->Close();
regKeyOpen = PR_FALSE;
regKeyOpen = false;
}
regKeyOpen = NS_SUCCEEDED(regKey->
Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
@ -1926,10 +1930,10 @@ nsIEProfileMigrator::CopyCookiesFromBuffer(char *aBuffer,
bool isIPAddress = false;
if (hostCopy[0] == '.') {
aCookieManager->Remove(nsDependentCString(hostCopy+1),
stringName, stringPath, PR_FALSE);
stringName, stringPath, false);
PRNetAddr addr;
if (PR_StringToNetAddr(hostCopy+1, &addr) == PR_SUCCESS)
isIPAddress = PR_TRUE;
isIPAddress = true;
}
nsresult onerv;
@ -1939,8 +1943,8 @@ nsIEProfileMigrator::CopyCookiesFromBuffer(char *aBuffer,
stringName,
nsDependentCString(value),
flagsValue & 0x1, // isSecure
PR_FALSE, // isHttpOnly
PR_FALSE, // isSession
false, // isHttpOnly
false, // isSession
PRInt64(expirationDate));
if (NS_FAILED(onerv)) {
rv = onerv;
@ -2099,8 +2103,8 @@ nsIEProfileMigrator::CopySecurityPrefs(nsIPrefBranch* aPrefs)
PRUint32 value;
if (NS_SUCCEEDED(regKey->ReadIntValue(NS_LITERAL_STRING("SecureProtocols"),
&value))) {
aPrefs->SetBoolPref("security.enable_ssl3", (value >> 5) & PR_TRUE);
aPrefs->SetBoolPref("security.enable_tls", (value >> 7) & PR_TRUE);
aPrefs->SetBoolPref("security.enable_ssl3", (value >> 5) & true);
aPrefs->SetBoolPref("security.enable_tls", (value >> 7) & true);
}
}
@ -2156,24 +2160,24 @@ nsIEProfileMigrator::CopyProxyPreferences(nsIPrefBranch* aPrefs)
ReadStringValue(NS_LITERAL_STRING("ProxyServer"), buf))) {
ProxyData data[] = {
{ "ftp=", 4, PR_FALSE, "network.proxy.ftp",
{ "ftp=", 4, false, "network.proxy.ftp",
"network.proxy.ftp_port" },
{ "http=", 5, PR_FALSE, "network.proxy.http",
{ "http=", 5, false, "network.proxy.http",
"network.proxy.http_port" },
{ "https=", 6, PR_FALSE, "network.proxy.ssl",
{ "https=", 6, false, "network.proxy.ssl",
"network.proxy.ssl_port" },
{ "socks=", 6, PR_FALSE, "network.proxy.socks",
{ "socks=", 6, false, "network.proxy.socks",
"network.proxy.socks_port" },
};
PRInt32 startIndex = 0, count = 0;
bool foundSpecificProxy = false;
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(data); ++i) {
for (PRUint32 i = 0; i < ArrayLength(data); ++i) {
PRInt32 offset = buf.Find(NS_ConvertASCIItoUTF16(data[i].prefix));
if (offset >= 0) {
foundSpecificProxy = PR_TRUE;
foundSpecificProxy = true;
data[i].proxyConfigured = PR_TRUE;
data[i].proxyConfigured = true;
startIndex = offset + data[i].prefixLength;
@ -2191,9 +2195,9 @@ nsIEProfileMigrator::CopyProxyPreferences(nsIPrefBranch* aPrefs)
// No proxy config for any specific type was found, assume
// the ProxyServer value is of the form host:port and that
// it applies to all protocols.
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(data); ++i)
for (PRUint32 i = 0; i < ArrayLength(data); ++i)
SetProxyPref(buf, data[i].hostPref, data[i].portPref, aPrefs);
aPrefs->SetBoolPref("network.proxy.share_proxy_settings", PR_TRUE);
aPrefs->SetBoolPref("network.proxy.share_proxy_settings", true);
}
}

View File

@ -35,6 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsBrowserProfileMigratorUtils.h"
#include "nsDirectoryServiceDefs.h"
@ -68,6 +70,8 @@
#include <windows.h>
#endif
using namespace mozilla;
#define MIGRATION_BUNDLE "chrome://browser/locale/migration/migration.properties"
#ifdef XP_WIN
@ -145,16 +149,16 @@ nsOperaProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
MigrationData data[] = { { ToNewUnicode(OPERA_PREFERENCES_FILE_NAME),
nsIBrowserProfileMigrator::SETTINGS,
PR_FALSE },
false },
{ ToNewUnicode(OPERA_COOKIES_FILE_NAME),
nsIBrowserProfileMigrator::COOKIES,
PR_FALSE },
false },
{ ToNewUnicode(OPERA_HISTORY_FILE_NAME),
nsIBrowserProfileMigrator::HISTORY,
PR_FALSE },
false },
{ ToNewUnicode(OPERA_BOOKMARKS_FILE_NAME),
nsIBrowserProfileMigrator::BOOKMARKS,
PR_FALSE } };
false } };
// Frees file name strings allocated above.
GetMigrateDataFromArray(data, sizeof(data)/sizeof(MigrationData),
@ -175,7 +179,7 @@ nsOperaProfileMigrator::GetSourceExists(bool* aResult)
*aResult = count > 0;
}
else
*aResult = PR_FALSE;
*aResult = false;
return NS_OK;
}
@ -194,7 +198,7 @@ nsOperaProfileMigrator::GetSourceHasMultipleProfiles(bool* aResult)
}
else
#endif
*aResult = PR_FALSE;
*aResult = false;
return NS_OK;
}
@ -306,24 +310,24 @@ nsOperaProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
static
nsOperaProfileMigrator::PrefTransform gTransforms[] = {
{ "User Prefs", "Download Directory", _OPM(STRING), "browser.download.dir", _OPM(SetFile), PR_FALSE, { -1 } },
{ nsnull, "Enable Cookies", _OPM(INT), "network.cookie.cookieBehavior", _OPM(SetCookieBehavior), PR_FALSE, { -1 } },
{ nsnull, "Accept Cookies Session Only", _OPM(BOOL), "network.cookie.lifetimePolicy", _OPM(SetCookieLifetime), PR_FALSE, { -1 } },
{ nsnull, "Allow script to resize window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), PR_FALSE, { -1 } },
{ nsnull, "Allow script to move window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), PR_FALSE, { -1 } },
{ nsnull, "Allow script to raise window", _OPM(BOOL), "dom.disable_window_flip", _OPM(SetBool), PR_FALSE, { -1 } },
{ nsnull, "Allow script to change status", _OPM(BOOL), "dom.disable_window_status_change", _OPM(SetBool), PR_FALSE, { -1 } },
{ nsnull, "Ignore Unrequested Popups", _OPM(BOOL), "dom.disable_open_during_load", _OPM(SetBool), PR_FALSE, { -1 } },
{ nsnull, "Load Figures", _OPM(BOOL), "permissions.default.image", _OPM(SetImageBehavior), PR_FALSE, { -1 } },
{ "User Prefs", "Download Directory", _OPM(STRING), "browser.download.dir", _OPM(SetFile), false, { -1 } },
{ nsnull, "Enable Cookies", _OPM(INT), "network.cookie.cookieBehavior", _OPM(SetCookieBehavior), false, { -1 } },
{ nsnull, "Accept Cookies Session Only", _OPM(BOOL), "network.cookie.lifetimePolicy", _OPM(SetCookieLifetime), false, { -1 } },
{ nsnull, "Allow script to resize window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), false, { -1 } },
{ nsnull, "Allow script to move window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), false, { -1 } },
{ nsnull, "Allow script to raise window", _OPM(BOOL), "dom.disable_window_flip", _OPM(SetBool), false, { -1 } },
{ nsnull, "Allow script to change status", _OPM(BOOL), "dom.disable_window_status_change", _OPM(SetBool), false, { -1 } },
{ nsnull, "Ignore Unrequested Popups", _OPM(BOOL), "dom.disable_open_during_load", _OPM(SetBool), false, { -1 } },
{ nsnull, "Load Figures", _OPM(BOOL), "permissions.default.image", _OPM(SetImageBehavior), false, { -1 } },
{ "Visited link", nsnull, _OPM(COLOR), "browser.visited_color", _OPM(SetString), PR_FALSE, { -1 } },
{ "Link", nsnull, _OPM(COLOR), "browser.anchor_color", _OPM(SetString), PR_FALSE, { -1 } },
{ nsnull, "Underline", _OPM(BOOL), "browser.underline_anchors", _OPM(SetBool), PR_FALSE, { -1 } },
{ "Visited link", nsnull, _OPM(COLOR), "browser.visited_color", _OPM(SetString), false, { -1 } },
{ "Link", nsnull, _OPM(COLOR), "browser.anchor_color", _OPM(SetString), false, { -1 } },
{ nsnull, "Underline", _OPM(BOOL), "browser.underline_anchors", _OPM(SetBool), false, { -1 } },
{ nsnull, "Enable SSL v3", _OPM(BOOL), "security.enable_ssl3", _OPM(SetBool), PR_FALSE, { -1 } },
{ nsnull, "Enable TLS v1.0", _OPM(BOOL), "security.enable_tls", _OPM(SetBool), PR_FALSE, { -1 } },
{ nsnull, "Enable SSL v3", _OPM(BOOL), "security.enable_ssl3", _OPM(SetBool), false, { -1 } },
{ nsnull, "Enable TLS v1.0", _OPM(BOOL), "security.enable_tls", _OPM(SetBool), false, { -1 } },
{ "Extensions", "Scripting", _OPM(BOOL), "javascript.enabled", _OPM(SetBool), PR_FALSE, { -1 } }
{ "Extensions", "Scripting", _OPM(BOOL), "javascript.enabled", _OPM(SetBool), false, { -1 } }
};
nsresult
@ -421,7 +425,7 @@ nsOperaProfileMigrator::CopyPreferences(bool aReplace)
if (NS_SUCCEEDED(rv)) {
transform->stringValue = colorString;
transform->prefHasValue = PR_TRUE;
transform->prefHasValue = true;
transform->prefSetterFunc(transform, branch);
}
if (colorString)
@ -449,7 +453,7 @@ nsOperaProfileMigrator::CopyPreferences(bool aReplace)
default:
break;
}
transform->prefHasValue = PR_TRUE;
transform->prefHasValue = true;
transform->prefSetterFunc(transform, branch);
if (transform->type == _OPM(STRING) && transform->stringValue) {
NS_Free(transform->stringValue);
@ -482,7 +486,7 @@ nsOperaProfileMigrator::CopyProxySettings(nsINIParser &aParser,
char toggleBuf[15], serverBuf[20], serverPrefBuf[20],
serverPortPrefBuf[25];
PRInt32 enabled;
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(protocols); ++i) {
for (PRUint32 i = 0; i < ArrayLength(protocols); ++i) {
sprintf(toggleBuf, "Use %s", protocols[i]);
GetInteger(aParser, "Proxy", toggleBuf, &enabled);
if (enabled) {
@ -580,7 +584,7 @@ nsOperaProfileMigrator::CopyUserContentSheet(nsINIParser &aParser)
// Copy the file
nsCOMPtr<nsILocalFile> userContentCSSFile;
rv = NS_NewNativeLocalFile(userContentCSS, PR_TRUE,
rv = NS_NewNativeLocalFile(userContentCSS, true,
getter_AddRefs(userContentCSSFile));
if (NS_FAILED(rv))
return NS_OK;
@ -634,13 +638,13 @@ nsOperaProfileMigrator::CopyCookies(bool aReplace)
nsOperaCookieMigrator::nsOperaCookieMigrator(nsIInputStream* aSourceStream) :
mAppVersion(0), mFileVersion(0), mTagTypeLength(0), mPayloadTypeLength(0),
mCookieOpen(PR_FALSE), mCurrHandlingInfo(0)
mCookieOpen(false), mCurrHandlingInfo(0)
{
mStream = do_CreateInstance("@mozilla.org/binaryinputstream;1");
if (mStream)
mStream->SetInputStream(aSourceStream);
mCurrCookie.isSecure = PR_FALSE;
mCurrCookie.isSecure = false;
mCurrCookie.expiryTime = 0;
}
@ -758,7 +762,7 @@ nsOperaCookieMigrator::Migrate()
AddCookie(manager);
mStream->Read16(&segmentLength);
mCookieOpen = PR_TRUE;
mCookieOpen = true;
}
break;
case COOKIE_ID:
@ -792,7 +796,7 @@ nsOperaCookieMigrator::Migrate()
mStream->Read32(reinterpret_cast<PRUint32*>(&(mCurrCookie.expiryTime)));
break;
case COOKIE_SECURE:
mCurrCookie.isSecure = PR_TRUE;
mCurrCookie.isSecure = true;
break;
// We don't support any of these fields but we must read them in
@ -895,15 +899,15 @@ nsOperaCookieMigrator::AddCookie(nsICookieManager2* aManager)
nsCString path;
SynthesizePath(getter_Copies(path));
mCookieOpen = PR_FALSE;
mCookieOpen = false;
nsresult rv = aManager->Add(domain,
path,
mCurrCookie.id,
mCurrCookie.data,
mCurrCookie.isSecure,
PR_FALSE, // isHttpOnly
PR_FALSE, // isSession
false, // isHttpOnly
false, // isSession
PRInt64(mCurrCookie.expiryTime));
mCurrCookie.isSecure = 0;
@ -971,16 +975,16 @@ nsOperaProfileMigrator::RunBatched(nsISupports* aUserData)
switch (batchAction) {
case BATCH_ACTION_HISTORY:
rv = CopyHistoryBatched(PR_FALSE);
rv = CopyHistoryBatched(false);
break;
case BATCH_ACTION_HISTORY_REPLACE:
rv = CopyHistoryBatched(PR_TRUE);
rv = CopyHistoryBatched(true);
break;
case BATCH_ACTION_BOOKMARKS:
rv = CopyBookmarksBatched(PR_FALSE);
rv = CopyBookmarksBatched(false);
break;
case BATCH_ACTION_BOOKMARKS_REPLACE:
rv = CopyBookmarksBatched(PR_TRUE);
rv = CopyBookmarksBatched(true);
break;
}
NS_ENSURE_SUCCESS(rv, rv);
@ -1376,7 +1380,7 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
break;
case LineType_ONTOOLBAR:
if (NS_LITERAL_STRING("YES").Equals(data))
onToolbar = PR_TRUE;
onToolbar = true;
break;
case LineType_NL: {
// XXX We don't know for sure how Opera deals with IDN hostnames in URL.
@ -1400,7 +1404,7 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
url.Truncate();
keyword.Truncate();
description.Truncate();
onToolbar = PR_FALSE;
onToolbar = false;
}
}
else if (entryType == EntryType_FOLDER) {

View File

@ -226,7 +226,7 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
// VERSIONINFO segment, but we just assume the first one).
nsCOMPtr<nsILocalFile> lf;
NS_NewLocalFile(filePath, PR_TRUE, getter_AddRefs(lf));
NS_NewLocalFile(filePath, true, getter_AddRefs(lf));
if (!lf)
return NS_ERROR_FAILURE;
@ -275,35 +275,35 @@ nsProfileMigrator::ImportRegistryProfiles(const nsACString& aAppName)
nsCOMPtr<nsIToolkitProfileService> profileSvc
(do_GetService(NS_PROFILESERVICE_CONTRACTID));
NS_ENSURE_TRUE(profileSvc, PR_FALSE);
NS_ENSURE_TRUE(profileSvc, false);
nsCOMPtr<nsIProperties> dirService
(do_GetService("@mozilla.org/file/directory_service;1"));
NS_ENSURE_TRUE(dirService, PR_FALSE);
NS_ENSURE_TRUE(dirService, false);
nsCOMPtr<nsILocalFile> regFile;
#ifdef XP_WIN
rv = dirService->Get(NS_WIN_APPDATA_DIR, NS_GET_IID(nsILocalFile),
getter_AddRefs(regFile));
NS_ENSURE_SUCCESS(rv, PR_FALSE);
NS_ENSURE_SUCCESS(rv, false);
regFile->AppendNative(aAppName);
regFile->AppendNative(NS_LITERAL_CSTRING("registry.dat"));
#elif defined(XP_MACOSX)
rv = dirService->Get(NS_MAC_USER_LIB_DIR, NS_GET_IID(nsILocalFile),
getter_AddRefs(regFile));
NS_ENSURE_SUCCESS(rv, PR_FALSE);
NS_ENSURE_SUCCESS(rv, false);
regFile->AppendNative(aAppName);
regFile->AppendNative(NS_LITERAL_CSTRING("Application Registry"));
#elif defined(XP_OS2)
rv = dirService->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile),
getter_AddRefs(regFile));
NS_ENSURE_SUCCESS(rv, PR_FALSE);
NS_ENSURE_SUCCESS(rv, false);
regFile->AppendNative(aAppName);
regFile->AppendNative(NS_LITERAL_CSTRING("registry.dat"));
#else
rv = dirService->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile),
getter_AddRefs(regFile));
NS_ENSURE_SUCCESS(rv, PR_FALSE);
NS_ENSURE_SUCCESS(rv, false);
nsCAutoString dotAppName;
ToLowerCase(aAppName, dotAppName);
dotAppName.Insert('.', 0);
@ -314,10 +314,10 @@ nsProfileMigrator::ImportRegistryProfiles(const nsACString& aAppName)
nsCAutoString path;
rv = regFile->GetNativePath(path);
NS_ENSURE_SUCCESS(rv, PR_FALSE);
NS_ENSURE_SUCCESS(rv, false);
if (NR_StartupRegistry())
return PR_FALSE;
return false;
bool migrated = false;
HREG reg = nsnull;
@ -365,7 +365,7 @@ nsProfileMigrator::ImportRegistryProfiles(const nsACString& aAppName)
profileSvc->CreateProfile(profileFile, nsnull,
nsDependentCString(profileName),
getter_AddRefs(tprofile));
migrated = PR_TRUE;
migrated = true;
}
cleanup:

View File

@ -61,7 +61,7 @@ protected:
/**
* Import profiles from ~/.firefox/
* @return PR_TRUE if any profiles imported.
* @return true if any profiles imported.
*/
bool ImportRegistryProfiles(const nsACString& aAppName);
};

View File

@ -103,7 +103,7 @@ nsSafariProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup,
bool replace = false;
if (aStartup) {
replace = PR_TRUE;
replace = true;
rv = aStartup->DoStartup();
NS_ENSURE_SUCCESS(rv, rv);
}
@ -140,10 +140,10 @@ nsSafariProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
// Safari stores most of its user settings under ~/Library/Safari/
MigrationData data[] = { { ToNewUnicode(SAFARI_HISTORY_FILE_NAME),
nsIBrowserProfileMigrator::HISTORY,
PR_FALSE },
false },
{ ToNewUnicode(SAFARI_BOOKMARKS_FILE_NAME),
nsIBrowserProfileMigrator::BOOKMARKS,
PR_FALSE } };
false } };
// Frees file name strings allocated above.
GetMigrateDataFromArray(data, sizeof(data)/sizeof(MigrationData),
aReplace, safariSettingsDir, aResult);
@ -151,7 +151,7 @@ nsSafariProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
// Safari stores Cookies under ~/Library/Cookies/Cookies.plist
MigrationData data2[] = { { ToNewUnicode(SAFARI_COOKIES_FILE_NAME),
nsIBrowserProfileMigrator::COOKIES,
PR_FALSE } };
false } };
GetMigrateDataFromArray(data2, sizeof(data2)/sizeof(MigrationData),
aReplace, safariCookiesDir, aResult);
@ -161,7 +161,7 @@ nsSafariProfileMigrator::GetMigrateData(const PRUnichar* aProfile,
getter_AddRefs(systemPrefsDir));
MigrationData data3[]= { { ToNewUnicode(SAFARI_PREFERENCES_FILE_NAME),
nsIBrowserProfileMigrator::SETTINGS,
PR_FALSE } };
false } };
GetMigrateDataFromArray(data3, sizeof(data3)/sizeof(MigrationData),
aReplace, systemPrefsDir, aResult);
@ -186,7 +186,7 @@ NS_IMETHODIMP
nsSafariProfileMigrator::GetSourceExists(bool* aResult)
{
PRUint16 data;
GetMigrateData(nsnull, PR_FALSE, &data);
GetMigrateData(nsnull, false, &data);
*aResult = data != 0;
@ -197,7 +197,7 @@ NS_IMETHODIMP
nsSafariProfileMigrator::GetSourceHasMultipleProfiles(bool* aResult)
{
// Safari only has one profile per-user.
*aResult = PR_FALSE;
*aResult = false;
return NS_OK;
}
@ -297,9 +297,9 @@ GetDictionaryStringValue(CFDictionaryRef aDictionary, CFStringRef aKey,
::CFStringGetCharacters(value, CFRangeMake(0, valueLength), buffer.Elements());
aResult.Assign(buffer.Elements(), valueLength);
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
bool
@ -314,10 +314,10 @@ GetDictionaryCStringValue(CFDictionaryRef aDictionary, CFStringRef aKey,
if (::CFStringGetCString(value, buffer.Elements(), valueLength + 1, aEncoding)) {
aResult = buffer.Elements();
return PR_TRUE;
return true;
}
}
return PR_FALSE;
return false;
}
bool
@ -331,31 +331,31 @@ GetArrayStringValue(CFArrayRef aArray, PRInt32 aIndex, nsAString& aResult)
::CFStringGetCharacters(value, CFRangeMake(0, valueLength), buffer.Elements());
aResult.Assign(buffer.Elements(), valueLength);
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
#define _SPM(type) nsSafariProfileMigrator::type
static
nsSafariProfileMigrator::PrefTransform gTransforms[] = {
{ CFSTR("AlwaysShowTabBar"), _SPM(BOOL), "browser.tabs.autoHide", _SPM(SetBoolInverted), PR_FALSE, { -1 } },
{ CFSTR("AutoFillPasswords"), _SPM(BOOL), "signon.rememberSignons", _SPM(SetBool), PR_FALSE, { -1 } },
{ CFSTR("OpenNewTabsInFront"), _SPM(BOOL), "browser.tabs.loadInBackground", _SPM(SetBoolInverted), PR_FALSE, { -1 } },
{ CFSTR("NSDefaultOpenDir"), _SPM(STRING), "browser.download.dir", _SPM(SetDownloadFolder), PR_FALSE, { -1 } },
{ CFSTR("AutoOpenSafeDownloads"), _SPM(BOOL), nsnull, _SPM(SetDownloadHandlers), PR_FALSE, { -1 } },
{ CFSTR("DownloadsClearingPolicy"), _SPM(INT), "browser.download.manager.retention", _SPM(SetDownloadRetention), PR_FALSE, { -1 } },
{ CFSTR("WebKitDefaultTextEncodingName"),_SPM(STRING), "intl.charset.default", _SPM(SetDefaultEncoding), PR_FALSE, { -1 } },
{ CFSTR("WebKitStandardFont"), _SPM(STRING), "font.name.serif.", _SPM(SetFontName), PR_FALSE, { -1 } },
{ CFSTR("WebKitDefaultFontSize"), _SPM(INT), "font.size.serif.", _SPM(SetFontSize), PR_FALSE, { -1 } },
{ CFSTR("WebKitFixedFont"), _SPM(STRING), "font.name.fixed.", _SPM(SetFontName), PR_FALSE, { -1 } },
{ CFSTR("WebKitDefaultFixedFontSize"), _SPM(INT), "font.size.fixed.", _SPM(SetFontSize), PR_FALSE, { -1 } },
{ CFSTR("WebKitMinimumFontSize"), _SPM(INT), "font.minimum-size.", _SPM(SetFontSize), PR_FALSE, { -1 } },
{ CFSTR("WebKitDisplayImagesKey"), _SPM(BOOL), "permissions.default.image", _SPM(SetDisplayImages), PR_FALSE, { -1 } },
{ CFSTR("WebKitJavaScriptEnabled"), _SPM(BOOL), "javascript.enabled", _SPM(SetBool), PR_FALSE, { -1 } },
{ CFSTR("AlwaysShowTabBar"), _SPM(BOOL), "browser.tabs.autoHide", _SPM(SetBoolInverted), false, { -1 } },
{ CFSTR("AutoFillPasswords"), _SPM(BOOL), "signon.rememberSignons", _SPM(SetBool), false, { -1 } },
{ CFSTR("OpenNewTabsInFront"), _SPM(BOOL), "browser.tabs.loadInBackground", _SPM(SetBoolInverted), false, { -1 } },
{ CFSTR("NSDefaultOpenDir"), _SPM(STRING), "browser.download.dir", _SPM(SetDownloadFolder), false, { -1 } },
{ CFSTR("AutoOpenSafeDownloads"), _SPM(BOOL), nsnull, _SPM(SetDownloadHandlers), false, { -1 } },
{ CFSTR("DownloadsClearingPolicy"), _SPM(INT), "browser.download.manager.retention", _SPM(SetDownloadRetention), false, { -1 } },
{ CFSTR("WebKitDefaultTextEncodingName"),_SPM(STRING), "intl.charset.default", _SPM(SetDefaultEncoding), false, { -1 } },
{ CFSTR("WebKitStandardFont"), _SPM(STRING), "font.name.serif.", _SPM(SetFontName), false, { -1 } },
{ CFSTR("WebKitDefaultFontSize"), _SPM(INT), "font.size.serif.", _SPM(SetFontSize), false, { -1 } },
{ CFSTR("WebKitFixedFont"), _SPM(STRING), "font.name.fixed.", _SPM(SetFontName), false, { -1 } },
{ CFSTR("WebKitDefaultFixedFontSize"), _SPM(INT), "font.size.fixed.", _SPM(SetFontSize), false, { -1 } },
{ CFSTR("WebKitMinimumFontSize"), _SPM(INT), "font.minimum-size.", _SPM(SetFontSize), false, { -1 } },
{ CFSTR("WebKitDisplayImagesKey"), _SPM(BOOL), "permissions.default.image", _SPM(SetDisplayImages), false, { -1 } },
{ CFSTR("WebKitJavaScriptEnabled"), _SPM(BOOL), "javascript.enabled", _SPM(SetBool), false, { -1 } },
{ CFSTR("WebKitJavaScriptCanOpenWindowsAutomatically"),
_SPM(BOOL), "dom.disable_open_during_load", _SPM(SetBoolInverted), PR_FALSE, { -1 } }
_SPM(BOOL), "dom.disable_open_during_load", _SPM(SetBoolInverted), false, { -1 } }
};
nsresult
@ -481,7 +481,7 @@ nsSafariProfileMigrator::SetDownloadFolder(void* aTransform, nsIPrefBranch* aBra
nsCOMPtr<nsILocalFile> downloadFolder;
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(xform->stringValue),
PR_TRUE, getter_AddRefs(downloadFolder));
true, getter_AddRefs(downloadFolder));
NS_ENSURE_SUCCESS(rv, rv);
// If the Safari download folder is the desktop, set the folderList pref
@ -542,18 +542,18 @@ nsSafariProfileMigrator::SetDownloadHandlers(void* aTransform, nsIPrefBranch* aB
overridesList->GetCount(&count);
for (PRInt32 i = count; i >= 1; --i) {
nsCOMPtr<nsIRDFNode> currOverrideNode;
overridesList->RemoveElementAt(i, PR_FALSE, getter_AddRefs(currOverrideNode));
overridesList->RemoveElementAt(i, false, getter_AddRefs(currOverrideNode));
nsCOMPtr<nsIRDFResource> currOverride(do_QueryInterface(currOverrideNode));
nsCOMPtr<nsIRDFNode> handlerPropNode;
mimeTypes->GetTarget(currOverride, handlerPropArc, PR_TRUE,
mimeTypes->GetTarget(currOverride, handlerPropArc, true,
getter_AddRefs(handlerPropNode));
nsCOMPtr<nsIRDFResource> handlerPropResource(do_QueryInterface(handlerPropNode));
if (handlerPropResource) {
nsCOMPtr<nsIRDFNode> externalApplicationNode;
mimeTypes->GetTarget(handlerPropResource, externalApplicationArc,
PR_TRUE, getter_AddRefs(externalApplicationNode));
true, getter_AddRefs(externalApplicationNode));
nsCOMPtr<nsIRDFResource> externalApplicationResource(do_QueryInterface(externalApplicationNode));
// Strip the resources down so that the datasource is completely flushed.
@ -593,7 +593,7 @@ nsSafariProfileMigrator::CleanResource(nsIRDFDataSource* aDataSource,
if (currArc) {
nsCOMPtr<nsIRDFNode> currTarget;
aDataSource->GetTarget(aResource, currArc, PR_TRUE,
aDataSource->GetTarget(aResource, currArc, true,
getter_AddRefs(currTarget));
aDataSource->Unassert(aResource, currArc, currTarget);
@ -681,7 +681,7 @@ nsSafariProfileMigrator::CopyPreferences(bool aReplace)
if (!hasValue)
continue;
transform->prefHasValue = PR_FALSE;
transform->prefHasValue = false;
switch (transform->type) {
case _SPM(STRING): {
CFStringRef stringValue = (CFStringRef)
@ -690,7 +690,7 @@ nsSafariProfileMigrator::CopyPreferences(bool aReplace)
char* value = GetNullTerminatedString(stringValue);
if (value) {
transform->stringValue = value;
transform->prefHasValue = PR_TRUE;
transform->prefHasValue = true;
}
}
break;
@ -701,7 +701,7 @@ nsSafariProfileMigrator::CopyPreferences(bool aReplace)
PRInt32 value = 0;
if (::CFNumberGetValue(intValue, kCFNumberSInt32Type, &value)) {
transform->intValue = value;
transform->prefHasValue = PR_TRUE;
transform->prefHasValue = true;
}
}
break;
@ -710,7 +710,7 @@ nsSafariProfileMigrator::CopyPreferences(bool aReplace)
::CFDictionaryGetValue(safariPrefs,
transform->keyName);
transform->boolValue = boolValue == kCFBooleanTrue;
transform->prefHasValue = PR_TRUE;
transform->prefHasValue = true;
}
break;
default:
@ -798,9 +798,9 @@ nsSafariProfileMigrator::CopyCookies(bool aReplace)
expiryTime += SAFARI_DATE_OFFSET;
cookieManager->Add(domain, path, name, value,
PR_FALSE, // isSecure
PR_FALSE, // isHttpOnly
PR_FALSE, // isSession
false, // isSecure
false, // isHttpOnly
false, // isSession
expiryTime);
}
}
@ -820,16 +820,16 @@ nsSafariProfileMigrator::RunBatched(nsISupports* aUserData)
switch (batchAction) {
case BATCH_ACTION_HISTORY:
rv = CopyHistoryBatched(PR_FALSE);
rv = CopyHistoryBatched(false);
break;
case BATCH_ACTION_HISTORY_REPLACE:
rv = CopyHistoryBatched(PR_TRUE);
rv = CopyHistoryBatched(true);
break;
case BATCH_ACTION_BOOKMARKS:
rv = CopyBookmarksBatched(PR_FALSE);
rv = CopyBookmarksBatched(false);
break;
case BATCH_ACTION_BOOKMARKS_REPLACE:
rv = CopyBookmarksBatched(PR_TRUE);
rv = CopyBookmarksBatched(true);
break;
}
NS_ENSURE_SUCCESS(rv, rv);
@ -1016,7 +1016,7 @@ nsSafariProfileMigrator::CopyBookmarksBatched(bool aReplace)
CFArrayRef children =
(CFArrayRef)::CFDictionaryGetValue(safariBookmarks, CFSTR("Children"));
if (children) {
rv = ParseBookmarksFolder(children, folder, bms, PR_TRUE);
rv = ParseBookmarksFolder(children, folder, bms, true);
}
}
}
@ -1062,14 +1062,14 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
rv |= ParseBookmarksFolder(children,
toolbarFolder,
aBookmarksService,
PR_FALSE);
false);
}
// Look for the BookmarksMenu Bookmarks and flatten them into the top level
else if (title.EqualsLiteral("BookmarksMenu") && aIsAtRootLevel) {
rv |= ParseBookmarksFolder(children,
aParentFolder,
aBookmarksService,
PR_TRUE);
true);
}
else {
// Encountered a Folder, so create one in our Bookmarks DataSource and then
@ -1081,7 +1081,7 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
rv |= ParseBookmarksFolder(children,
folder,
aBookmarksService,
PR_FALSE);
false);
}
}
else if (type.EqualsLiteral("WebBookmarkTypeLeaf")) {
@ -1120,7 +1120,7 @@ nsSafariProfileMigrator::HasFormDataToImport()
CFDictionaryRef safariPrefs = CopySafariPrefs();
if (safariPrefs) {
if (::CFDictionaryContainsKey(safariPrefs, CFSTR("RecentSearchStrings")))
hasFormData = PR_TRUE;
hasFormData = true;
::CFRelease(safariPrefs);
}
return hasFormData;
@ -1185,7 +1185,7 @@ nsSafariProfileMigrator::ProfileHasContentStyleSheet(bool *outExists)
path.Append("/userContent.css");
nsCOMPtr<nsILocalFile> file;
rv = NS_NewNativeLocalFile(path, PR_FALSE,
rv = NS_NewNativeLocalFile(path, false,
getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv, rv);
@ -1217,7 +1217,7 @@ nsSafariProfileMigrator::GetSafariUserStyleSheet(nsILocalFile** aResult)
CFSTR("WebKitUserStyleSheetLocation" \
"PreferenceKey"), path)) {
nsCOMPtr<nsILocalFile> file;
rv = NS_NewLocalFile(path, PR_FALSE, getter_AddRefs(file));
rv = NS_NewLocalFile(path, false, getter_AddRefs(file));
if (NS_SUCCEEDED(rv)) {
bool exists = false;
file->Exists(&exists);

View File

@ -630,7 +630,7 @@ let AboutPermissions = {
let filterValue = document.getElementById("sites-filter").value.toLowerCase();
item.collapsed = aSite.host.toLowerCase().indexOf(filterValue) == -1;
this.sitesList.appendChild(item);
(this._listFragment || this.sitesList).appendChild(item);
},
startSitesListBatch: function () {

View File

@ -65,8 +65,8 @@
<description value="&allowScripts.label;"/>
<checkbox id="moveResizeWindows" label="&moveResizeWindows.label;"
accesskey="&moveResizeWindows.accesskey;"
<checkbox id="moveResizePopupWindows" label="&moveResizePopupWindows.label;"
accesskey="&moveResizePopupWindows.accesskey;"
preference="dom.disable_window_move_resize"/>
<checkbox id="raiseLowerWindows" label="&raiseLowerWindows.label;"
accesskey="&raiseLowerWindows.accesskey;"

View File

@ -89,6 +89,8 @@ var gCookiesWindow = {
this.filter();
}
document.getElementById("removeAllCookies").disabled = this._view._rowCount == 0;
this._saveState();
},
@ -117,6 +119,7 @@ var gCookiesWindow = {
this._view._rowCount = 0;
this._tree.treeBoxObject.rowCountChanged(0, -oldRowCount);
this._view.selection.clearSelection();
document.getElementById("removeAllCookies").disabled = true;
}
else if (aData == "reload") {
// first, clear any existing entries
@ -207,7 +210,10 @@ var gCookiesWindow = {
this._view._rowCount += rowCountImpact;
this._tree.treeBoxObject.rowCountChanged(oldRowCount - 1, rowCountImpact);
document.getElementById("removeAllCookies").disabled = this._view._filtered;
if (this._view._rowCount > 0 && !this._view._filtered)
document.getElementById("removeAllCookies").disabled = false;
else
document.getElementById("removeAllCookies").disabled = true;
},
_view: {

View File

@ -41,15 +41,23 @@
function test() {
// initialization
waitForExplicitFinish();
gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
// fill in the search bar with something
// fill in the search bar with something, twice to populate undo history
const kTestSearchString = "privatebrowsing";
let searchBar = BrowserSearch.searchBar;
searchBar.value = kTestSearchString + "foo";
searchBar.value = kTestSearchString;
gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
registerCleanupFunction(function () {
searchBar.textbox.reset();
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
});
// enter private browsing mode
pb.privateBrowsingEnabled = true;
@ -85,8 +93,6 @@ function test() {
gBrowser.removeTab(gBrowser.selectedTab);
pb.privateBrowsingEnabled = false;
// cleanup
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
finish();
}, true);
}

View File

@ -89,9 +89,12 @@ function test() {
state.windows[0].tabs[i].extData["uniq"],
"sanity check that tab has correct extData");
}
else
else {
ok(!("extData" in curState.windows[0].tabs[i]),
"sanity check that tab doesn't have extData");
//XXXzpao output the tab state to help debug bug 679590
info("tabState: " + JSON.stringify(curState.windows[0].tabs[i]));
}
}
// Now we'll set a new unique value on 1 of the tabs

View File

@ -34,6 +34,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include "nsCOMPtr.h"
#include "nsGNOMEShellService.h"
#include "nsShellService.h"
@ -68,6 +70,8 @@
#include <limits.h>
#include <stdlib.h>
using namespace mozilla;
struct ProtocolAssociation
{
const char *name;
@ -81,10 +85,10 @@ struct MimeTypeAssociation
};
static const ProtocolAssociation appProtocols[] = {
{ "http", PR_TRUE },
{ "https", PR_TRUE },
{ "ftp", PR_FALSE },
{ "chrome", PR_FALSE }
{ "http", true },
{ "https", true },
{ "ftp", false },
{ "chrome", false }
};
static const MimeTypeAssociation appTypes[] = {
@ -156,25 +160,25 @@ nsGNOMEShellService::GetAppPathFromLauncher()
const char *launcher = PR_GetEnv("MOZ_APP_LAUNCHER");
if (!launcher)
return PR_FALSE;
return false;
if (g_path_is_absolute(launcher)) {
mAppPath = launcher;
tmp = g_path_get_basename(launcher);
gchar *fullpath = g_find_program_in_path(tmp);
if (fullpath && mAppPath.Equals(fullpath))
mAppIsInPath = PR_TRUE;
mAppIsInPath = true;
g_free(fullpath);
} else {
tmp = g_find_program_in_path(launcher);
if (!tmp)
return PR_FALSE;
return false;
mAppPath = tmp;
mAppIsInPath = PR_TRUE;
mAppIsInPath = true;
}
g_free(tmp);
return PR_TRUE;
return true;
}
bool
@ -186,7 +190,7 @@ nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const
gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, NULL, NULL, NULL);
if (!nativePath) {
NS_ERROR("Error converting path to filesystem encoding");
return PR_FALSE;
return false;
}
commandPath = g_find_program_in_path(nativePath);
@ -196,7 +200,7 @@ nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const
}
if (!commandPath)
return PR_FALSE;
return false;
bool matches = mAppPath.Equals(commandPath);
g_free(commandPath);
@ -219,18 +223,18 @@ nsGNOMEShellService::CheckHandlerMatchesAppName(const nsACString &handler) const
}
if (!KeyMatchesAppName(command.get()))
return PR_FALSE; // the handler is set to another app
return false; // the handler is set to another app
return PR_TRUE;
return true;
}
NS_IMETHODIMP
nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck,
bool* aIsDefaultBrowser)
{
*aIsDefaultBrowser = PR_FALSE;
*aIsDefaultBrowser = false;
if (aStartupCheck)
mCheckedThisSession = PR_TRUE;
mCheckedThisSession = true;
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
@ -239,7 +243,7 @@ nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck,
nsCAutoString handler;
nsCOMPtr<nsIGIOMimeApp> gioApp;
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) {
if (!appProtocols[i].essential)
continue;
@ -266,7 +270,7 @@ nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck,
}
}
*aIsDefaultBrowser = PR_TRUE;
*aIsDefaultBrowser = true;
return NS_OK;
}
@ -295,7 +299,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
appKeyValue.AppendLiteral(" %s");
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) {
if (appProtocols[i].essential || aClaimAllTypes) {
gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
appKeyValue);
@ -328,7 +332,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
NS_ENSURE_SUCCESS(rv, rv);
// set handler for the protocols
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) {
if (appProtocols[i].essential || aClaimAllTypes) {
appInfo->SetAsDefaultForURIScheme(nsDependentCString(appProtocols[i].name));
}
@ -337,7 +341,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
// set handler for .html and xhtml files and MIME types:
if (aClaimAllTypes) {
// Add mime types for html, xhtml extension and set app to just created appinfo.
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
for (unsigned int i = 0; i < ArrayLength(appTypes); ++i) {
appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
}
@ -353,7 +357,7 @@ nsGNOMEShellService::GetShouldCheckDefaultBrowser(bool* aResult)
// If we've already checked, the browser has been started and this is a
// new window open, and we don't want to check again.
if (mCheckedThisSession) {
*aResult = PR_FALSE;
*aResult = false;
return NS_OK;
}
@ -478,7 +482,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
nsDependentCString(file_uri));
g_free(file_uri);
background_settings->SetBoolean(NS_LITERAL_CSTRING(kDesktopDrawBGGSKey),
PR_TRUE);
true);
return rv;
}
}
@ -496,7 +500,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
EmptyCString());
gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey), filePath);
gconf->SetBool(NS_LITERAL_CSTRING(kDesktopDrawBGKey), PR_TRUE);
gconf->SetBool(NS_LITERAL_CSTRING(kDesktopDrawBGKey), true);
}
return rv;
@ -667,7 +671,7 @@ nsGNOMEShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const ns
const nsCString spec(aURI);
const char* specStr = spec.get();
return process->Run(PR_FALSE, &specStr, 1);
return process->Run(false, &specStr, 1);
}
NS_IMETHODIMP

View File

@ -43,7 +43,7 @@
class nsGNOMEShellService : public nsIShellService
{
public:
nsGNOMEShellService() : mCheckedThisSession(PR_FALSE), mAppIsInPath(PR_FALSE) { }
nsGNOMEShellService() : mCheckedThisSession(false), mAppIsInPath(false) { }
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE

View File

@ -68,7 +68,7 @@ NS_IMPL_ISUPPORTS3(nsMacShellService, nsIMacShellService, nsIShellService, nsIWe
NS_IMETHODIMP
nsMacShellService::IsDefaultBrowser(bool aStartupCheck, bool* aIsDefaultBrowser)
{
*aIsDefaultBrowser = PR_FALSE;
*aIsDefaultBrowser = false;
CFStringRef firefoxID = ::CFBundleGetIdentifier(::CFBundleGetMainBundle());
if (!firefoxID) {
@ -89,7 +89,7 @@ nsMacShellService::IsDefaultBrowser(bool aStartupCheck, bool* aIsDefaultBrowser)
// checked this session (so that subsequent window opens don't show the
// default browser dialog).
if (aStartupCheck)
mCheckedThisSession = PR_TRUE;
mCheckedThisSession = true;
return NS_OK;
}
@ -129,7 +129,7 @@ nsMacShellService::GetShouldCheckDefaultBrowser(bool* aResult)
// If we've already checked, the browser has been started and this is a
// new window open, and we don't want to check again.
if (mCheckedThisSession) {
*aResult = PR_FALSE;
*aResult = false;
return NS_OK;
}
@ -174,12 +174,8 @@ nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement,
// We need the referer URI for nsIWebBrowserPersist::saveURI
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> doc;
doc = content->GetOwnerDoc();
if (!doc)
return NS_ERROR_FAILURE;
nsIURI *docURI = doc->GetDocumentURI();
nsIURI *docURI = content->OwnerDoc()->GetDocumentURI();
if (!docURI)
return NS_ERROR_FAILURE;
@ -360,7 +356,7 @@ nsMacShellService::OpenApplication(PRInt32 aApplication)
case nsIMacShellService::APPLICATION_NETWORK:
{
nsCOMPtr<nsILocalFile> lf;
rv = NS_NewNativeLocalFile(NETWORK_PREFPANE, PR_TRUE, getter_AddRefs(lf));
rv = NS_NewNativeLocalFile(NETWORK_PREFPANE, true, getter_AddRefs(lf));
NS_ENSURE_SUCCESS(rv, rv);
bool exists;
lf->Exists(&exists);
@ -372,7 +368,7 @@ nsMacShellService::OpenApplication(PRInt32 aApplication)
case nsIMacShellService::APPLICATION_DESKTOP:
{
nsCOMPtr<nsILocalFile> lf;
rv = NS_NewNativeLocalFile(DESKTOP_PREFPANE, PR_TRUE, getter_AddRefs(lf));
rv = NS_NewNativeLocalFile(DESKTOP_PREFPANE, true, getter_AddRefs(lf));
NS_ENSURE_SUCCESS(rv, rv);
bool exists;
lf->Exists(&exists);

View File

@ -47,7 +47,7 @@ class nsMacShellService : public nsIMacShellService,
public nsIWebProgressListener
{
public:
nsMacShellService() : mCheckedThisSession(PR_FALSE) {};
nsMacShellService() : mCheckedThisSession(false) {};
virtual ~nsMacShellService() {};
NS_DECL_ISUPPORTS

View File

@ -351,10 +351,10 @@ nsWindowsShellService::IsDefaultBrowserVista(bool* aIsDefaultBrowser)
*aIsDefaultBrowser = res;
pAAR->Release();
return PR_TRUE;
return true;
}
#endif
return PR_FALSE;
return false;
}
NS_IMETHODIMP
@ -365,12 +365,12 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
// checked this session (so that subsequent window opens don't show the
// default browser dialog).
if (aStartupCheck)
mCheckedThisSession = PR_TRUE;
mCheckedThisSession = true;
SETTING* settings;
SETTING* end = gSettings + sizeof(gSettings)/sizeof(SETTING);
*aIsDefaultBrowser = PR_TRUE;
*aIsDefaultBrowser = true;
PRUnichar exePath[MAX_BUF];
if (!::GetModuleFileNameW(0, exePath, MAX_BUF))
@ -396,7 +396,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
HKEY theKey;
rv = OpenKeyForReading(HKEY_CLASSES_ROOT, key, &theKey);
if (NS_FAILED(rv)) {
*aIsDefaultBrowser = PR_FALSE;
*aIsDefaultBrowser = false;
return NS_OK;
}
@ -408,7 +408,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
if (REG_FAILED(res) ||
!dataLongPath.Equals(currValue, CaseInsensitiveCompare)) {
// Key wasn't set, or was set to something other than our registry entry
*aIsDefaultBrowser = PR_FALSE;
*aIsDefaultBrowser = false;
return NS_OK;
}
}
@ -445,7 +445,7 @@ nsWindowsShellService::GetShouldCheckDefaultBrowser(bool* aResult)
// If we've already checked, the browser has been started and this is a
// new window open, and we don't want to check again.
if (mCheckedThisSession) {
*aResult = PR_FALSE;
*aResult = false;
return NS_OK;
}
@ -847,7 +847,7 @@ nsWindowsShellService::GetMailAccountKey(HKEY* aResult)
// Close the key we opened.
::RegCloseKey(mailKey);
return PR_TRUE;
return true;
}
}
else
@ -857,7 +857,7 @@ nsWindowsShellService::GetMailAccountKey(HKEY* aResult)
// Close the key we opened.
::RegCloseKey(mailKey);
return PR_FALSE;
return false;
}
NS_IMETHODIMP
@ -876,7 +876,7 @@ nsWindowsShellService::OpenApplicationWithURI(nsILocalFile* aApplication,
const nsCString spec(aURI);
const char* specStr = spec.get();
return process->Run(PR_FALSE, &specStr, 1);
return process->Run(false, &specStr, 1);
}
NS_IMETHODIMP

View File

@ -49,7 +49,7 @@
class nsWindowsShellService : public nsIWindowsShellService
{
public:
nsWindowsShellService() : mCheckedThisSession(PR_FALSE) {};
nsWindowsShellService() : mCheckedThisSession(false) {};
virtual ~nsWindowsShellService() {};
NS_DECL_ISUPPORTS

View File

@ -0,0 +1,53 @@
#
# ***** 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 code
#
# The Initial Developer of the Original Code is
# Google Inc.
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Brett Wilson <brettw@gmail.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 *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifdef ENABLE_TESTS
DIRS += test
endif
include $(topsrcdir)/config/rules.mk
libs::
$(NSINSTALL) $(srcdir)/modules/* $(FINAL_TARGET)/modules/tabview

Some files were not shown because too many files have changed in this diff Show More