diff --git a/build/.gdbinit b/.gdbinit similarity index 100% rename from build/.gdbinit rename to .gdbinit diff --git a/accessible/src/base/AccTypes.h b/accessible/src/base/AccTypes.h index fe3e8834f926..b9c164fced0d 100644 --- a/accessible/src/base/AccTypes.h +++ b/accessible/src/base/AccTypes.h @@ -13,31 +13,31 @@ namespace a11y { * Accessible object types used when creating an accessible based on the frame. */ enum AccType { - eNoAccessible, - eHTMLBRAccessible, - eHTMLButtonAccessible, - eHTMLCanvasAccessible, - eHTMLCaptionAccessible, - eHTMLCheckboxAccessible, - eHTMLComboboxAccessible, - eHTMLFileInputAccessible, - eHTMLGroupboxAccessible, - eHTMLHRAccessible, - eHTMLImageMapAccessible, - eHTMLLabelAccessible, - eHTMLLiAccessible, - eHTMLSelectListAccessible, - eHTMLMediaAccessible, - eHTMLObjectFrameAccessible, - eHTMLRadioButtonAccessible, - eHTMLTableAccessible, - eHTMLTableCellAccessible, - eHTMLTableRowAccessible, - eHTMLTextFieldAccessible, - eHyperTextAccessible, - eImageAccessible, - eOuterDocAccessible, - eTextLeafAccessible + eNoType, + eHTMLBR, + eHTMLButton, + eHTMLCanvas, + eHTMLCaption, + eHTMLCheckbox, + eHTMLCombobox, + eHTMLFileInput, + eHTMLGroupbox, + eHTMLHR, + eHTMLImageMap, + eHTMLLabel, + eHTMLLi, + eHTMLSelectList, + eHTMLMedia, + eHTMLRadioButton, + eHTMLTable, + eHTMLTableCell, + eHTMLTableRow, + eHTMLTextField, + eHyperText, + eImage, + eOuterDoc, + ePlugin, + eTextLeaf }; } } diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index 494f8e2325e1..dc3ed8273376 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -207,9 +207,9 @@ nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell, } already_AddRefed -nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, - nsIContent* aContent, - Accessible* aContext) +nsAccessibilityService::CreatePluginAccessible(nsObjectFrame* aFrame, + nsIContent* aContent, + Accessible* aContext) { // nsObjectFrame means a plugin, so we need to use the accessibility support // of the plugin. @@ -799,13 +799,13 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode, // on accessible HTML table elements. if ((roleMapEntry->accTypes & Accessible::eTableCellAccessible)) { if (aContext->IsOfType(Accessible::eTableRowAccessible) && - (frame->AccessibleType() != eHTMLTableCellAccessible || + (frame->AccessibleType() != eHTMLTableCell || aContext->GetContent() != content->GetParent())) { newAcc = new ARIAGridCellAccessibleWrap(content, document); } } else if ((roleMapEntry->accTypes & Accessible::eTableAccessible) && - frame->AccessibleType() != eHTMLTableAccessible) { + frame->AccessibleType() != eHTMLTable) { newAcc = new ARIAGridAccessibleWrap(content, document); } } @@ -822,20 +822,20 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode, // If table has strong ARIA role then all table descendants shouldn't // expose their native roles. if (!roleMapEntry && newAcc) { - if (frame->AccessibleType() == eHTMLTableRowAccessible) { + if (frame->AccessibleType() == eHTMLTableRow) { nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap(); if (contextRoleMap && !(contextRoleMap->accTypes & Accessible::eTableAccessible)) roleMapEntry = &nsARIAMap::gEmptyRoleMap; - } else if (frame->AccessibleType() == eHTMLTableCellAccessible && + } else if (frame->AccessibleType() == eHTMLTableCell && aContext->ARIARoleMap() == &nsARIAMap::gEmptyRoleMap) { roleMapEntry = &nsARIAMap::gEmptyRoleMap; } else if (content->Tag() == nsGkAtoms::dt || content->Tag() == nsGkAtoms::li || content->Tag() == nsGkAtoms::dd || - frame->AccessibleType() == eHTMLLiAccessible) { + frame->AccessibleType() == eHTMLLi) { nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap(); if (contextRoleMap && !(contextRoleMap->accTypes & Accessible::eListAccessible)) @@ -1306,75 +1306,69 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame, nsRefPtr newAcc; switch (aFrame->AccessibleType()) { - case eNoAccessible: + case eNoType: return nullptr; - case eHTMLBRAccessible: + case eHTMLBR: newAcc = new HTMLBRAccessible(aContent, document); break; - case eHTMLButtonAccessible: + case eHTMLButton: newAcc = new HTMLButtonAccessible(aContent, document); break; - case eHTMLCanvasAccessible: + case eHTMLCanvas: newAcc = new HTMLCanvasAccessible(aContent, document); break; - case eHTMLCaptionAccessible: + case eHTMLCaption: if (aContext->IsOfType(Accessible::eTableAccessible) && aContext->GetContent() == aContent->GetParent()) { newAcc = new HTMLCaptionAccessible(aContent, document); } break; - case eHTMLCheckboxAccessible: + case eHTMLCheckbox: newAcc = new HTMLCheckboxAccessible(aContent, document); break; - case eHTMLComboboxAccessible: + case eHTMLCombobox: newAcc = new HTMLComboboxAccessible(aContent, document); break; - case eHTMLFileInputAccessible: + case eHTMLFileInput: newAcc = new HTMLFileInputAccessible(aContent, document); break; - case eHTMLGroupboxAccessible: + case eHTMLGroupbox: newAcc = new HTMLGroupboxAccessible(aContent, document); break; - case eHTMLHRAccessible: + case eHTMLHR: newAcc = new HTMLHRAccessible(aContent, document); break; - case eHTMLImageMapAccessible: + case eHTMLImageMap: newAcc = new HTMLImageMapAccessible(aContent, document); break; - case eHTMLLabelAccessible: + case eHTMLLabel: newAcc = new HTMLLabelAccessible(aContent, document); break; - case eHTMLLiAccessible: + case eHTMLLi: if (aContext->IsOfType(Accessible::eListAccessible) && aContext->GetContent() == aContent->GetParent()) { newAcc = new HTMLLIAccessible(aContent, document); } break; - case eHTMLSelectListAccessible: + case eHTMLSelectList: newAcc = new HTMLSelectListAccessible(aContent, document); break; - case eHTMLMediaAccessible: + case eHTMLMedia: newAcc = new EnumRoleAccessible(aContent, document, roles::GROUPING); break; - case eHTMLObjectFrameAccessible: { - nsObjectFrame* objectFrame = do_QueryFrame(aFrame); - newAcc = CreateHTMLObjectFrameAccessible(objectFrame, aContent, aContext); - break; - } - - case eHTMLRadioButtonAccessible: + case eHTMLRadioButton: newAcc = new HTMLRadioButtonAccessible(aContent, document); break; - case eHTMLTableAccessible: + case eHTMLTable: newAcc = new HTMLTableAccessibleWrap(aContent, document); break; - case eHTMLTableCellAccessible: + case eHTMLTableCell: // Accessible HTML table cell must be a child of accessible HTML table row. if (aContext->IsOfType(Accessible::eHTMLTableRowAccessible)) newAcc = new HTMLTableCellAccessibleWrap(aContent, document); break; - case eHTMLTableRowAccessible: { + case eHTMLTableRow: { // Accessible HTML table row must be a child of tbody/tfoot/thead of // accessible HTML table or must be a child of accessible of HTML table. if (aContext->IsOfType(Accessible::eTableAccessible)) { @@ -1392,21 +1386,26 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame, } break; } - case eHTMLTextFieldAccessible: + case eHTMLTextField: newAcc = new HTMLTextFieldAccessible(aContent, document); break; - case eHyperTextAccessible: + case eHyperText: if (aContent->Tag() != nsGkAtoms::dt && aContent->Tag() != nsGkAtoms::dd) newAcc = new HyperTextAccessibleWrap(aContent, document); break; - case eImageAccessible: + case eImage: newAcc = new ImageAccessibleWrap(aContent, document); break; - case eOuterDocAccessible: + case eOuterDoc: newAcc = new OuterDocAccessible(aContent, document); break; - case eTextLeafAccessible: + case ePlugin: { + nsObjectFrame* objectFrame = do_QueryFrame(aFrame); + newAcc = CreatePluginAccessible(objectFrame, aContent, aContext); + break; + } + case eTextLeaf: newAcc = new TextLeafAccessibleWrap(aContent, document); break; } diff --git a/accessible/src/base/nsAccessibilityService.h b/accessible/src/base/nsAccessibilityService.h index beb93374da9f..d30bca016c1a 100644 --- a/accessible/src/base/nsAccessibilityService.h +++ b/accessible/src/base/nsAccessibilityService.h @@ -54,8 +54,8 @@ public: virtual Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell, bool aCanCreate); already_AddRefed - CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, nsIContent* aContent, - Accessible* aContext); + CreatePluginAccessible(nsObjectFrame* aFrame, nsIContent* aContent, + Accessible* aContext); /** * Adds/remove ATK root accessible for gtk+ native window to/from children diff --git a/accessible/src/generic/Accessible-inl.h b/accessible/src/generic/Accessible-inl.h index 9fc9c37a025e..4cf2ae1f0a6a 100644 --- a/accessible/src/generic/Accessible-inl.h +++ b/accessible/src/generic/Accessible-inl.h @@ -42,7 +42,7 @@ Accessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry) inline bool Accessible::HasNumericValue() const { - if (mFlags & eHasNumericValue) + if (mStateFlags & eHasNumericValue) return true; return mRoleMapEntry && mRoleMapEntry->valueRule != eNoValue; diff --git a/accessible/src/generic/Accessible.cpp b/accessible/src/generic/Accessible.cpp index ae3a31f2c869..e65a59e609fd 100644 --- a/accessible/src/generic/Accessible.cpp +++ b/accessible/src/generic/Accessible.cpp @@ -145,8 +145,8 @@ Accessible::QueryInterface(REFNSIID aIID, void** aInstancePtr) Accessible::Accessible(nsIContent* aContent, DocAccessible* aDoc) : nsAccessNodeWrap(aContent, aDoc), - mParent(nullptr), mIndexInParent(-1), mFlags(eChildrenUninitialized), - mIndexOfEmbeddedChild(-1), mRoleMapEntry(nullptr) + mParent(nullptr), mIndexInParent(-1), mChildrenFlags(eChildrenUninitialized), + mStateFlags(0), mFlags(0), mIndexOfEmbeddedChild(-1), mRoleMapEntry(nullptr) { #ifdef NS_DEBUG_X { @@ -2430,7 +2430,7 @@ Accessible::Shutdown() { // Mark the accessible as defunct, invalidate the child count and pointers to // other accessibles, also make sure none of its children point to this parent - mFlags |= eIsDefunct; + mStateFlags |= eIsDefunct; InvalidateChildren(); if (mParent) diff --git a/accessible/src/generic/Accessible.h b/accessible/src/generic/Accessible.h index 442302f5123a..38aee6f28011 100644 --- a/accessible/src/generic/Accessible.h +++ b/accessible/src/generic/Accessible.h @@ -678,23 +678,24 @@ public: /** * Return true if the accessible is defunct. */ - bool IsDefunct() const { return mFlags & eIsDefunct; } + bool IsDefunct() const { return mStateFlags & eIsDefunct; } /** * Return true if the accessible is no longer in the document. */ - bool IsInDocument() const { return !(mFlags & eIsNotInDocument); } + bool IsInDocument() const { return !(mStateFlags & eIsNotInDocument); } /** * Return true if the accessible should be contained by document node map. */ bool IsNodeMapEntry() const - { return HasOwnContent() && !(mFlags & eNotNodeMapEntry); } + { return HasOwnContent() && !(mStateFlags & eNotNodeMapEntry); } /** * Return true if the accessible has associated DOM content. */ - bool HasOwnContent() const { return mContent && !(mFlags & eSharedNode); } + bool HasOwnContent() const + { return mContent && !(mStateFlags & eSharedNode); } /** * Return true if accessible is of given type. @@ -752,25 +753,24 @@ protected: /** * Return true if the children flag is set. */ - inline bool IsChildrenFlag(ChildrenFlags aFlag) const - { return static_cast (mFlags & kChildrenFlagsMask) == aFlag; } + bool IsChildrenFlag(ChildrenFlags aFlag) const + { return static_cast(mChildrenFlags) == aFlag; } /** * Set children flag. */ - inline void SetChildrenFlag(ChildrenFlags aFlag) - { mFlags = (mFlags & ~kChildrenFlagsMask) | aFlag; } + void SetChildrenFlag(ChildrenFlags aFlag) { mChildrenFlags = aFlag; } /** * Flags used to describe the state of this accessible. * @note keep these flags in sync with ChildrenFlags */ enum StateFlags { - eIsDefunct = 1 << 2, // accessible is defunct - eIsNotInDocument = 1 << 3, // accessible is not in document - eSharedNode = 1 << 4, // accessible shares DOM node from another accessible - eNotNodeMapEntry = 1 << 5, // accessible shouldn't be in document node map - eHasNumericValue = 1 << 6 // accessible has a numeric value + eIsDefunct = 1 << 0, // accessible is defunct + eIsNotInDocument = 1 << 1, // accessible is not in document + eSharedNode = 1 << 2, // accessible shares DOM node from another accessible + eNotNodeMapEntry = 1 << 3, // accessible shouldn't be in document node map + eHasNumericValue = 1 << 4 // accessible has a numeric value }; public: // XXX: a small hack to make these visible for nsARIAMap @@ -779,30 +779,30 @@ public: // XXX: a small hack to make these visible for nsARIAMap * @note keep these flags in sync with ChildrenFlags and StateFlags */ enum AccessibleTypes { - eApplicationAccessible = 1 << 7, - eAutoCompleteAccessible = 1 << 8, - eAutoCompletePopupAccessible = 1 << 9, - eComboboxAccessible = 1 << 10, - eDocAccessible = 1 << 11, - eHyperTextAccessible = 1 << 12, - eHTMLFileInputAccessible = 1 << 13, - eHTMLListItemAccessible = 1 << 14, - eHTMLTableRowAccessible = 1 << 15, - eImageAccessible = 1 << 16, - eImageMapAccessible = 1 << 17, - eListAccessible = 1 << 18, - eListControlAccessible = 1 << 19, - eMenuButtonAccessible = 1 << 20, - eMenuPopupAccessible = 1 << 21, - eProgressAccessible = 1 << 22, - eRootAccessible = 1 << 23, - eSelectAccessible = 1 << 24, - eTableAccessible = 1 << 25, - eTableCellAccessible = 1 << 26, - eTableRowAccessible = 1 << 27, - eTextLeafAccessible = 1 << 28, - eXULDeckAccessible = 1 << 29, - eXULTreeAccessible = 1 << 30 + eApplicationAccessible = 1 << 0, + eAutoCompleteAccessible = 1 << 1, + eAutoCompletePopupAccessible = 1 << 2, + eComboboxAccessible = 1 << 3, + eDocAccessible = 1 << 4, + eHyperTextAccessible = 1 << 5, + eHTMLFileInputAccessible = 1 << 6, + eHTMLListItemAccessible = 1 << 7, + eHTMLTableRowAccessible = 1 << 8, + eImageAccessible = 1 << 9, + eImageMapAccessible = 1 << 10, + eListAccessible = 1 << 11, + eListControlAccessible = 1 << 12, + eMenuButtonAccessible = 1 << 13, + eMenuPopupAccessible = 1 << 14, + eProgressAccessible = 1 << 15, + eRootAccessible = 1 << 16, + eSelectAccessible = 1 << 17, + eTableAccessible = 1 << 18, + eTableCellAccessible = 1 << 19, + eTableRowAccessible = 1 << 20, + eTextLeafAccessible = 1 << 21, + eXULDeckAccessible = 1 << 22, + eXULTreeAccessible = 1 << 23 }; protected: @@ -909,10 +909,13 @@ protected: nsTArray > mChildren; int32_t mIndexInParent; - static const uint32_t kChildrenFlagsMask = - eChildrenUninitialized | eMixedChildren | eEmbeddedChildren; + /** + * Keep in sync with ChildrenFlags, StateFlags and AccessibleTypes. + */ + uint32_t mChildrenFlags : 2; + uint32_t mStateFlags : 5; + uint32_t mFlags : 25; - uint32_t mFlags; friend class DocAccessible; nsAutoPtr mEmbeddedObjCollector; diff --git a/accessible/src/generic/DocAccessible.cpp b/accessible/src/generic/DocAccessible.cpp index 322dad830015..e79c128b7f8b 100644 --- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -79,7 +79,9 @@ DocAccessible:: mVirtualCursor(nullptr), mPresShell(aPresShell) { - mFlags |= eDocAccessible | eNotNodeMapEntry; + mFlags |= eDocAccessible; + mStateFlags |= eNotNodeMapEntry; + MOZ_ASSERT(mPresShell, "should have been given a pres shell"); mPresShell->SetDocAccessible(this); @@ -613,7 +615,7 @@ DocAccessible::Shutdown() // Mark the document as shutdown before AT is notified about the document // removal from its container (valid for root documents on ATK and due to // some reason for MSAA, refer to bug 757392 for details). - mFlags |= eIsDefunct; + mStateFlags |= eIsDefunct; nsCOMPtr kungFuDeathGripDoc = mDocumentNode; mDocumentNode = nullptr; @@ -1941,7 +1943,7 @@ DocAccessible::CacheChildrenInSubtree(Accessible* aRoot) void DocAccessible::UncacheChildrenInSubtree(Accessible* aRoot) { - aRoot->mFlags |= eIsNotInDocument; + aRoot->mStateFlags |= eIsNotInDocument; if (aRoot->IsElement()) RemoveDependentIDsFor(aRoot); diff --git a/accessible/src/generic/FormControlAccessible.h b/accessible/src/generic/FormControlAccessible.h index fa0561369215..ea73e202db5b 100644 --- a/accessible/src/generic/FormControlAccessible.h +++ b/accessible/src/generic/FormControlAccessible.h @@ -21,7 +21,8 @@ public: ProgressMeterAccessible(nsIContent* aContent, DocAccessible* aDoc) : LeafAccessible(aContent, aDoc) { - mFlags |= eHasNumericValue | eProgressAccessible; + mStateFlags |= eHasNumericValue; + mFlags |= eProgressAccessible; } NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/html/HTMLImageMapAccessible.cpp b/accessible/src/html/HTMLImageMapAccessible.cpp index 925bd2dd5eef..cd330542d5fd 100644 --- a/accessible/src/html/HTMLImageMapAccessible.cpp +++ b/accessible/src/html/HTMLImageMapAccessible.cpp @@ -153,7 +153,7 @@ HTMLAreaAccessible:: { // Make HTML area DOM element not accessible. HTML image map accessible // manages its tree itself. - mFlags |= eNotNodeMapEntry; + mStateFlags |= eNotNodeMapEntry; } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/html/HTMLListAccessible.cpp b/accessible/src/html/HTMLListAccessible.cpp index 7e32a32b7d20..ccf1a58aa599 100644 --- a/accessible/src/html/HTMLListAccessible.cpp +++ b/accessible/src/html/HTMLListAccessible.cpp @@ -145,7 +145,7 @@ HTMLListBulletAccessible:: HTMLListBulletAccessible(nsIContent* aContent, DocAccessible* aDoc) : LeafAccessible(aContent, aDoc) { - mFlags |= eSharedNode; + mStateFlags |= eSharedNode; } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/html/HTMLSelectAccessible.cpp b/accessible/src/html/HTMLSelectAccessible.cpp index 9fbc393718cd..3db6e0097368 100644 --- a/accessible/src/html/HTMLSelectAccessible.cpp +++ b/accessible/src/html/HTMLSelectAccessible.cpp @@ -620,7 +620,7 @@ HTMLComboboxListAccessible:: DocAccessible* aDoc) : HTMLSelectListAccessible(aContent, aDoc) { - mFlags |= eSharedNode; + mStateFlags |= eSharedNode; } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/html/HTMLTableAccessible.cpp b/accessible/src/html/HTMLTableAccessible.cpp index f7841b9d9bb8..68ba61228019 100644 --- a/accessible/src/html/HTMLTableAccessible.cpp +++ b/accessible/src/html/HTMLTableAccessible.cpp @@ -30,12 +30,13 @@ #include "nsIDocument.h" #include "nsIMutableArray.h" #include "nsIPresShell.h" -#include "nsITableLayout.h" #include "nsITableCellLayout.h" #include "nsFrameSelection.h" #include "nsError.h" #include "nsArrayUtils.h" #include "nsComponentManagerUtils.h" +#include "nsTableCellFrame.h" +#include "nsTableOuterFrame.h" using namespace mozilla; using namespace mozilla::a11y; @@ -121,9 +122,11 @@ HTMLTableCellAccessible::NativeAttributes() if (ChildCount() == 1) { Accessible* abbr = FirstChild(); if (abbr->IsAbbreviation()) { - nsTextEquivUtils:: - AppendTextEquivFromTextContent(abbr->GetContent()->GetFirstChild(), - &abbrText); + nsIContent* firstChildNode = abbr->GetContent()->GetFirstChild(); + if (firstChildNode) { + nsTextEquivUtils:: + AppendTextEquivFromTextContent(firstChildNode, &abbrText); + } } } if (abbrText.IsEmpty()) @@ -469,52 +472,35 @@ HTMLTableAccessible::Summary(nsString& aSummary) uint32_t HTMLTableAccessible::ColCount() { - nsITableLayout* tableLayout = GetTableLayout(); - if (!tableLayout) - return 0; - - int32_t rowCount = 0, colCount = 0; - tableLayout->GetTableSize(rowCount, colCount); - return colCount; + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + return tableFrame ? tableFrame->GetColCount() : 0; } uint32_t HTMLTableAccessible::RowCount() { - nsITableLayout* tableLayout = GetTableLayout(); - if (!tableLayout) - return 0; - - int32_t rowCount = 0, colCount = 0; - tableLayout->GetTableSize(rowCount, colCount); - return rowCount; + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + return tableFrame ? tableFrame->GetRowCount() : 0; } uint32_t HTMLTableAccessible::SelectedCellCount() { - nsITableLayout *tableLayout = GetTableLayout(); - if (!tableLayout) + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) return 0; uint32_t count = 0, rowCount = RowCount(), colCount = ColCount(); - - nsCOMPtr domElement; - int32_t startRowIndex = 0, startColIndex = 0, - rowSpan, colSpan, actualRowSpan, actualColSpan; - bool isSelected = false; - for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) { for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) { - nsresult rv = tableLayout->GetCellDataAt(rowIdx, colIdx, - *getter_AddRefs(domElement), - startRowIndex, startColIndex, - rowSpan, colSpan, - actualRowSpan, actualColSpan, - isSelected); + nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx); + if (!cellFrame || !cellFrame->IsSelected()) + continue; - if (NS_SUCCEEDED(rv) && startRowIndex == rowIdx && - startColIndex == colIdx && isSelected) + int32_t startRow = -1, startCol = -1; + cellFrame->GetRowIndex(startRow); + cellFrame->GetColIndex(startCol); + if (startRow == rowIdx && startCol == colIdx) count++; } } @@ -549,32 +535,25 @@ HTMLTableAccessible::SelectedRowCount() void HTMLTableAccessible::SelectedCells(nsTArray* aCells) { - uint32_t rowCount = RowCount(), colCount = ColCount(); - - nsITableLayout *tableLayout = GetTableLayout(); - if (!tableLayout) + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) return; - nsCOMPtr cellElement; - int32_t startRowIndex = 0, startColIndex = 0, - rowSpan, colSpan, actualRowSpan, actualColSpan; - bool isSelected = false; - + uint32_t rowCount = RowCount(), colCount = ColCount(); for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) { for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) { - nsresult rv = tableLayout->GetCellDataAt(rowIdx, colIdx, - *getter_AddRefs(cellElement), - startRowIndex, startColIndex, - rowSpan, colSpan, - actualRowSpan, actualColSpan, - isSelected); + nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx); + if (!cellFrame || !cellFrame->IsSelected()) + continue; - if (NS_SUCCEEDED(rv) && startRowIndex == rowIdx && - startColIndex == colIdx && isSelected) { - nsCOMPtr cellContent(do_QueryInterface(cellElement)); - Accessible* cell = mDoc->GetAccessible(cellContent); + int32_t startCol = -1, startRow = -1; + cellFrame->GetRowIndex(startRow); + cellFrame->GetColIndex(startCol); + if (startRow != rowIdx || startCol != colIdx) + continue; + + Accessible* cell = mDoc->GetAccessible(cellFrame->GetContent()); aCells->AppendElement(cell); - } } } } @@ -582,28 +561,21 @@ HTMLTableAccessible::SelectedCells(nsTArray* aCells) void HTMLTableAccessible::SelectedCellIndices(nsTArray* aCells) { - nsITableLayout *tableLayout = GetTableLayout(); - if (!tableLayout) + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) return; uint32_t rowCount = RowCount(), colCount = ColCount(); - - nsCOMPtr domElement; - int32_t startRowIndex = 0, startColIndex = 0, - rowSpan, colSpan, actualRowSpan, actualColSpan; - bool isSelected = false; - for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) { for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) { - nsresult rv = tableLayout->GetCellDataAt(rowIdx, colIdx, - *getter_AddRefs(domElement), - startRowIndex, startColIndex, - rowSpan, colSpan, - actualRowSpan, actualColSpan, - isSelected); + nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx); + if (!cellFrame || !cellFrame->IsSelected()) + continue; - if (NS_SUCCEEDED(rv) && startRowIndex == rowIdx && - startColIndex == colIdx && isSelected) + int32_t startRow = -1, startCol = -1; + cellFrame->GetColIndex(startCol); + cellFrame->GetRowIndex(startRow); + if (startRow == rowIdx && startCol == colIdx) aCells->AppendElement(CellIndexAt(rowIdx, colIdx)); } } @@ -628,17 +600,13 @@ HTMLTableAccessible::SelectedRowIndices(nsTArray* aRows) } Accessible* -HTMLTableAccessible::CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) -{ - nsCOMPtr cellElement; - GetCellAt(aRowIndex, aColumnIndex, *getter_AddRefs(cellElement)); - if (!cellElement) - return nullptr; - - nsCOMPtr cellContent(do_QueryInterface(cellElement)); - if (!cellContent) +HTMLTableAccessible::CellAt(uint32_t aRowIdx, uint32_t aColIdx) +{ + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) return nullptr; + nsIContent* cellContent = tableFrame->GetCellAt(aRowIdx, aColIdx); Accessible* cell = mDoc->GetAccessible(cellContent); // XXX bug 576838: crazy tables (like table6 in tables/test_table2.html) may @@ -649,34 +617,34 @@ HTMLTableAccessible::CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) int32_t HTMLTableAccessible::CellIndexAt(uint32_t aRowIdx, uint32_t aColIdx) { - nsITableLayout* tableLayout = GetTableLayout(); + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) + return -1; - int32_t index = -1; - tableLayout->GetIndexByRowAndColumn(aRowIdx, aColIdx, &index); - return index; + return tableFrame->GetIndexByRowAndColumn(aRowIdx, aColIdx); } int32_t HTMLTableAccessible::ColIndexAt(uint32_t aCellIdx) { - nsITableLayout* tableLayout = GetTableLayout(); - if (!tableLayout) + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) return -1; int32_t rowIdx = -1, colIdx = -1; - tableLayout->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx); + tableFrame->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx); return colIdx; } int32_t HTMLTableAccessible::RowIndexAt(uint32_t aCellIdx) { - nsITableLayout* tableLayout = GetTableLayout(); - if (!tableLayout) + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) return -1; int32_t rowIdx = -1, colIdx = -1; - tableLayout->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx); + tableFrame->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx); return rowIdx; } @@ -684,52 +652,29 @@ void HTMLTableAccessible::RowAndColIndicesAt(uint32_t aCellIdx, int32_t* aRowIdx, int32_t* aColIdx) { - nsITableLayout* tableLayout = GetTableLayout(); - - if (tableLayout) - tableLayout->GetRowAndColumnByIndex(aCellIdx, aRowIdx, aColIdx); + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (tableFrame) + tableFrame->GetRowAndColumnByIndex(aCellIdx, aRowIdx, aColIdx); } uint32_t HTMLTableAccessible::ColExtentAt(uint32_t aRowIdx, uint32_t aColIdx) { - nsITableLayout* tableLayout = GetTableLayout(); - if (!tableLayout) + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) return 0; - nsCOMPtr domElement; - int32_t startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan; - bool isSelected; - int32_t columnExtent = 0; - - DebugOnly rv = tableLayout-> - GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement), - startRowIndex, startColIndex, rowSpan, colSpan, - actualRowSpan, columnExtent, isSelected); - NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get cell data"); - - return columnExtent; + return tableFrame->GetEffectiveColSpanAt(aRowIdx, aColIdx); } uint32_t HTMLTableAccessible::RowExtentAt(uint32_t aRowIdx, uint32_t aColIdx) { - nsITableLayout* tableLayout = GetTableLayout(); - if (!tableLayout) + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) return 0; - nsCOMPtr domElement; - int32_t startRowIndex, startColIndex, rowSpan, colSpan, actualColSpan; - bool isSelected; - int32_t rowExtent = 0; - - DebugOnly rv = tableLayout-> - GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement), - startRowIndex, startColIndex, rowSpan, colSpan, - rowExtent, actualColSpan, isSelected); - NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get cell data"); - - return rowExtent; + return tableFrame->GetEffectiveRowSpanAt(aRowIdx, aColIdx); } bool @@ -765,20 +710,12 @@ HTMLTableAccessible::IsRowSelected(uint32_t aRowIdx) bool HTMLTableAccessible::IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx) { - nsITableLayout *tableLayout = GetTableLayout(); - if (!tableLayout) + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) return false; - nsCOMPtr domElement; - int32_t startRowIndex = 0, startColIndex = 0, - rowSpan, colSpan, actualRowSpan, actualColSpan; - bool isSelected = false; - - tableLayout->GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement), - startRowIndex, startColIndex, rowSpan, colSpan, - actualRowSpan, actualColSpan, isSelected); - - return isSelected; + nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(aRowIdx, aColIdx); + return cellFrame ? cellFrame->IsSelected() : false; } void @@ -828,40 +765,26 @@ HTMLTableAccessible::AddRowOrColumnToSelection(int32_t aIndex, uint32_t aTarget) { bool doSelectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW); - nsITableLayout *tableLayout = GetTableLayout(); - NS_ENSURE_STATE(tableLayout); + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) + return NS_OK; - nsCOMPtr cellElm; - int32_t startRowIdx, startColIdx, rowSpan, colSpan, - actualRowSpan, actualColSpan; - bool isSelected = false; - - nsresult rv = NS_OK; - int32_t count = 0; + uint32_t count = 0; if (doSelectRow) - rv = GetColumnCount(&count); + count = ColCount(); else - rv = GetRowCount(&count); - - NS_ENSURE_SUCCESS(rv, rv); + count = RowCount(); nsIPresShell* presShell(mDoc->PresShell()); nsRefPtr tableSelection = const_cast(presShell->ConstFrameSelection()); - for (int32_t idx = 0; idx < count; idx++) { + for (uint32_t idx = 0; idx < count; idx++) { int32_t rowIdx = doSelectRow ? aIndex : idx; int32_t colIdx = doSelectRow ? idx : aIndex; - rv = tableLayout->GetCellDataAt(rowIdx, colIdx, - *getter_AddRefs(cellElm), - startRowIdx, startColIdx, - rowSpan, colSpan, - actualRowSpan, actualColSpan, - isSelected); - - if (NS_SUCCEEDED(rv) && !isSelected) { - nsCOMPtr cellContent(do_QueryInterface(cellElm)); - rv = tableSelection->SelectCellElement(cellContent); + nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx); + if (cellFrame && !cellFrame->IsSelected()) { + nsresult rv = tableSelection->SelectCellElement(cellFrame->GetContent()); NS_ENSURE_SUCCESS(rv, rv); } } @@ -874,17 +797,16 @@ HTMLTableAccessible::RemoveRowsOrColumnsFromSelection(int32_t aIndex, uint32_t aTarget, bool aIsOuter) { - nsITableLayout *tableLayout = GetTableLayout(); - NS_ENSURE_STATE(tableLayout); + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) + return NS_OK; nsIPresShell* presShell(mDoc->PresShell()); nsRefPtr tableSelection = const_cast(presShell->ConstFrameSelection()); bool doUnselectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW); - int32_t count = 0; - nsresult rv = doUnselectRow ? GetColumnCount(&count) : GetRowCount(&count); - NS_ENSURE_SUCCESS(rv, rv); + uint32_t count = doUnselectRow ? ColCount() : RowCount(); int32_t startRowIdx = doUnselectRow ? aIndex : 0; int32_t endRowIdx = doUnselectRow ? aIndex : count - 1; @@ -901,37 +823,6 @@ HTMLTableAccessible::RemoveRowsOrColumnsFromSelection(int32_t aIndex, endRowIdx, endColIdx); } -nsITableLayout* -HTMLTableAccessible::GetTableLayout() -{ - nsIFrame *frame = mContent->GetPrimaryFrame(); - if (!frame) - return nullptr; - - nsITableLayout *tableLayout = do_QueryFrame(frame); - return tableLayout; -} - -nsresult -HTMLTableAccessible::GetCellAt(int32_t aRowIndex, int32_t aColIndex, - nsIDOMElement*& aCell) -{ - int32_t startRowIndex = 0, startColIndex = 0, - rowSpan, colSpan, actualRowSpan, actualColSpan; - bool isSelected; - - nsITableLayout *tableLayout = GetTableLayout(); - NS_ENSURE_STATE(tableLayout); - - nsresult rv = tableLayout-> - GetCellDataAt(aRowIndex, aColIndex, aCell, startRowIndex, startColIndex, - rowSpan, colSpan, actualRowSpan, actualColSpan, isSelected); - - if (rv == NS_TABLELAYOUT_CELL_NOT_FOUND) - return NS_ERROR_INVALID_ARG; - return rv; -} - void HTMLTableAccessible::Description(nsString& aDescription) { @@ -1138,16 +1029,14 @@ HTMLTableAccessible::IsProbablyLayoutTable() // Now we know there are 2-4 columns and 2 or more rows // Check to see if there are visible borders on the cells // XXX currently, we just check the first cell -- do we really need to do more? - nsCOMPtr cellElement; - nsresult rv = GetCellAt(0, 0, *getter_AddRefs(cellElement)); - NS_ENSURE_SUCCESS(rv, false); + nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame()); + if (!tableFrame) + RETURN_LAYOUT_ANSWER(false, "table with no frame!"); + + nsIFrame* cellFrame = tableFrame->GetCellFrameAt(0, 0); + if (!cellFrame) + RETURN_LAYOUT_ANSWER(false, "table's first cell has no frame!"); - nsCOMPtr cellContent(do_QueryInterface(cellElement)); - NS_ENSURE_TRUE(cellContent, false); - nsIFrame *cellFrame = cellContent->GetPrimaryFrame(); - if (!cellFrame) { - RETURN_LAYOUT_ANSWER(false, "Could not get frame for cellContent"); - } nsMargin border; cellFrame->GetBorder(border); if (border.top && border.bottom && border.left && border.right) { diff --git a/accessible/src/html/HTMLTableAccessible.h b/accessible/src/html/HTMLTableAccessible.h index f4db6d7173ca..9c04782afb88 100644 --- a/accessible/src/html/HTMLTableAccessible.h +++ b/accessible/src/html/HTMLTableAccessible.h @@ -166,19 +166,6 @@ public: virtual already_AddRefed NativeAttributes() MOZ_OVERRIDE; virtual Relation RelationByType(uint32_t aRelationType); - // HTMLTableAccessible - - /** - * Retun cell element at the given row and column index. - */ - nsresult GetCellAt(int32_t aRowIndex, int32_t aColIndex, - nsIDOMElement* &aCell); - - /** - * Return nsITableLayout for the frame of the accessible table. - */ - nsITableLayout* GetTableLayout(); - protected: // Accessible virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; diff --git a/accessible/src/html/Makefile.in b/accessible/src/html/Makefile.in index 6f625f6f457b..58405191c7d7 100644 --- a/accessible/src/html/Makefile.in +++ b/accessible/src/html/Makefile.in @@ -39,6 +39,7 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../../../content/base/src \ -I$(srcdir)/../../../content/html/content/src \ -I$(srcdir)/../../../layout/generic \ + -I$(srcdir)/../../../layout/tables \ -I$(srcdir)/../../../layout/xul/base/src \ $(NULL) diff --git a/accessible/src/jsat/AccessFu.jsm b/accessible/src/jsat/AccessFu.jsm index ef75795218d1..69df693ea7ef 100644 --- a/accessible/src/jsat/AccessFu.jsm +++ b/accessible/src/jsat/AccessFu.jsm @@ -14,7 +14,6 @@ this.EXPORTED_SYMBOLS = ['AccessFu']; Cu.import('resource://gre/modules/Services.jsm'); Cu.import('resource://gre/modules/accessibility/Utils.jsm'); -Cu.import('resource://gre/modules/accessibility/TouchAdapter.jsm'); const ACCESSFU_DISABLE = 0; const ACCESSFU_ENABLE = 1; @@ -58,6 +57,8 @@ this.AccessFu = { this._activatePref = ACCESSFU_DISABLE; } + Input.quickNavMode.updateModes(this.prefsBranch); + this._enableOrDisable(); }, @@ -76,9 +77,6 @@ this.AccessFu = { Logger.info('enable'); - this.touchAdapter = (Utils.MozBuildApp == 'mobile/android') ? - AndroidTouchAdapter : TouchAdapter; - for each (let mm in Utils.getAllMessageManagers(this.chromeWin)) this._loadFrameScript(mm); @@ -91,7 +89,7 @@ this.AccessFu = { Input.attach(this.chromeWin); Output.attach(this.chromeWin); - this.touchAdapter.attach(this.chromeWin); + TouchAdapter.attach(this.chromeWin); Services.obs.addObserver(this, 'remote-browser-frame-shown', false); Services.obs.addObserver(this, 'Accessibility:NextObject', false); @@ -117,7 +115,7 @@ this.AccessFu = { mm.sendAsyncMessage('AccessFu:Stop'); Input.detach(); - this.touchAdapter.detach(this.chromeWin); + TouchAdapter.detach(this.chromeWin); this.chromeWin.removeEventListener('TabOpen', this); this.chromeWin.removeEventListener('TabSelect', this); @@ -205,6 +203,8 @@ this.AccessFu = { if (aData == 'activate') { this._activatePref = this.prefsBranch.getIntPref('activate'); this._enableOrDisable(); + } else if (aData == 'quicknav_modes') { + Input.quickNavMode.updateModes(this.prefsBranch); } break; case 'remote-browser-frame-shown': @@ -389,7 +389,7 @@ var Input = { this._handleKeypress(aEvent); break; case 'mozAccessFuGesture': - this._handleGesture(aEvent); + this._handleGesture(aEvent.detail); break; } } catch (x) { @@ -397,44 +397,56 @@ var Input = { } }, - _handleGesture: function _handleGesture(aEvent) { - let detail = aEvent.detail; - Logger.info('Gesture', detail.type, - '(fingers: ' + detail.touches.length + ')'); + _handleGesture: function _handleGesture(aGesture) { + let gestureName = aGesture.type + aGesture.touches.length; + Logger.info('Gesture', aGesture.type, + '(fingers: ' + aGesture.touches.length + ')'); - if (detail.touches.length == 1) { - switch (detail.type) { - case 'swiperight': - this.moveCursor('moveNext', 'Simple', 'gestures'); - break; - case 'swipeleft': - this.moveCursor('movePrevious', 'Simple', 'gesture'); - break; - case 'doubletap': - this.activateCurrent(); - break; - case 'explore': - this.moveCursor('moveToPoint', 'Simple', 'gesture', - detail.x, detail.y); - break; - } - } - - if (detail.touches.length == 3) { - switch (detail.type) { - case 'swiperight': - this.scroll(-1, true); - break; - case 'swipedown': - this.scroll(-1); - break; - case 'swipeleft': - this.scroll(1, true); - break; - case 'swipeup': - this.scroll(1); - break; - } + switch (gestureName) { + case 'dwell1': + case 'explore1': + this.moveCursor('moveToPoint', 'Simple', 'gesture', + aGesture.x, aGesture.y); + break; + case 'doubletap1': + this.activateCurrent(); + break; + case 'swiperight1': + this.moveCursor('moveNext', 'Simple', 'gestures'); + break; + case 'swipeleft1': + this.moveCursor('movePrevious', 'Simple', 'gesture'); + break; + case 'swiperight2': + this.scroll(-1, true); + break; + case 'swipedown2': + this.scroll(-1); + break; + case 'swipeleft2': + this.scroll(1, true); + break; + case 'swipeup2': + this.scroll(1); + break; + case 'explore2': + Utils.getCurrentBrowser(this.chromeWin).contentWindow.scrollBy( + -aGesture.deltaX, -aGesture.deltaY); + break; + case 'swiperight3': + this.moveCursor('moveNext', this.quickNavMode.current, 'gesture'); + break; + case 'swipeleft3': + this.moveCursor('movePrevious', this.quickNavMode.current, 'gesture'); + break; + case 'swipedown3': + this.quickNavMode.next(); + AccessFu.announce('quicknav_' + this.quickNavMode.current); + break; + case 'swipeup3': + this.quickNavMode.previous(); + AccessFu.announce('quicknav_' + this.quickNavMode.current); + break; } }, @@ -568,5 +580,34 @@ var Input = { x: ['moveNext', 'Checkbox'], X: ['movePrevious', 'Checkbox'] }; + + return this.keyMap; + }, + + quickNavMode: { + get current() { + return this.modes[this._currentIndex]; + }, + + previous: function quickNavMode_previous() { + if (--this._currentIndex < 0) + this._currentIndex = this.modes.length - 1; + }, + + next: function quickNavMode_next() { + if (++this._currentIndex >= this.modes.length) + this._currentIndex = 0; + }, + + updateModes: function updateModes(aPrefsBranch) { + try { + this.modes = aPrefsBranch.getCharPref('quicknav_modes').split(','); + } catch (x) { + // Fallback + this.modes = []; + } + }, + + _currentIndex: -1 } }; diff --git a/accessible/src/jsat/TouchAdapter.jsm b/accessible/src/jsat/TouchAdapter.jsm index 21e16c5c0499..765baa0ca3bb 100644 --- a/accessible/src/jsat/TouchAdapter.jsm +++ b/accessible/src/jsat/TouchAdapter.jsm @@ -9,7 +9,7 @@ const Ci = Components.interfaces; const Cu = Components.utils; const Cr = Components.results; -this.EXPORTED_SYMBOLS = ['TouchAdapter', 'AndroidTouchAdapter']; +this.EXPORTED_SYMBOLS = ['TouchAdapter']; Cu.import('resource://gre/modules/accessibility/Utils.jsm'); @@ -39,6 +39,9 @@ this.TouchAdapter = { // maximum distance the mouse could move during a tap in inches TAP_MAX_RADIUS: 0.2, + // The virtual touch ID generated by an Android hover event. + HOVER_ID: 'hover', + attach: function TouchAdapter_attach(aWindow) { if (this.chromeWin) return; @@ -53,14 +56,26 @@ this.TouchAdapter = { this._dpi = this.chromeWin.QueryInterface(Ci.nsIInterfaceRequestor). getInterface(Ci.nsIDOMWindowUtils).displayDPI; - this.glass = this.chromeWin.document. - createElementNS('http://www.w3.org/1999/xhtml', 'div'); - this.glass.id = 'accessfu-glass'; - this.chromeWin.document.documentElement.appendChild(this.glass); + let target = this.chromeWin; - this.glass.addEventListener('touchend', this, true, true); - this.glass.addEventListener('touchmove', this, true, true); - this.glass.addEventListener('touchstart', this, true, true); + if (Utils.MozBuildApp == 'b2g') { + this.glass = this.chromeWin.document. + createElementNS('http://www.w3.org/1999/xhtml', 'div'); + this.glass.id = 'accessfu-glass'; + this.chromeWin.document.documentElement.appendChild(this.glass); + target = this.glass; + } + + target.addEventListener('mousemove', this, true, true); + target.addEventListener('mouseenter', this, true, true); + target.addEventListener('mouseleave', this, true, true); + target.addEventListener('mousedown', this, true, true); + target.addEventListener('mouseup', this, true, true); + target.addEventListener('click', this, true, true); + + target.addEventListener('touchend', this, true, true); + target.addEventListener('touchmove', this, true, true); + target.addEventListener('touchstart', this, true, true); if (Utils.OS != 'Android') Mouse2Touch.attach(aWindow); @@ -72,10 +87,23 @@ this.TouchAdapter = { Logger.info('TouchAdapter.detach'); - this.glass.removeEventListener('touchend', this, true, true); - this.glass.removeEventListener('touchmove', this, true, true); - this.glass.removeEventListener('touchstart', this, true, true); - this.glass.parentNode.removeChild(this.glass); + let target = this.chromeWin; + + if (Utils.MozBuildApp == 'b2g') { + target = this.glass; + this.glass.parentNode.removeChild(this.glass); + } + + target.removeEventListener('mousemove', this, true, true); + target.removeEventListener('mouseenter', this, true, true); + target.removeEventListener('mouseleave', this, true, true); + target.removeEventListener('mousedown', this, true, true); + target.removeEventListener('mouseup', this, true, true); + target.removeEventListener('click', this, true, true); + + target.removeEventListener('touchend', this, true, true); + target.removeEventListener('touchmove', this, true, true); + target.removeEventListener('touchstart', this, true, true); if (Utils.OS != 'Android') Mouse2Touch.detach(aWindow); @@ -84,16 +112,23 @@ this.TouchAdapter = { }, handleEvent: function TouchAdapter_handleEvent(aEvent) { - let touches = aEvent.changedTouches; + if (this._delayedEvent) { + this.chromeWin.clearTimeout(this._delayedEvent); + delete this._delayedEvent; + } + + let changedTouches = aEvent.changedTouches || [aEvent]; + // XXX: Until bug 77992 is resolved, on desktop we get microseconds // instead of milliseconds. let timeStamp = (Utils.OS == 'Android') ? aEvent.timeStamp : Date.now(); switch (aEvent.type) { + case 'mouseenter': case 'touchstart': - for (var i = 0; i < touches.length; i++) { - let touch = touches[i]; + for (var i = 0; i < changedTouches.length; i++) { + let touch = changedTouches[i]; let touchPoint = new TouchPoint(touch, timeStamp, this._dpi); - this._touchPoints[touch.identifier] = touchPoint; + this._touchPoints[touch.identifier || this.HOVER_ID] = touchPoint; this._lastExploreTime = timeStamp + this.SWIPE_MAX_DURATION; } this._dwellTimeout = this.chromeWin.setTimeout( @@ -101,27 +136,34 @@ this.TouchAdapter = { this.compileAndEmit(timeStamp + this.DWELL_THRESHOLD); }).bind(this), this.DWELL_THRESHOLD); break; + case 'mousemove': case 'touchmove': - for (var i = 0; i < touches.length; i++) { - let touch = touches[i]; - let touchPoint = this._touchPoints[touch.identifier]; - touchPoint.update(touch, timeStamp); + for (var i = 0; i < changedTouches.length; i++) { + let touch = changedTouches[i]; + let touchPoint = this._touchPoints[touch.identifier || this.HOVER_ID]; + if (touchPoint) + touchPoint.update(touch, timeStamp); } if (timeStamp - this._lastExploreTime >= EXPLORE_THROTTLE) { this.compileAndEmit(timeStamp); this._lastExploreTime = timeStamp; } break; + case 'mouseleave': case 'touchend': - for (var i = 0; i < touches.length; i++) { - let touch = touches[i]; - let touchPoint = this._touchPoints[touch.identifier]; - touchPoint.update(touch, timeStamp); - touchPoint.finish(); + for (var i = 0; i < changedTouches.length; i++) { + let touch = changedTouches[i]; + let touchPoint = this._touchPoints[touch.identifier || this.HOVER_ID]; + if (touchPoint) { + touchPoint.update(touch, timeStamp); + touchPoint.finish(); + } } this.compileAndEmit(timeStamp); break; } + + aEvent.preventDefault(); }, cleanupTouches: function cleanupTouches() { @@ -170,12 +212,22 @@ this.TouchAdapter = { if (timeDelta > this.MAX_CONSECUTIVE_GESTURE_DELAY) { delete this._prevGestures[idhash]; } else { - if (details.type == 'tap' && prevGesture.type == 'tap') - details.type = 'doubletap'; - if (details.type == 'tap' && prevGesture.type == 'doubletap') - details.type = 'tripletap'; - if (details.type == 'dwell' && prevGesture.type == 'tap') - details.type = 'taphold'; + let sequence = prevGesture.type + '-' + details.type; + switch (sequence) { + case 'tap-tap': + details.type = 'doubletap'; + break; + case 'doubletap-tap': + details.type = 'tripletap'; + break; + case 'tap-dwell': + details.type = 'taphold'; + break; + case 'explore-explore': + details.deltaX = details.x - prevGesture.x; + details.deltaY = details.y - prevGesture.y; + break; + } } } @@ -189,9 +241,36 @@ this.TouchAdapter = { }, emitGesture: function TouchAdapter_emitGesture(aDetails) { - let evt = this.chromeWin.document.createEvent('CustomEvent'); - evt.initCustomEvent('mozAccessFuGesture', true, true, aDetails); - this.chromeWin.dispatchEvent(evt); + let emitDelay = 0; + + // Unmutate gestures we are getting from Android when EBT is enabled. + // Two finger gestures are translated to one. Double taps are translated + // to single taps. + if (Utils.MozBuildApp == 'mobile/android' && + Utils.AndroidSdkVersion >= 14 && + aDetails.touches[0] != this.HOVER_ID) { + if (aDetails.touches.length == 1) { + if (aDetails.type == 'tap') { + emitDelay = 50; + aDetails.type = 'doubletap'; + } else { + aDetails.touches.push(this.HOVER_ID); + } + } + } + + let emit = function emit() { + let evt = this.chromeWin.document.createEvent('CustomEvent'); + evt.initCustomEvent('mozAccessFuGesture', true, true, aDetails); + this.chromeWin.dispatchEvent(evt); + delete this._delayedEvent; + }.bind(this); + + if (emitDelay) { + this._delayedEvent = this.chromeWin.setTimeout(emit, emitDelay); + } else { + emit(); + } }, compileAndEmit: function TouchAdapter_compileAndEmit(aTime) { @@ -364,41 +443,3 @@ var Mouse2Touch = { aEvent.stopImmediatePropagation(); } }; - -this.AndroidTouchAdapter = { - attach: function AndroidTouchAdapter_attach(aWindow) { - if (this.chromeWin) - return; - - Logger.info('AndroidTouchAdapter.attach'); - - this.chromeWin = aWindow; - this.chromeWin.addEventListener('mousemove', this, true, true); - this._lastExploreTime = 0; - }, - - detach: function AndroidTouchAdapter_detach(aWindow) { - if (!this.chromeWin) - return; - - Logger.info('AndroidTouchAdapter.detach'); - - this.chromeWin.removeEventListener('mousemove', this, true, true); - delete this.chromeWin; - }, - - handleEvent: function AndroidTouchAdapter_handleEvent(aEvent) { - // On non-Android we use the shift key to simulate touch. - if (Utils.MozBuildApp != 'mobile/android' && !aEvent.shiftKey) - return; - - if (aEvent.timeStamp - this._lastExploreTime >= EXPLORE_THROTTLE) { - let evt = this.chromeWin.document.createEvent('CustomEvent'); - evt.initCustomEvent( - 'mozAccessFuGesture', true, true, - {type: 'explore', x: aEvent.screenX, y: aEvent.screenY, touches: [1]}); - this.chromeWin.dispatchEvent(evt); - this._lastExploreTime = aEvent.timeStamp; - } - } -}; \ No newline at end of file diff --git a/accessible/src/msaa/AccessibleWrap.cpp b/accessible/src/msaa/AccessibleWrap.cpp index b17342c1c887..d74f5bfabddb 100644 --- a/accessible/src/msaa/AccessibleWrap.cpp +++ b/accessible/src/msaa/AccessibleWrap.cpp @@ -59,9 +59,6 @@ const uint32_t USE_ROLE_STRING = 0; static gAccessibles = 0; #endif -EXTERN_C GUID CDECL CLSID_Accessible = -{ 0x61044601, 0xa811, 0x4e2b, { 0xbb, 0xba, 0x17, 0xbf, 0xab, 0xd3, 0x29, 0xd7 } }; - static const int32_t kIEnumVariantDisconnected = -1; //////////////////////////////////////////////////////////////////////////////// @@ -70,7 +67,7 @@ static const int32_t kIEnumVariantDisconnected = -1; ITypeInfo* AccessibleWrap::gTypeInfo = NULL; -NS_IMPL_ISUPPORTS_INHERITED0(AccessibleWrap, Accessible); +NS_IMPL_ISUPPORTS_INHERITED0(AccessibleWrap, Accessible) //----------------------------------------------------- // IUnknown interface methods - see iunknown.h for documentation @@ -97,7 +94,7 @@ AccessibleWrap::QueryInterface(REFIID iid, void** ppv) else if (IID_IAccessible2 == iid && !Compatibility::IsIA2Off()) *ppv = static_cast(this); else if (IID_ISimpleDOMNode == iid) { - if (IsDefunct() || !HasOwnContent() && !IsDoc()) + if (IsDefunct() || (!HasOwnContent() && !IsDoc())) return E_NOINTERFACE; *ppv = new sdnAccessible(GetNode()); @@ -145,7 +142,7 @@ AccessibleWrap::QueryService(REFGUID aGuidService, REFIID aIID, // UIA IAccessibleEx if (aGuidService == IID_IAccessibleEx && Preferences::GetBool("accessibility.uia.enable")) { - IAccessibleEx* accEx = new uiaRawElmProvider(this); + uiaRawElmProvider* accEx = new uiaRawElmProvider(this); HRESULT hr = accEx->QueryInterface(aIID, aInstancePtr); if (FAILED(hr)) delete accEx; @@ -175,8 +172,8 @@ AccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent) // Return window system accessible object for root document and tab document // accessibles. if (!doc->ParentDocument() || - nsWinUtils::IsWindowEmulationStarted() && - nsCoreUtils::IsTabDocument(doc->DocumentNode())) { + (nsWinUtils::IsWindowEmulationStarted() && + nsCoreUtils::IsTabDocument(doc->DocumentNode()))) { HWND hwnd = static_cast(doc->GetNativeWindow()); if (hwnd && SUCCEEDED(::AccessibleObjectFromWindow(hwnd, OBJID_WINDOW, IID_IAccessible, @@ -585,7 +582,7 @@ AccessibleWrap::get_accFocus( // This helper class implements IEnumVARIANT for a nsIArray containing nsIAccessible objects. -class AccessibleEnumerator : public IEnumVARIANT +class AccessibleEnumerator MOZ_FINAL : public IEnumVARIANT { public: AccessibleEnumerator(nsIArray* aArray) : mArray(aArray), mCurIndex(0) { } @@ -1102,7 +1099,7 @@ AccessibleWrap::get_relation(long aRelationIndex, if (IsDefunct()) return CO_E_OBJNOTCONNECTED; - uint32_t relIdx = 0; + long relIdx = 0; for (uint32_t relType = nsIAccessibleRelation::RELATION_FIRST; relType <= nsIAccessibleRelation::RELATION_LAST; relType++) { Relation rel = RelationByType(relType); @@ -1569,8 +1566,7 @@ AccessibleWrap::FirePlatformEvent(AccEvent* aEvent) eventType < nsIAccessibleEvent::EVENT_LAST_ENTRY, NS_ERROR_FAILURE); - uint32_t winLastEntry = gWinEventMap[nsIAccessibleEvent::EVENT_LAST_ENTRY]; - NS_ASSERTION(winLastEntry == kEVENT_LAST_ENTRY, + NS_ASSERTION(gWinEventMap[nsIAccessibleEvent::EVENT_LAST_ENTRY] == kEVENT_LAST_ENTRY, "MSAA event map skewed"); uint32_t winEvent = gWinEventMap[eventType]; @@ -1711,7 +1707,7 @@ AccessibleWrap::ConvertToIA2Attributes(nsIPersistentProperties *aAttributes, if (NS_FAILED(propElem->GetKey(name))) return E_FAIL; - uint32_t offset = 0; + int32_t offset = 0; while ((offset = name.FindCharInSet(kCharsToEscape, offset)) != kNotFound) { name.Insert('\\', offset); offset += 2; diff --git a/accessible/src/msaa/DocAccessibleWrap.cpp b/accessible/src/msaa/DocAccessibleWrap.cpp index 28c4644497aa..49010a4ce197 100644 --- a/accessible/src/msaa/DocAccessibleWrap.cpp +++ b/accessible/src/msaa/DocAccessibleWrap.cpp @@ -259,7 +259,7 @@ DocAccessibleWrap::DoInitialUpdate() a11y::RootAccessible* rootDocument = RootAccessible(); - mozilla::WindowsHandle nativeData = NULL; + mozilla::WindowsHandle nativeData = 0; if (tabChild) tabChild->SendGetWidgetNativeData(&nativeData); else diff --git a/accessible/src/msaa/EnumVariant.h b/accessible/src/msaa/EnumVariant.h index 167298807103..248c42a1643d 100644 --- a/accessible/src/msaa/EnumVariant.h +++ b/accessible/src/msaa/EnumVariant.h @@ -18,8 +18,8 @@ namespace a11y { class ChildrenEnumVariant MOZ_FINAL : public IEnumVARIANT { public: - ChildrenEnumVariant(AccessibleWrap* aAnchor) : mAnchorAcc(aAnchor), - mCurAcc(mAnchorAcc->GetChildAt(0)), mCurIndex(0), mRefCnt(0) { } + ChildrenEnumVariant(AccessibleWrap* aAnchor) : mRefCnt(0), mAnchorAcc(aAnchor), + mCurAcc(mAnchorAcc->GetChildAt(0)), mCurIndex(0) { } // IUnknown DECL_IUNKNOWN @@ -43,8 +43,8 @@ private: ChildrenEnumVariant& operator =(const ChildrenEnumVariant&) MOZ_DELETE; ChildrenEnumVariant(const ChildrenEnumVariant& aEnumVariant) : - mAnchorAcc(aEnumVariant.mAnchorAcc), mCurAcc(aEnumVariant.mCurAcc), - mCurIndex(aEnumVariant.mCurIndex), mRefCnt(0) { } + mRefCnt(0), mAnchorAcc(aEnumVariant.mAnchorAcc), mCurAcc(aEnumVariant.mCurAcc), + mCurIndex(aEnumVariant.mCurIndex) { } virtual ~ChildrenEnumVariant() { } protected: diff --git a/accessible/src/msaa/ImageAccessibleWrap.cpp b/accessible/src/msaa/ImageAccessibleWrap.cpp index cc944f7a561f..61974b04d95f 100644 --- a/accessible/src/msaa/ImageAccessibleWrap.cpp +++ b/accessible/src/msaa/ImageAccessibleWrap.cpp @@ -15,5 +15,5 @@ NS_IMPL_ISUPPORTS_INHERITED0(ImageAccessibleWrap, IMPL_IUNKNOWN_INHERITED1(ImageAccessibleWrap, AccessibleWrap, - ia2AccessibleImage); + ia2AccessibleImage) diff --git a/accessible/src/windows/ia2/ia2AccessibleRelation.cpp b/accessible/src/windows/ia2/ia2AccessibleRelation.cpp index 67f3819dff46..5ce226648880 100644 --- a/accessible/src/windows/ia2/ia2AccessibleRelation.cpp +++ b/accessible/src/windows/ia2/ia2AccessibleRelation.cpp @@ -160,7 +160,7 @@ ia2AccessibleRelation::get_target(long aTargetIndex, IUnknown **aTarget) { A11Y_TRYBLOCK_BEGIN - if (aTargetIndex < 0 || aTargetIndex >= mTargets.Length() || !aTarget) + if (aTargetIndex < 0 || (uint32_t)aTargetIndex >= mTargets.Length() || !aTarget) return E_INVALIDARG; mTargets[aTargetIndex]->QueryNativeInterface(IID_IUnknown, (void**) aTarget); @@ -179,11 +179,11 @@ ia2AccessibleRelation::get_targets(long aMaxTargets, IUnknown **aTargets, return E_INVALIDARG; *aNTargets = 0; - uint32_t maxTargets = mTargets.Length(); + long maxTargets = mTargets.Length(); if (maxTargets > aMaxTargets) maxTargets = aMaxTargets; - for (uint32_t idx = 0; idx < maxTargets; idx++) + for (long idx = 0; idx < maxTargets; idx++) get_target(idx, aTargets + idx); *aNTargets = maxTargets; diff --git a/accessible/src/windows/sdn/sdnAccessible.h b/accessible/src/windows/sdn/sdnAccessible.h index 84009e44e605..42b37411ce6b 100644 --- a/accessible/src/windows/sdn/sdnAccessible.h +++ b/accessible/src/windows/sdn/sdnAccessible.h @@ -15,7 +15,7 @@ namespace mozilla { namespace a11y { -class sdnAccessible : public ISimpleDOMNode +class sdnAccessible MOZ_FINAL : public ISimpleDOMNode { public: sdnAccessible(nsINode* aNode) : mNode(aNode) { } diff --git a/accessible/src/windows/uia/uiaRawElmProvider.cpp b/accessible/src/windows/uia/uiaRawElmProvider.cpp index 099e17ab80b5..c002ae17242a 100644 --- a/accessible/src/windows/uia/uiaRawElmProvider.cpp +++ b/accessible/src/windows/uia/uiaRawElmProvider.cpp @@ -77,7 +77,7 @@ uiaRawElmProvider::GetRuntimeId(__RPC__deref_out_opt SAFEARRAY** aRuntimeIds) if (!*aRuntimeIds) return E_OUTOFMEMORY; - for (LONG i = 0; i < ArrayLength(ids); i++) + for (LONG i = 0; i < (LONG)ArrayLength(ids); i++) SafeArrayPutElement(*aRuntimeIds, &i, (void*)&(ids[i])); return S_OK; diff --git a/accessible/src/windows/uia/uiaRawElmProvider.h b/accessible/src/windows/uia/uiaRawElmProvider.h index 3506859c71a8..fc282cf7771c 100644 --- a/accessible/src/windows/uia/uiaRawElmProvider.h +++ b/accessible/src/windows/uia/uiaRawElmProvider.h @@ -23,7 +23,7 @@ class uiaRawElmProvider MOZ_FINAL : public IAccessibleEx, public IRawElementProviderSimple { public: - uiaRawElmProvider(AccessibleWrap* aAcc) : mAcc(aAcc), mRefCnt(0) { } + uiaRawElmProvider(AccessibleWrap* aAcc) : mRefCnt(0), mAcc(aAcc) { } // IUnknown DECL_IUNKNOWN diff --git a/accessible/src/xul/XULSliderAccessible.cpp b/accessible/src/xul/XULSliderAccessible.cpp index 390de243dc43..96e5f1c7032a 100644 --- a/accessible/src/xul/XULSliderAccessible.cpp +++ b/accessible/src/xul/XULSliderAccessible.cpp @@ -21,7 +21,7 @@ XULSliderAccessible:: XULSliderAccessible(nsIContent* aContent, DocAccessible* aDoc) : AccessibleWrap(aContent, aDoc) { - mFlags = mFlags | eHasNumericValue; + mStateFlags |= eHasNumericValue; } // nsISupports diff --git a/accessible/src/xul/XULTreeAccessible.cpp b/accessible/src/xul/XULTreeAccessible.cpp index 0d7b3c940a70..90ac582ec6a3 100644 --- a/accessible/src/xul/XULTreeAccessible.cpp +++ b/accessible/src/xul/XULTreeAccessible.cpp @@ -685,7 +685,7 @@ XULTreeItemAccessibleBase:: mTree(aTree), mTreeView(aTreeView), mRow(aRow) { mParent = aParent; - mFlags |= eSharedNode; + mStateFlags |= eSharedNode; } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/xul/XULTreeGridAccessible.cpp b/accessible/src/xul/XULTreeGridAccessible.cpp index 9076cc15e1a5..3dade850b491 100644 --- a/accessible/src/xul/XULTreeGridAccessible.cpp +++ b/accessible/src/xul/XULTreeGridAccessible.cpp @@ -463,7 +463,7 @@ XULTreeGridCellAccessible:: mTreeView(aTreeView), mRow(aRow), mColumn(aColumn) { mParent = aRowAcc; - mFlags |= eSharedNode; + mStateFlags |= eSharedNode; NS_ASSERTION(mTreeView, "mTreeView is null"); diff --git a/accessible/tests/mochitest/attributes/test_obj.html b/accessible/tests/mochitest/attributes/test_obj.html index bc3bdd26abac..f6267f00dcff 100644 --- a/accessible/tests/mochitest/attributes/test_obj.html +++ b/accessible/tests/mochitest/attributes/test_obj.html @@ -100,6 +100,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036 testAttrs("th2", { "abbr": "SS#" }, true); testAttrs("th2", { "axis": "social" }, true); + // don't barf on an empty abbr element. + testAbsentAttrs("th3", { "abbr": "" }, true); + // application accessible if (WIN) { var gfxInfo = Components.classes["@mozilla.org/gfx/info;1"]. @@ -154,6 +157,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036 title="Expand support for nsIAccessibleEvent::OBJECT_ATTRIBUTE_CHANGE"> Mozilla Bug 563862 + + Mozilla Bug 819303 +

@@ -211,6 +219,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
     
       SS#
       Social Security Number
+      
     
   
 
diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js
index d0ea9fb54977..8091ecd311a3 100644
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -234,16 +234,25 @@ pref("editor.singleLine.pasteNewlines", 2);
 pref("ui.dragThresholdX", 25);
 pref("ui.dragThresholdY", 25);
 
-// Layers Acceleration
-pref("layers.acceleration.disabled", false);
-#ifndef XP_WIN
-//TODO: turn this on for Windows in bug 808016
+// Layers Acceleration.  We can only have nice things on gonk, because
+// they're not maintained anywhere else.
+#ifndef MOZ_WIDGET_GONK
+pref("dom.ipc.tabs.disabled", true);
+pref("layers.offmainthreadcomposition.enabled", false);
+pref("layers.offmainthreadcomposition.animate-opacity", false);
+pref("layers.offmainthreadcomposition.animate-transform", false);
+pref("layers.offmainthreadcomposition.throttle-animations", false);
+pref("layers.async-video.enabled", false);
+#else
+pref("dom.ipc.tabs.disabled", false);
 pref("layers.offmainthreadcomposition.enabled", true);
-#endif
+pref("layers.acceleration.disabled", false);
 pref("layers.offmainthreadcomposition.animate-opacity", true);
 pref("layers.offmainthreadcomposition.animate-transform", true);
+pref("layers.offmainthreadcomposition.throttle-animations", true);
 pref("layers.async-video.enabled", true);
 pref("layers.async-pan-zoom.enabled", true);
+#endif
 
 // Web Notifications
 pref("notification.feature.enabled", true);
@@ -379,7 +388,6 @@ pref("dom.mozBrowserFramesEnabled", true);
 // We'll run out of PIDs on UNIX-y systems before we hit this limit.
 pref("dom.ipc.processCount", 100000);
 
-pref("dom.ipc.tabs.disabled", false);
 pref("dom.ipc.browser_frames.oop_by_default", false);
 
 // Temporary permission hack for WebSMS
@@ -395,6 +403,7 @@ pref("dom.mozAlarms.enabled", true);
 // NetworkStats
 #ifdef MOZ_B2G_RIL
 pref("dom.mozNetworkStats.enabled", true);
+pref("ril.lastKnownMcc", 724);
 #endif
 
 // WebSettings
diff --git a/b2g/app/nsBrowserApp.cpp b/b2g/app/nsBrowserApp.cpp
index 5c64cfec2c5b..1d5440f01547 100644
--- a/b2g/app/nsBrowserApp.cpp
+++ b/b2g/app/nsBrowserApp.cpp
@@ -168,10 +168,6 @@ int main(int argc, char* argv[])
 {
   char exePath[MAXPATHLEN];
 
-#if defined(MOZ_X11)
-  putenv("MOZ_USE_OMTC=1");
-#endif
-
   nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
   if (NS_FAILED(rv)) {
     Output("Couldn't calculate the application directory.\n");
diff --git a/b2g/chrome/content/settings.js b/b2g/chrome/content/settings.js
index 5ffb93fc40b6..73ee1f5d4051 100644
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -70,7 +70,7 @@ if ("nsIAudioManager" in Ci) {
   const nsIAudioManager = Ci.nsIAudioManager;
   audioChannelSettings = [
     // settings name, max value, apply to stream types
-    ['audio.volume.content', 15, [nsIAudioManager.STREAM_TYPE_SYSTEM, nsIAudioManager.STREAM_TYPE_MUSIC, nsIAudioManager.STREAM_TYPE_FM]],
+    ['audio.volume.content', 15, [nsIAudioManager.STREAM_TYPE_SYSTEM, nsIAudioManager.STREAM_TYPE_MUSIC]],
     ['audio.volume.notification', 15, [nsIAudioManager.STREAM_TYPE_RING, nsIAudioManager.STREAM_TYPE_NOTIFICATION]],
     ['audio.volume.alarm', 15, [nsIAudioManager.STREAM_TYPE_ALARM]],
     ['audio.volume.telephony', 5, [nsIAudioManager.STREAM_TYPE_VOICE_CALL]],
diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js
index 5e14d9e59f69..b989b707fe62 100644
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -107,6 +107,9 @@ var shell = {
       return;
     }
 
+    // purge the queue.
+    this.CrashSubmit.pruneSavedDumps();
+
     try {
       // Check if we should automatically submit this crash.
       if (Services.prefs.getBoolPref("app.reportCrashes")) {
@@ -135,7 +138,7 @@ var shell = {
           && network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
         shell.CrashSubmit.submit(aCrashID);
 
-        // purge the queue.
+        // submit the pending queue.
         let pending = shell.CrashSubmit.pendingIDs();
         for (let crashid of pending) {
           shell.CrashSubmit.submit(crashid);
diff --git a/b2g/config/mozconfigs/ics_armv7a_gecko/nightly b/b2g/config/mozconfigs/ics_armv7a_gecko/nightly
index b285d8d2b25c..f11006b575d8 100644
--- a/b2g/config/mozconfigs/ics_armv7a_gecko/nightly
+++ b/b2g/config/mozconfigs/ics_armv7a_gecko/nightly
@@ -4,6 +4,7 @@ mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-b2g
 
 ac_add_options --enable-application=b2g
 ac_add_options --enable-b2g-camera
+ac_add_options --enable-updater
 
 ac_add_options --target=arm-linux-androideabi
 ac_add_options --with-gonk="$topsrcdir/gonk-toolchain"
diff --git a/b2g/config/otoro/config.json b/b2g/config/otoro/config.json
index 776ed5635c6c..e71943ba5c46 100644
--- a/b2g/config/otoro/config.json
+++ b/b2g/config/otoro/config.json
@@ -6,8 +6,6 @@
     "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
     "build_targets": [],
     "upload_files": [
-        "{objdir}/dist/b2g-update/*.mar",
-        "{objdir}/dist/b2g-*.tar.gz",
         "{objdir}/dist/b2g-*.crashreporter-symbols.zip",
         "{workdir}/sources.xml"
     ],
@@ -24,6 +22,7 @@
         "MOZILLA_OFFICIAL": "1",
         "B2GUPDATER": "1"
     },
+    "gecko_l10n_root": "http://hg.mozilla.org/l10n-central",
     "gaia": {
         "vcs": "hgtool",
         "repo": "http://hg.mozilla.org/integration/gaia-nightly",
diff --git a/b2g/config/otoro/releng-otoro.tt b/b2g/config/otoro/releng-otoro.tt
index 6a92d1ccc9c6..97950d21081f 100644
--- a/b2g/config/otoro/releng-otoro.tt
+++ b/b2g/config/otoro/releng-otoro.tt
@@ -1,7 +1,7 @@
 [
 {
-"size": 868355892,
-"digest": "0ccae39ee8910947fe3cf51fa3a45e820d2ff11571f6ccec29d9b3e5ae7f7709c1ad657210fbfea98baadd032c3d6a58e00ddbb2e93acafd751089869a72fed6",
+"size": 895408640,
+"digest": "fc5be04b9b8365cd65fa8e66f4686bf0da8e34abb16ee618dd069469c9d9c9c3495562ebfcd21a2beadb27d59d6c011781188b9038ffebfd3e85cdd264f0aac3",
 "algorithm": "sha512",
 "filename": "gonk.tar.xz"
 },
diff --git a/b2g/config/otoro/sources.xml b/b2g/config/otoro/sources.xml
index 87209fe131f2..4b25e383a5bb 100644
--- a/b2g/config/otoro/sources.xml
+++ b/b2g/config/otoro/sources.xml
@@ -7,6 +7,7 @@
   
   
   
+  
   
 
   
@@ -14,76 +15,76 @@
     
   
   
-  
+  
   
-  
+  
   
 
   
-  
+  
   
   
   
   
   
-  
+  
   
-  
+  
   
-  
-  
+  
+  
   
   
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
   
-  
-  
-  
-  
-  
+  
+  
+  
+  
+  
   
-  
+  
   
   
   
   
-  
-  
+  
+  
   
   
   
-  
+  
   
-  
-  
-  
+  
+  
+  
   
-  
+  
   
-  
-  
-  
+  
+  
+  
   
-  
-  
+  
+  
   
-  
+  
   
   
   
   
-  
+  
   
   
   
@@ -96,13 +97,13 @@
   
   
   
-  
+  
   
   
   
   
   
-  
+  
   
   
-
+
\ No newline at end of file
diff --git a/b2g/config/panda-gaia-central/config.json b/b2g/config/panda-gaia-central/config.json
index 6e708d8863bc..36a818bb52d5 100644
--- a/b2g/config/panda-gaia-central/config.json
+++ b/b2g/config/panda-gaia-central/config.json
@@ -4,15 +4,15 @@
     "mock_target": "mozilla-centos6-i386",
     "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel"],
     "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
-    "build_targets": ["boottarball", "systemtarball", "userdatatarball"],
+    "build_targets": ["boottarball", "systemtarball", "userdatatarball", "package-tests"],
     "upload_files": [
         "{workdir}/out/target/product/panda/*.tar.bz2",
-        "{objdir}/dist/b2g-update/*.mar",
-        "{objdir}/dist/b2g-*.tar.gz",
+        "{workdir}/out/target/product/panda/tests/*.zip",
         "{objdir}/dist/b2g-*.crashreporter-symbols.zip",
         "{srcdir}/b2g/config/panda/README",
         "{workdir}/sources.xml"
     ],
+    "gecko_l10n_root": "http://hg.mozilla.org/l10n-central",
     "gaia": {
         "vcs": "hgtool",
         "repo": "http://hg.mozilla.org/integration/gaia-central",
diff --git a/b2g/config/panda/config.json b/b2g/config/panda/config.json
index b6d5c4fba184..c5e1b7ef7023 100644
--- a/b2g/config/panda/config.json
+++ b/b2g/config/panda/config.json
@@ -4,15 +4,15 @@
     "mock_target": "mozilla-centos6-i386",
     "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel"],
     "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
-    "build_targets": ["boottarball", "systemtarball", "userdatatarball"],
+    "build_targets": ["boottarball", "systemtarball", "userdatatarball", "package-tests"],
     "upload_files": [
         "{workdir}/out/target/product/panda/*.tar.bz2",
-        "{objdir}/dist/b2g-update/*.mar",
-        "{objdir}/dist/b2g-*.tar.gz",
+        "{workdir}/out/target/product/panda/tests/*.zip",
         "{objdir}/dist/b2g-*.crashreporter-symbols.zip",
         "{srcdir}/b2g/config/panda/README",
         "{workdir}/sources.xml"
     ],
+    "gecko_l10n_root": "http://hg.mozilla.org/l10n-central",
     "gaia": {
         "vcs": "hgtool",
         "repo": "http://hg.mozilla.org/integration/gaia-nightly",
diff --git a/b2g/config/panda/releng-pandaboard.tt b/b2g/config/panda/releng-pandaboard.tt
index 063e7bd2db72..9cfc0a1666ac 100644
--- a/b2g/config/panda/releng-pandaboard.tt
+++ b/b2g/config/panda/releng-pandaboard.tt
@@ -1,7 +1,7 @@
 [
 {
-"size": 649725280,
-"digest": "9059a4ebdf8d1ead0e9975fb872d95b07bceba1f84453f47a32559f258351ee6f6ff459c2747130603de309586dfaf784e674fd7a558be354f276795d12c273f",
+"size": 676548372,
+"digest": "e94c1ef674d2144ef19bf6b5faa0bc050f2f6e61d5a859c20f0d61a4665cd4587836f2c45dbc3a2b264f94b4da9db7f31d566d6ad21e9e43b90bc3f617508184",
 "algorithm": "sha512",
 "filename": "gonk.tar.xz"
 }
diff --git a/b2g/config/panda/sources.xml b/b2g/config/panda/sources.xml
index 87715ac5f6a4..d5451998f4b6 100644
--- a/b2g/config/panda/sources.xml
+++ b/b2g/config/panda/sources.xml
@@ -14,67 +14,67 @@
     
   
   
-  
+  
   
   
 
   
-  
+  
   
   
   
   
-  
+  
   
   
   
-  
+  
   
-  
+  
   
   
-  
-  
-  
-  
-  
-  
+  
+  
+  
+  
+  
+  
   
   
-  
-  
-  
+  
+  
+  
   
-  
-  
+  
+  
   
-  
+  
   
   
-  
+  
   
   
   
-  
-  
+  
+  
   
   
   
-  
+  
   
-  
-  
-  
+  
+  
+  
   
-  
-  
+  
+  
   
-  
+  
   
   
   
   
-  
+  
   
   
   
@@ -97,4 +97,4 @@
   
   
 
-
+
\ No newline at end of file
diff --git a/b2g/config/tooltool-manifests/macosx64/releng.manifest b/b2g/config/tooltool-manifests/macosx64/releng.manifest
index f363c9a95ace..3cb17242b31a 100644
--- a/b2g/config/tooltool-manifests/macosx64/releng.manifest
+++ b/b2g/config/tooltool-manifests/macosx64/releng.manifest
@@ -1,6 +1,6 @@
 [
 {
-"clang_version": "r169139"
+"clang_version": "r169730"
 },
 {
 "size": 47,
@@ -9,8 +9,8 @@
 "filename": "setup.sh"
 },
 {
-"size": 56158651,
-"digest": "38d718f20a8fa9218e22ade312e724e6c9cdd7c6650e023cfdc21b5505fe7aa3743ae41c0abd717a1bbccec4c4271be2fa82d0e2f96c91e693d70e33b4dc00d6",
+"size": 56115091,
+"digest": "d7188264f28d6f6a84fab9737520cad22fe3d575917a87fc110d0b9a2033617c35da83530ea20553f5c55a996459f750fa2d0c49288c1fb9671f6252a92cf4c9",
 "algorithm": "sha512",
 "filename": "clang.tar.bz2"
 }
diff --git a/b2g/config/unagi/config.json b/b2g/config/unagi/config.json
index 6b22ef682b8e..e49d3d861bd9 100644
--- a/b2g/config/unagi/config.json
+++ b/b2g/config/unagi/config.json
@@ -7,7 +7,6 @@
     "build_targets": [],
     "upload_files": [
         "{objdir}/dist/b2g-update/*.mar",
-        "{objdir}/dist/b2g-*.tar.gz",
         "{objdir}/dist/b2g-*.crashreporter-symbols.zip",
         "{workdir}/sources.xml"
     ],
@@ -24,6 +23,7 @@
         "MOZILLA_OFFICIAL": "1",
         "B2GUPDATER": "1"
     },
+    "gecko_l10n_root": "http://hg.mozilla.org/l10n-central",
     "gaia": {
         "vcs": "hgtool",
         "repo": "http://hg.mozilla.org/integration/gaia-nightly",
diff --git a/b2g/config/unagi/releng-unagi.tt b/b2g/config/unagi/releng-unagi.tt
index f8ea002eb2a0..027f82ca5c07 100644
--- a/b2g/config/unagi/releng-unagi.tt
+++ b/b2g/config/unagi/releng-unagi.tt
@@ -1,13 +1,13 @@
 [
 {
-"size": 805101852,
-"digest": "553e88831f0760ef8de039a037c91499ff9334691f0532835c73a44352750a4911752cf0d5346f5e023f64b2351ed7f49a2a833c27538ddde59ad505f50ab063",
+"size": 832341968,
+"digest": "e2d099677f5f930db0b2c03eaf3812a53f02be0773bdb3bad89b1c387041e920c17b90f041bf70d9c2ab715dd4556503534483d4ebc28fb035f41cd5ebba6a52",
 "algorithm": "sha512",
 "filename": "gonk.tar.xz"
 },
 {
-"size": 8859648,
-"digest": "05d4a99e0f36cd91d1b10a2b558979ea776e9a7e03b8a921af3b0bfc62e2d96cf4faa20586c39885b6f8b25089fe07726794620a3b18c4826a2f71e29d90a8ef",
+"size": 8622080,
+"digest": "7a2bbf0c76f7b7d5e4b89f758f69b5d8bcf08ec579374877de8939ad69883ab8cd842f04fdaa03a4ef9cdf8170f242e0381dd437e969d5212ead6cdd6f79ab50",
 "algorithm": "sha512",
 "filename": "boot.img"
 }
diff --git a/b2g/config/unagi/sources.xml b/b2g/config/unagi/sources.xml
index afbaa1d0d34b..fafe167b23f3 100644
--- a/b2g/config/unagi/sources.xml
+++ b/b2g/config/unagi/sources.xml
@@ -7,6 +7,7 @@
   
   
   
+  
   
 
   
@@ -14,76 +15,76 @@
     
   
   
-  
+  
   
-  
+  
   
 
   
-  
+  
   
   
   
   
   
-  
+  
   
-  
+  
   
-  
-  
+  
+  
   
   
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
   
-  
-  
-  
-  
-  
+  
+  
+  
+  
+  
   
-  
+  
   
   
   
   
-  
-  
+  
+  
   
   
   
-  
+  
   
-  
-  
-  
+  
+  
+  
   
-  
+  
   
-  
-  
-  
+  
+  
+  
   
-  
-  
+  
+  
   
-  
+  
   
   
   
   
-  
+  
   
   
   
@@ -95,14 +96,14 @@
   
   
   
-  
-  
+  
+  
   
   
   
   
   
-  
+  
   
   
-
+
\ No newline at end of file
diff --git a/b2g/confvars.sh b/b2g/confvars.sh
index 7c0337b5f5ae..040c8b269035 100755
--- a/b2g/confvars.sh
+++ b/b2g/confvars.sh
@@ -47,6 +47,7 @@ MOZ_EXTENSION_MANAGER=1
 MOZ_SYS_MSG=1
 MOZ_TIME_MANAGER=1
 
+MOZ_B2G_CERTDATA=1
 MOZ_PAY=1
 MOZ_TOOLKIT_SEARCH=
 MOZ_PLACES=
diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in
index 867a24b0ba29..06540e33c6c5 100644
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -54,6 +54,9 @@
 @BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
+#ifdef MOZ_DMD
+@BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@
+#endif
 #ifdef XP_MACOSX
 @BINPATH@/XUL
 #else
diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in
index e5d01f6f3e1a..626afd0776ad 100644
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -146,8 +146,8 @@ libs:: $(srcdir)/profile/prefs.js
 ifndef LIBXUL_SDK
 # channel-prefs.js is handled separate from other prefs due to bug 756325
 libs:: $(srcdir)/profile/channel-prefs.js
-	$(NSINSTALL) -D $(FINAL_TARGET)/defaults/pref
-	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(ACDEFINES) $^ > $(FINAL_TARGET)/defaults/pref/channel-prefs.js
+	$(NSINSTALL) -D $(DIST)/bin/defaults/pref
+	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(ACDEFINES) $^ > $(DIST)/bin/defaults/pref/channel-prefs.js
 endif
 
 libs:: $(srcdir)/blocklist.xml
diff --git a/browser/app/blocklist.xml b/browser/app/blocklist.xml
index fa1d63a724d9..429c5ae3fe98 100644
--- a/browser/app/blocklist.xml
+++ b/browser/app/blocklist.xml
@@ -68,7 +68,7 @@
       
                         
                       
-                              
+                              
                           
                     
                   
diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index a719cb83e57b..c9c7c5d1ab30 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -862,8 +862,10 @@ pref("security.alternate_certificate_error_page", "certerror");
 // Whether to start the private browsing mode at application startup
 pref("browser.privatebrowsing.autostart", false);
 
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
 // Whether we should skip prompting before starting the private browsing mode
 pref("browser.privatebrowsing.dont_prompt_on_enter", false);
+#endif
 
 // Don't try to alter this pref, it'll be reset the next time you use the
 // bookmarking dialog
@@ -1045,6 +1047,9 @@ pref("devtools.debugger.ui.variables-sorting-enabled", true);
 pref("devtools.debugger.ui.variables-only-enum-visible", false);
 pref("devtools.debugger.ui.variables-searchbox-visible", false);
 
+// Enable the Profiler
+pref("devtools.profiler.enabled", true);
+
 // Enable the Tilt inspector
 pref("devtools.tilt.enabled", true);
 pref("devtools.tilt.intro_transition", true);
@@ -1163,14 +1168,15 @@ pref("pdfjs.previousHandler.alwaysAskBeforeHandling", false);
 // (This is intentionally on the high side; see bug 746055.)
 pref("image.mem.max_decoded_image_kb", 256000);
 
-// Example social provider
+// Default social providers
 pref("social.manifest.facebook", "{\"origin\":\"https://www.facebook.com\",\"name\":\"Facebook Messenger\",\"workerURL\":\"https://www.facebook.com/desktop/fbdesktop2/socialfox/fbworker.js.php\",\"iconURL\":\"data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAAX0lEQVQ4jWP4%2F%2F8%2FAyUYTFhHzjgDxP9JxGeQDSBVMxgTbUBCxer%2Fr999%2BQ8DJBuArJksA9A10s8AXIBoA0B%2BR%2FY%2FjD%2BEwoBoA1yT5v3PbdmCE8MAshhID%2FUMoDgzUYIBj0Cgi7ar4coAAAAASUVORK5CYII%3D\",\"sidebarURL\":\"https://www.facebook.com/desktop/fbdesktop2/?socialfox=true\"}");
+
 // Comma-separated list of nsIURI::prePaths that are allowed to activate
 // built-in social functionality.
 pref("social.activation.whitelist", "https://www.facebook.com");
+
 pref("social.sidebar.open", true);
 pref("social.sidebar.unload_timeout_ms", 10000);
-pref("social.active", false);
 pref("social.toast-notifications.enabled", true);
 
 pref("dom.identity.enabled", false);
diff --git a/browser/base/content/browser-appmenu.inc b/browser/base/content/browser-appmenu.inc
index d06e4fa33d67..812131537ad3 100644
--- a/browser/base/content/browser-appmenu.inc
+++ b/browser/base/content/browser-appmenu.inc
@@ -309,10 +309,8 @@
                       disabled="true"/>
 #endif
             
+                      command="Browser:RestoreLastSession"/>
             
 #endif
                 
+                          command="Browser:RestoreLastSession"/>