diff --git a/accessible/atk/AccessibleWrap.cpp b/accessible/atk/AccessibleWrap.cpp index 2b00c87355..88c83d19d8 100644 --- a/accessible/atk/AccessibleWrap.cpp +++ b/accessible/atk/AccessibleWrap.cpp @@ -759,7 +759,7 @@ getAttributesCB(AtkObject *aAtkObj) if (!proxy) return nullptr; - nsAutoTArray attrs; + AutoTArray attrs; proxy->Attributes(&attrs); if (attrs.IsEmpty()) return nullptr; @@ -1019,7 +1019,7 @@ refRelationSetCB(AtkObject *aAtkObj) continue; size_t targetCount = targetSets[i].Length(); - nsAutoTArray wrappers; + AutoTArray wrappers; for (size_t j = 0; j < targetCount; j++) wrappers.AppendElement(GetWrapperFor(targetSets[i][j])); @@ -1664,7 +1664,7 @@ AccessibleWrap::GetColumnHeader(TableAccessible* aAccessible, int32_t aColIdx) return nullptr; } - nsAutoTArray headerCells; + AutoTArray headerCells; tableCell->ColHeaderCells(&headerCells); if (headerCells.IsEmpty()) { return nullptr; @@ -1698,7 +1698,7 @@ AccessibleWrap::GetRowHeader(TableAccessible* aAccessible, int32_t aRowIdx) return nullptr; } - nsAutoTArray headerCells; + AutoTArray headerCells; tableCell->RowHeaderCells(&headerCells); if (headerCells.IsEmpty()) { return nullptr; diff --git a/accessible/atk/nsMaiInterfaceTable.cpp b/accessible/atk/nsMaiInterfaceTable.cpp index 1795f8e12b..c94815f3c8 100644 --- a/accessible/atk/nsMaiInterfaceTable.cpp +++ b/accessible/atk/nsMaiInterfaceTable.cpp @@ -273,7 +273,7 @@ getSelectedColumnsCB(AtkTable *aTable, gint** aSelected) { *aSelected = nullptr; - nsAutoTArray cols; + AutoTArray cols; AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); if (accWrap) { accWrap->AsTable()->SelectedColIndices(&cols); @@ -300,7 +300,7 @@ getSelectedColumnsCB(AtkTable *aTable, gint** aSelected) static gint getSelectedRowsCB(AtkTable *aTable, gint **aSelected) { - nsAutoTArray rows; + AutoTArray rows; AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); if (accWrap) { accWrap->AsTable()->SelectedRowIndices(&rows); diff --git a/accessible/atk/nsMaiInterfaceText.cpp b/accessible/atk/nsMaiInterfaceText.cpp index 0386ef8343..1982f37309 100644 --- a/accessible/atk/nsMaiInterfaceText.cpp +++ b/accessible/atk/nsMaiInterfaceText.cpp @@ -311,7 +311,7 @@ getRunAttributesCB(AtkText *aText, gint aOffset, return nullptr; } - nsAutoTArray attrs; + AutoTArray attrs; proxy->TextAttributes(false, aOffset, &attrs, &startOffset, &endOffset); *aStartOffset = startOffset; *aEndOffset = endOffset; @@ -337,7 +337,7 @@ getDefaultAttributesCB(AtkText *aText) return nullptr; } - nsAutoTArray attrs; + AutoTArray attrs; proxy->DefaultTextAttributes(&attrs); return ConvertToAtkTextAttributeSet(attrs); } diff --git a/accessible/base/DocManager.cpp b/accessible/base/DocManager.cpp index 08db38e656..6c6bf13af4 100644 --- a/accessible/base/DocManager.cpp +++ b/accessible/base/DocManager.cpp @@ -40,6 +40,8 @@ using namespace mozilla::a11y; using namespace mozilla::dom; StaticAutoPtr> DocManager::sRemoteDocuments; +nsRefPtrHashtable, xpcAccessibleDocument>* +DocManager::sRemoteXPCDocumentCache = nullptr; //////////////////////////////////////////////////////////////////////////////// // DocManager @@ -101,6 +103,16 @@ DocManager::NotifyOfDocumentShutdown(DocAccessible* aDocument, RemoveListeners(aDOMDocument); } +void +DocManager::NotifyOfRemoteDocShutdown(DocAccessibleParent* aDoc) +{ + xpcAccessibleDocument* doc = GetCachedXPCDocument(aDoc); + if (doc) { + doc->Shutdown(); + sRemoteXPCDocumentCache->Remove(aDoc); + } +} + xpcAccessibleDocument* DocManager::GetXPCDocument(DocAccessible* aDocument) { @@ -115,6 +127,26 @@ DocManager::GetXPCDocument(DocAccessible* aDocument) return xpcDoc; } +xpcAccessibleDocument* +DocManager::GetXPCDocument(DocAccessibleParent* aDoc) +{ + xpcAccessibleDocument* doc = GetCachedXPCDocument(aDoc); + if (doc) { + return doc; + } + + if (!sRemoteXPCDocumentCache) { + sRemoteXPCDocumentCache = + new nsRefPtrHashtable, xpcAccessibleDocument>; + } + + doc = + new xpcAccessibleDocument(aDoc, Interfaces::DOCUMENT | Interfaces::HYPERTEXT); + sRemoteXPCDocumentCache->Put(aDoc, doc); + + return doc; +} + #ifdef DEBUG bool DocManager::IsProcessingRefreshDriverNotification() const diff --git a/accessible/base/DocManager.h b/accessible/base/DocManager.h index 1251f3df2e..b07b6eb013 100644 --- a/accessible/base/DocManager.h +++ b/accessible/base/DocManager.h @@ -90,6 +90,21 @@ public: static const nsTArray* TopLevelRemoteDocs() { return sRemoteDocuments; } + /** + * Remove the xpc document for a remote document if there is one. + */ + static void NotifyOfRemoteDocShutdown(DocAccessibleParent* adoc); + + /** + * Get a XPC document for a remote document. + */ + static xpcAccessibleDocument* GetXPCDocument(DocAccessibleParent* aDoc); + static xpcAccessibleDocument* GetCachedXPCDocument(const DocAccessibleParent* aDoc) + { + return sRemoteXPCDocumentCache ? sRemoteXPCDocumentCache->GetWeak(aDoc) + : nullptr; + } + #ifdef DEBUG bool IsProcessingRefreshDriverNotification() const; #endif @@ -147,6 +162,8 @@ private: typedef nsRefPtrHashtable, xpcAccessibleDocument> XPCDocumentHashtable; XPCDocumentHashtable mXPCDocumentCache; + static nsRefPtrHashtable, xpcAccessibleDocument>* + sRemoteXPCDocumentCache; /* * The list of remote top level documents. diff --git a/accessible/base/EventQueue.h b/accessible/base/EventQueue.h index 01384b844f..b80cddcbeb 100644 --- a/accessible/base/EventQueue.h +++ b/accessible/base/EventQueue.h @@ -76,7 +76,7 @@ protected: DocAccessible* mDocument; /** - * Pending events array. Don't make this an nsAutoTArray; we use + * Pending events array. Don't make this an AutoTArray; we use * SwapElements() on it. */ nsTArray > mEvents; diff --git a/accessible/base/NotificationController.h b/accessible/base/NotificationController.h index 946b7964f0..9ae6f7e6aa 100644 --- a/accessible/base/NotificationController.h +++ b/accessible/base/NotificationController.h @@ -275,7 +275,7 @@ private: /** * A pending accessible tree update notifications for content insertions. - * Don't make this an nsAutoTArray; we use SwapElements() on it. + * Don't make this an AutoTArray; we use SwapElements() on it. */ nsTArray > mContentInsertions; @@ -309,7 +309,7 @@ private: nsTHashtable > mTextHash; /** - * Other notifications like DOM events. Don't make this an nsAutoTArray; we + * Other notifications like DOM events. Don't make this an AutoTArray; we * use SwapElements() on it. */ nsTArray > mNotifications; diff --git a/accessible/base/TextRange-inl.h b/accessible/base/TextRange-inl.h index ab8a4969a4..15bbaa2357 100644 --- a/accessible/base/TextRange-inl.h +++ b/accessible/base/TextRange-inl.h @@ -17,7 +17,7 @@ inline Accessible* TextRange::Container() const { uint32_t pos1 = 0, pos2 = 0; - nsAutoTArray parents1, parents2; + AutoTArray parents1, parents2; return CommonParent(mStartContainer, mEndContainer, &parents1, &pos1, &parents2, &pos2); } diff --git a/accessible/base/TextRange.cpp b/accessible/base/TextRange.cpp index 5a1afe272f..c2a69dc59e 100644 --- a/accessible/base/TextRange.cpp +++ b/accessible/base/TextRange.cpp @@ -24,7 +24,7 @@ TextPoint::operator <(const TextPoint& aPoint) const // Build the chain of parents Accessible* p1 = mContainer; Accessible* p2 = aPoint.mContainer; - nsAutoTArray parents1, parents2; + AutoTArray parents1, parents2; do { parents1.AppendElement(p1); p1 = p1->Parent(); @@ -76,7 +76,7 @@ TextRange::EmbeddedChildren(nsTArray* aChildren) const Accessible* p2 = mEndContainer->GetChildAtOffset(mEndOffset); uint32_t pos1 = 0, pos2 = 0; - nsAutoTArray parents1, parents2; + AutoTArray parents1, parents2; Accessible* container = CommonParent(p1, p2, &parents1, &pos1, &parents2, &pos2); @@ -146,7 +146,7 @@ bool TextRange::Crop(Accessible* aContainer) { uint32_t boundaryPos = 0, containerPos = 0; - nsAutoTArray boundaryParents, containerParents; + AutoTArray boundaryParents, containerParents; // Crop the start boundary. Accessible* container = nullptr; diff --git a/accessible/base/TreeWalker.cpp b/accessible/base/TreeWalker.cpp index 365477afa3..a06bd2e351 100644 --- a/accessible/base/TreeWalker.cpp +++ b/accessible/base/TreeWalker.cpp @@ -27,8 +27,8 @@ TreeWalker:: { NS_ASSERTION(aContent, "No node for the accessible tree walker!"); - mChildFilter = mContext->CanHaveAnonChildren() ? - nsIContent::eAllChildren : nsIContent::eAllButXBL; + mChildFilter = mContext->NoXBLKids() ? + nsIContent::eAllButXBL : nsIContent::eAllChildren; mChildFilter |= nsIContent::eSkipPlaceholderContent; if (aContent) @@ -46,7 +46,7 @@ TreeWalker::~TreeWalker() // TreeWalker: private Accessible* -TreeWalker::NextChild() +TreeWalker::Next() { if (mStateStack.IsEmpty()) return nullptr; @@ -80,11 +80,9 @@ TreeWalker::NextChild() nsIContent* parent = parentNode->AsElement(); top = PushState(parent); - while (nsIContent* childNode = Next(top)) { - if (childNode == mAnchorNode) { - mAnchorNode = parent; - return NextChild(); - } + if (top->mDOMIter.Seek(mAnchorNode)) { + mAnchorNode = parent; + return Next(); } // XXX We really should never get here, it means we're trying to find an diff --git a/accessible/base/TreeWalker.h b/accessible/base/TreeWalker.h index 356a329aef..d35c8147ce 100644 --- a/accessible/base/TreeWalker.h +++ b/accessible/base/TreeWalker.h @@ -44,13 +44,13 @@ public: ~TreeWalker(); /** - * Return the next child accessible. + * Return the next accessible. * * @note Returned accessible is bound to the document, if the accessible is * rejected during tree creation then the caller should be unbind it * from the document. */ - Accessible* NextChild(); + Accessible* Next(); private: TreeWalker(); @@ -87,7 +87,7 @@ private: DocAccessible* mDoc; Accessible* mContext; nsIContent* mAnchorNode; - nsAutoTArray mStateStack; + AutoTArray mStateStack; int32_t mChildFilter; uint32_t mFlags; }; diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp index 10b316c395..e0359c3ebf 100644 --- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -596,7 +596,7 @@ nsAccessibilityService::ContentRemoved(nsIPresShell* aPresShell, Accessible* container = document->GetContainerAccessible(aChildNode); a11y::TreeWalker walker(container ? container : document, aChildNode, a11y::TreeWalker::eWalkCache); - child = walker.NextChild(); + child = walker.Next(); } if (child) { diff --git a/accessible/base/nsCoreUtils.cpp b/accessible/base/nsCoreUtils.cpp index 7bd4c1eca4..8b12a5196f 100644 --- a/accessible/base/nsCoreUtils.cpp +++ b/accessible/base/nsCoreUtils.cpp @@ -16,11 +16,13 @@ #include "nsIBoxObject.h" #include "nsIDOMXULElement.h" #include "nsIDocShell.h" +#include "nsIObserverService.h" #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsIScrollableFrame.h" #include "nsISelectionPrivate.h" #include "nsISelectionController.h" +#include "nsISimpleEnumerator.h" #include "mozilla/dom/TouchEvent.h" #include "mozilla/EventListenerManager.h" #include "mozilla/EventStateManager.h" @@ -647,3 +649,29 @@ nsCoreUtils::IsWhitespaceString(const nsSubstring& aString) return iterBegin == iterEnd; } + +bool +nsCoreUtils::AccEventObserversExist() +{ + nsCOMPtr obsService = services::GetObserverService(); + NS_ENSURE_TRUE(obsService, false); + + nsCOMPtr observers; + obsService->EnumerateObservers(NS_ACCESSIBLE_EVENT_TOPIC, + getter_AddRefs(observers)); + NS_ENSURE_TRUE(observers, false); + + bool hasObservers = false; + observers->HasMoreElements(&hasObservers); + + return hasObservers; +} + +void +nsCoreUtils::DispatchAccEvent(RefPtr event) +{ + nsCOMPtr obsService = services::GetObserverService(); + NS_ENSURE_TRUE_VOID(obsService); + + obsService->NotifyObservers(event, NS_ACCESSIBLE_EVENT_TOPIC, nullptr); +} diff --git a/accessible/base/nsCoreUtils.h b/accessible/base/nsCoreUtils.h index 2e1593bed6..78fa99e282 100644 --- a/accessible/base/nsCoreUtils.h +++ b/accessible/base/nsCoreUtils.h @@ -7,6 +7,7 @@ #define nsCoreUtils_h_ #include "mozilla/EventForwards.h" +#include "nsIAccessibleEvent.h" #include "nsIContent.h" #include "nsIDocument.h" // for GetShell() #include "nsIPresShell.h" @@ -314,6 +315,16 @@ public: return aChar == ' ' || aChar == '\n' || aChar == '\r' || aChar == '\t' || aChar == 0xa0; } + + /* + * Return true if there are any observers of accessible events. + */ + static bool AccEventObserversExist(); + + /** + * Notify accessible event observers of an event. + */ + static void DispatchAccEvent(RefPtr aEvent); }; #endif diff --git a/accessible/generic/Accessible.cpp b/accessible/generic/Accessible.cpp index 5c5de625a2..e0164a9a09 100644 --- a/accessible/generic/Accessible.cpp +++ b/accessible/generic/Accessible.cpp @@ -302,12 +302,6 @@ Accessible::KeyboardShortcut() const return KeyBinding(); } -bool -Accessible::CanHaveAnonChildren() -{ - return true; -} - void Accessible::TranslateString(const nsString& aKey, nsAString& aStringOut) { @@ -885,20 +879,8 @@ Accessible::HandleAccEvent(AccEvent* aEvent) } } - nsCOMPtr obsService = services::GetObserverService(); - NS_ENSURE_TRUE(obsService, NS_ERROR_FAILURE); - - nsCOMPtr observers; - obsService->EnumerateObservers(NS_ACCESSIBLE_EVENT_TOPIC, - getter_AddRefs(observers)); - - NS_ENSURE_STATE(observers); - - bool hasObservers = false; - observers->HasMoreElements(&hasObservers); - if (hasObservers) { - nsCOMPtr event = MakeXPCEvent(aEvent); - return obsService->NotifyObservers(event, NS_ACCESSIBLE_EVENT_TOPIC, nullptr); + if (nsCoreUtils::AccEventObserversExist()) { + nsCoreUtils::DispatchAccEvent(MakeXPCEvent(aEvent)); } return NS_OK; @@ -2512,7 +2494,7 @@ Accessible::CacheChildren() TreeWalker walker(this, mContent); Accessible* child = nullptr; - while ((child = walker.NextChild()) && AppendChild(child)); + while ((child = walker.Next()) && AppendChild(child)); } void diff --git a/accessible/generic/Accessible.h b/accessible/generic/Accessible.h index 788ff3d290..deed3a9575 100644 --- a/accessible/generic/Accessible.h +++ b/accessible/generic/Accessible.h @@ -489,11 +489,6 @@ public: */ virtual nsresult HandleAccEvent(AccEvent* aAccEvent); - /** - * Return true if this accessible allows accessible children from anonymous subtree. - */ - virtual bool CanHaveAnonChildren(); - /** * Return true if the accessible is an acceptable child. */ @@ -925,6 +920,12 @@ public: mStateFlags &= ~eRelocated; } + /** + * Return true if the accessible doesn't allow accessible children from XBL + * anonymous subtree. + */ + bool NoXBLKids() { return mStateFlags & eNoXBLKids; } + /** * Return true if this accessible has a parent whose name depends on this * accessible. @@ -1016,8 +1017,9 @@ protected: eIgnoreDOMUIEvent = 1 << 7, // don't process DOM UI events for a11y events eSurvivingInUpdate = 1 << 8, // parent drops children to recollect them eRelocated = 1 << 9, // accessible was moved in tree + eNoXBLKids = 1 << 10, // accessible don't allows XBL children - eLastStateFlag = eRelocated + eLastStateFlag = eNoXBLKids }; /** @@ -1132,7 +1134,7 @@ protected: int32_t mIndexInParent; static const uint8_t kChildrenFlagsBits = 2; - static const uint8_t kStateFlagsBits = 10; + static const uint8_t kStateFlagsBits = 11; static const uint8_t kContextFlagsBits = 2; static const uint8_t kTypeBits = 6; static const uint8_t kGenericTypesBits = 14; diff --git a/accessible/generic/DocAccessible.cpp b/accessible/generic/DocAccessible.cpp index 4b207a39cc..e4e609527a 100644 --- a/accessible/generic/DocAccessible.cpp +++ b/accessible/generic/DocAccessible.cpp @@ -1437,7 +1437,7 @@ DocAccessible::CacheChildren() // Ignore last HTML:br, copied from HyperTextAccessible. TreeWalker walker(this, rootElm); Accessible* lastChild = nullptr; - while (Accessible* child = walker.NextChild()) { + while (Accessible* child = walker.Next()) { if (lastChild) AppendChild(lastChild); diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp index e344599ecd..751211668a 100644 --- a/accessible/generic/HyperTextAccessible.cpp +++ b/accessible/generic/HyperTextAccessible.cpp @@ -284,7 +284,7 @@ HyperTextAccessible::DOMPointToOffset(nsINode* aNode, int32_t aNodeOffset, if (container) { TreeWalker walker(container, findNode->AsContent(), TreeWalker::eWalkContextTree); - descendant = walker.NextChild(); + descendant = walker.Next(); if (!descendant) descendant = container; } @@ -1945,7 +1945,7 @@ HyperTextAccessible::CacheChildren() TreeWalker walker(this, mContent); Accessible* child = nullptr; Accessible* lastChild = nullptr; - while ((child = walker.NextChild())) { + while ((child = walker.Next())) { if (lastChild) AppendChild(lastChild); diff --git a/accessible/html/HTMLTableAccessible.cpp b/accessible/html/HTMLTableAccessible.cpp index 247687f398..5a8de9ff0b 100644 --- a/accessible/html/HTMLTableAccessible.cpp +++ b/accessible/html/HTMLTableAccessible.cpp @@ -403,10 +403,10 @@ HTMLTableAccessible::CacheChildren() TreeWalker walker(this, mContent); Accessible* child = nullptr; - while ((child = walker.NextChild())) { + while ((child = walker.Next())) { if (child->Role() == roles::CAPTION) { InsertChildAt(0, child); - while ((child = walker.NextChild()) && AppendChild(child)); + while ((child = walker.Next()) && AppendChild(child)); break; } AppendChild(child); diff --git a/accessible/ipc/DocAccessibleChild.cpp b/accessible/ipc/DocAccessibleChild.cpp index 0c47835b64..023cdfbddd 100644 --- a/accessible/ipc/DocAccessibleChild.cpp +++ b/accessible/ipc/DocAccessibleChild.cpp @@ -1048,7 +1048,7 @@ DocAccessibleChild::RecvColHeaderCells(const uint64_t& aID, { TableCellAccessible* acc = IdToTableCellAccessible(aID); if (acc) { - nsAutoTArray headerCells; + AutoTArray headerCells; acc->ColHeaderCells(&headerCells); aCells->SetCapacity(headerCells.Length()); for (uint32_t i = 0; i < headerCells.Length(); ++i) { @@ -1066,7 +1066,7 @@ DocAccessibleChild::RecvRowHeaderCells(const uint64_t& aID, { TableCellAccessible* acc = IdToTableCellAccessible(aID); if (acc) { - nsAutoTArray headerCells; + AutoTArray headerCells; acc->RowHeaderCells(&headerCells); aCells->SetCapacity(headerCells.Length()); for (uint32_t i = 0; i < headerCells.Length(); ++i) { @@ -1368,7 +1368,7 @@ DocAccessibleChild::RecvTableSelectedCells(const uint64_t& aID, { TableAccessible* acc = IdToTableAccessible(aID); if (acc) { - nsAutoTArray cells; + AutoTArray cells; acc->SelectedCells(&cells); aCellIDs->SetCapacity(cells.Length()); for (uint32_t i = 0; i < cells.Length(); ++i) { @@ -1529,7 +1529,7 @@ DocAccessibleChild::RecvSelectedItems(const uint64_t& aID, { Accessible* acc = IdToAccessibleSelect(aID); if (acc) { - nsAutoTArray selectedItems; + AutoTArray selectedItems; acc->SelectedItems(&selectedItems); aSelectedItemIDs->SetCapacity(selectedItems.Length()); for (size_t i = 0; i < selectedItems.Length(); ++i) { diff --git a/accessible/ipc/DocAccessibleParent.cpp b/accessible/ipc/DocAccessibleParent.cpp index dc0831d344..2b0c12dffb 100644 --- a/accessible/ipc/DocAccessibleParent.cpp +++ b/accessible/ipc/DocAccessibleParent.cpp @@ -267,6 +267,8 @@ DocAccessibleParent::Destroy() ProxyDestroyed(iter.Get()->mProxy); iter.Remove(); } + + DocManager::NotifyOfRemoteDocShutdown(this); ProxyDestroyed(this); if (mParentDoc) mParentDoc->RemoveChildDoc(this); diff --git a/accessible/ipc/ProxyAccessible.cpp b/accessible/ipc/ProxyAccessible.cpp index 3c927fc53b..aad2f03c06 100644 --- a/accessible/ipc/ProxyAccessible.cpp +++ b/accessible/ipc/ProxyAccessible.cpp @@ -14,6 +14,7 @@ #include "mozilla/a11y/Platform.h" #include "RelationType.h" #include "mozilla/a11y/Role.h" +#include "xpcAccessibleDocument.h" namespace mozilla { namespace a11y { @@ -23,6 +24,11 @@ ProxyAccessible::Shutdown() { MOZ_DIAGNOSTIC_ASSERT(!IsDoc()); NS_ASSERTION(!mOuterDoc, "Why do we still have a child doc?"); + xpcAccessibleDocument* xpcDoc = + GetAccService()->GetCachedXPCDocument(Document()); + if (xpcDoc) { + xpcDoc->NotifyOfShutdown(this); + } // XXX Ideally this wouldn't be necessary, but it seems OuterDoc accessibles // can be destroyed before the doc they own. @@ -772,7 +778,7 @@ ProxyAccessible::TableSelectedRowCount() void ProxyAccessible::TableSelectedCells(nsTArray* aCellIDs) { - nsAutoTArray cellIDs; + AutoTArray cellIDs; Unused << mDoc->SendTableSelectedCells(mID, &cellIDs); aCellIDs->SetCapacity(cellIDs.Length()); for (uint32_t i = 0; i < cellIDs.Length(); ++i) { @@ -851,7 +857,7 @@ ProxyAccessible::AtkTableRowHeader(int32_t aRow) void ProxyAccessible::SelectedItems(nsTArray* aSelectedItems) { - nsAutoTArray itemIDs; + AutoTArray itemIDs; Unused << mDoc->SendSelectedItems(mID, &itemIDs); aSelectedItems->SetCapacity(itemIDs.Length()); for (size_t i = 0; i < itemIDs.Length(); ++i) { diff --git a/accessible/ipc/moz.build b/accessible/ipc/moz.build index a3054a4ff9..8223402253 100644 --- a/accessible/ipc/moz.build +++ b/accessible/ipc/moz.build @@ -24,6 +24,7 @@ if CONFIG['ACCESSIBILITY']: LOCAL_INCLUDES += [ '../base', '../generic', + '../xpcom', ] if CONFIG['MOZ_ENABLE_GTK']: diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm index 770df417e0..4426af45b7 100644 --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -420,7 +420,7 @@ ConvertToNSArray(nsTArray& aArray) nsCOMPtr attributes = accWrap->Attributes(); nsAccUtils::GetAccAttr(attributes, nsGkAtoms::linethickness_, thickness); } else { - nsAutoTArray attrs; + AutoTArray attrs; proxy->Attributes(&attrs); for (size_t i = 0 ; i < attrs.Length() ; i++) { if (attrs.ElementAt(i).Name() == "thickness") { @@ -684,11 +684,11 @@ ConvertToNSArray(nsTArray& aArray) // get the array of children. if (accWrap) { - nsAutoTArray childrenArray; + AutoTArray childrenArray; accWrap->GetUnignoredChildren(&childrenArray); mChildren = ConvertToNSArray(childrenArray); } else if (ProxyAccessible* proxy = [self getProxyAccessible]) { - nsAutoTArray childrenArray; + AutoTArray childrenArray; GetProxyUnignoredChildren(proxy, &childrenArray); mChildren = ConvertToNSArray(childrenArray); } diff --git a/accessible/mac/mozTableAccessible.mm b/accessible/mac/mozTableAccessible.mm index 53381cd2ca..a3612e5bc3 100644 --- a/accessible/mac/mozTableAccessible.mm +++ b/accessible/mac/mozTableAccessible.mm @@ -207,12 +207,12 @@ return [NSValue valueWithRange:NSMakeRange(cell->ColIdx(), cell->ColExtent())]; if ([attribute isEqualToString:NSAccessibilityRowHeaderUIElementsAttribute]) { - nsAutoTArray headerCells; + AutoTArray headerCells; cell->RowHeaderCells(&headerCells); return ConvertToNSArray(headerCells); } if ([attribute isEqualToString:NSAccessibilityColumnHeaderUIElementsAttribute]) { - nsAutoTArray headerCells; + AutoTArray headerCells; cell->ColHeaderCells(&headerCells); return ConvertToNSArray(headerCells); } diff --git a/accessible/windows/ia2/ia2Accessible.cpp b/accessible/windows/ia2/ia2Accessible.cpp index f655417800..ec17b47e22 100644 --- a/accessible/windows/ia2/ia2Accessible.cpp +++ b/accessible/windows/ia2/ia2Accessible.cpp @@ -768,7 +768,7 @@ ia2Accessible::get_selectionRanges(IA2Range** aRanges, if (acc->IsDefunct()) return CO_E_OBJNOTCONNECTED; - nsAutoTArray ranges; + AutoTArray ranges; acc->Document()->SelectionRanges(&ranges); uint32_t len = ranges.Length(); for (uint32_t idx = 0; idx < len; idx++) { diff --git a/accessible/windows/ia2/ia2AccessibleTable.cpp b/accessible/windows/ia2/ia2AccessibleTable.cpp index 79ea2ccaeb..6ac6bbab4e 100644 --- a/accessible/windows/ia2/ia2AccessibleTable.cpp +++ b/accessible/windows/ia2/ia2AccessibleTable.cpp @@ -371,7 +371,7 @@ ia2AccessibleTable::get_selectedChildren(long aMaxChildren, long** aChildren, if (!mTable) return CO_E_OBJNOTCONNECTED; - nsAutoTArray cellIndices; + AutoTArray cellIndices; mTable->SelectedCellIndices(&cellIndices); uint32_t maxCells = cellIndices.Length(); @@ -663,7 +663,7 @@ ia2AccessibleTable::get_selectedCells(IUnknown*** aCells, long* aNSelectedCells) if (!mTable) return CO_E_OBJNOTCONNECTED; - nsAutoTArray cells; + AutoTArray cells; mTable->SelectedCells(&cells); if (cells.IsEmpty()) return S_FALSE; @@ -699,7 +699,7 @@ ia2AccessibleTable::get_selectedColumns(long** aColumns, long* aNColumns) if (!mTable) return CO_E_OBJNOTCONNECTED; - nsAutoTArray colIndices; + AutoTArray colIndices; mTable->SelectedColIndices(&colIndices); uint32_t maxCols = colIndices.Length(); @@ -729,7 +729,7 @@ ia2AccessibleTable::get_selectedRows(long** aRows, long* aNRows) if (!mTable) return CO_E_OBJNOTCONNECTED; - nsAutoTArray rowIndices; + AutoTArray rowIndices; mTable->SelectedRowIndices(&rowIndices); uint32_t maxRows = rowIndices.Length(); diff --git a/accessible/windows/ia2/ia2AccessibleTableCell.cpp b/accessible/windows/ia2/ia2AccessibleTableCell.cpp index 20f0f1ecd7..e625a70495 100644 --- a/accessible/windows/ia2/ia2AccessibleTableCell.cpp +++ b/accessible/windows/ia2/ia2AccessibleTableCell.cpp @@ -100,7 +100,7 @@ ia2AccessibleTableCell::get_columnHeaderCells(IUnknown*** aCellAccessibles, if (!mTableCell) return CO_E_OBJNOTCONNECTED; - nsAutoTArray cells; + AutoTArray cells; mTableCell->ColHeaderCells(&cells); *aNColumnHeaderCells = cells.Length(); @@ -172,7 +172,7 @@ ia2AccessibleTableCell::get_rowHeaderCells(IUnknown*** aCellAccessibles, if (!mTableCell) return CO_E_OBJNOTCONNECTED; - nsAutoTArray cells; + AutoTArray cells; mTableCell->RowHeaderCells(&cells); *aNRowHeaderCells = cells.Length(); diff --git a/accessible/windows/ia2/ia2AccessibleText.cpp b/accessible/windows/ia2/ia2AccessibleText.cpp index d8237370cf..7f79b110cc 100644 --- a/accessible/windows/ia2/ia2AccessibleText.cpp +++ b/accessible/windows/ia2/ia2AccessibleText.cpp @@ -61,7 +61,7 @@ ia2AccessibleText::get_attributes(long aOffset, long *aStartOffset, int32_t startOffset = 0, endOffset = 0; HRESULT hr; if (ProxyAccessible* proxy = HyperTextProxyFor(this)) { - nsAutoTArray attrs; + AutoTArray attrs; proxy->TextAttributes(true, aOffset, &attrs, &startOffset, &endOffset); hr = AccessibleWrap::ConvertToIA2Attributes(&attrs, aTextAttributes); } else { diff --git a/accessible/windows/msaa/AccessibleWrap.cpp b/accessible/windows/msaa/AccessibleWrap.cpp index b159e23b29..2f89bd56b8 100644 --- a/accessible/windows/msaa/AccessibleWrap.cpp +++ b/accessible/windows/msaa/AccessibleWrap.cpp @@ -837,7 +837,7 @@ AccessibleWrap::get_accSelection(VARIANT __RPC_FAR *pvarChildren) return E_NOTIMPL; if (IsSelect()) { - nsAutoTArray selectedItems; + AutoTArray selectedItems; if (IsProxy()) { nsTArray proxies; Proxy()->SelectedItems(&proxies); diff --git a/accessible/xpcom/moz.build b/accessible/xpcom/moz.build index 4bcc76998d..d2b38f3cb1 100644 --- a/accessible/xpcom/moz.build +++ b/accessible/xpcom/moz.build @@ -60,3 +60,5 @@ xpc_acc_events_cpp.script = 'AccEventGen.py:gen_cpp_file' xpc_acc_events_cpp.inputs += ['AccEvents.conf'] FINAL_LIBRARY = 'xul' + +include('/ipc/chromium/chromium-config.mozbuild') diff --git a/accessible/xpcom/xpcAccessible.h b/accessible/xpcom/xpcAccessible.h index 124b1add76..865b42b4b5 100644 --- a/accessible/xpcom/xpcAccessible.h +++ b/accessible/xpcom/xpcAccessible.h @@ -15,6 +15,7 @@ namespace mozilla { namespace a11y { class Accessible; +class AccessibleOrProxy; /** * XPCOM nsIAccessible interface implementation, used by xpcAccessibleGeneric @@ -92,6 +93,7 @@ protected: private: Accessible* Intl(); + AccessibleOrProxy IntlGeneric(); xpcAccessible(const xpcAccessible&) = delete; xpcAccessible& operator =(const xpcAccessible&) = delete; diff --git a/accessible/xpcom/xpcAccessibleApplication.h b/accessible/xpcom/xpcAccessibleApplication.h index 0acb239626..24edbcbdbc 100644 --- a/accessible/xpcom/xpcAccessibleApplication.h +++ b/accessible/xpcom/xpcAccessibleApplication.h @@ -36,7 +36,7 @@ protected: virtual ~xpcAccessibleApplication() {} private: - ApplicationAccessible* Intl() { return mIntl->AsApplication(); } + ApplicationAccessible* Intl() { return mIntl.AsAccessible()->AsApplication(); } xpcAccessibleApplication(const xpcAccessibleApplication&) = delete; xpcAccessibleApplication& operator =(const xpcAccessibleApplication&) = delete; diff --git a/accessible/xpcom/xpcAccessibleDocument.cpp b/accessible/xpcom/xpcAccessibleDocument.cpp index de3b7ebcfe..601cf06fd4 100644 --- a/accessible/xpcom/xpcAccessibleDocument.cpp +++ b/accessible/xpcom/xpcAccessibleDocument.cpp @@ -9,9 +9,11 @@ #include "xpcAccessibleTable.h" #include "xpcAccessibleTableCell.h" +#include "mozilla/a11y/DocAccessibleParent.h" #include "DocAccessible-inl.h" #include "nsIDOMDocument.h" +using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// @@ -168,6 +170,7 @@ xpcAccessibleDocument::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) xpcAccessibleGeneric* xpcAccessibleDocument::GetAccessible(Accessible* aAccessible) { + MOZ_ASSERT(!mRemote); if (ToXPCDocument(aAccessible->Document()) != this) { NS_ERROR("This XPCOM document is not related with given internal accessible!"); return nullptr; @@ -195,6 +198,27 @@ xpcAccessibleDocument::GetAccessible(Accessible* aAccessible) return xpcAcc; } +xpcAccessibleGeneric* +xpcAccessibleDocument::GetXPCAccessible(ProxyAccessible* aProxy) +{ + MOZ_ASSERT(mRemote); + MOZ_ASSERT(aProxy->Document() == mIntl.AsProxy()); + if (aProxy->IsDoc()) { + return this; + } + + xpcAccessibleGeneric* acc = mCache.GetWeak(aProxy); + if (acc) { + return acc; + } + + // XXX support exposing optional interfaces. + acc = new xpcAccessibleGeneric(aProxy, 0); + mCache.Put(aProxy, acc); + + return acc; +} + void xpcAccessibleDocument::Shutdown() { @@ -204,3 +228,18 @@ xpcAccessibleDocument::Shutdown() } xpcAccessibleGeneric::Shutdown(); } + +xpcAccessibleGeneric* +a11y::ToXPC(AccessibleOrProxy aAcc) +{ + if (aAcc.IsNull()) { + return nullptr; + } + + if (aAcc.IsAccessible()) { + return ToXPC(aAcc.AsAccessible()); + } + + xpcAccessibleDocument* doc = ToXPCDocument(aAcc.AsProxy()->Document()); + return doc->GetXPCAccessible(aAcc.AsProxy()); +} diff --git a/accessible/xpcom/xpcAccessibleDocument.h b/accessible/xpcom/xpcAccessibleDocument.h index a50d7dcbeb..5d21683e6a 100644 --- a/accessible/xpcom/xpcAccessibleDocument.h +++ b/accessible/xpcom/xpcAccessibleDocument.h @@ -25,7 +25,11 @@ class xpcAccessibleDocument : public xpcAccessibleHyperText, { public: explicit xpcAccessibleDocument(DocAccessible* aIntl) : - xpcAccessibleHyperText(aIntl), mCache(kDefaultCacheLength) { } + xpcAccessibleHyperText(aIntl), mCache(kDefaultCacheLength), mRemote(false) { } + + xpcAccessibleDocument(ProxyAccessible* aProxy, uint32_t aInterfaces) : + xpcAccessibleHyperText(aProxy, aInterfaces), mCache(kDefaultCacheLength), + mRemote(true) {} NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(xpcAccessibleDocument, @@ -51,6 +55,7 @@ public: * Return XPCOM wrapper for the internal accessible. */ xpcAccessibleGeneric* GetAccessible(Accessible* aAccessible); + xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy); virtual void Shutdown() override; @@ -58,10 +63,18 @@ protected: virtual ~xpcAccessibleDocument() {} private: - DocAccessible* Intl() { return mIntl->AsDoc(); } + DocAccessible* Intl() + { + if (Accessible* acc = mIntl.AsAccessible()) { + return acc->AsDoc(); + } + + return nullptr; + } void NotifyOfShutdown(Accessible* aAccessible) { + MOZ_ASSERT(!mRemote); xpcAccessibleGeneric* xpcAcc = mCache.GetWeak(aAccessible); if (xpcAcc) xpcAcc->Shutdown(); @@ -69,13 +82,26 @@ private: mCache.Remove(aAccessible); } + void NotifyOfShutdown(ProxyAccessible* aProxy) + { + MOZ_ASSERT(mRemote); + xpcAccessibleGeneric* acc = mCache.GetWeak(aProxy); + if (acc) { + acc->Shutdown(); + } + + mCache.Remove(aProxy); + } + friend class DocManager; friend class DocAccessible; + friend class ProxyAccessible; xpcAccessibleDocument(const xpcAccessibleDocument&) = delete; xpcAccessibleDocument& operator =(const xpcAccessibleDocument&) = delete; - nsRefPtrHashtable, xpcAccessibleGeneric> mCache; + nsRefPtrHashtable, xpcAccessibleGeneric> mCache; + bool mRemote; }; inline xpcAccessibleGeneric* @@ -92,6 +118,8 @@ ToXPC(Accessible* aAccessible) return xpcDoc ? xpcDoc->GetAccessible(aAccessible) : nullptr; } +xpcAccessibleGeneric* ToXPC(AccessibleOrProxy aAcc); + inline xpcAccessibleHyperText* ToXPCText(HyperTextAccessible* aAccessible) { @@ -109,6 +137,12 @@ ToXPCDocument(DocAccessible* aAccessible) return GetAccService()->GetXPCDocument(aAccessible); } +inline xpcAccessibleDocument* +ToXPCDocument(DocAccessibleParent* aAccessible) +{ + return GetAccService()->GetXPCDocument(aAccessible); +} + } // namespace a11y } // namespace mozilla diff --git a/accessible/xpcom/xpcAccessibleGeneric.cpp b/accessible/xpcom/xpcAccessibleGeneric.cpp index 1a370d9017..5793b8a2ef 100644 --- a/accessible/xpcom/xpcAccessibleGeneric.cpp +++ b/accessible/xpcom/xpcAccessibleGeneric.cpp @@ -33,7 +33,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(xpcAccessibleGeneric) Accessible* xpcAccessibleGeneric::ToInternalAccessible() const { - return mIntl; + return mIntl.AsAccessible(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/xpcom/xpcAccessibleGeneric.h b/accessible/xpcom/xpcAccessibleGeneric.h index 05f408cabc..8f6d987874 100644 --- a/accessible/xpcom/xpcAccessibleGeneric.h +++ b/accessible/xpcom/xpcAccessibleGeneric.h @@ -13,6 +13,7 @@ #include "xpcAccessibleValue.h" #include "Accessible.h" +#include "AccessibleOrProxy.h" namespace mozilla { namespace a11y { @@ -29,14 +30,28 @@ public: explicit xpcAccessibleGeneric(Accessible* aInternal) : mIntl(aInternal), mSupportedIfaces(0) { - if (mIntl->IsSelect()) + if (aInternal->IsSelect()) mSupportedIfaces |= eSelectable; - if (mIntl->HasNumericValue()) + if (aInternal->HasNumericValue()) mSupportedIfaces |= eValue; - if (mIntl->IsLink()) + if (aInternal->IsLink()) mSupportedIfaces |= eHyperLink; } + xpcAccessibleGeneric(ProxyAccessible* aProxy, uint32_t aInterfaces) : + mIntl(aProxy), mSupportedIfaces(0) + { + if (aInterfaces & Interfaces::SELECTION) { + mSupportedIfaces |= eSelectable; + } + if (aInterfaces & Interfaces::VALUE) { + mSupportedIfaces |= eValue; + } + if (aInterfaces & Interfaces::HYPERLINK) { + mSupportedIfaces |= eHyperLink; + } + } + NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(xpcAccessibleGeneric, nsIAccessible) @@ -49,7 +64,7 @@ public: protected: virtual ~xpcAccessibleGeneric() {} - Accessible* mIntl; + AccessibleOrProxy mIntl; enum { eSelectable = 1 << 0, @@ -72,6 +87,12 @@ private: inline Accessible* xpcAccessible::Intl() +{ + return static_cast(this)->mIntl.AsAccessible(); +} + +inline AccessibleOrProxy +xpcAccessible::IntlGeneric() { return static_cast(this)->mIntl; } @@ -79,19 +100,19 @@ xpcAccessible::Intl() inline Accessible* xpcAccessibleHyperLink::Intl() { - return static_cast(this)->mIntl; + return static_cast(this)->mIntl.AsAccessible(); } inline Accessible* xpcAccessibleSelectable::Intl() { - return static_cast(this)->mIntl; + return static_cast(this)->mIntl.AsAccessible(); } inline Accessible* xpcAccessibleValue::Intl() { - return static_cast(this)->mIntl; + return static_cast(this)->mIntl.AsAccessible(); } } // namespace a11y diff --git a/accessible/xpcom/xpcAccessibleHyperText.cpp b/accessible/xpcom/xpcAccessibleHyperText.cpp index 3734ed8518..ade838eca3 100644 --- a/accessible/xpcom/xpcAccessibleHyperText.cpp +++ b/accessible/xpcom/xpcAccessibleHyperText.cpp @@ -371,7 +371,7 @@ xpcAccessibleHyperText::GetSelectionRanges(nsIArray** aRanges) do_CreateInstance(NS_ARRAY_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - nsAutoTArray ranges; + AutoTArray ranges; Intl()->SelectionRanges(&ranges); uint32_t len = ranges.Length(); for (uint32_t idx = 0; idx < len; idx++) diff --git a/accessible/xpcom/xpcAccessibleHyperText.h b/accessible/xpcom/xpcAccessibleHyperText.h index c8293f481f..fbdac95cf8 100644 --- a/accessible/xpcom/xpcAccessibleHyperText.h +++ b/accessible/xpcom/xpcAccessibleHyperText.h @@ -26,10 +26,13 @@ public: explicit xpcAccessibleHyperText(Accessible* aIntl) : xpcAccessibleGeneric(aIntl) { - if (mIntl->IsHyperText() && mIntl->AsHyperText()->IsTextRole()) + if (aIntl->IsHyperText() && aIntl->AsHyperText()->IsTextRole()) mSupportedIfaces |= eText; } + xpcAccessibleHyperText(ProxyAccessible* aProxy, uint32_t aInterfaces) : + xpcAccessibleGeneric(aProxy, aInterfaces) { mSupportedIfaces |= eText; } + NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIACCESSIBLETEXT @@ -40,7 +43,14 @@ protected: virtual ~xpcAccessibleHyperText() {} private: - HyperTextAccessible* Intl() { return mIntl->AsHyperText(); } + HyperTextAccessible* Intl() + { + if (Accessible* acc = mIntl.AsAccessible()) { + return acc->AsHyperText(); + } + + return nullptr; + } xpcAccessibleHyperText(const xpcAccessibleHyperText&) = delete; xpcAccessibleHyperText& operator =(const xpcAccessibleHyperText&) = delete; diff --git a/accessible/xpcom/xpcAccessibleImage.h b/accessible/xpcom/xpcAccessibleImage.h index 1e5bff78e8..1c0bc805fd 100644 --- a/accessible/xpcom/xpcAccessibleImage.h +++ b/accessible/xpcom/xpcAccessibleImage.h @@ -21,6 +21,9 @@ public: explicit xpcAccessibleImage(Accessible* aIntl) : xpcAccessibleGeneric(aIntl) { } + xpcAccessibleImage(ProxyAccessible* aProxy, uint32_t aInterfaces) : + xpcAccessibleGeneric(aProxy, aInterfaces) {} + NS_DECL_ISUPPORTS_INHERITED NS_IMETHOD GetImagePosition(uint32_t aCoordType, @@ -31,7 +34,8 @@ protected: virtual ~xpcAccessibleImage() {} private: - ImageAccessible* Intl() { return mIntl->AsImage(); } + ImageAccessible* Intl() + { return mIntl.IsAccessible() ? mIntl.AsAccessible()->AsImage() : nullptr; } xpcAccessibleImage(const xpcAccessibleImage&) = delete; xpcAccessibleImage& operator =(const xpcAccessibleImage&) = delete; diff --git a/accessible/xpcom/xpcAccessibleSelectable.cpp b/accessible/xpcom/xpcAccessibleSelectable.cpp index 2a09450530..df63e116c8 100644 --- a/accessible/xpcom/xpcAccessibleSelectable.cpp +++ b/accessible/xpcom/xpcAccessibleSelectable.cpp @@ -21,7 +21,7 @@ xpcAccessibleSelectable::GetSelectedItems(nsIArray** aSelectedItems) return NS_ERROR_FAILURE; NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!"); - nsAutoTArray items; + AutoTArray items; Intl()->SelectedItems(&items); uint32_t itemCount = items.Length(); diff --git a/accessible/xpcom/xpcAccessibleTable.cpp b/accessible/xpcom/xpcAccessibleTable.cpp index aa6ee8f764..0787bf73fd 100644 --- a/accessible/xpcom/xpcAccessibleTable.cpp +++ b/accessible/xpcom/xpcAccessibleTable.cpp @@ -273,7 +273,7 @@ xpcAccessibleTable::GetSelectedCells(nsIArray** aSelectedCells) do_CreateInstance(NS_ARRAY_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - nsAutoTArray cellsArray; + AutoTArray cellsArray; Intl()->SelectedCells(&cellsArray); uint32_t totalCount = cellsArray.Length(); @@ -299,7 +299,7 @@ xpcAccessibleTable::GetSelectedCellIndices(uint32_t* aCellsArraySize, if (!Intl()) return NS_ERROR_FAILURE; - nsAutoTArray cellsArray; + AutoTArray cellsArray; Intl()->SelectedCellIndices(&cellsArray); *aCellsArraySize = cellsArray.Length(); @@ -324,7 +324,7 @@ xpcAccessibleTable::GetSelectedColumnIndices(uint32_t* aColsArraySize, if (!Intl()) return NS_ERROR_FAILURE; - nsAutoTArray colsArray; + AutoTArray colsArray; Intl()->SelectedColIndices(&colsArray); *aColsArraySize = colsArray.Length(); @@ -349,7 +349,7 @@ xpcAccessibleTable::GetSelectedRowIndices(uint32_t* aRowsArraySize, if (!Intl()) return NS_ERROR_FAILURE; - nsAutoTArray rowsArray; + AutoTArray rowsArray; Intl()->SelectedRowIndices(&rowsArray); *aRowsArraySize = rowsArray.Length(); diff --git a/accessible/xpcom/xpcAccessibleTable.h b/accessible/xpcom/xpcAccessibleTable.h index 40b611e59f..36dd77e0a4 100644 --- a/accessible/xpcom/xpcAccessibleTable.h +++ b/accessible/xpcom/xpcAccessibleTable.h @@ -23,6 +23,9 @@ public: explicit xpcAccessibleTable(Accessible* aIntl) : xpcAccessibleGeneric(aIntl) { } + xpcAccessibleTable(ProxyAccessible* aProxy, uint32_t aInterfaces) : + xpcAccessibleGeneric(aProxy, aInterfaces) {} + NS_DECL_ISUPPORTS_INHERITED // nsIAccessibleTable @@ -80,7 +83,8 @@ protected: virtual ~xpcAccessibleTable() {} private: - TableAccessible* Intl() { return mIntl->AsTable(); } + TableAccessible* Intl() + { return mIntl.IsAccessible() ? mIntl.AsAccessible()->AsTable() : nullptr; } xpcAccessibleTable(const xpcAccessibleTable&) = delete; xpcAccessibleTable& operator =(const xpcAccessibleTable&) = delete; diff --git a/accessible/xpcom/xpcAccessibleTableCell.cpp b/accessible/xpcom/xpcAccessibleTableCell.cpp index dfd975bbdb..e507a88162 100644 --- a/accessible/xpcom/xpcAccessibleTableCell.cpp +++ b/accessible/xpcom/xpcAccessibleTableCell.cpp @@ -108,7 +108,7 @@ xpcAccessibleTableCell::GetColumnHeaderCells(nsIArray** aHeaderCells) if (!Intl()) return NS_ERROR_FAILURE; - nsAutoTArray headerCells; + AutoTArray headerCells; Intl()->ColHeaderCells(&headerCells); nsCOMPtr cells = do_CreateInstance(NS_ARRAY_CONTRACTID); @@ -132,7 +132,7 @@ xpcAccessibleTableCell::GetRowHeaderCells(nsIArray** aHeaderCells) if (!Intl()) return NS_ERROR_FAILURE; - nsAutoTArray headerCells; + AutoTArray headerCells; Intl()->RowHeaderCells(&headerCells); nsCOMPtr cells = do_CreateInstance(NS_ARRAY_CONTRACTID); diff --git a/accessible/xpcom/xpcAccessibleTableCell.h b/accessible/xpcom/xpcAccessibleTableCell.h index d6f3a14186..9a40f8e1a5 100644 --- a/accessible/xpcom/xpcAccessibleTableCell.h +++ b/accessible/xpcom/xpcAccessibleTableCell.h @@ -24,6 +24,9 @@ public: explicit xpcAccessibleTableCell(Accessible* aIntl) : xpcAccessibleHyperText(aIntl) { } + xpcAccessibleTableCell(ProxyAccessible* aProxy, uint32_t aInterfaces) : + xpcAccessibleHyperText(aProxy, aInterfaces) {} + NS_DECL_ISUPPORTS_INHERITED // nsIAccessibleTableCell @@ -40,7 +43,14 @@ protected: virtual ~xpcAccessibleTableCell() {} private: - TableCellAccessible* Intl() { return mIntl->AsTableCell(); } + TableCellAccessible* Intl() + { + if (Accessible* acc = mIntl.AsAccessible()) { + return acc->AsTableCell(); + } + + return nullptr; +} xpcAccessibleTableCell(const xpcAccessibleTableCell&) = delete; xpcAccessibleTableCell& operator =(const xpcAccessibleTableCell&) = delete; diff --git a/accessible/xul/XULComboboxAccessible.cpp b/accessible/xul/XULComboboxAccessible.cpp index ec818dffc1..1bca6d58e1 100644 --- a/accessible/xul/XULComboboxAccessible.cpp +++ b/accessible/xul/XULComboboxAccessible.cpp @@ -31,6 +31,15 @@ XULComboboxAccessible:: mGenericTypes |= eAutoComplete; else mGenericTypes |= eCombobox; + + // Both the XUL and + // widgets use XULComboboxAccessible. We need to walk the anonymous children + // for these so that the entry field is a child. Otherwise no XBL children. + if (!mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) && + !mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable, + nsGkAtoms::_true, eIgnoreCase)) { + mStateFlags |= eNoXBLKids; + } } role @@ -96,23 +105,6 @@ XULComboboxAccessible::Value(nsString& aValue) menuList->GetLabel(aValue); } -bool -XULComboboxAccessible::CanHaveAnonChildren() -{ - if (mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) || - mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable, - nsGkAtoms::_true, eIgnoreCase)) { - // Both the XUL and widgets - // use XULComboboxAccessible. We need to walk the anonymous children for these - // so that the entry field is a child - return true; - } - - // Argument of false indicates we don't walk anonymous children for - // menuitems - return false; -} - uint8_t XULComboboxAccessible::ActionCount() { diff --git a/accessible/xul/XULComboboxAccessible.h b/accessible/xul/XULComboboxAccessible.h index ae8398a521..679f479b5f 100644 --- a/accessible/xul/XULComboboxAccessible.h +++ b/accessible/xul/XULComboboxAccessible.h @@ -26,7 +26,6 @@ public: virtual void Value(nsString& aValue) override; virtual a11y::role NativeRole() override; virtual uint64_t NativeState() override; - virtual bool CanHaveAnonChildren() override; // ActionAccessible virtual uint8_t ActionCount() override; diff --git a/accessible/xul/XULListboxAccessible.cpp b/accessible/xul/XULListboxAccessible.cpp index 3f37e9e929..52c3ddf0f4 100644 --- a/accessible/xul/XULListboxAccessible.cpp +++ b/accessible/xul/XULListboxAccessible.cpp @@ -544,6 +544,10 @@ XULListitemAccessible:: nsGkAtoms::checkbox, eCaseMatters); mType = eXULListItemType; + + // Walk XBL anonymous children for list items. Overrides the flag value from + // base XULMenuitemAccessible class. + mStateFlags &= ~eNoXBLKids; } XULListitemAccessible::~XULListitemAccessible() @@ -668,13 +672,6 @@ XULListitemAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) } } -bool -XULListitemAccessible::CanHaveAnonChildren() -{ - // That indicates we should walk anonymous children for listitems - return true; -} - //////////////////////////////////////////////////////////////////////////////// // XULListitemAccessible: Widgets diff --git a/accessible/xul/XULListboxAccessible.h b/accessible/xul/XULListboxAccessible.h index e90f88acec..0578380350 100644 --- a/accessible/xul/XULListboxAccessible.h +++ b/accessible/xul/XULListboxAccessible.h @@ -115,7 +115,6 @@ public: virtual a11y::role NativeRole() override; virtual uint64_t NativeState() override; virtual uint64_t NativeInteractiveState() const override; - virtual bool CanHaveAnonChildren() override; // Actions virtual void ActionNameAt(uint8_t index, nsAString& aName) override; diff --git a/accessible/xul/XULMenuAccessible.cpp b/accessible/xul/XULMenuAccessible.cpp index 6c5e4287b7..fde8c970b3 100644 --- a/accessible/xul/XULMenuAccessible.cpp +++ b/accessible/xul/XULMenuAccessible.cpp @@ -41,6 +41,7 @@ XULMenuitemAccessible:: XULMenuitemAccessible(nsIContent* aContent, DocAccessible* aDoc) : AccessibleWrap(aContent, aDoc) { + mStateFlags |= eNoXBLKids; } uint64_t @@ -267,13 +268,6 @@ XULMenuitemAccessible::GetLevelInternal() return nsAccUtils::GetLevelForXULContainerItem(mContent); } -bool -XULMenuitemAccessible::CanHaveAnonChildren() -{ - // That indicates we don't walk anonymous children for menuitems - return false; -} - bool XULMenuitemAccessible::DoAction(uint8_t index) { diff --git a/accessible/xul/XULMenuAccessible.h b/accessible/xul/XULMenuAccessible.h index 3fa66620e7..6280db17dd 100644 --- a/accessible/xul/XULMenuAccessible.h +++ b/accessible/xul/XULMenuAccessible.h @@ -30,8 +30,6 @@ public: virtual uint64_t NativeInteractiveState() const override; virtual int32_t GetLevelInternal() override; - virtual bool CanHaveAnonChildren() override; - // ActionAccessible virtual uint8_t ActionCount() override; virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override; diff --git a/accessible/xul/XULSliderAccessible.cpp b/accessible/xul/XULSliderAccessible.cpp index a2cbfa0d27..476cb17ebf 100644 --- a/accessible/xul/XULSliderAccessible.cpp +++ b/accessible/xul/XULSliderAccessible.cpp @@ -23,7 +23,7 @@ XULSliderAccessible:: XULSliderAccessible(nsIContent* aContent, DocAccessible* aDoc) : AccessibleWrap(aContent, aDoc) { - mStateFlags |= eHasNumericValue; + mStateFlags |= eHasNumericValue | eNoXBLKids; } // Accessible @@ -127,13 +127,6 @@ XULSliderAccessible::SetCurValue(double aValue) return SetSliderAttr(nsGkAtoms::curpos, aValue); } -bool -XULSliderAccessible::CanHaveAnonChildren() -{ - // Do not allow anonymous xul:slider be accessible. - return false; -} - // Utils nsIContent* diff --git a/accessible/xul/XULSliderAccessible.h b/accessible/xul/XULSliderAccessible.h index 264f78c8c9..72c914c267 100644 --- a/accessible/xul/XULSliderAccessible.h +++ b/accessible/xul/XULSliderAccessible.h @@ -26,7 +26,6 @@ public: virtual a11y::role NativeRole() override; virtual uint64_t NativeInteractiveState() const override; virtual bool NativelyUnavailable() const override; - virtual bool CanHaveAnonChildren() override; // Value virtual double MaxValue() const override; diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 8c0df2e537..e87381243e 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1699,7 +1699,7 @@ nsDocShell::FirePageHideNotification(bool aIsUnload) mTiming->NotifyUnloadEventEnd(); } - nsAutoTArray, 8> kids; + AutoTArray, 8> kids; uint32_t n = mChildList.Length(); kids.SetCapacity(n); for (uint32_t i = 0; i < n; i++) { @@ -4377,7 +4377,7 @@ nsDocShell::RemoveFromSessionHistory() int32_t index = 0; sessionHistory->GetIndex(&index); - nsAutoTArray ids; + AutoTArray ids; ids.AppendElement(mHistoryID); internalHistory->RemoveEntries(ids, index); return NS_OK; @@ -4468,7 +4468,7 @@ nsDocShell::ClearFrameHistory(nsISHEntry* aEntry) int32_t count = 0; shcontainer->GetChildCount(&count); - nsAutoTArray ids; + AutoTArray ids; for (int32_t i = 0; i < count; ++i) { nsCOMPtr child; shcontainer->GetChildAt(i, getter_AddRefs(child)); diff --git a/docshell/shistory/src/nsSHistory.cpp b/docshell/shistory/src/nsSHistory.cpp index ea2237b1e5..7017716bfe 100644 --- a/docshell/shistory/src/nsSHistory.cpp +++ b/docshell/shistory/src/nsSHistory.cpp @@ -1404,7 +1404,7 @@ nsSHistory::RemoveDynEntries(int32_t aOldIndex, int32_t aNewIndex) nsCOMPtr originalSH; GetEntryAtIndex(aOldIndex, false, getter_AddRefs(originalSH)); nsCOMPtr originalContainer = do_QueryInterface(originalSH); - nsAutoTArray toBeRemovedEntries; + AutoTArray toBeRemovedEntries; if (originalContainer) { nsTArray originalDynDocShellIDs; GetDynamicChildren(originalContainer, originalDynDocShellIDs, true); diff --git a/dom/animation/EffectCompositor.cpp b/dom/animation/EffectCompositor.cpp index 7eeba27649..9bedf4f81f 100644 --- a/dom/animation/EffectCompositor.cpp +++ b/dom/animation/EffectCompositor.cpp @@ -551,7 +551,7 @@ EffectCompositor::GetOverriddenProperties(nsStyleContext* aStyleContext, nsCSSPropertySet& aPropertiesOverridden) { - nsAutoTArray propertiesToTrack; + AutoTArray propertiesToTrack; { nsCSSPropertySet propertiesToTrackAsSet; for (KeyframeEffectReadOnly* effect : aEffectSet) { diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index f6de95ce43..c760626d19 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -1394,7 +1394,7 @@ BuildAnimationPropertyListFromKeyframeSequence( { // Convert the object in aIterator to sequence, producing // an array of OffsetIndexedKeyframe objects. - nsAutoTArray keyframes; + AutoTArray keyframes; if (!ConvertKeyframeSequence(aCx, aIterator, keyframes)) { aRv.Throw(NS_ERROR_FAILURE); return; diff --git a/dom/base/ChildIterator.cpp b/dom/base/ChildIterator.cpp index 13dd9fc66f..9557d1ed1a 100644 --- a/dom/base/ChildIterator.cpp +++ b/dom/base/ChildIterator.cpp @@ -190,7 +190,7 @@ FlattenedChildIterator::Init(bool aIgnoreXBL) } } -void +bool ExplicitChildIterator::Seek(nsIContent* aChildToFind) { if (aChildToFind->GetParent() == mParent && @@ -204,14 +204,14 @@ ExplicitChildIterator::Seek(nsIContent* aChildToFind) mShadowIterator = nullptr; mDefaultChild = nullptr; mIsFirst = false; - return; + return true; } // Can we add more fast paths here based on whether the parent of aChildToFind // is a shadow insertion point or content insertion point? // Slow path: just walk all our kids. - Seek(aChildToFind, nullptr); + return Seek(aChildToFind, nullptr); } nsIContent* @@ -311,6 +311,37 @@ ExplicitChildIterator::GetPreviousChild() return mChild; } +bool +AllChildrenIterator::Seek(nsIContent* aChildToFind) +{ + if (mPhase == eNeedBeforeKid) { + mPhase = eNeedExplicitKids; + nsIFrame* frame = mOriginalContent->GetPrimaryFrame(); + if (frame) { + nsIFrame* beforeFrame = nsLayoutUtils::GetBeforeFrame(frame); + if (beforeFrame) { + if (beforeFrame->GetContent() == aChildToFind) { + return true; + } + } + } + } + + if (mPhase == eNeedExplicitKids) { + if (ExplicitChildIterator::Seek(aChildToFind)) { + return true; + } + mPhase = eNeedAnonKids; + } + + nsIContent* child = nullptr; + do { + child = GetNextChild(); + } while (child && child != aChildToFind); + + return child == aChildToFind; +} + nsIContent* AllChildrenIterator::GetNextChild() { diff --git a/dom/base/ChildIterator.h b/dom/base/ChildIterator.h index dbe6def3cf..d7c0c4c896 100644 --- a/dom/base/ChildIterator.h +++ b/dom/base/ChildIterator.h @@ -64,7 +64,7 @@ public: // found. This version can take shortcuts that the two-argument version // can't, so can be faster (and in fact can be O(1) instead of O(N) in many // cases). - void Seek(nsIContent* aChildToFind); + bool Seek(nsIContent* aChildToFind); // Looks for aChildToFind respecting insertion points until aChildToFind is found. // or aBound is found. If aBound is nullptr then the seek is unbounded. Returns @@ -199,6 +199,8 @@ public: ~AllChildrenIterator() { MOZ_ASSERT(!mMutationGuard.Mutated(0)); } #endif + bool Seek(nsIContent* aChildToFind); + nsIContent* GetNextChild(); nsIContent* Parent() const { return mOriginalContent; } diff --git a/dom/base/DOMMatrix.cpp b/dom/base/DOMMatrix.cpp index 47210d96fe..f30243befd 100644 --- a/dom/base/DOMMatrix.cpp +++ b/dom/base/DOMMatrix.cpp @@ -267,7 +267,7 @@ template void GetDataFromMatrix(const DOMMatrixReadOnly* aMatrix, T void DOMMatrixReadOnly::ToFloat32Array(JSContext* aCx, JS::MutableHandle aResult, ErrorResult& aRv) const { - nsAutoTArray arr; + AutoTArray arr; arr.SetLength(16); GetDataFromMatrix(this, arr.Elements()); JS::Rooted value(aCx); @@ -281,7 +281,7 @@ DOMMatrixReadOnly::ToFloat32Array(JSContext* aCx, JS::MutableHandle a void DOMMatrixReadOnly::ToFloat64Array(JSContext* aCx, JS::MutableHandle aResult, ErrorResult& aRv) const { - nsAutoTArray arr; + AutoTArray arr; arr.SetLength(16); GetDataFromMatrix(this, arr.Elements()); JS::Rooted value(aCx); diff --git a/dom/base/File.cpp b/dom/base/File.cpp index 7168d4ef27..8bcf816203 100644 --- a/dom/base/File.cpp +++ b/dom/base/File.cpp @@ -259,7 +259,7 @@ Blob::ToFile() already_AddRefed Blob::ToFile(const nsAString& aName, ErrorResult& aRv) const { - nsAutoTArray, 1> blobImpls; + AutoTArray, 1> blobImpls; blobImpls.AppendElement(mImpl); nsAutoString contentType; diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 4b7f4b33fd..81b0bf659d 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -303,7 +303,7 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const // faster for the far more common case of there not being any such // attributes. // Also check for SVG elements which require special handling - nsAutoTArray baseAttrs; + AutoTArray baseAttrs; nsString attr; const nsIContent *elem = this; do { @@ -1323,7 +1323,7 @@ public: } private: - nsAutoTArray, + AutoTArray, SUBTREE_UNBINDINGS_PER_RUNNABLE> mSubtreeRoots; RefPtr mNext; ContentUnbinder* mLast; @@ -1522,11 +1522,11 @@ FragmentOrElement::CanSkipInCC(nsINode* aNode) // nodesToUnpurple contains nodes which will be removed // from the purple buffer if the DOM tree is black. - nsAutoTArray nodesToUnpurple; + AutoTArray nodesToUnpurple; // grayNodes need script traverse, so they aren't removed from // the purple buffer, but are marked to be in black subtree so that // traverse is faster. - nsAutoTArray grayNodes; + AutoTArray grayNodes; bool foundBlack = root->IsBlack(); if (root != currentDoc) { @@ -1592,8 +1592,8 @@ FragmentOrElement::CanSkipInCC(nsINode* aNode) return !NeedsScriptTraverse(aNode); } -nsAutoTArray* gPurpleRoots = nullptr; -nsAutoTArray* gNodesToUnbind = nullptr; +AutoTArray* gPurpleRoots = nullptr; +AutoTArray* gNodesToUnbind = nullptr; void ClearCycleCollectorCleanupData() { @@ -1696,7 +1696,7 @@ FragmentOrElement::CanSkip(nsINode* aNode, bool aRemovingAllowed) // nodesToClear contains nodes which are either purple or // gray. - nsAutoTArray nodesToClear; + AutoTArray nodesToClear; bool foundBlack = root->IsBlack(); bool domOnlyCycle = false; @@ -1745,7 +1745,7 @@ FragmentOrElement::CanSkip(nsINode* aNode, bool aRemovingAllowed) root->SetIsPurpleRoot(true); if (domOnlyCycle) { if (!gNodesToUnbind) { - gNodesToUnbind = new nsAutoTArray(); + gNodesToUnbind = new AutoTArray(); } gNodesToUnbind->AppendElement(static_cast(root)); for (uint32_t i = 0; i < nodesToClear.Length(); ++i) { @@ -1757,7 +1757,7 @@ FragmentOrElement::CanSkip(nsINode* aNode, bool aRemovingAllowed) return true; } else { if (!gPurpleRoots) { - gPurpleRoots = new nsAutoTArray(); + gPurpleRoots = new AutoTArray(); } gPurpleRoots->AppendElement(root); } diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 990023a314..be24af28f0 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -850,7 +850,7 @@ Navigator::RemoveIdleObserver(MozIdleObserver& aIdleObserver, ErrorResult& aRv) bool Navigator::Vibrate(uint32_t aDuration) { - nsAutoTArray pattern; + AutoTArray pattern; pattern.AppendElement(aDuration); return Vibrate(pattern); } diff --git a/dom/base/nsContentIterator.cpp b/dom/base/nsContentIterator.cpp index bf3ba0c622..033011ccc6 100644 --- a/dom/base/nsContentIterator.cpp +++ b/dom/base/nsContentIterator.cpp @@ -155,7 +155,7 @@ protected: nsCOMPtr mCommonParent; // used by nsContentIterator to cache indices - nsAutoTArray mIndexes; + AutoTArray mIndexes; // used by nsSubtreeIterator to cache indices. Why put them in the base // class? Because otherwise I have to duplicate the routines GetNextSibling @@ -1058,8 +1058,8 @@ nsContentIterator::PositionAt(nsINode* aCurNode) // We can be at ANY node in the sequence. Need to regenerate the array of // indexes back to the root or common parent! - nsAutoTArray oldParentStack; - nsAutoTArray newIndexes; + AutoTArray oldParentStack; + AutoTArray newIndexes; // Get a list of the parents up to the root, then compare the new node with // entries in that array until we find a match (lowest common ancestor). If @@ -1213,8 +1213,8 @@ protected: RefPtr mRange; // these arrays all typically are used and have elements - nsAutoTArray mEndNodes; - nsAutoTArray mEndOffsets; + AutoTArray mEndNodes; + AutoTArray mEndOffsets; }; NS_IMPL_ADDREF_INHERITED(nsContentSubtreeIterator, nsContentIterator) diff --git a/dom/base/nsContentList.cpp b/dom/base/nsContentList.cpp index 389b90e4fa..32fcc063cf 100644 --- a/dom/base/nsContentList.cpp +++ b/dom/base/nsContentList.cpp @@ -549,7 +549,7 @@ nsContentList::GetSupportedNames(unsigned aFlags, nsTArray& aNames) BringSelfUpToDate(true); - nsAutoTArray atoms; + AutoTArray atoms; for (uint32_t i = 0; i < mElements.Length(); ++i) { nsIContent *content = mElements.ElementAt(i); if (content->HasID()) { diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 2775b159d8..748070536d 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -2304,7 +2304,7 @@ nsContentUtils::GetCommonAncestor(nsINode* aNode1, } // Build the chain of parents - nsAutoTArray parents1, parents2; + AutoTArray parents1, parents2; do { parents1.AppendElement(aNode1); aNode1 = aNode1->GetParentNode(); @@ -2353,7 +2353,7 @@ nsContentUtils::ComparePoints(nsINode* aParent1, int32_t aOffset1, 0; } - nsAutoTArray parents1, parents2; + AutoTArray parents1, parents2; nsINode* node1 = aParent1; nsINode* node2 = aParent2; do { @@ -4288,7 +4288,7 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode, return frag.forget(); } - nsAutoTArray tagStack; + AutoTArray tagStack; nsAutoString uriStr, nameStr; nsCOMPtr content = do_QueryInterface(aContextNode); // just in case we have a text node @@ -6863,7 +6863,7 @@ nsContentUtils::FireMutationEventsForDirectParsing(nsIDocument* aDoc, int32_t newChildCount = aDest->GetChildCount(); if (newChildCount && nsContentUtils:: HasMutationListeners(aDoc, NS_EVENT_BITS_MUTATION_NODEINSERTED)) { - nsAutoTArray, 50> childNodes; + AutoTArray, 50> childNodes; NS_ASSERTION(newChildCount - aOldChildCount >= 0, "What, some unexpected dom mutation has happened?"); childNodes.SetCapacity(newChildCount - aOldChildCount); @@ -7935,7 +7935,7 @@ nsContentUtils::FirePageHideEvent(nsIDocShellTreeItem* aItem, int32_t childCount = 0; aItem->GetChildCount(&childCount); - nsAutoTArray, 8> kids; + AutoTArray, 8> kids; kids.AppendElements(childCount); for (int32_t i = 0; i < childCount; ++i) { aItem->GetChildAt(i, getter_AddRefs(kids[i])); @@ -7960,7 +7960,7 @@ nsContentUtils::FirePageShowEvent(nsIDocShellTreeItem* aItem, { int32_t childCount = 0; aItem->GetChildCount(&childCount); - nsAutoTArray, 8> kids; + AutoTArray, 8> kids; kids.AppendElements(childCount); for (int32_t i = 0; i < childCount; ++i) { aItem->GetChildAt(i, getter_AddRefs(kids[i])); @@ -8570,7 +8570,7 @@ private: } } - nsAutoTArray mUnits; + AutoTArray mUnits; nsAutoPtr mNext; StringBuilder* mLast; // mLength is used only in the first StringBuilder object in the linked list. diff --git a/dom/base/nsDOMMutationObserver.cpp b/dom/base/nsDOMMutationObserver.cpp index 424128d6d6..c1f94017fa 100644 --- a/dom/base/nsDOMMutationObserver.cpp +++ b/dom/base/nsDOMMutationObserver.cpp @@ -22,7 +22,7 @@ using mozilla::dom::TreeOrderComparator; using mozilla::dom::Animation; -nsAutoTArray, 4>* +AutoTArray, 4>* nsDOMMutationObserver::sScheduledMutationObservers = nullptr; nsDOMMutationObserver* nsDOMMutationObserver::sCurrentObserver = nullptr; @@ -30,7 +30,7 @@ nsDOMMutationObserver* nsDOMMutationObserver::sCurrentObserver = nullptr; uint32_t nsDOMMutationObserver::sMutationLevel = 0; uint64_t nsDOMMutationObserver::sCount = 0; -nsAutoTArray, 4>, 4>* +AutoTArray, 4>, 4>* nsDOMMutationObserver::sCurrentlyHandlingObservers = nullptr; nsINodeList* @@ -585,7 +585,7 @@ void nsDOMMutationObserver::RescheduleForRun() { if (!sScheduledMutationObservers) { - sScheduledMutationObservers = new nsAutoTArray, 4>; + sScheduledMutationObservers = new AutoTArray, 4>; } bool didInsert = false; @@ -882,7 +882,7 @@ nsDOMMutationObserver::HandleMutationsInternal() nsTArray >* suppressedObservers = nullptr; while (sScheduledMutationObservers) { - nsAutoTArray, 4>* observers = + AutoTArray, 4>* observers = sScheduledMutationObservers; sScheduledMutationObservers = nullptr; for (uint32_t i = 0; i < observers->Length(); ++i) { @@ -995,7 +995,7 @@ nsDOMMutationObserver::AddCurrentlyHandlingObserver(nsDOMMutationObserver* aObse if (!sCurrentlyHandlingObservers) { sCurrentlyHandlingObservers = - new nsAutoTArray, 4>, 4>; + new AutoTArray, 4>, 4>; } while (sCurrentlyHandlingObservers->Length() < aMutationLevel) { diff --git a/dom/base/nsDOMMutationObserver.h b/dom/base/nsDOMMutationObserver.h index b2eaebbe00..026a667f57 100644 --- a/dom/base/nsDOMMutationObserver.h +++ b/dom/base/nsDOMMutationObserver.h @@ -604,7 +604,7 @@ protected: nsClassHashtable > mTransientReceivers; // MutationRecords which are being constructed. - nsAutoTArray mCurrentMutations; + AutoTArray mCurrentMutations; // MutationRecords which will be handed to the callback at the end of // the microtask. RefPtr mFirstPendingMutation; @@ -620,11 +620,11 @@ protected: uint64_t mId; static uint64_t sCount; - static nsAutoTArray, 4>* sScheduledMutationObservers; + static AutoTArray, 4>* sScheduledMutationObservers; static nsDOMMutationObserver* sCurrentObserver; static uint32_t sMutationLevel; - static nsAutoTArray, 4>, 4>* + static AutoTArray, 4>, 4>* sCurrentlyHandlingObservers; }; @@ -739,7 +739,7 @@ private: static nsAutoMutationBatch* sCurrentBatch; nsAutoMutationBatch* mPreviousBatch; - nsAutoTArray mObservers; + AutoTArray mObservers; nsTArray > mRemovedNodes; nsTArray > mAddedNodes; nsINode* mBatchTarget; @@ -906,7 +906,7 @@ private: }; static nsAutoAnimationMutationBatch* sCurrentBatch; - nsAutoTArray mObservers; + AutoTArray mObservers; typedef nsTArray EntryArray; nsClassHashtable, EntryArray> mEntryTable; // List of nodes referred to by mEntryTable so we can sort them diff --git a/dom/base/nsDOMTokenList.cpp b/dom/base/nsDOMTokenList.cpp index 682be1ddb9..855b8e9c0e 100644 --- a/dom/base/nsDOMTokenList.cpp +++ b/dom/base/nsDOMTokenList.cpp @@ -134,7 +134,7 @@ nsDOMTokenList::AddInternal(const nsAttrValue* aAttr, } bool oneWasAdded = false; - nsAutoTArray addedClasses; + AutoTArray addedClasses; for (uint32_t i = 0, l = aTokens.Length(); i < l; ++i) { const nsString& aToken = aTokens[i]; @@ -175,7 +175,7 @@ nsDOMTokenList::Add(const nsTArray& aTokens, ErrorResult& aError) void nsDOMTokenList::Add(const nsAString& aToken, mozilla::ErrorResult& aError) { - nsAutoTArray tokens; + AutoTArray tokens; tokens.AppendElement(aToken); Add(tokens, aError); } @@ -261,7 +261,7 @@ nsDOMTokenList::Remove(const nsTArray& aTokens, ErrorResult& aError) void nsDOMTokenList::Remove(const nsAString& aToken, mozilla::ErrorResult& aError) { - nsAutoTArray tokens; + AutoTArray tokens; tokens.AppendElement(aToken); Remove(tokens, aError); } @@ -281,7 +281,7 @@ nsDOMTokenList::Toggle(const nsAString& aToken, const bool forceOff = aForce.WasPassed() && !aForce.Value(); bool isPresent = attr && attr->Contains(aToken); - nsAutoTArray tokens; + AutoTArray tokens; (*tokens.AppendElement()).Rebind(aToken.Data(), aToken.Length()); if (isPresent) { diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 708f8bf03b..f6f7bd70ad 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -3338,7 +3338,7 @@ nsDocument::ElementFromPointHelper(float aX, float aY, bool aIgnoreRootScrollFrame, bool aFlushLayout) { - nsAutoTArray, 1> elementArray; + AutoTArray, 1> elementArray; ElementsFromPointHelper(aX, aY, ((aIgnoreRootScrollFrame ? nsIDocument::IGNORE_ROOT_SCROLL_FRAME : 0) | (aFlushLayout ? nsIDocument::FLUSH_LAYOUT : 0) | @@ -3460,7 +3460,7 @@ nsDocument::NodesFromRectHelper(float aX, float aY, if (!rootFrame) return NS_OK; // return nothing to premature XUL callers as a reminder to wait - nsAutoTArray outFrames; + AutoTArray outFrames; nsLayoutUtils::GetFramesForArea(rootFrame, rect, outFrames, nsLayoutUtils::IGNORE_PAINT_SUPPRESSION | nsLayoutUtils::IGNORE_CROSS_DOC | (aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0)); @@ -11217,7 +11217,7 @@ ExitFullscreenInDocTree(nsIDocument* aMaybeNotARootDoc) // order when exiting fullscreen, but we traverse the doctree in a // root-to-leaf order, so we save references to the documents we must // dispatch to so that we dispatch in the specified order. - nsAutoTArray changed; + AutoTArray changed; // Walk the tree of fullscreen documents, and reset their fullscreen state. ResetFullScreen(root, static_cast(&changed)); @@ -11788,7 +11788,7 @@ nsDocument::RequestFullScreen(Element* aElement, // order, but we traverse the doctree in a leaf-to-root order, so we save // references to the documents we must dispatch to so that we get the order // as specified. - nsAutoTArray changed; + AutoTArray changed; // Remember the root document, so that if a full-screen document is hidden // we can reset full-screen state in the remaining visible full-screen documents. diff --git a/dom/base/nsDocumentEncoder.cpp b/dom/base/nsDocumentEncoder.cpp index afa9b9137a..e2c795353c 100644 --- a/dom/base/nsDocumentEncoder.cpp +++ b/dom/base/nsDocumentEncoder.cpp @@ -162,11 +162,11 @@ protected: uint32_t mEndDepth; int32_t mStartRootIndex; int32_t mEndRootIndex; - nsAutoTArray mCommonAncestors; - nsAutoTArray mStartNodes; - nsAutoTArray mStartOffsets; - nsAutoTArray mEndNodes; - nsAutoTArray mEndOffsets; + AutoTArray mCommonAncestors; + AutoTArray mStartNodes; + AutoTArray mStartOffsets; + AutoTArray mEndNodes; + AutoTArray mEndOffsets; bool mHaltRangeHint; // Used when context has already been serialized for // table cell selections (where parent is ) diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 0484c0fcbc..a483aa6b6b 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -1385,7 +1385,7 @@ nsFocusManager::GetCommonAncestor(nsPIDOMWindow* aWindow1, nsCOMPtr dsti2 = aWindow2->GetDocShell(); NS_ENSURE_TRUE(dsti2, nullptr); - nsAutoTArray parents1, parents2; + AutoTArray parents1, parents2; do { parents1.AppendElement(dsti1); nsCOMPtr parentDsti1; diff --git a/dom/base/nsFrameMessageManager.h b/dom/base/nsFrameMessageManager.h index b0215ef32c..9f38e293bd 100644 --- a/dom/base/nsFrameMessageManager.h +++ b/dom/base/nsFrameMessageManager.h @@ -399,7 +399,7 @@ protected: bool InitChildGlobalInternal(nsISupports* aScope, const nsACString& aID); nsCOMPtr mGlobal; nsCOMPtr mPrincipal; - nsAutoTArray, 2> mAnonymousGlobalScopes; + AutoTArray, 2> mAnonymousGlobalScopes; static nsDataHashtable* sCachedScripts; static nsScriptCacheCleaner* sScriptCacheCleaner; diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index db824a1ee7..de6ef5b5fc 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -1855,7 +1855,7 @@ public: return mObservers; } protected: - nsAutoTArray< nsCOMPtr, 8 > mObservers; + AutoTArray< nsCOMPtr, 8 > mObservers; }; /** diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index 66130e58e6..790c2173e0 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -595,7 +595,7 @@ void nsINode::Normalize() { // First collect list of nodes to be removed - nsAutoTArray, 50> nodes; + AutoTArray, 50> nodes; bool canMerge = false; for (nsIContent* node = this->GetFirstChild(); @@ -864,7 +864,7 @@ nsINode::CompareDocumentPosition(nsINode& aOtherNode) const return static_cast(nsIDOMNode::DOCUMENT_POSITION_FOLLOWING); } - nsAutoTArray parents1, parents2; + AutoTArray parents1, parents2; const nsINode *node1 = &aOtherNode, *node2 = this; @@ -2156,7 +2156,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild, nodeToInsertBefore = nodeToInsertBefore->GetNextSibling(); } - Maybe, 50> > fragChildren; + Maybe, 50> > fragChildren; // Remove the new child from the old parent if one exists nsCOMPtr oldParent = newContent->GetParentNode(); @@ -2864,7 +2864,7 @@ nsINode::QuerySelectorAll(const nsAString& aSelector, ErrorResult& aResult) nsCSSSelectorList* selectorList = ParseSelectorList(aSelector, aResult); if (selectorList) { - FindMatchingElements>(this, + FindMatchingElements>(this, selectorList, *contentList, aResult); diff --git a/dom/base/nsImageLoadingContent.cpp b/dom/base/nsImageLoadingContent.cpp index 64da78f517..24d0d782d1 100644 --- a/dom/base/nsImageLoadingContent.cpp +++ b/dom/base/nsImageLoadingContent.cpp @@ -150,7 +150,7 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest, { // Calling Notify on observers can modify the list of observers so make // a local copy. - nsAutoTArray, 2> observers; + AutoTArray, 2> observers; for (ImageObserver* observer = &mObserverList, *next; observer; observer = next) { diff --git a/dom/base/nsLineBreaker.cpp b/dom/base/nsLineBreaker.cpp index b0e71275fa..89d5e6a59f 100644 --- a/dom/base/nsLineBreaker.cpp +++ b/dom/base/nsLineBreaker.cpp @@ -59,7 +59,7 @@ nsresult nsLineBreaker::FlushCurrentWord() { uint32_t length = mCurrentWord.Length(); - nsAutoTArray breakState; + AutoTArray breakState; if (!breakState.AppendElements(length)) return NS_ERROR_OUT_OF_MEMORY; @@ -187,7 +187,7 @@ nsLineBreaker::AppendText(nsIAtom* aHyphenationLanguage, const char16_t* aText, return rv; } - nsAutoTArray breakState; + AutoTArray breakState; if (aSink) { if (!breakState.AppendElements(aLength)) return NS_ERROR_OUT_OF_MEMORY; @@ -313,7 +313,7 @@ nsLineBreaker::FindHyphenationPoints(nsHyphenator *aHyphenator, uint8_t *aBreakState) { nsDependentSubstring string(aTextStart, aTextLimit); - AutoFallibleTArray hyphens; + AutoTArray hyphens; if (NS_SUCCEEDED(aHyphenator->Hyphenate(string, hyphens))) { for (uint32_t i = 0; i + 1 < string.Length(); ++i) { if (hyphens[i]) { @@ -368,7 +368,7 @@ nsLineBreaker::AppendText(nsIAtom* aHyphenationLanguage, const uint8_t* aText, u return rv; } - nsAutoTArray breakState; + AutoTArray breakState; if (aSink) { if (!breakState.AppendElements(aLength)) return NS_ERROR_OUT_OF_MEMORY; diff --git a/dom/base/nsLineBreaker.h b/dom/base/nsLineBreaker.h index 012faa62dd..81c4c334e9 100644 --- a/dom/base/nsLineBreaker.h +++ b/dom/base/nsLineBreaker.h @@ -206,9 +206,9 @@ private: const char16_t *aTextLimit, uint8_t *aBreakState); - nsAutoTArray mCurrentWord; + AutoTArray mCurrentWord; // All the items that contribute to mCurrentWord - nsAutoTArray mTextItems; + AutoTArray mTextItems; nsIAtom* mCurrentWordLanguage; bool mCurrentWordContainsMixedLang; bool mCurrentWordContainsComplexChar; diff --git a/dom/base/nsPerformance.cpp b/dom/base/nsPerformance.cpp index ecdbb22fec..d74fbdaf6a 100644 --- a/dom/base/nsPerformance.cpp +++ b/dom/base/nsPerformance.cpp @@ -997,7 +997,7 @@ DOMHighResTimeStamp PerformanceBase::ResolveTimestampFromName(const nsAString& aName, ErrorResult& aRv) { - nsAutoTArray, 1> arr; + AutoTArray, 1> arr; DOMHighResTimeStamp ts; Optional typeParam; nsAutoString str; diff --git a/dom/base/nsPlainTextSerializer.h b/dom/base/nsPlainTextSerializer.h index 9c941eefda..a11adc1aa1 100644 --- a/dom/base/nsPlainTextSerializer.h +++ b/dom/base/nsPlainTextSerializer.h @@ -195,10 +195,10 @@ private: RefPtr mElement; // For handling table rows - nsAutoTArray mHasWrittenCellsForRow; + AutoTArray mHasWrittenCellsForRow; // Values gotten in OpenContainer that is (also) needed in CloseContainer - nsAutoTArray mIsInCiteBlockquote; + AutoTArray mIsInCiteBlockquote; // The output data nsAString* mOutputString; diff --git a/dom/base/nsXHTMLContentSerializer.h b/dom/base/nsXHTMLContentSerializer.h index 32f387f26c..0108ca7d99 100644 --- a/dom/base/nsXHTMLContentSerializer.h +++ b/dom/base/nsXHTMLContentSerializer.h @@ -158,7 +158,7 @@ protected: }; // Stack to store one olState struct per
    . - nsAutoTArray mOLStateStack; + AutoTArray mOLStateStack; bool HasNoChildren(nsIContent* aContent); }; diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 0a04b1a377..b8f2341dcc 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -2075,10 +2075,10 @@ void DoTraceSequence(JSTracer* trc, InfallibleTArray& seq); namespace binding_detail { template -class AutoSequence : public AutoFallibleTArray +class AutoSequence : public AutoTArray { public: - AutoSequence() : AutoFallibleTArray() + AutoSequence() : AutoTArray() {} // Allow converting to const sequences as needed diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 0fb885253a..e44cca73b5 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -4467,8 +4467,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, # reallocation behavior for arrays. In particular, if we use auto # arrays for sequences and have a sequence of elements which are # themselves sequences or have sequences as members, we have a problem. - # In that case, resizing the outermost nsAutoTarray to the right size - # will memmove its elements, but nsAutoTArrays are not memmovable and + # In that case, resizing the outermost AutoTArray to the right size + # will memmove its elements, but AutoTArrays are not memmovable and # hence will end up with pointers to bogus memory, which is bad. To # deal with this, we typically map WebIDL sequences to our Sequence # type, which is in fact memmovable. The one exception is when we're @@ -8404,7 +8404,7 @@ class CGEnumerateHook(CGAbstractBindingMethod): def generate_code(self): return CGGeneric(dedent(""" - nsAutoTArray names; + AutoTArray names; ErrorResult rv; self->GetOwnPropertyNames(cx, names, rv); if (rv.MaybeSetPendingException(cx)) { @@ -10471,7 +10471,7 @@ class CGEnumerateOwnPropertiesViaGetOwnPropertyNames(CGAbstractBindingMethod): def generate_code(self): return CGGeneric(dedent(""" - nsAutoTArray names; + AutoTArray names; ErrorResult rv; self->GetOwnPropertyNames(cx, names, rv); if (rv.MaybeSetPendingException(cx)) { diff --git a/dom/bluetooth/common/BluetoothService.cpp b/dom/bluetooth/common/BluetoothService.cpp index 76c1a945fa..7f4f39736a 100644 --- a/dom/bluetooth/common/BluetoothService.cpp +++ b/dom/bluetooth/common/BluetoothService.cpp @@ -94,7 +94,7 @@ GetAllBluetoothActors(InfallibleTArray& aActors) MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aActors.IsEmpty()); - nsAutoTArray contentActors; + AutoTArray contentActors; ContentParent::GetAll(contentActors); for (uint32_t contentIndex = 0; @@ -102,7 +102,7 @@ GetAllBluetoothActors(InfallibleTArray& aActors) contentIndex++) { MOZ_ASSERT(contentActors[contentIndex]); - AutoInfallibleTArray bluetoothActors; + AutoTArray bluetoothActors; contentActors[contentIndex]->ManagedPBluetoothParent(bluetoothActors); for (uint32_t bluetoothIndex = 0; @@ -487,7 +487,7 @@ BluetoothService::SetEnabled(bool aEnabled) { MOZ_ASSERT(NS_IsMainThread()); - AutoInfallibleTArray childActors; + AutoTArray childActors; GetAllBluetoothActors(childActors); for (uint32_t index = 0; index < childActors.Length(); index++) { @@ -571,7 +571,7 @@ BluetoothService::HandleShutdown() Cleanup(); - AutoInfallibleTArray childActors; + AutoTArray childActors; GetAllBluetoothActors(childActors); if (!childActors.IsEmpty()) { diff --git a/dom/cache/AutoUtils.cpp b/dom/cache/AutoUtils.cpp index 1f9c8a52c7..527cb528a7 100644 --- a/dom/cache/AutoUtils.cpp +++ b/dom/cache/AutoUtils.cpp @@ -47,7 +47,7 @@ CleanupChildFds(CacheReadStream& aReadStream, CleanupAction aAction) return; } - nsAutoTArray fds; + AutoTArray fds; FileDescriptorSetChild* fdSetActor = static_cast(aReadStream.fds().get_PFileDescriptorSetChild()); @@ -107,7 +107,7 @@ CleanupParentFds(CacheReadStream& aReadStream, CleanupAction aAction) return; } - nsAutoTArray fds; + AutoTArray fds; FileDescriptorSetParent* fdSetActor = static_cast(aReadStream.fds().get_PFileDescriptorSetParent()); @@ -306,7 +306,7 @@ MatchInPutList(InternalRequest* aRequest, RefPtr cachedResponseHeaders = TypeUtils::ToInternalHeaders(cachedResponse.headers()); - nsAutoTArray varyHeaders; + AutoTArray varyHeaders; ErrorResult rv; cachedResponseHeaders->GetAll(NS_LITERAL_CSTRING("vary"), varyHeaders, rv); MOZ_ALWAYS_TRUE(!rv.Failed()); diff --git a/dom/cache/Cache.cpp b/dom/cache/Cache.cpp index 9d13104213..3134f410ee 100644 --- a/dom/cache/Cache.cpp +++ b/dom/cache/Cache.cpp @@ -114,7 +114,7 @@ public: // an Array of Response objects. The following code unwraps these // JS values back to an nsTArray>. - nsAutoTArray, 256> responseList; + AutoTArray, 256> responseList; responseList.SetCapacity(mRequestList.Length()); bool isArray; @@ -555,7 +555,7 @@ Cache::AddAll(const GlobalObject& aGlobal, return promise.forget(); } - nsAutoTArray, 256> fetchList; + AutoTArray, 256> fetchList; fetchList.SetCapacity(aRequestList.Length()); // Begin fetching each request in parallel. For now, if an error occurs just diff --git a/dom/cache/CacheOpChild.cpp b/dom/cache/CacheOpChild.cpp index fdc942abe3..c65a7fe1c6 100644 --- a/dom/cache/CacheOpChild.cpp +++ b/dom/cache/CacheOpChild.cpp @@ -219,7 +219,7 @@ CacheOpChild::HandleResponse(const CacheResponseOrVoid& aResponseOrVoid) void CacheOpChild::HandleResponseList(const nsTArray& aResponseList) { - nsAutoTArray, 256> responses; + AutoTArray, 256> responses; responses.SetCapacity(aResponseList.Length()); for (uint32_t i = 0; i < aResponseList.Length(); ++i) { @@ -233,7 +233,7 @@ CacheOpChild::HandleResponseList(const nsTArray& aResponseList) void CacheOpChild::HandleRequestList(const nsTArray& aRequestList) { - nsAutoTArray, 256> requests; + AutoTArray, 256> requests; requests.SetCapacity(aRequestList.Length()); for (uint32_t i = 0; i < aRequestList.Length(); ++i) { diff --git a/dom/cache/CacheOpParent.cpp b/dom/cache/CacheOpParent.cpp index 1077d4e8ab..b67fbaa774 100644 --- a/dom/cache/CacheOpParent.cpp +++ b/dom/cache/CacheOpParent.cpp @@ -79,8 +79,8 @@ CacheOpParent::Execute(Manager* aManager) const CachePutAllArgs& args = mOpArgs.get_CachePutAllArgs(); const nsTArray& list = args.requestResponseList(); - nsAutoTArray, 256> requestStreamList; - nsAutoTArray, 256> responseStreamList; + AutoTArray, 256> requestStreamList; + AutoTArray, 256> responseStreamList; for (uint32_t i = 0; i < list.Length(); ++i) { requestStreamList.AppendElement( @@ -221,7 +221,7 @@ CacheOpParent::DeserializeCacheStream(const CacheReadStreamOrVoid& aStreamOrVoid } // Option 3: A stream was serialized using normal methods. - nsAutoTArray fds; + AutoTArray fds; if (readStream.fds().type() == OptionalFileDescriptorSet::TPFileDescriptorSetChild) { diff --git a/dom/cache/DBSchema.cpp b/dom/cache/DBSchema.cpp index c00a26af5f..22a1e1ac07 100644 --- a/dom/cache/DBSchema.cpp +++ b/dom/cache/DBSchema.cpp @@ -588,11 +588,11 @@ DeleteCacheId(mozIStorageConnection* aConn, CacheId aCacheId, // Delete the bodies explicitly as we need to read out the body IDs // anyway. These body IDs must be deleted one-by-one as content may // still be referencing them invidivually. - nsAutoTArray matches; + AutoTArray matches; nsresult rv = QueryAll(aConn, aCacheId, matches); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } - nsAutoTArray deletedSecurityIdList; + AutoTArray deletedSecurityIdList; rv = DeleteEntries(aConn, matches, aDeletedBodyIdListOut, deletedSecurityIdList); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -720,7 +720,7 @@ CacheMatch(mozIStorageConnection* aConn, CacheId aCacheId, *aFoundResponseOut = false; - nsAutoTArray matches; + AutoTArray matches; nsresult rv = QueryCache(aConn, aCacheId, aRequest, aParams, matches, 1); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -747,7 +747,7 @@ CacheMatchAll(mozIStorageConnection* aConn, CacheId aCacheId, MOZ_ASSERT(aConn); nsresult rv; - nsAutoTArray matches; + AutoTArray matches; if (aRequestOrVoid.type() == CacheRequestOrVoid::Tvoid_t) { rv = QueryAll(aConn, aCacheId, matches); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -781,11 +781,11 @@ CachePut(mozIStorageConnection* aConn, CacheId aCacheId, CacheQueryParams params(false, false, false, false, NS_LITERAL_STRING("")); - nsAutoTArray matches; + AutoTArray matches; nsresult rv = QueryCache(aConn, aCacheId, aRequest, params, matches); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } - nsAutoTArray deletedSecurityIdList; + AutoTArray deletedSecurityIdList; rv = DeleteEntries(aConn, matches, aDeletedBodyIdListOut, deletedSecurityIdList); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -814,7 +814,7 @@ CacheDelete(mozIStorageConnection* aConn, CacheId aCacheId, *aSuccessOut = false; - nsAutoTArray matches; + AutoTArray matches; nsresult rv = QueryCache(aConn, aCacheId, aRequest, aParams, matches); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -822,7 +822,7 @@ CacheDelete(mozIStorageConnection* aConn, CacheId aCacheId, return rv; } - nsAutoTArray deletedSecurityIdList; + AutoTArray deletedSecurityIdList; rv = DeleteEntries(aConn, matches, aDeletedBodyIdListOut, deletedSecurityIdList); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -845,7 +845,7 @@ CacheKeys(mozIStorageConnection* aConn, CacheId aCacheId, MOZ_ASSERT(aConn); nsresult rv; - nsAutoTArray matches; + AutoTArray matches; if (aRequestOrVoid.type() == CacheRequestOrVoid::Tvoid_t) { rv = QueryAll(aConn, aCacheId, matches); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -912,7 +912,7 @@ StorageMatch(mozIStorageConnection* aConn, rv = state->BindInt32ByName(NS_LITERAL_CSTRING("namespace"), aNamespace); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } - nsAutoTArray cacheIdList; + AutoTArray cacheIdList; bool hasMoreData = false; while (NS_SUCCEEDED(state->ExecuteStep(&hasMoreData)) && hasMoreData) { @@ -1218,7 +1218,7 @@ MatchByVaryHeader(mozIStorageConnection* aConn, rv = state->BindInt32ByName(NS_LITERAL_CSTRING("entry_id"), entryId); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } - nsAutoTArray varyValues; + AutoTArray varyValues; bool hasMoreData = false; while (NS_SUCCEEDED(state->ExecuteStep(&hasMoreData)) && hasMoreData) { diff --git a/dom/cache/Manager.cpp b/dom/cache/Manager.cpp index 891455b8a1..1f3082f0a8 100644 --- a/dom/cache/Manager.cpp +++ b/dom/cache/Manager.cpp @@ -74,12 +74,12 @@ public: mozIStorageConnection::TRANSACTION_IMMEDIATE); // Clean up orphaned Cache objects - nsAutoTArray orphanedCacheIdList; + AutoTArray orphanedCacheIdList; nsresult rv = db::FindOrphanedCacheIds(aConn, orphanedCacheIdList); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } for (uint32_t i = 0; i < orphanedCacheIdList.Length(); ++i) { - nsAutoTArray deletedBodyIdList; + AutoTArray deletedBodyIdList; rv = db::DeleteCacheId(aConn, orphanedCacheIdList[i], deletedBodyIdList); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } @@ -88,7 +88,7 @@ public: } // Clean up orphaned body objects - nsAutoTArray knownBodyIdList; + AutoTArray knownBodyIdList; rv = db::GetKnownBodyIds(aConn, knownBodyIdList); rv = BodyDeleteOrphanedFiles(aDBDir, knownBodyIdList); @@ -1489,7 +1489,7 @@ Manager::Listener::OnOpComplete(ErrorResult&& aRv, const CacheOpResult& aResult, const SavedResponse& aSavedResponse, StreamList* aStreamList) { - nsAutoTArray responseList; + AutoTArray responseList; responseList.AppendElement(aSavedResponse); OnOpComplete(Move(aRv), aResult, INVALID_CACHE_ID, responseList, nsTArray(), aStreamList); @@ -2018,7 +2018,7 @@ Manager::NoteOrphanedBodyIdList(const nsTArray& aDeletedBodyIdList) { NS_ASSERT_OWNINGTHREAD(Manager); - nsAutoTArray deleteNowList; + AutoTArray deleteNowList; deleteNowList.SetCapacity(aDeletedBodyIdList.Length()); for (uint32_t i = 0; i < aDeletedBodyIdList.Length(); ++i) { diff --git a/dom/cache/ReadStream.cpp b/dom/cache/ReadStream.cpp index d4a74c0084..7cdd3d3a76 100644 --- a/dom/cache/ReadStream.cpp +++ b/dom/cache/ReadStream.cpp @@ -222,7 +222,7 @@ ReadStream::Inner::Serialize(CacheReadStream* aReadStreamOut) aReadStreamOut->id() = mId; mControl->SerializeControl(aReadStreamOut); - nsAutoTArray fds; + AutoTArray fds; SerializeInputStream(mStream, aReadStreamOut->params(), fds); mControl->SerializeFds(aReadStreamOut, fds); @@ -451,7 +451,7 @@ ReadStream::Create(const CacheReadStream& aReadStream) } MOZ_ASSERT(control); - nsAutoTArray fds; + AutoTArray fds; control->DeserializeFds(aReadStream, fds); nsCOMPtr stream = diff --git a/dom/cache/TypeUtils.cpp b/dom/cache/TypeUtils.cpp index ad373b2673..dce6909509 100644 --- a/dom/cache/TypeUtils.cpp +++ b/dom/cache/TypeUtils.cpp @@ -44,7 +44,7 @@ namespace { static bool HasVaryStar(mozilla::dom::InternalHeaders* aHeaders) { - nsAutoTArray varyHeaders; + AutoTArray varyHeaders; ErrorResult rv; aHeaders->GetAll(NS_LITERAL_CSTRING("vary"), varyHeaders, rv); MOZ_ALWAYS_TRUE(!rv.Failed()); @@ -67,7 +67,7 @@ HasVaryStar(mozilla::dom::InternalHeaders* aHeaders) void SerializeNormalStream(nsIInputStream* aStream, CacheReadStream& aReadStreamOut) { - nsAutoTArray fds; + AutoTArray fds; SerializeInputStream(aStream, aReadStreamOut.params(), fds); PFileDescriptorSetChild* fdSet = nullptr; @@ -94,7 +94,7 @@ ToHeadersEntryList(nsTArray& aOut, InternalHeaders* aHeaders) { MOZ_ASSERT(aHeaders); - nsAutoTArray entryList; + AutoTArray entryList; aHeaders->GetEntries(entryList); for (uint32_t i = 0; i < entryList.Length(); ++i) { diff --git a/dom/camera/GonkCameraControl.cpp b/dom/camera/GonkCameraControl.cpp index 9c1bc29229..aafa47249a 100644 --- a/dom/camera/GonkCameraControl.cpp +++ b/dom/camera/GonkCameraControl.cpp @@ -247,7 +247,7 @@ nsGonkCameraControl::Initialize() DOM_CAMERA_LOGI(" - flash: NOT supported\n"); } - nsAutoTArray sizes; + AutoTArray sizes; mParams.Get(CAMERA_PARAM_SUPPORTED_VIDEOSIZES, sizes); if (sizes.Length() > 0) { mSeparateVideoAndPreviewSizesSupported = true; @@ -264,7 +264,7 @@ nsGonkCameraControl::Initialize() mLastRecorderSize = mCurrentConfiguration.mPreviewSize; } - nsAutoTArray modes; + AutoTArray modes; mParams.Get(CAMERA_PARAM_SUPPORTED_METERINGMODES, modes); if (!modes.IsEmpty()) { nsString mode; @@ -302,7 +302,7 @@ nsGonkCameraControl::~nsGonkCameraControl() nsresult nsGonkCameraControl::ValidateConfiguration(const Configuration& aConfig, Configuration& aValidatedConfig) { - nsAutoTArray supportedSizes; + AutoTArray supportedSizes; Get(CAMERA_PARAM_SUPPORTED_PICTURESIZES, supportedSizes); nsresult rv = GetSupportedSize(aConfig.mPictureSize, supportedSizes, @@ -923,7 +923,7 @@ nsGonkCameraControl::SetThumbnailSizeImpl(const Size& aSize) uint32_t smallestDeltaIndex = UINT32_MAX; int targetArea = aSize.width * aSize.height; - nsAutoTArray supportedSizes; + AutoTArray supportedSizes; Get(CAMERA_PARAM_SUPPORTED_JPEG_THUMBNAIL_SIZES, supportedSizes); for (uint32_t i = 0; i < supportedSizes.Length(); ++i) { @@ -1028,7 +1028,7 @@ nsGonkCameraControl::SetPictureSizeImpl(const Size& aSize) return NS_OK; } - nsAutoTArray supportedSizes; + AutoTArray supportedSizes; Get(CAMERA_PARAM_SUPPORTED_PICTURESIZES, supportedSizes); Size best; @@ -1727,7 +1727,7 @@ nsGonkCameraControl::SelectCaptureAndPreviewSize(const Size& aPreviewSize, aPreviewSize.width, aPreviewSize.height, aMaxSize.width, aMaxSize.height); - nsAutoTArray sizes; + AutoTArray sizes; nsresult rv = Get(CAMERA_PARAM_SUPPORTED_PREVIEWSIZES, sizes); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; diff --git a/dom/canvas/CanvasRenderingContext2D.h b/dom/canvas/CanvasRenderingContext2D.h index dbdfc195e3..1deed156ac 100644 --- a/dom/canvas/CanvasRenderingContext2D.h +++ b/dom/canvas/CanvasRenderingContext2D.h @@ -1038,7 +1038,7 @@ protected: bool fontExplicitLanguage; }; - nsAutoTArray mStyleStack; + AutoTArray mStyleStack; inline ContextState& CurrentState() { return mStyleStack[mStyleStack.Length() - 1]; diff --git a/dom/canvas/ImageBitmapRenderingContext.cpp b/dom/canvas/ImageBitmapRenderingContext.cpp index b8b079eeb5..e300991861 100644 --- a/dom/canvas/ImageBitmapRenderingContext.cpp +++ b/dom/canvas/ImageBitmapRenderingContext.cpp @@ -239,7 +239,7 @@ ImageBitmapRenderingContext::GetCanvasLayer(nsDisplayListBuilder* aBuilder, imageLayer->SetContainer(imageContainer); } - nsAutoTArray imageList; + AutoTArray imageList; RefPtr image = ClipToIntrinsicSize(); imageList.AppendElement(ImageContainer::NonOwningImage(image)); imageContainer->SetCurrentImages(imageList); diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index 5f3216ca97..be3eee2895 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -716,7 +716,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext, if (modifierMask && (modifierMask == Prefs::ChromeAccessModifierMask() || modifierMask == Prefs::ContentAccessModifierMask())) { - nsAutoTArray accessCharCodes; + AutoTArray accessCharCodes; nsContentUtils::GetAccessKeyCandidates(keyEvent, accessCharCodes); if (HandleAccessKey(aPresContext, accessCharCodes, @@ -1275,7 +1275,7 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent, // event to. // // NB: the elements of |targets| must be unique, for correctness. - nsAutoTArray, 1> targets; + AutoTArray, 1> targets; if (aEvent->mClass != eTouchEventClass || aEvent->mMessage == eTouchStart) { // If this event only has one target, and it's remote, add it to // the array. diff --git a/dom/events/TextComposition.h b/dom/events/TextComposition.h index f99da8ef09..103d0b81e2 100644 --- a/dom/events/TextComposition.h +++ b/dom/events/TextComposition.h @@ -429,7 +429,7 @@ private: */ class TextCompositionArray final : - public nsAutoTArray, 2> + public AutoTArray, 2> { public: // Looking for per native IME context. diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp index 887e9748e4..b8f540479b 100644 --- a/dom/fetch/FetchDriver.cpp +++ b/dom/fetch/FetchDriver.cpp @@ -241,7 +241,7 @@ FetchDriver::HttpFetch() NS_ENSURE_SUCCESS(rv, rv); // Set the same headers. - nsAutoTArray headers; + AutoTArray headers; mRequest->Headers()->GetEntries(headers); bool hasAccept = false; for (uint32_t i = 0; i < headers.Length(); ++i) { @@ -347,7 +347,7 @@ FetchDriver::HttpFetch() // nsCORSListenerProxy. We just inform it which unsafe headers are included // in the request. if (mRequest->Mode() == RequestMode::Cors) { - nsAutoTArray unsafeHeaders; + AutoTArray unsafeHeaders; mRequest->Headers()->GetUnsafeHeaders(unsafeHeaders); nsCOMPtr loadInfo = chan->GetLoadInfo(); loadInfo->SetCorsPreflightInfo(unsafeHeaders, false); diff --git a/dom/fetch/InternalHeaders.cpp b/dom/fetch/InternalHeaders.cpp index fccc9fc18f..e8d1a76e7d 100644 --- a/dom/fetch/InternalHeaders.cpp +++ b/dom/fetch/InternalHeaders.cpp @@ -309,7 +309,7 @@ InternalHeaders::CORSHeaders(InternalHeaders* aHeaders) aHeaders->Get(NS_LITERAL_CSTRING("Access-Control-Expose-Headers"), acExposedNames, result); MOZ_ASSERT(!result.Failed()); - nsAutoTArray exposeNamesArray; + AutoTArray exposeNamesArray; nsCCharSeparatedTokenizer exposeTokens(acExposedNames, ','); while (exposeTokens.hasMoreTokens()) { const nsDependentCSubstring& token = exposeTokens.nextToken(); diff --git a/dom/gamepad/linux/LinuxGamepad.cpp b/dom/gamepad/linux/LinuxGamepad.cpp index 420f277d88..7cc52ec53e 100644 --- a/dom/gamepad/linux/LinuxGamepad.cpp +++ b/dom/gamepad/linux/LinuxGamepad.cpp @@ -77,7 +77,7 @@ private: struct udev_monitor* mMonitor; guint mMonitorSourceID; // Information about currently connected gamepads. - nsAutoTArray mGamepads; + AutoTArray mGamepads; }; // singleton instance diff --git a/dom/html/HTMLAllCollection.cpp b/dom/html/HTMLAllCollection.cpp index 098fd3ffcf..ff0c0c2a66 100644 --- a/dom/html/HTMLAllCollection.cpp +++ b/dom/html/HTMLAllCollection.cpp @@ -173,7 +173,7 @@ HTMLAllCollection::GetSupportedNames(unsigned aFlags, nsTArray& aNames // XXXbz this is very similar to nsContentList::GetSupportedNames, // but has to check IsAllNamedElement for the name case. - nsAutoTArray atoms; + AutoTArray atoms; for (uint32_t i = 0; i < Length(); ++i) { nsIContent *content = Item(i); if (content->HasID()) { diff --git a/dom/html/HTMLOptionsCollection.cpp b/dom/html/HTMLOptionsCollection.cpp index b4611aaf49..1435706179 100644 --- a/dom/html/HTMLOptionsCollection.cpp +++ b/dom/html/HTMLOptionsCollection.cpp @@ -287,7 +287,7 @@ HTMLOptionsCollection::GetSupportedNames(unsigned aFlags, return; } - nsAutoTArray atoms; + AutoTArray atoms; for (uint32_t i = 0; i < mElements.Length(); ++i) { HTMLOptionElement* content = mElements.ElementAt(i); if (content) { diff --git a/dom/html/TimeRanges.cpp b/dom/html/TimeRanges.cpp index c817b53e20..debb81a2fa 100644 --- a/dom/html/TimeRanges.cpp +++ b/dom/html/TimeRanges.cpp @@ -112,7 +112,7 @@ void TimeRanges::Normalize(double aTolerance) { if (mRanges.Length() >= 2) { - nsAutoTArray normalized; + AutoTArray normalized; mRanges.Sort(CompareTimeRanges()); @@ -147,7 +147,7 @@ TimeRanges::Union(const TimeRanges* aOtherRanges, double aTolerance) void TimeRanges::Intersection(const TimeRanges* aOtherRanges) { - nsAutoTArray intersection; + AutoTArray intersection; const nsTArray& otherRanges = aOtherRanges->mRanges; for (index_type i = 0, j = 0; i < mRanges.Length() && j < otherRanges.Length();) { diff --git a/dom/html/TimeRanges.h b/dom/html/TimeRanges.h index 5e9bb6f004..306fe3ff0b 100644 --- a/dom/html/TimeRanges.h +++ b/dom/html/TimeRanges.h @@ -93,7 +93,7 @@ private: } }; - nsAutoTArray mRanges; + AutoTArray mRanges; nsCOMPtr mParent; diff --git a/dom/html/nsHTMLContentSink.cpp b/dom/html/nsHTMLContentSink.cpp index 3a3b1c43d8..5be802274e 100644 --- a/dom/html/nsHTMLContentSink.cpp +++ b/dom/html/nsHTMLContentSink.cpp @@ -160,7 +160,7 @@ protected: RefPtr mBody; RefPtr mHead; - nsAutoTArray mContextStack; + AutoTArray mContextStack; SinkContext* mCurrentContext; SinkContext* mHeadContext; diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 3046348a1e..0061bb22c0 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -851,10 +851,9 @@ MakeCompressedIndexDataValues( } nsresult -ReadCompressedIndexDataValuesFromBlob( - const uint8_t* aBlobData, - uint32_t aBlobDataLength, - FallibleTArray& aIndexValues) +ReadCompressedIndexDataValuesFromBlob(const uint8_t* aBlobData, + uint32_t aBlobDataLength, + nsTArray& aIndexValues) { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsOnBackgroundThread()); @@ -929,10 +928,9 @@ ReadCompressedIndexDataValuesFromBlob( // static template nsresult -ReadCompressedIndexDataValuesFromSource( - T* aSource, - uint32_t aColumnIndex, - FallibleTArray& aIndexValues) +ReadCompressedIndexDataValuesFromSource(T* aSource, + uint32_t aColumnIndex, + nsTArray& aIndexValues) { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsOnBackgroundThread()); @@ -976,7 +974,7 @@ ReadCompressedIndexDataValuesFromSource( nsresult ReadCompressedIndexDataValues(mozIStorageStatement* aStatement, uint32_t aColumnIndex, - FallibleTArray& aIndexValues) + nsTArray& aIndexValues) { return ReadCompressedIndexDataValuesFromSource(aStatement, aColumnIndex, @@ -986,7 +984,7 @@ ReadCompressedIndexDataValues(mozIStorageStatement* aStatement, nsresult ReadCompressedIndexDataValues(mozIStorageValueArray* aValues, uint32_t aColumnIndex, - FallibleTArray& aIndexValues) + nsTArray& aIndexValues) { return ReadCompressedIndexDataValuesFromSource(aValues, aColumnIndex, @@ -2781,7 +2779,7 @@ InsertIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aValues, // Read out the previous value. It may be NULL, in which case we'll just end // up with an empty array. - AutoFallibleTArray indexValues; + AutoTArray indexValues; nsresult rv = ReadCompressedIndexDataValues(aValues, 0, indexValues); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -3877,7 +3875,7 @@ private: nsresult ReadOldCompressedIDVFromBlob(const uint8_t* aBlobData, uint32_t aBlobDataLength, - FallibleTArray& aIndexValues); + nsTArray& aIndexValues); NS_IMETHOD OnFunctionCall(mozIStorageValueArray* aArguments, @@ -3890,7 +3888,7 @@ nsresult UpgradeIndexDataValuesFunction::ReadOldCompressedIDVFromBlob( const uint8_t* aBlobData, uint32_t aBlobDataLength, - FallibleTArray& aIndexValues) + nsTArray& aIndexValues) { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsOnBackgroundThread()); @@ -4002,7 +4000,7 @@ UpgradeIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aArguments return rv; } - AutoFallibleTArray oldIdv; + AutoTArray oldIdv; rv = ReadOldCompressedIDVFromBlob(oldBlob, oldBlobLength, oldIdv); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -5865,10 +5863,9 @@ protected: Maybe& aMaybeUniqueIndexTable); static nsresult - IndexDataValuesFromUpdateInfos( - const nsTArray& aUpdateInfos, - const UniqueIndexTable& aUniqueIndexTable, - FallibleTArray& aIndexValues); + IndexDataValuesFromUpdateInfos(const nsTArray& aUpdateInfos, + const UniqueIndexTable& aUniqueIndexTable, + nsTArray& aIndexValues); static nsresult InsertIndexTableRows(DatabaseConnection* aConnection, @@ -7918,7 +7915,7 @@ private: nsresult RemoveReferencesToIndex(DatabaseConnection* aConnection, const Key& aObjectDataKey, - FallibleTArray& aIndexValues); + nsTArray& aIndexValues); virtual nsresult DoDatabaseWork(DatabaseConnection* aConnection) override; @@ -8056,7 +8053,7 @@ class ObjectStoreGetRequestOp final const uint32_t mObjectStoreId; RefPtr mDatabase; const OptionalKeyRange mOptionalKeyRange; - AutoFallibleTArray mResponse; + AutoTArray mResponse; PBackgroundParent* mBackgroundParent; const uint32_t mLimit; const bool mGetAll; @@ -8217,7 +8214,7 @@ class IndexGetRequestOp final RefPtr mDatabase; const OptionalKeyRange mOptionalKeyRange; - AutoFallibleTArray mResponse; + AutoTArray mResponse; PBackgroundParent* mBackgroundParent; const uint32_t mLimit; const bool mGetAll; @@ -8244,7 +8241,7 @@ class IndexGetKeyRequestOp final friend class TransactionBase; const OptionalKeyRange mOptionalKeyRange; - AutoFallibleTArray mResponse; + AutoTArray mResponse; const uint32_t mLimit; const bool mGetAll; @@ -16314,10 +16311,10 @@ QuotaClient::InitOrigin(PersistenceType aPersistenceType, // are database files then we need to cleanup stored files (if it's needed) // and also get the usage. - nsAutoTArray subdirsToProcess; + AutoTArray subdirsToProcess; nsTArray> unknownFiles; nsTHashtable validSubdirs(20); - nsAutoTArray initInfos; + AutoTArray initInfos; nsCOMPtr entries; rv = directory->GetDirectoryEntries(getter_AddRefs(entries)); @@ -18240,7 +18237,7 @@ DatabaseOperationBase::GetStructuredCloneReadInfoFromBlob( return NS_ERROR_FILE_CORRUPTED; } - AutoFallibleTArray uncompressed; + AutoTArray uncompressed; if (NS_WARN_IF(!uncompressed.SetLength(uncompressedLength, fallible))) { return NS_ERROR_OUT_OF_MEMORY; } @@ -18255,7 +18252,7 @@ DatabaseOperationBase::GetStructuredCloneReadInfoFromBlob( aInfo->mData.SwapElements(uncompressed); if (!aFileIds.IsVoid()) { - nsAutoTArray array; + AutoTArray array; nsresult rv = ConvertFileIdsToArray(aFileIds, array); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -18441,7 +18438,7 @@ nsresult DatabaseOperationBase::IndexDataValuesFromUpdateInfos( const nsTArray& aUpdateInfos, const UniqueIndexTable& aUniqueIndexTable, - FallibleTArray& aIndexValues) + nsTArray& aIndexValues) { MOZ_ASSERT(aIndexValues.IsEmpty()); MOZ_ASSERT_IF(!aUpdateInfos.IsEmpty(), aUniqueIndexTable.Count()); @@ -18761,7 +18758,7 @@ DatabaseOperationBase::DeleteObjectStoreDataTableRowsWithIndexes( } DatabaseConnection::CachedStatement deleteStmt; - AutoFallibleTArray indexValues; + AutoTArray indexValues; DebugOnly resultCountDEBUG = 0; @@ -23394,7 +23391,7 @@ UpdateIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aValues, const IndexMetadata& metadata = mOp->mMetadata; const int64_t& objectStoreId = mOp->mObjectStoreId; - nsAutoTArray updateInfos; + AutoTArray updateInfos; rv = IDBObjectStore::AppendIndexUpdateInfo(metadata.id(), metadata.keyPath(), metadata.unique(), @@ -23460,7 +23457,7 @@ UpdateIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aValues, return rv; } - AutoFallibleTArray indexValues; + AutoTArray indexValues; rv = ReadCompressedIndexDataValues(aValues, 1, indexValues); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -23557,10 +23554,9 @@ DeleteIndexOp::DeleteIndexOp(VersionChangeTransaction* aTransaction, } nsresult -DeleteIndexOp::RemoveReferencesToIndex( - DatabaseConnection* aConnection, - const Key& aObjectStoreKey, - FallibleTArray& aIndexValues) +DeleteIndexOp::RemoveReferencesToIndex(DatabaseConnection* aConnection, + const Key& aObjectStoreKey, + nsTArray& aIndexValues) { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsOnBackgroundThread()); @@ -23815,7 +23811,7 @@ DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection) DatabaseConnection::CachedStatement nullIndexDataValuesStmt; Key lastObjectStoreKey; - AutoFallibleTArray lastIndexValues; + AutoTArray lastIndexValues; bool hasResult; while (NS_SUCCEEDED(rv = selectStmt->ExecuteStep(&hasResult)) && hasResult) { @@ -24159,7 +24155,7 @@ ObjectStoreAddOrPutRequestOp::RemoveOldIndexDataValues( } if (hasResult) { - AutoFallibleTArray existingIndexValues; + AutoTArray existingIndexValues; rv = ReadCompressedIndexDataValues(indexValuesStmt, 0, existingIndexValues); @@ -24686,7 +24682,7 @@ ObjectStoreAddOrPutRequestOp::DoDatabaseWork(DatabaseConnection* aConnection) MOZ_ASSERT(mUniqueIndexTable.isSome()); // Write the index_data_values column. - AutoFallibleTArray indexValues; + AutoTArray indexValues; rv = IndexDataValuesFromUpdateInfos(mParams.indexUpdateInfos(), mUniqueIndexTable.ref(), indexValues); diff --git a/dom/indexedDB/IDBDatabase.cpp b/dom/indexedDB/IDBDatabase.cpp index d852647143..95c5004d80 100644 --- a/dom/indexedDB/IDBDatabase.cpp +++ b/dom/indexedDB/IDBDatabase.cpp @@ -665,7 +665,7 @@ IDBDatabase::Transaction(const StringOrStringSequence& aStoreNames, return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR; } - nsAutoTArray stackSequence; + AutoTArray stackSequence; if (aStoreNames.IsString()) { stackSequence.AppendElement(aStoreNames.GetAsString()); @@ -846,8 +846,8 @@ IDBDatabase::AbortTransactions(bool aShouldWarn) class MOZ_STACK_CLASS Helper final { - typedef nsAutoTArray, 20> StrongTransactionArray; - typedef nsAutoTArray WeakTransactionArray; + typedef AutoTArray, 20> StrongTransactionArray; + typedef AutoTArray WeakTransactionArray; public: static void diff --git a/dom/indexedDB/Key.cpp b/dom/indexedDB/Key.cpp index fe3c8d4f1b..c7fd28048c 100644 --- a/dom/indexedDB/Key.cpp +++ b/dom/indexedDB/Key.cpp @@ -470,7 +470,7 @@ Key::EncodeLocaleString(const nsDependentString& aString, uint8_t aTypeOffset, } MOZ_ASSERT(collator); - nsAutoTArray keyBuffer; + AutoTArray keyBuffer; int32_t sortKeyLength = ucol_getSortKey(collator, ustr, length, keyBuffer.Elements(), keyBuffer.Length()); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index d89a25aa86..9eff312e43 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -603,7 +603,7 @@ ContentParentsMemoryReporter::CollectReports(nsIMemoryReporterCallback* cb, nsISupports* aClosure, bool aAnonymize) { - nsAutoTArray cps; + AutoTArray cps; ContentParent::GetAllEvenIfDead(cps); for (uint32_t i = 0; i < cps.Length(); i++) { @@ -907,7 +907,7 @@ ContentParent::JoinAllSubprocesses() { MOZ_ASSERT(NS_IsMainThread()); - nsAutoTArray processes; + AutoTArray processes; GetAll(processes); if (processes.IsEmpty()) { printf_stderr("There are no live subprocesses."); @@ -5203,7 +5203,7 @@ ContentParent::IgnoreIPCPrincipal() void ContentParent::NotifyUpdatedDictionaries() { - nsAutoTArray processes; + AutoTArray processes; GetAll(processes); nsCOMPtr spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID)); diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp index 8bce3dc1a3..46c12f6578 100644 --- a/dom/ipc/PreallocatedProcessManager.cpp +++ b/dom/ipc/PreallocatedProcessManager.cpp @@ -71,8 +71,8 @@ private: CancelableTask* mPreallocateAppProcessTask; // The array containing the preallocated processes. 4 as the inline storage size - // should be enough so we don't need to grow the nsAutoTArray. - nsAutoTArray, 4> mSpareProcesses; + // should be enough so we don't need to grow the AutoTArray. + AutoTArray, 4> mSpareProcesses; // Nuwa process is ready for creating new process. bool mIsNuwaReady; diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 3a1d22fe5b..eedde6d020 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -665,7 +665,7 @@ private: // Whether we have already received a FileDescriptor for the app package. bool mAppPackageFileDescriptorRecved; // At present only 1 of these is really expected. - nsAutoTArray, 1> + AutoTArray, 1> mCachedFileDescriptorInfos; nscolor mLastBackgroundColor; bool mDidFakeShow; @@ -693,7 +693,7 @@ private: CSSSize mUnscaledInnerSize; bool mDidSetRealShowInfo; - nsAutoTArray mAudioChannelsActive; + AutoTArray mAudioChannelsActive; DISALLOW_EVIL_CONSTRUCTORS(TabChild); }; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index b45b74c33d..e171e1f6d2 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -1479,9 +1479,9 @@ bool TabParent::RecvRequestNativeKeyBindings(const WidgetKeyboardEvent& aEvent, MaybeNativeKeyBinding* aBindings) { - AutoInfallibleTArray singleLine; - AutoInfallibleTArray multiLine; - AutoInfallibleTArray richText; + AutoTArray singleLine; + AutoTArray multiLine; + AutoTArray richText; *aBindings = mozilla::void_t(); @@ -1693,9 +1693,9 @@ bool TabParent::SendRealKeyEvent(WidgetKeyboardEvent& event) if (event.mMessage == eKeyPress) { nsCOMPtr widget = GetWidget(); - AutoInfallibleTArray singleLine; - AutoInfallibleTArray multiLine; - AutoInfallibleTArray richText; + AutoTArray singleLine; + AutoTArray multiLine; + AutoTArray richText; widget->ExecuteNativeKeyBinding(nsIWidget::NativeKeyBindingsForSingleLineEditor, event, DoCommandCallback, &singleLine); diff --git a/dom/media/AudioCaptureStream.cpp b/dom/media/AudioCaptureStream.cpp index 459d1cba81..5d192d8320 100644 --- a/dom/media/AudioCaptureStream.cpp +++ b/dom/media/AudioCaptureStream.cpp @@ -102,8 +102,8 @@ AudioCaptureStream::MixerCallback(AudioDataValue* aMixedBuffer, AudioSampleFormat aFormat, uint32_t aChannels, uint32_t aFrames, uint32_t aSampleRate) { - nsAutoTArray, MONO> output; - nsAutoTArray bufferPtrs; + AutoTArray, MONO> output; + AutoTArray bufferPtrs; output.SetLength(MONO); bufferPtrs.SetLength(MONO); diff --git a/dom/media/AudioSegment.cpp b/dom/media/AudioSegment.cpp index 56a4f46cf3..1f24215732 100644 --- a/dom/media/AudioSegment.cpp +++ b/dom/media/AudioSegment.cpp @@ -85,9 +85,9 @@ void AudioSegment::Mix(AudioMixer& aMixer, uint32_t aOutputChannels, uint32_t aSampleRate) { - nsAutoTArray + AutoTArray buf; - nsAutoTArray channelData; + AutoTArray channelData; uint32_t offsetSamples = 0; uint32_t duration = GetDuration(); @@ -132,7 +132,7 @@ AudioSegment::Mix(AudioMixer& aMixer, uint32_t aOutputChannels, MOZ_ASSERT(channelData.Length() == aOutputChannels); } else if (channelData.Length() > aOutputChannels) { // Down mix. - nsAutoTArray outChannelPtrs; + AutoTArray outChannelPtrs; outChannelPtrs.SetLength(aOutputChannels); uint32_t offsetSamples = 0; for (uint32_t channel = 0; channel < aOutputChannels; channel++) { @@ -166,7 +166,7 @@ AudioSegment::Mix(AudioMixer& aMixer, uint32_t aOutputChannels, void AudioSegment::WriteTo(uint64_t aID, AudioMixer& aMixer, uint32_t aOutputChannels, uint32_t aSampleRate) { - nsAutoTArray buf; + AutoTArray buf; // Offset in the buffer that will be written to the mixer, in samples. uint32_t offset = 0; diff --git a/dom/media/AudioSegment.h b/dom/media/AudioSegment.h index e2880dadc3..252b7e5747 100644 --- a/dom/media/AudioSegment.h +++ b/dom/media/AudioSegment.h @@ -118,8 +118,8 @@ DownmixAndInterleave(const nsTArray& aChannelData, InterleaveAndConvertBuffer(aChannelData.Elements(), aDuration, aVolume, aOutputChannels, aOutput); } else { - nsAutoTArray outputChannelData; - nsAutoTArray outputBuffers; + AutoTArray outputChannelData; + AutoTArray outputBuffers; outputChannelData.SetLength(aOutputChannels); outputBuffers.SetLength(aDuration * aOutputChannels); for (uint32_t i = 0; i < aOutputChannels; i++) { @@ -254,8 +254,8 @@ public: #endif for (ChunkIterator ci(*this); !ci.IsEnded(); ci.Next()) { - nsAutoTArray, GUESS_AUDIO_CHANNELS> output; - nsAutoTArray bufferPtrs; + AutoTArray, GUESS_AUDIO_CHANNELS> output; + AutoTArray bufferPtrs; AudioChunk& c = *ci; // If this chunk is null, don't bother resampling, just alter its duration if (c.IsNull()) { @@ -395,7 +395,7 @@ void WriteChunk(AudioChunk& aChunk, uint32_t aOutputChannels, AudioDataValue* aOutputBuffer) { - nsAutoTArray channelData; + AutoTArray channelData; channelData = aChunk.ChannelData(); diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index b69bca3f36..4b25b49395 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -112,7 +112,7 @@ public: } } private: - nsAutoTArray mChunks; + AutoTArray mChunks; int64_t mBaseOffset; double mBasePosition; }; @@ -286,7 +286,7 @@ WriteDumpFile(FILE* aDumpFile, AudioStream* aStream, uint32_t aFrames, } NS_ASSERTION(AUDIO_OUTPUT_FORMAT == AUDIO_FORMAT_FLOAT32, "bad format"); - nsAutoTArray buf; + AutoTArray buf; buf.SetLength(samples*2); float* input = static_cast(aBuffer); uint8_t* output = buf.Elements(); @@ -620,7 +620,7 @@ AudioStream::GetTimeStretched(AudioBufferWriter& aWriter) mTimeStretcher->putSamples(c->Data(), c->Frames()); } else { // Write silence if downmixing fails. - nsAutoTArray buf; + AutoTArray buf; buf.SetLength(mOutChannels * c->Frames()); memset(buf.Elements(), 0, buf.Length() * sizeof(AudioDataValue)); mTimeStretcher->putSamples(buf.Elements(), c->Frames()); diff --git a/dom/media/DOMMediaStream.h b/dom/media/DOMMediaStream.h index 07256c13d8..2d7e182185 100644 --- a/dom/media/DOMMediaStream.h +++ b/dom/media/DOMMediaStream.h @@ -583,10 +583,10 @@ protected: RefPtr mPlaybackPort; // MediaStreamTracks corresponding to tracks in our mOwnedStream. - nsAutoTArray, 2> mOwnedTracks; + AutoTArray, 2> mOwnedTracks; // MediaStreamTracks corresponding to tracks in our mPlaybackStream. - nsAutoTArray, 2> mTracks; + AutoTArray, 2> mTracks; RefPtr mOwnedListener; RefPtr mPlaybackListener; diff --git a/dom/media/FileBlockCache.h b/dom/media/FileBlockCache.h index c55281ba85..c184801d26 100644 --- a/dom/media/FileBlockCache.h +++ b/dom/media/FileBlockCache.h @@ -203,7 +203,7 @@ private: // main thread). nsCOMPtr mThread; // Queue of pending block indexes that need to be written or moved. - //nsAutoTArray mChangeIndexList; + //AutoTArray mChangeIndexList; Int32Queue mChangeIndexList; // True if we've dispatched an event to commit all pending block changes // to file on mThread. diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 9e12899bfa..b2ab3a6bdb 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -1099,7 +1099,7 @@ AudioCallbackDriver::EnqueueStreamAndPromiseForOperation(MediaStream* aStream, void AudioCallbackDriver::CompleteAudioContextOperations(AsyncCubebOperation aOperation) { - nsAutoTArray array; + AutoTArray array; // We can't lock for the whole function because AudioContextOperationCompleted // will grab the monitor diff --git a/dom/media/GraphDriver.h b/dom/media/GraphDriver.h index 9a1c19f30f..bafb21c53e 100644 --- a/dom/media/GraphDriver.h +++ b/dom/media/GraphDriver.h @@ -521,7 +521,7 @@ private: * shutdown of the audio stream. */ nsCOMPtr mInitShutdownThread; /* This must be accessed with the graph monitor held. */ - nsAutoTArray mPromisesForOperation; + AutoTArray mPromisesForOperation; /* This is set during initialization, and can be read safely afterwards. */ dom::AudioChannel mAudioChannel; /* Used to queue us to add the mixer callback on first run. */ diff --git a/dom/media/Intervals.h b/dom/media/Intervals.h index cf80e9f51e..6500765eb0 100644 --- a/dom/media/Intervals.h +++ b/dom/media/Intervals.h @@ -255,7 +255,7 @@ class IntervalSet public: typedef IntervalSet SelfType; typedef Interval ElemType; - typedef nsAutoTArray ContainerType; + typedef AutoTArray ContainerType; typedef typename ContainerType::index_type IndexType; IntervalSet() diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index 268e169710..5b14d23432 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -794,7 +794,7 @@ MediaCache::FindReusableBlock(TimeStamp aNow, // predicted time of next use". We can exploit the fact that the block // linked lists are ordered by increasing time of next use. This is // actually the whole point of having the linked lists. - nsAutoTArray candidates; + AutoTArray candidates; for (uint32_t i = 0; i < mStreams.Length(); ++i) { MediaCacheStream* stream = mStreams[i]; if (stream->mPinCount > 0) { @@ -1040,7 +1040,7 @@ MediaCache::Update() // decisions while holding the cache lock but implement those decisions // without holding the cache lock, since we need to call out to // stream, decoder and element code. - nsAutoTArray actions; + AutoTArray actions; { ReentrantMonitorAutoEnter mon(mReentrantMonitor); diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index d344e338c4..0ebde97a3d 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -637,7 +637,7 @@ MediaStreamGraphImpl::CreateOrDestroyAudioStreams(MediaStream* aStream) STREAM_LOG(LogLevel::Debug, ("Updating AudioOutputStreams for MediaStream %p", aStream)); - nsAutoTArray audioOutputStreamsFound; + AutoTArray audioOutputStreamsFound; for (uint32_t i = 0; i < aStream->mAudioOutputStreams.Length(); ++i) { audioOutputStreamsFound.AppendElement(false); } @@ -822,7 +822,7 @@ MediaStreamGraphImpl::PlayVideo(MediaStream* aStream) TimeStamp currentTimeStamp = CurrentDriver()->GetCurrentTimeStamp(); // Collect any new frames produced in this iteration. - nsAutoTArray newImages; + AutoTArray newImages; RefPtr blackImage; MOZ_ASSERT(mProcessedTime >= aStream->mBufferStartTime, "frame position before buffer?"); @@ -892,14 +892,14 @@ MediaStreamGraphImpl::PlayVideo(MediaStream* aStream) if (!aStream->mLastPlayedVideoFrame.GetImage()) return; - nsAutoTArray images; + AutoTArray images; bool haveMultipleImages = false; for (uint32_t i = 0; i < aStream->mVideoOutputs.Length(); ++i) { VideoFrameContainer* output = aStream->mVideoOutputs[i]; // Find previous frames that may still be valid. - nsAutoTArray previousImages; + AutoTArray previousImages; output->GetImageContainer()->GetCurrentImages(&previousImages); uint32_t j = previousImages.Length(); if (j) { diff --git a/dom/media/TrackUnionStream.cpp b/dom/media/TrackUnionStream.cpp index 9325641970..06ff80b513 100644 --- a/dom/media/TrackUnionStream.cpp +++ b/dom/media/TrackUnionStream.cpp @@ -67,8 +67,8 @@ TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) : if (IsFinishedOnGraphThread()) { return; } - nsAutoTArray mappedTracksFinished; - nsAutoTArray mappedTracksWithMatchingInputTracks; + AutoTArray mappedTracksFinished; + AutoTArray mappedTracksWithMatchingInputTracks; for (uint32_t i = 0; i < mTrackMap.Length(); ++i) { mappedTracksFinished.AppendElement(true); mappedTracksWithMatchingInputTracks.AppendElement(false); diff --git a/dom/media/VideoFrameContainer.cpp b/dom/media/VideoFrameContainer.cpp index 2ece19ad2c..e5a172e0ce 100644 --- a/dom/media/VideoFrameContainer.cpp +++ b/dom/media/VideoFrameContainer.cpp @@ -35,7 +35,7 @@ void VideoFrameContainer::SetCurrentFrame(const gfx::IntSize& aIntrinsicSize, { if (aImage) { MutexAutoLock lock(mMutex); - nsAutoTArray imageList; + AutoTArray imageList; imageList.AppendElement( ImageContainer::NonOwningImage(aImage, aTargetTime, ++mFrameID)); SetCurrentFramesLocked(aIntrinsicSize, imageList); diff --git a/dom/media/encoder/OpusTrackEncoder.cpp b/dom/media/encoder/OpusTrackEncoder.cpp index b9cf28c3fa..145aec095e 100644 --- a/dom/media/encoder/OpusTrackEncoder.cpp +++ b/dom/media/encoder/OpusTrackEncoder.cpp @@ -312,7 +312,7 @@ OpusTrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData) } // Start encoding data. - nsAutoTArray pcm; + AutoTArray pcm; pcm.SetLength(GetPacketDuration() * mChannels); AudioSegment::ChunkIterator iter(mSourceSegment); int frameCopied = 0; @@ -343,7 +343,7 @@ OpusTrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData) audiodata->SetFrameType(EncodedFrame::OPUS_AUDIO_FRAME); int framesInPCM = frameCopied; if (mResampler) { - nsAutoTArray resamplingDest; + AutoTArray resamplingDest; // We want to consume all the input data, so we slightly oversize the // resampled data buffer so we can fit the output data in. We cannot really // predict the output frame count at each call. diff --git a/dom/media/encoder/TrackEncoder.cpp b/dom/media/encoder/TrackEncoder.cpp index 7e2161a0c5..cd137e4c3b 100644 --- a/dom/media/encoder/TrackEncoder.cpp +++ b/dom/media/encoder/TrackEncoder.cpp @@ -129,7 +129,7 @@ AudioTrackEncoder::InterleaveTrackData(AudioChunk& aChunk, { switch(aChunk.mBufferFormat) { case AUDIO_FORMAT_S16: { - nsAutoTArray array; + AutoTArray array; array.SetLength(aOutputChannels); for (uint32_t i = 0; i < array.Length(); i++) { array[i] = static_cast(aChunk.mChannelData[i]); @@ -138,7 +138,7 @@ AudioTrackEncoder::InterleaveTrackData(AudioChunk& aChunk, break; } case AUDIO_FORMAT_FLOAT32: { - nsAutoTArray array; + AutoTArray array; array.SetLength(aOutputChannels); for (uint32_t i = 0; i < array.Length(); i++) { array[i] = static_cast(aChunk.mChannelData[i]); diff --git a/dom/media/encoder/VorbisTrackEncoder.cpp b/dom/media/encoder/VorbisTrackEncoder.cpp index 3a1c153bd5..0ea74608ab 100644 --- a/dom/media/encoder/VorbisTrackEncoder.cpp +++ b/dom/media/encoder/VorbisTrackEncoder.cpp @@ -200,8 +200,8 @@ VorbisTrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData) vorbis_analysis_buffer(&mVorbisDsp, (int)sourceSegment->GetDuration()); int framesCopied = 0; - nsAutoTArray interleavedPcm; - nsAutoTArray nonInterleavedPcm; + AutoTArray interleavedPcm; + AutoTArray nonInterleavedPcm; interleavedPcm.SetLength(sourceSegment->GetDuration() * mChannels); nonInterleavedPcm.SetLength(sourceSegment->GetDuration() * mChannels); while (!iter.IsEnded()) { diff --git a/dom/media/gmp/GMPDecryptorChild.cpp b/dom/media/gmp/GMPDecryptorChild.cpp index 0df7da8d9c..aec5078e45 100644 --- a/dom/media/gmp/GMPDecryptorChild.cpp +++ b/dom/media/gmp/GMPDecryptorChild.cpp @@ -157,7 +157,7 @@ GMPDecryptorChild::KeyStatusChanged(const char* aSessionId, uint32_t aKeyIdLength, GMPMediaKeyStatus aStatus) { - nsAutoTArray kid; + AutoTArray kid; kid.AppendElements(aKeyId, aKeyIdLength); CALL_ON_GMP_THREAD(SendKeyStatusChanged, nsCString(aSessionId, aSessionIdLength), kid, diff --git a/dom/media/gtest/TestVorbisTrackEncoder.cpp b/dom/media/gtest/TestVorbisTrackEncoder.cpp index 4f16519364..9166afcf5b 100644 --- a/dom/media/gtest/TestVorbisTrackEncoder.cpp +++ b/dom/media/gtest/TestVorbisTrackEncoder.cpp @@ -183,7 +183,7 @@ TEST(VorbisTrackEncoder, EncodedFrame) for (int i = 0; i < rate; i++) { data[i] = ((i%8)*4000) - (7*4000)/2; } - nsAutoTArray channelData; + AutoTArray channelData; channelData.AppendElement(data); AudioSegment segment; segment.AppendFrames(samples.forget(), channelData, 44100); diff --git a/dom/media/mediasink/DecodedStream.cpp b/dom/media/mediasink/DecodedStream.cpp index e71790168f..662583aa55 100644 --- a/dom/media/mediasink/DecodedStream.cpp +++ b/dom/media/mediasink/DecodedStream.cpp @@ -488,7 +488,7 @@ SendStreamAudio(DecodedStreamData* aStream, int64_t aStartTime, audio->EnsureAudioBuffer(); RefPtr buffer = audio->mAudioBuffer; AudioDataValue* bufferData = static_cast(buffer->Data()); - nsAutoTArray channels; + AutoTArray channels; for (uint32_t i = 0; i < audio->mChannels; ++i) { channels.AppendElement(bufferData + i * audio->mFrames); } @@ -510,7 +510,7 @@ DecodedStream::SendAudio(double aVolume, bool aIsSameOrigin) AudioSegment output; uint32_t rate = mInfo.mAudio.mRate; - nsAutoTArray,10> audio; + AutoTArray,10> audio; TrackID audioTrackId = mInfo.mAudio.mTrackId; SourceMediaStream* sourceStream = mData->mStream; @@ -575,7 +575,7 @@ DecodedStream::SendVideo(bool aIsSameOrigin) VideoSegment output; TrackID videoTrackId = mInfo.mVideo.mTrackId; - nsAutoTArray, 10> video; + AutoTArray, 10> video; SourceMediaStream* sourceStream = mData->mStream; // It's OK to hold references to the VideoData because VideoData diff --git a/dom/media/mediasink/VideoSink.cpp b/dom/media/mediasink/VideoSink.cpp index bcb819892a..7bd97cb5da 100644 --- a/dom/media/mediasink/VideoSink.cpp +++ b/dom/media/mediasink/VideoSink.cpp @@ -315,13 +315,13 @@ VideoSink::RenderVideoFrames(int32_t aMaxFrames, { AssertOwnerThread(); - nsAutoTArray,16> frames; + AutoTArray,16> frames; VideoQueue().GetFirstElements(aMaxFrames, &frames); if (frames.IsEmpty() || !mContainer) { return; } - nsAutoTArray images; + AutoTArray images; TimeStamp lastFrameTime; MediaSink::PlaybackParams params = mAudioSink->GetPlaybackParams(); for (uint32_t i = 0; i < frames.Length(); ++i) { diff --git a/dom/media/ogg/OggReader.cpp b/dom/media/ogg/OggReader.cpp index 18205b9876..a9a61a7af7 100644 --- a/dom/media/ogg/OggReader.cpp +++ b/dom/media/ogg/OggReader.cpp @@ -283,7 +283,7 @@ void OggReader::SetupTargetSkeleton(SkeletonState* aSkeletonState) } else if (ReadHeaders(aSkeletonState) && aSkeletonState->HasIndex()) { // Extract the duration info out of the index, so we don't need to seek to // the end of resource to get it. - nsAutoTArray tracks; + AutoTArray tracks; BuildSerialList(tracks); int64_t duration = 0; if (NS_SUCCEEDED(aSkeletonState->GetDuration(tracks, duration))) { @@ -382,7 +382,7 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo, *aTags = nullptr; ogg_page page; - nsAutoTArray bitstreams; + AutoTArray bitstreams; nsTArray serials; bool readAllBOS = false; while (!readAllBOS) { @@ -1238,7 +1238,7 @@ OggReader::IndexedSeekResult OggReader::SeekToKeyframeUsingIndex(int64_t aTarget return SEEK_INDEX_FAIL; } // We have an index from the Skeleton track, try to use it to seek. - nsAutoTArray tracks; + AutoTArray tracks; BuildSerialList(tracks); SkeletonState::nsSeekTarget keyframe; if (NS_FAILED(mSkeletonState->IndexedSeekTarget(aTarget, @@ -1433,7 +1433,7 @@ nsresult OggReader::SeekInternal(int64_t aTarget, int64_t aEndTime) // No index or other non-fatal index-related failure. Try to seek // using a bisection search. Determine the already downloaded data // in the media cache, so we can try to seek in the cached data first. - nsAutoTArray ranges; + AutoTArray ranges; res = GetSeekRanges(ranges); NS_ENSURE_SUCCESS(res,res); diff --git a/dom/media/omx/OMXCodecWrapper.cpp b/dom/media/omx/OMXCodecWrapper.cpp index 3266b47437..d820dcea91 100644 --- a/dom/media/omx/OMXCodecWrapper.cpp +++ b/dom/media/omx/OMXCodecWrapper.cpp @@ -659,7 +659,7 @@ public: UpdateAfterSendChunk(chunkSamples, bytesCopied, aSamplesRead); } else { // Interleave data to a temporary buffer. - nsAutoTArray pcm; + AutoTArray pcm; pcm.SetLength(bytesToCopy); AudioDataValue* interleavedSource = pcm.Elements(); AudioTrackEncoder::InterleaveTrackData(aChunk, chunkSamples, @@ -761,7 +761,7 @@ private: * mOMXAEncoder.mChannels * sizeof(AudioDataValue); uint32_t dstSamplesCopied = aSamplesNum; if (mOMXAEncoder.mResampler) { - nsAutoTArray pcm; + AutoTArray pcm; pcm.SetLength(bytesToCopy); AudioTrackEncoder::InterleaveTrackData(aSource, aSamplesNum, mOMXAEncoder.mChannels, diff --git a/dom/media/platforms/agnostic/VorbisDecoder.cpp b/dom/media/platforms/agnostic/VorbisDecoder.cpp index 356c585136..7b58716a29 100644 --- a/dom/media/platforms/agnostic/VorbisDecoder.cpp +++ b/dom/media/platforms/agnostic/VorbisDecoder.cpp @@ -71,8 +71,8 @@ VorbisDataDecoder::Init() PodZero(&mVorbisDsp); PodZero(&mVorbisBlock); - nsAutoTArray headers; - nsAutoTArray headerLens; + AutoTArray headers; + AutoTArray headerLens; if (!XiphExtradataToHeaders(headers, headerLens, mInfo.mCodecSpecificConfig->Elements(), mInfo.mCodecSpecificConfig->Length())) { diff --git a/dom/media/platforms/ffmpeg/FFmpegH264Decoder.h b/dom/media/platforms/ffmpeg/FFmpegH264Decoder.h index 1045ab3c7e..676efbb776 100644 --- a/dom/media/platforms/ffmpeg/FFmpegH264Decoder.h +++ b/dom/media/platforms/ffmpeg/FFmpegH264Decoder.h @@ -115,7 +115,7 @@ private: } private: - nsAutoTArray mMap; + AutoTArray mMap; }; DurationMap mDurationMap; diff --git a/dom/media/systemservices/MediaUtils.h b/dom/media/systemservices/MediaUtils.h index bde0c913fa..dad43bd349 100644 --- a/dom/media/systemservices/MediaUtils.h +++ b/dom/media/systemservices/MediaUtils.h @@ -321,7 +321,7 @@ private: static uint32_t counter = 0; return ++counter; }; - nsAutoTArray mElements; + AutoTArray mElements; }; /* media::Refcountable - Add threadsafe ref-counting to something that isn't. diff --git a/dom/media/webaudio/AudioBuffer.h b/dom/media/webaudio/AudioBuffer.h index 4f5ebe3271..42a57d7e4d 100644 --- a/dom/media/webaudio/AudioBuffer.h +++ b/dom/media/webaudio/AudioBuffer.h @@ -119,7 +119,7 @@ protected: nsWeakPtr mOwnerWindow; // Float32Arrays - nsAutoTArray, 2> mJSChannels; + AutoTArray, 2> mJSChannels; // mSharedChannels aggregates the data from mJSChannels. This is non-null // if and only if the mJSChannels are neutered. diff --git a/dom/media/webaudio/AudioNodeEngine.h b/dom/media/webaudio/AudioNodeEngine.h index 3ae5ecc85d..73a14956d9 100644 --- a/dom/media/webaudio/AudioNodeEngine.h +++ b/dom/media/webaudio/AudioNodeEngine.h @@ -128,7 +128,7 @@ public: } private: - nsAutoTArray mContents; + AutoTArray mContents; }; /** @@ -253,7 +253,7 @@ class AudioNodeEngine { public: // This should be compatible with AudioNodeStream::OutputChunks. - typedef nsAutoTArray OutputChunks; + typedef AutoTArray OutputChunks; explicit AudioNodeEngine(dom::AudioNode* aNode) : mNode(aNode) diff --git a/dom/media/webaudio/AudioNodeExternalInputStream.cpp b/dom/media/webaudio/AudioNodeExternalInputStream.cpp index b32b3378a1..bcf5220dee 100644 --- a/dom/media/webaudio/AudioNodeExternalInputStream.cpp +++ b/dom/media/webaudio/AudioNodeExternalInputStream.cpp @@ -49,7 +49,7 @@ CopyChunkToBlock(AudioChunk& aInput, AudioBlock *aBlock, uint32_t aOffsetInBlock) { uint32_t blockChannels = aBlock->ChannelCount(); - nsAutoTArray channels; + AutoTArray channels; if (aInput.IsNull()) { channels.SetLength(blockChannels); PodZero(channels.Elements(), blockChannels); @@ -133,7 +133,7 @@ AudioNodeExternalInputStream::ProcessInput(GraphTime aFrom, GraphTime aTo, MOZ_ASSERT(mInputs.Length() == 1); MediaStream* source = mInputs[0]->GetSource(); - nsAutoTArray audioSegments; + AutoTArray audioSegments; uint32_t inputChannels = 0; for (StreamBuffer::TrackIter tracks(source->mBuffer, MediaSegment::AUDIO); !tracks.IsEnded(); tracks.Next()) { @@ -188,7 +188,7 @@ AudioNodeExternalInputStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t accumulateIndex = 0; if (inputChannels) { - nsAutoTArray downmixBuffer; + AutoTArray downmixBuffer; for (uint32_t i = 0; i < audioSegments.Length(); ++i) { AudioBlock tmpChunk; ConvertSegmentToAudioBlock(&audioSegments[i], &tmpChunk, inputChannels); diff --git a/dom/media/webaudio/AudioNodeStream.cpp b/dom/media/webaudio/AudioNodeStream.cpp index 0fa1e8ea3b..4e835ed144 100644 --- a/dom/media/webaudio/AudioNodeStream.cpp +++ b/dom/media/webaudio/AudioNodeStream.cpp @@ -409,7 +409,7 @@ AudioNodeStream::ObtainInputBlock(AudioBlock& aTmpChunk, { uint32_t inputCount = mInputs.Length(); uint32_t outputChannelCount = 1; - nsAutoTArray inputChunks; + AutoTArray inputChunks; for (uint32_t i = 0; i < inputCount; ++i) { if (aPortIndex != mInputs[i]->InputNumber()) { // This input is connected to a different port @@ -455,7 +455,7 @@ AudioNodeStream::ObtainInputBlock(AudioBlock& aTmpChunk, aTmpChunk.AllocateChannels(outputChannelCount); // The static storage here should be 1KB, so it's fine - nsAutoTArray downmixBuffer; + AutoTArray downmixBuffer; for (uint32_t i = 0; i < inputChunkCount; ++i) { AccumulateInputChunk(i, *inputChunks[i], &aTmpChunk, &downmixBuffer); @@ -468,7 +468,7 @@ AudioNodeStream::AccumulateInputChunk(uint32_t aInputIndex, AudioBlock* aBlock, nsTArray* aDownmixBuffer) { - nsAutoTArray channels; + AutoTArray channels; UpMixDownMixChunk(&aChunk, aBlock->ChannelCount(), channels, *aDownmixBuffer); for (uint32_t c = 0; c < channels.Length(); ++c) { @@ -510,7 +510,7 @@ AudioNodeStream::UpMixDownMixChunk(const AudioBlock* aChunk, } } else if (aOutputChannels.Length() > aOutputChannelCount) { if (mChannelInterpretation == ChannelInterpretation::Speakers) { - nsAutoTArray outputChannels; + AutoTArray outputChannels; outputChannels.SetLength(aOutputChannelCount); aDownmixBuffer.SetLength(aOutputChannelCount * WEBAUDIO_BLOCK_SIZE); for (uint32_t j = 0; j < aOutputChannelCount; ++j) { diff --git a/dom/media/webaudio/AudioNodeStream.h b/dom/media/webaudio/AudioNodeStream.h index f0832e072b..2882578c35 100644 --- a/dom/media/webaudio/AudioNodeStream.h +++ b/dom/media/webaudio/AudioNodeStream.h @@ -41,7 +41,7 @@ public: enum { AUDIO_TRACK = 1 }; - typedef nsAutoTArray OutputChunks; + typedef AutoTArray OutputChunks; // Flags re main thread updates and stream output. typedef unsigned Flags; diff --git a/dom/media/webaudio/DelayBuffer.h b/dom/media/webaudio/DelayBuffer.h index 6109e038f2..e55d0ba83a 100644 --- a/dom/media/webaudio/DelayBuffer.h +++ b/dom/media/webaudio/DelayBuffer.h @@ -94,7 +94,7 @@ private: // Circular buffer for capturing delayed samples. FallibleTArray mChunks; // Cache upmixed channel arrays. - nsAutoTArray mUpmixChannels; + AutoTArray mUpmixChannels; double mSmoothingRate; // Current delay, in fractional ticks double mCurrentDelay; diff --git a/dom/media/webaudio/WebAudioUtils.cpp b/dom/media/webaudio/WebAudioUtils.cpp index fc1936337d..ee869ccc82 100644 --- a/dom/media/webaudio/WebAudioUtils.cpp +++ b/dom/media/webaudio/WebAudioUtils.cpp @@ -34,8 +34,8 @@ WebAudioUtils::SpeexResamplerProcess(SpeexResamplerState* aResampler, float* aOut, uint32_t* aOutLen) { #ifdef MOZ_SAMPLE_TYPE_S16 - nsAutoTArray tmp1; - nsAutoTArray tmp2; + AutoTArray tmp1; + AutoTArray tmp2; tmp1.SetLength(*aInLen); tmp2.SetLength(*aOutLen); ConvertAudioSamples(aIn, tmp1.Elements(), *aInLen); @@ -53,7 +53,7 @@ WebAudioUtils::SpeexResamplerProcess(SpeexResamplerState* aResampler, const int16_t* aIn, uint32_t* aInLen, float* aOut, uint32_t* aOutLen) { - nsAutoTArray tmp; + AutoTArray tmp; #ifdef MOZ_SAMPLE_TYPE_S16 tmp.SetLength(*aOutLen); int result = speex_resampler_process_int(aResampler, aChannel, aIn, aInLen, tmp.Elements(), aOutLen); @@ -76,8 +76,8 @@ WebAudioUtils::SpeexResamplerProcess(SpeexResamplerState* aResampler, #ifdef MOZ_SAMPLE_TYPE_S16 return speex_resampler_process_int(aResampler, aChannel, aIn, aInLen, aOut, aOutLen); #else - nsAutoTArray tmp1; - nsAutoTArray tmp2; + AutoTArray tmp1; + AutoTArray tmp2; tmp1.SetLength(*aInLen); tmp2.SetLength(*aOutLen); ConvertAudioSamples(aIn, tmp1.Elements(), *aInLen); diff --git a/dom/media/webaudio/blink/HRTFElevation.cpp b/dom/media/webaudio/blink/HRTFElevation.cpp index c6e0430885..2300872f3a 100644 --- a/dom/media/webaudio/blink/HRTFElevation.cpp +++ b/dom/media/webaudio/blink/HRTFElevation.cpp @@ -128,7 +128,7 @@ nsReturnRef HRTFElevation::calculateKernelForAzimuthElevation(int az // Note that depending on the fftSize returned by the panner, we may be truncating the impulse response. const size_t resampledResponseLength = fftSizeForSampleRate(sampleRate) / 2; - nsAutoTArray resampled; + AutoTArray resampled; if (sampleRate == rawSampleRate) { resampledResponse = response; MOZ_ASSERT(resampledResponseLength == ResponseFrameSize); @@ -163,7 +163,7 @@ nsReturnRef HRTFElevation::calculateKernelForAzimuthElevation(int az } #ifdef MOZ_SAMPLE_TYPE_S16 - nsAutoTArray floatArray; + AutoTArray floatArray; floatArray.SetLength(resampledResponseLength); float *floatResponse = floatArray.Elements(); ConvertAudioSamples(resampledResponse, diff --git a/dom/media/webaudio/blink/Reverb.cpp b/dom/media/webaudio/blink/Reverb.cpp index 39f9d59c93..4fca0822b6 100644 --- a/dom/media/webaudio/blink/Reverb.cpp +++ b/dom/media/webaudio/blink/Reverb.cpp @@ -81,11 +81,11 @@ Reverb::Reverb(ThreadSharedFloatArrayBufferList* impulseResponse, size_t impulse { float scale = 1; - nsAutoTArray irChannels; + AutoTArray irChannels; for (size_t i = 0; i < impulseResponse->GetChannels(); ++i) { irChannels.AppendElement(impulseResponse->GetData(i)); } - nsAutoTArray tempBuf; + AutoTArray tempBuf; if (normalize) { scale = calculateNormalizationScale(impulseResponse, impulseResponseBufferLength, sampleRate); diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp index 4cf3fe57d4..ebc582bda9 100644 --- a/dom/media/webm/WebMDemuxer.cpp +++ b/dom/media/webm/WebMDemuxer.cpp @@ -389,8 +389,8 @@ WebMDemuxer::ReadMetadata() return NS_ERROR_FAILURE; } - nsAutoTArray headers; - nsAutoTArray headerLens; + AutoTArray headers; + AutoTArray headerLens; for (uint32_t header = 0; header < nheaders; ++header) { unsigned char* data = 0; size_t length = 0; diff --git a/dom/media/webrtc/MediaEngineDefault.cpp b/dom/media/webrtc/MediaEngineDefault.cpp index e9c25a505a..589a2238f3 100644 --- a/dom/media/webrtc/MediaEngineDefault.cpp +++ b/dom/media/webrtc/MediaEngineDefault.cpp @@ -514,7 +514,7 @@ MediaEngineDefaultAudioSource::AppendToSegment(AudioSegment& aSegment, int16_t* dest = static_cast(buffer->Data()); mSineGenerator->generate(dest, aSamples); - nsAutoTArray channels; + AutoTArray channels; channels.AppendElement(dest); aSegment.AppendFrames(buffer.forget(), channels, aSamples); } diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 4f44acec89..6b0fc2598e 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -652,7 +652,7 @@ MediaEngineWebRTCMicrophoneSource::Process(int channel, memcpy(dest, audio10ms, length * sizeof(sample)); nsAutoPtr segment(new AudioSegment()); - nsAutoTArray channels; + AutoTArray channels; channels.AppendElement(dest); segment->AppendFrames(buffer.forget(), channels, length); TimeStamp insertTime; diff --git a/dom/media/webspeech/recognition/SpeechRecognition.cpp b/dom/media/webspeech/recognition/SpeechRecognition.cpp index e53e749307..b0b1b61681 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.cpp +++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp @@ -932,7 +932,7 @@ SpeechRecognition::CreateAudioSegment(nsTArray>& aChunks) RefPtr buffer = aChunks[i]; const int16_t* chunkData = static_cast(buffer->Data()); - nsAutoTArray channels; + AutoTArray channels; channels.AppendElement(chunkData); segment->AppendFrames(buffer.forget(), channels, mAudioSamplesPerChunk); } @@ -959,7 +959,7 @@ SpeechRecognition::FeedAudioData(already_AddRefed aSamples, uint32_t samplesIndex = 0; const int16_t* samples = static_cast(refSamples->Data()); - nsAutoTArray, 5> chunksToSend; + AutoTArray, 5> chunksToSend; // fill up our buffer and make a chunk out of it, if possible if (mBufferedSamples > 0) { diff --git a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm index d78a99bb3c..7ccab6b51e 100644 --- a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm +++ b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm @@ -275,7 +275,7 @@ EnumVoicesRunnable::Run() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - nsAutoTArray list; + AutoTArray list; NSArray* voices = [NSSpeechSynthesizer availableVoices]; NSString* defaultVoice = [NSSpeechSynthesizer defaultVoice]; diff --git a/dom/media/webspeech/synth/nsSpeechTask.cpp b/dom/media/webspeech/synth/nsSpeechTask.cpp index a8cc2d13cd..aa038ceabe 100644 --- a/dom/media/webspeech/synth/nsSpeechTask.cpp +++ b/dom/media/webspeech/synth/nsSpeechTask.cpp @@ -323,7 +323,7 @@ nsSpeechTask::SendAudioImpl(RefPtr& aSamples, uint32_t aD } AudioSegment segment; - nsAutoTArray channelData; + AutoTArray channelData; channelData.AppendElement(static_cast(aSamples->Data())); segment.AppendFrames(aSamples.forget(), channelData, aDataLen); mStream->AppendToTrack(1, &segment); diff --git a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp index f32eac9b8e..f1d0e17ae9 100644 --- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp +++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp @@ -36,7 +36,7 @@ GetAllSpeechSynthActors(InfallibleTArray& MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aActors.IsEmpty()); - nsAutoTArray contentActors; + AutoTArray contentActors; mozilla::dom::ContentParent::GetAll(contentActors); for (uint32_t contentIndex = 0; @@ -44,7 +44,7 @@ GetAllSpeechSynthActors(InfallibleTArray& ++contentIndex) { MOZ_ASSERT(contentActors[contentIndex]); - AutoInfallibleTArray speechsynthActors; + AutoTArray speechsynthActors; contentActors[contentIndex]->ManagedPSpeechSynthesisParent(speechsynthActors); for (uint32_t speechsynthIndex = 0; diff --git a/dom/messagechannel/MessagePort.cpp b/dom/messagechannel/MessagePort.cpp index 967b665544..f577859763 100644 --- a/dom/messagechannel/MessagePort.cpp +++ b/dom/messagechannel/MessagePort.cpp @@ -474,10 +474,10 @@ MessagePort::PostMessage(JSContext* aCx, JS::Handle aMessage, MOZ_ASSERT(mActor); MOZ_ASSERT(mMessagesForTheOtherPort.IsEmpty()); - nsAutoTArray, 1> array; + AutoTArray, 1> array; array.AppendElement(data); - nsAutoTArray messages; + AutoTArray messages; SharedMessagePortMessage::FromSharedToMessagesChild(mActor, array, messages); mActor->SendPostMessages(messages); } diff --git a/dom/mobilemessage/ipc/SmsChild.cpp b/dom/mobilemessage/ipc/SmsChild.cpp index d0594450c9..5bc2289fc2 100644 --- a/dom/mobilemessage/ipc/SmsChild.cpp +++ b/dom/mobilemessage/ipc/SmsChild.cpp @@ -349,10 +349,10 @@ MobileMessageCursorChild::DoNotifyResult(const nsTArray& aDat const uint32_t length = aDataArray.Length(); MOZ_ASSERT(length); - AutoFallibleTArray autoArray; + AutoTArray autoArray; NS_ENSURE_TRUE_VOID(autoArray.SetCapacity(length, fallible)); - AutoFallibleTArray, 1> messages; + AutoTArray, 1> messages; NS_ENSURE_TRUE_VOID(messages.SetCapacity(length, fallible)); for (uint32_t i = 0; i < length; i++) { @@ -370,10 +370,10 @@ MobileMessageCursorChild::DoNotifyResult(const nsTArray& aDataArray) const uint32_t length = aDataArray.Length(); MOZ_ASSERT(length); - AutoFallibleTArray autoArray; + AutoTArray autoArray; NS_ENSURE_TRUE_VOID(autoArray.SetCapacity(length, fallible)); - AutoFallibleTArray, 1> threads; + AutoTArray, 1> threads; NS_ENSURE_TRUE_VOID(threads.SetCapacity(length, fallible)); for (uint32_t i = 0; i < length; i++) { diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp index 3ece59c174..7406fe0c5f 100644 --- a/dom/notification/Notification.cpp +++ b/dom/notification/Notification.cpp @@ -158,7 +158,7 @@ public: MOZ_ASSERT(ok); ErrorResult result; - nsAutoTArray, 5> notifications; + AutoTArray, 5> notifications; for (uint32_t i = 0; i < mStrings.Length(); ++i) { RefPtr n = @@ -2098,7 +2098,7 @@ public: RefPtr workerPromise = mPromiseProxy->WorkerPromise(); ErrorResult result; - nsAutoTArray, 5> notifications; + AutoTArray, 5> notifications; for (uint32_t i = 0; i < mStrings.Length(); ++i) { RefPtr n = Notification::ConstructFromFields(aWorkerPrivate->GlobalScope(), diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 6424042a55..439f87d2a7 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -1832,7 +1832,7 @@ _releasevariantvalue(NPVariant* variant) } else { void *p = (void *)s->UTF8Characters; DWORD nheaps = 0; - nsAutoTArray heaps; + AutoTArray heaps; nheaps = GetProcessHeaps(0, heaps.Elements()); heaps.AppendElements(nheaps); GetProcessHeaps(nheaps, heaps.Elements()); diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index 708d180bc7..dff177d10f 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -2053,7 +2053,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, if (NS_FAILED(rv)) return rv; - nsAutoTArray, 6> pluginFiles; + AutoTArray, 6> pluginFiles; bool hasMore; while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) { @@ -3617,7 +3617,7 @@ nsPluginHost::ParsePostBufferToFixHeaders(const char *inPostData, uint32_t inPos const char CRLFCRLF[] = {CR,LF,CR,LF,'\0'}; // C string"\r\n\r\n" const char ContentLenHeader[] = "Content-length"; - nsAutoTArray singleLF; + AutoTArray singleLF; const char *pSCntlh = 0;// pointer to start of ContentLenHeader in inPostData const char *pSod = 0; // pointer to start of data in inPostData const char *pEoh = 0; // pointer to end of headers in inPostData diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 2f0325fbe6..56459f52e8 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -903,7 +903,7 @@ nsPluginInstanceOwner::GetCompositionString(uint32_t aType, *aLength = aDist->Length(); return true; } - nsAutoTArray clauses; + AutoTArray clauses; clauses.AppendElement(0); for (TextRange& range : *ranges) { if (!range.IsClause()) { diff --git a/dom/plugins/base/nsPluginsDirUtils.h b/dom/plugins/base/nsPluginsDirUtils.h index 8fb907c0d1..178dc6968e 100644 --- a/dom/plugins/base/nsPluginsDirUtils.h +++ b/dom/plugins/base/nsPluginsDirUtils.h @@ -26,7 +26,7 @@ ParsePluginMimeDescription(const char *mdesc, nsPluginInfo &info) char *mdescDup = PL_strdup(mdesc); // make a dup of intput string we'll change it content char anEmptyString[] = ""; - nsAutoTArray tmpMimeTypeArr; + AutoTArray tmpMimeTypeArr; char delimiters[] = {':',':',';'}; int mimeTypeVariantCount = 0; char *p = mdescDup; // make a dup of intput string we'll change it content diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index e276f29394..27b6634040 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -2043,7 +2043,7 @@ PluginInstanceChild::ImmGetCompositionStringProc(HIMC aIMC, DWORD aIndex, if (!sCurrentPluginInstance) { return IMM_ERROR_GENERAL; } - nsAutoTArray dist; + AutoTArray dist; int32_t length = 0; // IMM_ERROR_NODATA sCurrentPluginInstance->SendGetCompositionString(aIndex, &dist, &length); if (length == IMM_ERROR_NODATA || length == IMM_ERROR_GENERAL) { diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 7694ca29df..f0bc626dd1 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -826,7 +826,7 @@ PluginInstanceParent::SetCurrentImage(Image* aImage) ImageContainer::NonOwningImage holder(aImage); holder.mFrameID = ++mFrameID; - nsAutoTArray imageList; + AutoTArray imageList; imageList.AppendElement(holder); mImageContainer->SetCurrentImages(imageList); @@ -978,7 +978,7 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect, gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(nullptr, surface); RefPtr image = new SourceSurfaceImage(surface->GetSize(), sourceSurface); - nsAutoTArray imageList; + AutoTArray imageList; imageList.AppendElement( ImageContainer::NonOwningImage(image)); diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index da1f09fb45..bd1079112b 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -363,7 +363,7 @@ private: bool _savedNestableTasksAllowed; }; - nsAutoTArray mIncallPumpingStack; + AutoTArray mIncallPumpingStack; static LRESULT CALLBACK NestedInputEventHook(int code, WPARAM wParam, diff --git a/dom/plugins/ipc/PluginScriptableObjectChild.cpp b/dom/plugins/ipc/PluginScriptableObjectChild.cpp index 29bc46fb9f..66bb3746ea 100644 --- a/dom/plugins/ipc/PluginScriptableObjectChild.cpp +++ b/dom/plugins/ipc/PluginScriptableObjectChild.cpp @@ -436,7 +436,7 @@ PluginScriptableObjectChild::ScriptableEnumerate(NPObject* aObject, NS_ASSERTION(actor, "This shouldn't ever be null!"); NS_ASSERTION(actor->Type() == Proxy, "Bad type!"); - AutoInfallibleTArray identifiers; + AutoTArray identifiers; bool success; actor->CallEnumerate(&identifiers, &success); @@ -775,7 +775,7 @@ PluginScriptableObjectChild::AnswerInvoke(const PluginIdentifier& aId, return true; } - AutoFallibleTArray convertedArgs; + AutoTArray convertedArgs; uint32_t argCount = aArgs.Length(); if (!convertedArgs.SetLength(argCount, mozilla::fallible)) { @@ -845,7 +845,7 @@ PluginScriptableObjectChild::AnswerInvokeDefault(InfallibleTArray&& aAr return true; } - AutoFallibleTArray convertedArgs; + AutoTArray convertedArgs; uint32_t argCount = aArgs.Length(); if (!convertedArgs.SetLength(argCount, mozilla::fallible)) { @@ -1096,7 +1096,7 @@ PluginScriptableObjectChild::AnswerConstruct(InfallibleTArray&& aArgs, return true; } - AutoFallibleTArray convertedArgs; + AutoTArray convertedArgs; uint32_t argCount = aArgs.Length(); if (!convertedArgs.SetLength(argCount, mozilla::fallible)) { diff --git a/dom/plugins/ipc/PluginScriptableObjectParent.cpp b/dom/plugins/ipc/PluginScriptableObjectParent.cpp index 5119df3b74..9f042cfc26 100644 --- a/dom/plugins/ipc/PluginScriptableObjectParent.cpp +++ b/dom/plugins/ipc/PluginScriptableObjectParent.cpp @@ -485,7 +485,7 @@ PluginScriptableObjectParent::ScriptableEnumerate(NPObject* aObject, return false; } - AutoInfallibleTArray identifiers; + AutoTArray identifiers; bool success; if (!actor->CallEnumerate(&identifiers, &success)) { NS_WARNING("Failed to send message!"); @@ -830,7 +830,7 @@ PluginScriptableObjectParent::AnswerInvoke(const PluginIdentifier& aId, return true; } - AutoFallibleTArray convertedArgs; + AutoTArray convertedArgs; uint32_t argCount = aArgs.Length(); if (!convertedArgs.SetLength(argCount, fallible)) { @@ -913,7 +913,7 @@ PluginScriptableObjectParent::AnswerInvokeDefault(InfallibleTArray&& aA return true; } - AutoFallibleTArray convertedArgs; + AutoTArray convertedArgs; uint32_t argCount = aArgs.Length(); if (!convertedArgs.SetLength(argCount, fallible)) { @@ -1233,7 +1233,7 @@ PluginScriptableObjectParent::AnswerConstruct(InfallibleTArray&& aArgs, return true; } - AutoFallibleTArray convertedArgs; + AutoTArray convertedArgs; uint32_t argCount = aArgs.Length(); if (!convertedArgs.SetLength(argCount, fallible)) { diff --git a/dom/power/PowerManager.cpp b/dom/power/PowerManager.cpp index 4f4a39748d..efe58b0f55 100644 --- a/dom/power/PowerManager.cpp +++ b/dom/power/PowerManager.cpp @@ -135,7 +135,7 @@ PowerManager::Callback(const nsAString &aTopic, const nsAString &aState) * because the callbacks may install new listeners. We expect no * more than one listener per window, so it shouldn't be too long. */ - nsAutoTArray, 2> listeners(mListeners); + AutoTArray, 2> listeners(mListeners); for (uint32_t i = 0; i < listeners.Length(); ++i) { listeners[i]->Callback(aTopic, aState); } diff --git a/dom/power/PowerManagerService.cpp b/dom/power/PowerManagerService.cpp index 76aad88410..eb704ae8d2 100644 --- a/dom/power/PowerManagerService.cpp +++ b/dom/power/PowerManagerService.cpp @@ -110,7 +110,7 @@ PowerManagerService::Notify(const WakeLockInformation& aWakeLockInfo) * because the callbacks may install new listeners. We expect no * more than one listener per window, so it shouldn't be too long. */ - nsAutoTArray, 2> listeners(mWakeLockListeners); + AutoTArray, 2> listeners(mWakeLockListeners); for (uint32_t i = 0; i < listeners.Length(); ++i) { listeners[i]->Callback(aWakeLockInfo.topic(), state); diff --git a/dom/quota/QuotaManager.cpp b/dom/quota/QuotaManager.cpp index 1688f44e28..e51c1b4051 100644 --- a/dom/quota/QuotaManager.cpp +++ b/dom/quota/QuotaManager.cpp @@ -1875,7 +1875,7 @@ QuotaObject::MaybeUpdateSize(int64_t aSize, bool aTruncate) if (newTemporaryStorageUsage > quotaManager->mTemporaryStorageLimit) { // This will block the thread without holding the lock while waitting. - nsAutoTArray, 10> locks; + AutoTArray, 10> locks; uint64_t sizeToBeFreed = quotaManager->LockedCollectOriginsForEviction(delta, locks); @@ -3163,7 +3163,7 @@ QuotaManager::OpenDirectoryInternal(Nullable aPersistenceType, // All the locks that block this new exclusive lock need to be invalidated. // We also need to notify clients to abort operations for them. - nsAutoTArray>, + AutoTArray>, Client::TYPE_MAX> origins; origins.SetLength(Client::TYPE_MAX); diff --git a/dom/quota/QuotaManager.h b/dom/quota/QuotaManager.h index eebf69e78d..defb0ac935 100644 --- a/dom/quota/QuotaManager.h +++ b/dom/quota/QuotaManager.h @@ -493,7 +493,7 @@ private: // by any mutex but it is only ever touched on the IO thread. nsTArray mInitializedOrigins; - nsAutoTArray, Client::TYPE_MAX> mClients; + AutoTArray, Client::TYPE_MAX> mClients; nsString mIndexedDBPath; nsString mStoragePath; diff --git a/dom/svg/SVGLengthList.h b/dom/svg/SVGLengthList.h index 4d11e1afb9..7ca07d1da3 100644 --- a/dom/svg/SVGLengthList.h +++ b/dom/svg/SVGLengthList.h @@ -130,20 +130,20 @@ protected: /* Rationale for using nsTArray and not nsTArray: * - * It might seem like we should use nsAutoTArray instead of + * It might seem like we should use AutoTArray instead of * nsTArray. That would preallocate space for one SVGLength and * avoid an extra memory allocation call in the common case of the 'x' * and 'y' attributes each containing a single length (and the 'dx' and 'dy' * attributes being empty). However, consider this: * - * An empty nsTArray uses sizeof(Header*). An nsAutoTArray on the other hand uses sizeof(Header*) + * (2 * sizeof(uint32_t)) + (N * sizeof(E)), which for one SVGLength is * sizeof(Header*) + 16 bytes. * * Now consider that for text elements we have four length list attributes * (x, y, dx, dy), each of which can have a baseVal and an animVal list. If - * we were to go the nsAutoTArray route for each of these, we'd + * we were to go the AutoTArray route for each of these, we'd * end up using at least 160 bytes for these four attributes alone, even * though we only need storage for two SVGLengths (16 bytes) in the common * case!! diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini index 14818b133b..ff3bdc3c93 100644 --- a/dom/tests/mochitest/general/mochitest.ini +++ b/dom/tests/mochitest/general/mochitest.ini @@ -73,6 +73,7 @@ skip-if = e10s || buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'androi [test_for_of.html] [test_frameElementWrapping.html] [test_pointerPreserves3D.html] +[test_pointerPreserves3DClip.html] [test_framedhistoryframes.html] [test_idleapi_permissions.html] skip-if = e10s || buildapp == 'b2g' || buildapp == 'mulet' diff --git a/dom/tests/mochitest/general/test_pointerPreserves3DClip.html b/dom/tests/mochitest/general/test_pointerPreserves3DClip.html new file mode 100644 index 0000000000..29c8f3e7e6 --- /dev/null +++ b/dom/tests/mochitest/general/test_pointerPreserves3DClip.html @@ -0,0 +1,55 @@ + + + + Test for pointer events with preserve-3d and clips + + + + + +
    +
    +
    +
    +
    +
    +
    +
    + + + diff --git a/dom/voicemail/Voicemail.h b/dom/voicemail/Voicemail.h index 50cfd6c0a2..1817b70d6a 100644 --- a/dom/voicemail/Voicemail.h +++ b/dom/voicemail/Voicemail.h @@ -87,7 +87,7 @@ private: // |mStatuses| keeps all instantiated VoicemailStatus objects as well as the // empty slots for not interested ones. The length of |mStatuses| is decided // in the constructor and is never changed ever since. - nsAutoTArray, 1> mStatuses; + AutoTArray, 1> mStatuses; // Return a nsIVoicemailProvider instance based on the requests from external // components. Return nullptr if aOptionalServiceId contains an invalid diff --git a/dom/workers/Queue.h b/dom/workers/Queue.h index f4f87e985a..c7a99158bf 100644 --- a/dom/workers/Queue.h +++ b/dom/workers/Queue.h @@ -17,7 +17,7 @@ BEGIN_WORKERS_NAMESPACE template struct StorageWithTArray { - typedef nsAutoTArray StorageType; + typedef AutoTArray StorageType; static void Reverse(StorageType& aStorage) { diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index a7b47ab01b..62ee125cc5 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -126,7 +126,7 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1, PR_BEGIN_MACRO \ AssertIsOnMainThread(); \ \ - nsAutoTArray workers; \ + AutoTArray workers; \ { \ MutexAutoLock lock(mMutex); \ \ @@ -1783,7 +1783,7 @@ RuntimeService::ShutdownIdleThreads(nsITimer* aTimer, void* /* aClosure */) TimeStamp nextExpiration; - nsAutoTArray, 20> expiredThreads; + AutoTArray, 20> expiredThreads; { MutexAutoLock lock(runtime->mMutex); @@ -1987,7 +1987,7 @@ RuntimeService::Shutdown() { MutexAutoLock lock(mMutex); - nsAutoTArray workers; + AutoTArray workers; AddAllTopLevelWorkersToArray(workers); if (!workers.IsEmpty()) { @@ -2028,7 +2028,7 @@ RuntimeService::Cleanup() { MutexAutoLock lock(mMutex); - nsAutoTArray workers; + AutoTArray workers; AddAllTopLevelWorkersToArray(workers); if (!workers.IsEmpty()) { @@ -2037,7 +2037,7 @@ RuntimeService::Cleanup() // Shut down any idle threads. if (!mIdleThreadArray.IsEmpty()) { - nsAutoTArray, 20> idleThreads; + AutoTArray, 20> idleThreads; uint32_t idleThreadCount = mIdleThreadArray.Length(); idleThreads.SetLength(idleThreadCount); @@ -2192,7 +2192,7 @@ RuntimeService::CancelWorkersForWindow(nsPIDOMWindow* aWindow) { AssertIsOnMainThread(); - nsAutoTArray workers; + AutoTArray workers; GetWorkersForWindow(aWindow, workers); if (!workers.IsEmpty()) { @@ -2220,7 +2220,7 @@ RuntimeService::FreezeWorkersForWindow(nsPIDOMWindow* aWindow) AssertIsOnMainThread(); MOZ_ASSERT(aWindow); - nsAutoTArray workers; + AutoTArray workers; GetWorkersForWindow(aWindow, workers); if (!workers.IsEmpty()) { @@ -2244,7 +2244,7 @@ RuntimeService::ThawWorkersForWindow(nsPIDOMWindow* aWindow) AssertIsOnMainThread(); MOZ_ASSERT(aWindow); - nsAutoTArray workers; + AutoTArray workers; GetWorkersForWindow(aWindow, workers); if (!workers.IsEmpty()) { @@ -2268,7 +2268,7 @@ RuntimeService::SuspendWorkersForWindow(nsPIDOMWindow* aWindow) AssertIsOnMainThread(); MOZ_ASSERT(aWindow); - nsAutoTArray workers; + AutoTArray workers; GetWorkersForWindow(aWindow, workers); for (uint32_t index = 0; index < workers.Length(); index++) { @@ -2282,7 +2282,7 @@ RuntimeService::ResumeWorkersForWindow(nsPIDOMWindow* aWindow) AssertIsOnMainThread(); MOZ_ASSERT(aWindow); - nsAutoTArray workers; + AutoTArray workers; GetWorkersForWindow(aWindow, workers); for (uint32_t index = 0; index < workers.Length(); index++) { diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp index 8af3911708..c1d0fd0b29 100644 --- a/dom/workers/ServiceWorkerEvents.cpp +++ b/dom/workers/ServiceWorkerEvents.cpp @@ -200,7 +200,7 @@ public: mChannel->SynthesizeStatus(mInternalResponse->GetUnfilteredStatus(), mInternalResponse->GetUnfilteredStatusText()); - nsAutoTArray entries; + AutoTArray entries; mInternalResponse->UnfilteredHeaders()->GetEntries(entries); for (uint32_t i = 0; i < entries.Length(); ++i) { mChannel->SynthesizeHeader(entries[i].mName, entries[i].mValue); diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index 398fa6d080..1b3923aa53 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -2528,7 +2528,7 @@ ServiceWorkerManager::ReportToAllClients(const nsCString& aScope, return; } - nsAutoTArray windows; + AutoTArray windows; // Report errors to every controlled document. for (auto iter = mControlledDocuments.Iter(); !iter.Done(); iter.Next()) { @@ -5047,7 +5047,7 @@ public: } private: - nsAutoTArray, 1> mInstances; + AutoTArray, 1> mInstances; ServiceWorkerState mState; }; diff --git a/dom/workers/ServiceWorkerManager.h b/dom/workers/ServiceWorkerManager.h index 15b89fe853..5bbc527d92 100644 --- a/dom/workers/ServiceWorkerManager.h +++ b/dom/workers/ServiceWorkerManager.h @@ -208,7 +208,7 @@ private: // addition and removal. // There is a high chance of there being at least one ServiceWorker // associated with this all the time. - nsAutoTArray mInstances; + AutoTArray mInstances; RefPtr mServiceWorkerPrivate; bool mSkipWaitingFlag; diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index f33ec5d560..ad0154fae7 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -3101,14 +3101,14 @@ WorkerPrivateParent::BroadcastErrorToSharedWorkers( { AssertIsOnMainThread(); - nsAutoTArray, 10> sharedWorkers; + AutoTArray, 10> sharedWorkers; GetAllSharedWorkers(sharedWorkers); if (sharedWorkers.IsEmpty()) { return; } - nsAutoTArray windowActions; + AutoTArray windowActions; nsresult rv; // First fire the error event at all SharedWorker objects. This may include @@ -5184,7 +5184,7 @@ WorkerPrivate::NotifyFeatures(JSContext* aCx, Status aStatus) } } - nsAutoTArray children; + AutoTArray children; children.AppendElements(mChildWorkers); for (uint32_t index = 0; index < children.Length(); index++) { @@ -5980,7 +5980,7 @@ WorkerPrivate::RunExpiredTimeouts(JSContext* aCx) // early. Fudge the value of now to at least include the first timeout. const TimeStamp now = std::max(TimeStamp::Now(), mTimeouts[0]->mTargetTime); - nsAutoTArray expiredTimeouts; + AutoTArray expiredTimeouts; for (uint32_t index = 0; index < mTimeouts.Length(); index++) { nsAutoPtr& info = mTimeouts[index]; if (info->mTargetTime > now) { diff --git a/dom/xbl/nsXBLEventHandler.cpp b/dom/xbl/nsXBLEventHandler.cpp index 790ee374b1..2522419f8e 100644 --- a/dom/xbl/nsXBLEventHandler.cpp +++ b/dom/xbl/nsXBLEventHandler.cpp @@ -140,7 +140,7 @@ nsXBLKeyEventHandler::HandleEvent(nsIDOMEvent* aEvent) if (!key) return NS_OK; - nsAutoTArray accessKeys; + AutoTArray accessKeys; nsContentUtils::GetAccelKeyCandidates(key, accessKeys); if (accessKeys.IsEmpty()) { diff --git a/dom/xbl/nsXBLService.cpp b/dom/xbl/nsXBLService.cpp index 4e0e5f0d72..f4623d0eeb 100644 --- a/dom/xbl/nsXBLService.cpp +++ b/dom/xbl/nsXBLService.cpp @@ -188,7 +188,7 @@ private: ~nsXBLStreamListener(); nsCOMPtr mInner; - nsAutoTArray mBindingRequests; + AutoTArray mBindingRequests; nsCOMPtr mBoundDocument; nsCOMPtr mSink; // Only set until OnStartRequest @@ -647,7 +647,7 @@ nsXBLService::GetBinding(nsIContent* aBoundElement, nsIURI* aURI, bool* aIsReady, nsXBLBinding** aResult) { // More than 6 binding URIs are rare, see bug 55070 comment 18. - nsAutoTArray, 6> uris; + AutoTArray, 6> uris; return GetBinding(aBoundElement, aURI, aPeekOnly, aOriginPrincipal, aIsReady, aResult, uris); } diff --git a/dom/xbl/nsXBLWindowKeyHandler.cpp b/dom/xbl/nsXBLWindowKeyHandler.cpp index 59385c40ec..dda51272e2 100644 --- a/dom/xbl/nsXBLWindowKeyHandler.cpp +++ b/dom/xbl/nsXBLWindowKeyHandler.cpp @@ -441,7 +441,7 @@ nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent, bool aExecute, bool* aOutReservedForChrome) { - nsAutoTArray accessKeys; + AutoTArray accessKeys; nsContentUtils::GetAccelKeyCandidates(aKeyEvent, accessKeys); if (accessKeys.IsEmpty()) { diff --git a/dom/xslt/base/txURIUtils.cpp b/dom/xslt/base/txURIUtils.cpp index 33f7e919aa..201f5d3954 100644 --- a/dom/xslt/base/txURIUtils.cpp +++ b/dom/xslt/base/txURIUtils.cpp @@ -17,30 +17,6 @@ using mozilla::LoadInfo; * A set of utilities for handling URIs **/ -/** - * Resolves the given href argument, using the given documentBase - * if necessary. - * The new resolved href will be appended to the given dest String -**/ -void URIUtils::resolveHref(const nsAString& href, const nsAString& base, - nsAString& dest) { - if (base.IsEmpty()) { - dest.Append(href); - return; - } - if (href.IsEmpty()) { - dest.Append(base); - return; - } - nsCOMPtr pURL; - nsAutoString resultHref; - nsresult result = NS_NewURI(getter_AddRefs(pURL), base); - if (NS_SUCCEEDED(result)) { - NS_MakeAbsoluteURI(resultHref, href, pURL); - dest.Append(resultHref); - } -} //-- resolveHref - // static void URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode) diff --git a/dom/xslt/base/txURIUtils.h b/dom/xslt/base/txURIUtils.h index ca38538a8b..188f7224df 100644 --- a/dom/xslt/base/txURIUtils.h +++ b/dom/xslt/base/txURIUtils.h @@ -23,14 +23,6 @@ public: * Reset the given document with the document of the source node */ static void ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode); - - /** - * Resolves the given href argument, using the given documentBase - * if necessary. - * The new resolved href will be appended to the given dest String - **/ - static void resolveHref(const nsAString& href, const nsAString& base, - nsAString& dest); }; //-- URIUtils /* */ diff --git a/dom/xslt/tests/mochitest/file_bug1222624.xml b/dom/xslt/tests/mochitest/file_bug1222624.xml new file mode 100644 index 0000000000..c8290a3380 --- /dev/null +++ b/dom/xslt/tests/mochitest/file_bug1222624.xml @@ -0,0 +1,4 @@ + + + file_bug1222624_data2.xml + diff --git a/dom/xslt/tests/mochitest/file_bug1222624.xsl b/dom/xslt/tests/mochitest/file_bug1222624.xsl new file mode 100644 index 0000000000..cf954c4fc8 --- /dev/null +++ b/dom/xslt/tests/mochitest/file_bug1222624.xsl @@ -0,0 +1,12 @@ + + + + + + + + ! + + + + diff --git a/dom/xslt/tests/mochitest/file_bug1222624_data1.xml b/dom/xslt/tests/mochitest/file_bug1222624_data1.xml new file mode 100644 index 0000000000..f50fdbc1cb --- /dev/null +++ b/dom/xslt/tests/mochitest/file_bug1222624_data1.xml @@ -0,0 +1 @@ +doc1 diff --git a/dom/xslt/tests/mochitest/file_bug1222624_data2.xml b/dom/xslt/tests/mochitest/file_bug1222624_data2.xml new file mode 100644 index 0000000000..e6228590c1 --- /dev/null +++ b/dom/xslt/tests/mochitest/file_bug1222624_data2.xml @@ -0,0 +1 @@ +doc2 diff --git a/dom/xslt/tests/mochitest/file_bug1222624_sub.xsl b/dom/xslt/tests/mochitest/file_bug1222624_sub.xsl new file mode 100644 index 0000000000..189031a1f3 --- /dev/null +++ b/dom/xslt/tests/mochitest/file_bug1222624_sub.xsl @@ -0,0 +1,4 @@ + + + + diff --git a/dom/xslt/tests/mochitest/file_bug1222624_sub_sub.xsl b/dom/xslt/tests/mochitest/file_bug1222624_sub_sub.xsl new file mode 100644 index 0000000000..881e4c55bc --- /dev/null +++ b/dom/xslt/tests/mochitest/file_bug1222624_sub_sub.xsl @@ -0,0 +1,6 @@ + + + + + + diff --git a/dom/xslt/tests/mochitest/mochitest.ini b/dom/xslt/tests/mochitest/mochitest.ini index 53a6d001cd..08ae189808 100644 --- a/dom/xslt/tests/mochitest/mochitest.ini +++ b/dom/xslt/tests/mochitest/mochitest.ini @@ -16,5 +16,7 @@ [test_bug667315.html] [test_bug1135764.html] support-files = file_bug1135764.xml file_bug1135764.xsl +[test_bug1222624.html] +support-files = file_bug1222624.xml file_bug1222624.xsl file_bug1222624_sub.xsl file_bug1222624_sub_sub.xsl file_bug1222624_data1.xml file_bug1222624_data2.xml [test_exslt_regex.html] [test_parameter.html] diff --git a/dom/xslt/tests/mochitest/test_bug1222624.html b/dom/xslt/tests/mochitest/test_bug1222624.html new file mode 100644 index 0000000000..be016a4701 --- /dev/null +++ b/dom/xslt/tests/mochitest/test_bug1222624.html @@ -0,0 +1,50 @@ + + + + + Test for Bug 1222624 + + + + +Mozilla Bug 1222624 +

    + +
    +
    +
    + + diff --git a/dom/xslt/xml/txXMLParser.cpp b/dom/xslt/xml/txXMLParser.cpp index 0cf281f2cf..8882cdfbf8 100644 --- a/dom/xslt/xml/txXMLParser.cpp +++ b/dom/xslt/xml/txXMLParser.cpp @@ -15,20 +15,14 @@ #include "nsIPrincipal.h" nsresult -txParseDocumentFromURI(const nsAString& aHref, - const txXPathNode& aLoader, +txParseDocumentFromURI(nsIURI* aUri, + nsIDocument* aLoadingDocument, nsAString& aErrMsg, txXPathNode** aResult) { - NS_ENSURE_ARG_POINTER(aResult); *aResult = nullptr; - nsCOMPtr documentURI; - nsresult rv = NS_NewURI(getter_AddRefs(documentURI), aHref); - NS_ENSURE_SUCCESS(rv, rv); - nsIDocument* loaderDocument = txXPathNativeNode::getDocument(aLoader); - - nsCOMPtr loadGroup = loaderDocument->GetDocumentLoadGroup(); + nsCOMPtr loadGroup = aLoadingDocument->GetDocumentLoadGroup(); // For the system principal loaderUri will be null here, which is good // since that means that chrome documents can load any uri. @@ -36,20 +30,24 @@ txParseDocumentFromURI(const nsAString& aHref, // Raw pointer, we want the resulting txXPathNode to hold a reference to // the document. nsIDOMDocument* theDocument = nullptr; - nsAutoSyncOperation sync(loaderDocument); - rv = nsSyncLoadService::LoadDocument(documentURI, - nsIContentPolicy::TYPE_INTERNAL_XMLHTTPREQUEST, - loaderDocument->NodePrincipal(), - nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS, - loadGroup, true, - loaderDocument->GetReferrerPolicy(), - &theDocument); + nsAutoSyncOperation sync(aLoadingDocument); + nsresult rv = + nsSyncLoadService::LoadDocument(aUri, + nsIContentPolicy::TYPE_INTERNAL_XMLHTTPREQUEST, + aLoadingDocument->NodePrincipal(), + nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS, + loadGroup, + true, + aLoadingDocument->GetReferrerPolicy(), + &theDocument); if (NS_FAILED(rv)) { aErrMsg.AppendLiteral("Document load of "); - aErrMsg.Append(aHref); + nsAutoCString spec; + aUri->GetSpec(spec); + aErrMsg.Append(NS_ConvertUTF8toUTF16(spec)); aErrMsg.AppendLiteral(" failed."); - return NS_FAILED(rv) ? rv : NS_ERROR_FAILURE; + return rv; } *aResult = txXPathNativeNode::createXPathNode(theDocument); diff --git a/dom/xslt/xml/txXMLParser.h b/dom/xslt/xml/txXMLParser.h index fea9defe34..2153d90dc1 100644 --- a/dom/xslt/xml/txXMLParser.h +++ b/dom/xslt/xml/txXMLParser.h @@ -9,6 +9,8 @@ #include "txCore.h" class txXPathNode; +class nsIURI; +class nsIDocument; /** * API to load XML files into DOM datastructures. @@ -20,7 +22,9 @@ class txXPathNode; * of the document aLoader. */ extern "C" nsresult -txParseDocumentFromURI(const nsAString& aHref, const txXPathNode& aLoader, - nsAString& aErrMsg, txXPathNode** aResult); +txParseDocumentFromURI(nsIURI* aUri, + nsIDocument* aLoadingDocument, + nsAString& aErrMsg, + txXPathNode** aResult); #endif diff --git a/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp b/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp index c0338ec0e6..fee671ea59 100644 --- a/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp +++ b/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp @@ -563,9 +563,9 @@ txXPathNodeUtils::getXSLTId(const txXPathNode& aNode, /* static */ void -txXPathNodeUtils::getBaseURI(const txXPathNode& aNode, nsAString& aURI) +txXPathNodeUtils::getBaseURI(const txXPathNode& aNode, nsIURI** aUri) { - aNode.mNode->GetBaseURI(aURI); + *aUri = aNode.mNode->GetBaseURI().take(); } /* static */ @@ -604,7 +604,7 @@ txXPathNodeUtils::comparePosition(const txXPathNode& aNode, // same tree. // Get parents up the tree. - nsAutoTArray parents, otherParents; + AutoTArray parents, otherParents; nsINode* node = aNode.mNode; nsINode* otherNode = aOtherNode.mNode; nsINode* parent; diff --git a/dom/xslt/xpath/txXPathTreeWalker.h b/dom/xslt/xpath/txXPathTreeWalker.h index 26cb42ddd4..1c66f2c8ba 100644 --- a/dom/xslt/xpath/txXPathTreeWalker.h +++ b/dom/xslt/xpath/txXPathTreeWalker.h @@ -93,7 +93,7 @@ public: static nsresult getXSLTId(const txXPathNode& aNode, const txXPathNode& aBase, nsAString& aResult); static void release(txXPathNode* aNode); - static void getBaseURI(const txXPathNode& aNode, nsAString& aURI); + static void getBaseURI(const txXPathNode& aNode, nsIURI** aURI); static int comparePosition(const txXPathNode& aNode, const txXPathNode& aOtherNode); static bool localNameEquals(const txXPathNode& aNode, diff --git a/dom/xslt/xslt/txDocumentFunctionCall.cpp b/dom/xslt/xslt/txDocumentFunctionCall.cpp index 2a35f7ff7c..1de5cf75c8 100644 --- a/dom/xslt/xslt/txDocumentFunctionCall.cpp +++ b/dom/xslt/xslt/txDocumentFunctionCall.cpp @@ -14,48 +14,32 @@ #include "txExecutionState.h" #include "txURIUtils.h" #include "nsIURI.h" - -/* - * Creates a new DocumentFunctionCall. - */ -DocumentFunctionCall::DocumentFunctionCall(nsIURI* aBaseURI) -{ - nsCString spec; - aBaseURI->GetSpec(spec); - mBaseURI = NS_ConvertUTF8toUTF16(spec); -} +#include "nsNetUtil.h" static void -retrieveNode(txExecutionState* aExecutionState, const nsAString& aUri, - const nsAString& aBaseUri, txNodeSet* aNodeSet) +retrieveNode(txExecutionState* aExecutionState, + const nsAString& aUri, + nsIURI* aBaseUri, + txNodeSet* aNodeSet) { - nsAutoString absUrl; - URIUtils::resolveHref(aUri, aBaseUri, absUrl); - - int32_t hash = absUrl.RFindChar(char16_t('#')); - uint32_t urlEnd, fragStart, fragEnd; - if (hash == kNotFound) { - urlEnd = absUrl.Length(); - fragStart = 0; - fragEnd = 0; - } - else { - urlEnd = hash; - fragStart = hash + 1; - fragEnd = absUrl.Length(); + nsCOMPtr uri; + nsresult rv = NS_NewURI(getter_AddRefs(uri), aUri, nullptr, aBaseUri); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; } - nsDependentSubstring docUrl(absUrl, 0, urlEnd); - nsDependentSubstring frag(absUrl, fragStart, fragEnd); + nsAutoCString frag; + uri->GetRef(frag); + uri->SetRef(EmptyCString()); - const txXPathNode* loadNode = aExecutionState->retrieveDocument(docUrl); + const txXPathNode* loadNode = aExecutionState->retrieveDocument(uri); if (loadNode) { if (frag.IsEmpty()) { aNodeSet->add(*loadNode); } else { txXPathTreeWalker walker(*loadNode); - if (walker.moveToElementById(frag)) { + if (walker.moveToElementById(NS_ConvertUTF8toUTF16(frag))) { aNodeSet->add(walker.getCurrentPosition()); } } @@ -90,7 +74,7 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext, rv = mParams[0]->evaluate(aContext, getter_AddRefs(exprResult1)); NS_ENSURE_SUCCESS(rv, rv); - nsAutoString baseURI; + nsCOMPtr baseURI; bool baseURISet = false; if (mParams.Length() == 2) { @@ -107,7 +91,8 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext, baseURISet = true; if (!nodeSet2->isEmpty()) { - txXPathNodeUtils::getBaseURI(nodeSet2->get(0), baseURI); + txXPathNodeUtils::getBaseURI(nodeSet2->get(0), + getter_AddRefs(baseURI)); } } @@ -124,7 +109,7 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext, if (!baseURISet) { // if the second argument wasn't specified, use // the baseUri of node itself - txXPathNodeUtils::getBaseURI(node, baseURI); + txXPathNodeUtils::getBaseURI(node, getter_AddRefs(baseURI)); } retrieveNode(es, uriStr, baseURI, nodeSet); } @@ -137,8 +122,8 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext, // The first argument is not a NodeSet nsAutoString uriStr; exprResult1->stringValue(uriStr); - const nsAString* base = baseURISet ? &baseURI : &mBaseURI; - retrieveNode(es, uriStr, *base, nodeSet); + nsIURI* base = baseURISet ? baseURI.get() : mBaseURI.get(); + retrieveNode(es, uriStr, base, nodeSet); NS_ADDREF(*aResult = nodeSet); diff --git a/dom/xslt/xslt/txExecutionState.cpp b/dom/xslt/xslt/txExecutionState.cpp index 44139ef34e..527e5a4a24 100644 --- a/dom/xslt/xslt/txExecutionState.cpp +++ b/dom/xslt/xslt/txExecutionState.cpp @@ -21,27 +21,28 @@ txLoadedDocumentsHash::init(txXPathNode* aSourceDocument) { mSourceDocument = aSourceDocument; - nsAutoString baseURI; - txXPathNodeUtils::getBaseURI(*mSourceDocument, baseURI); + nsCOMPtr baseURI; + txXPathNodeUtils::getBaseURI(*mSourceDocument, getter_AddRefs(baseURI)); - PutEntry(baseURI)->mDocument = mSourceDocument; + LookupOrAdd(baseURI)->mDocument = mSourceDocument; } txLoadedDocumentsHash::~txLoadedDocumentsHash() { if (mSourceDocument) { - nsAutoString baseURI; - txXPathNodeUtils::getBaseURI(*mSourceDocument, baseURI); + nsCOMPtr baseURI; + txXPathNodeUtils::getBaseURI(*mSourceDocument, getter_AddRefs(baseURI)); - txLoadedDocumentEntry* entry = GetEntry(baseURI); - if (entry) { - delete entry->mDocument.forget(); + txLoadedDocumentInfo* info = Get(baseURI); + if (info) { + delete info->mDocument.forget(); } } } txExecutionState::txExecutionState(txStylesheet* aStylesheet, - bool aDisableLoads) + bool aDisableLoads, + nsIDocument* aLoadingDocument) : mOutputHandler(nullptr), mResultHandler(nullptr), mStylesheet(aStylesheet), @@ -51,6 +52,7 @@ txExecutionState::txExecutionState(txStylesheet* aStylesheet, mEvalContext(nullptr), mInitialEvalContext(nullptr), mGlobalParams(nullptr), + mLoadingDocument(aLoadingDocument), mKeyHash(aStylesheet->getKeyMap()), mDisableLoads(aDisableLoads) { @@ -406,41 +408,48 @@ txExecutionState::getEvalContext() } const txXPathNode* -txExecutionState::retrieveDocument(const nsAString& aUri) +txExecutionState::retrieveDocument(nsIURI* aUri) { - NS_ASSERTION(!aUri.Contains(char16_t('#')), - "Remove the fragment."); +#ifdef DEBUG + { + bool hasFrag; + aUri->GetHasRef(&hasFrag); + MOZ_ASSERT(!hasFrag, "Remove the fragment"); + } +#endif - if (mDisableLoads) { + if (mDisableLoads || !mLoadingDocument) { return nullptr; } - MOZ_LOG(txLog::xslt, LogLevel::Debug, - ("Retrieve Document %s", NS_LossyConvertUTF16toASCII(aUri).get())); + if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Debug)) { + nsAutoCString spec; + aUri->GetSpec(spec); + MOZ_LOG(txLog::xslt, LogLevel::Debug, + ("Retrieve Document %s", spec.get())); + } // try to get already loaded document - txLoadedDocumentEntry *entry = mLoadedDocuments.PutEntry(aUri); - if (!entry) { - return nullptr; - } + txLoadedDocumentInfo* info = mLoadedDocuments.LookupOrAdd(aUri); - if (!entry->mDocument && !entry->LoadingFailed()) { + if (!info->mDocument && !info->LoadingFailed()) { // open URI nsAutoString errMsg; - // XXX we should get the loader from the actual node - // triggering the load, but this will do for the time being - entry->mLoadResult = - txParseDocumentFromURI(aUri, *mLoadedDocuments.mSourceDocument, - errMsg, getter_Transfers(entry->mDocument)); + info->mLoadResult = + txParseDocumentFromURI(aUri, mLoadingDocument, + errMsg, getter_Transfers(info->mDocument)); - if (entry->LoadingFailed()) { + if (info->LoadingFailed()) { + nsAutoCString spec; + aUri->GetSpec(spec); receiveError(NS_LITERAL_STRING("Couldn't load document '") + - aUri + NS_LITERAL_STRING("': ") + errMsg, - entry->mLoadResult); + NS_ConvertUTF8toUTF16(spec) + + NS_LITERAL_STRING("': ") + errMsg, + info->mLoadResult); } } - return entry->mDocument; + return info->mDocument; } nsresult diff --git a/dom/xslt/xslt/txExecutionState.h b/dom/xslt/xslt/txExecutionState.h index 64fda56a88..63b48c16dd 100644 --- a/dom/xslt/xslt/txExecutionState.h +++ b/dom/xslt/xslt/txExecutionState.h @@ -17,24 +17,19 @@ #include "txStylesheet.h" #include "txXPathTreeWalker.h" #include "nsTArray.h" +#include "nsURIHashKey.h" class txAOutputHandlerFactory; class txAXMLEventHandler; class txInstruction; -class txLoadedDocumentEntry : public nsStringHashKey +class txLoadedDocumentInfo { public: - explicit txLoadedDocumentEntry(KeyTypePointer aStr) : nsStringHashKey(aStr), - mLoadResult(NS_OK) + explicit txLoadedDocumentInfo() : mLoadResult(NS_OK) { } - txLoadedDocumentEntry(const txLoadedDocumentEntry& aToCopy) - : nsStringHashKey(aToCopy) - { - NS_ERROR("We're horked."); - } - ~txLoadedDocumentEntry() + ~txLoadedDocumentInfo() { if (mDocument) { txXPathNodeUtils::release(mDocument); @@ -52,11 +47,11 @@ public: nsresult mLoadResult; }; -class txLoadedDocumentsHash : public nsTHashtable +class txLoadedDocumentsHash : public nsClassHashtable { public: txLoadedDocumentsHash() - : nsTHashtable(4), + : nsClassHashtable(4), mSourceDocument(nullptr) { } @@ -72,7 +67,8 @@ private: class txExecutionState : public txIMatchContext { public: - txExecutionState(txStylesheet* aStylesheet, bool aDisableLoads); + txExecutionState(txStylesheet* aStylesheet, bool aDisableLoads, + nsIDocument* aLoaderDocument); ~txExecutionState(); nsresult init(const txXPathNode& aNode, txOwningExpandedNameMap* aGlobalParams); @@ -117,7 +113,7 @@ public: // state-getting functions txIEvalContext* getEvalContext(); - const txXPathNode* retrieveDocument(const nsAString& aUri); + const txXPathNode* retrieveDocument(nsIURI* aUri); nsresult getKeyNodes(const txExpandedName& aKeyName, const txXPathNode& aRoot, const nsAString& aKeyValue, bool aIndexIfNotFound, @@ -164,13 +160,14 @@ private: RefPtr mGlobalVarPlaceholderValue; int32_t mRecursionDepth; - AutoInfallibleTArray mTemplateRules; + AutoTArray mTemplateRules; txIEvalContext* mEvalContext; txIEvalContext* mInitialEvalContext; //Document* mRTFDocument; txOwningExpandedNameMap* mGlobalParams; + nsCOMPtr mLoadingDocument; txLoadedDocumentsHash mLoadedDocuments; txKeyHash mKeyHash; RefPtr mRecycler; diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp index d70473a341..798aa3e021 100644 --- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp +++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp @@ -667,7 +667,7 @@ txMozillaXSLTProcessor::TransformToDoc(nsIDOMDocument **aResult, sourceDOMDocument = do_QueryInterface(mSource); } - txExecutionState es(mStylesheet, IsLoadDisabled()); + txExecutionState es(mStylesheet, IsLoadDisabled(), getLoaderDoc()); // XXX Need to add error observers @@ -735,7 +735,7 @@ txMozillaXSLTProcessor::TransformToFragment(nsIDOMNode *aSource, return NS_ERROR_OUT_OF_MEMORY; } - txExecutionState es(mStylesheet, IsLoadDisabled()); + txExecutionState es(mStylesheet, IsLoadDisabled(), getLoaderDoc()); // XXX Need to add error observers diff --git a/dom/xslt/xslt/txXSLTFunctions.h b/dom/xslt/xslt/txXSLTFunctions.h index ca1921cbd5..3ef80f0950 100644 --- a/dom/xslt/xslt/txXSLTFunctions.h +++ b/dom/xslt/xslt/txXSLTFunctions.h @@ -23,12 +23,14 @@ public: /** * Creates a new document() function call **/ - explicit DocumentFunctionCall(nsIURI* aBaseURI); + explicit DocumentFunctionCall(nsIURI* aBaseURI) + : mBaseURI(aBaseURI) + {} TX_DECL_FUNCTION private: - nsString mBaseURI; + nsCOMPtr mBaseURI; }; /* diff --git a/dom/xul/templates/nsTreeRows.h b/dom/xul/templates/nsTreeRows.h index 75eb1eba97..801af02269 100644 --- a/dom/xul/templates/nsTreeRows.h +++ b/dom/xul/templates/nsTreeRows.h @@ -187,7 +187,7 @@ public: class iterator { protected: int32_t mRowIndex; - nsAutoTArray mLink; + AutoTArray mLink; void Next(); void Prev(); diff --git a/dom/xul/templates/nsXULContentBuilder.cpp b/dom/xul/templates/nsXULContentBuilder.cpp index 95b644fa60..246494016f 100644 --- a/dom/xul/templates/nsXULContentBuilder.cpp +++ b/dom/xul/templates/nsXULContentBuilder.cpp @@ -1270,7 +1270,7 @@ nsXULContentBuilder::RemoveGeneratedContent(nsIContent* aElement) { // Keep a queue of "ungenerated" elements that we have to probe // for generated content. - nsAutoTArray ungenerated; + AutoTArray ungenerated; if (ungenerated.AppendElement(aElement) == nullptr) return NS_ERROR_OUT_OF_MEMORY; diff --git a/dom/xul/templates/nsXULTemplateBuilder.cpp b/dom/xul/templates/nsXULTemplateBuilder.cpp index c8e55b97af..08ee3427d0 100644 --- a/dom/xul/templates/nsXULTemplateBuilder.cpp +++ b/dom/xul/templates/nsXULTemplateBuilder.cpp @@ -2357,7 +2357,7 @@ nsXULTemplateBuilder::AddSimpleRuleBindings(nsTemplateRule* aRule, // Crawl the content tree of a "simple" rule, adding a variable // assignment for any attribute whose value is "rdf:". - nsAutoTArray elements; + AutoTArray elements; if (elements.AppendElement(aElement) == nullptr) return NS_ERROR_OUT_OF_MEMORY; diff --git a/dom/xul/templates/nsXULTreeBuilder.cpp b/dom/xul/templates/nsXULTreeBuilder.cpp index e67f5e74d9..8c4e9682a7 100644 --- a/dom/xul/templates/nsXULTreeBuilder.cpp +++ b/dom/xul/templates/nsXULTreeBuilder.cpp @@ -1463,7 +1463,7 @@ nsXULTreeBuilder::OpenSubtreeOf(nsTreeRows::Subtree* aSubtree, nsIXULTemplateResult *aResult, int32_t* aDelta) { - nsAutoTArray open; + AutoTArray open; int32_t count = 0; int32_t rulecount = mQuerySets.Length(); diff --git a/editor/libeditor/nsEditor.cpp b/editor/libeditor/nsEditor.cpp index c3c0d4c496..059c19d0dd 100644 --- a/editor/libeditor/nsEditor.cpp +++ b/editor/libeditor/nsEditor.cpp @@ -2776,7 +2776,7 @@ nsEditor::JoinNodesImpl(nsINode* aNodeToKeep, nsINode* parent = GetNodeLocation(aNodeToKeep, &keepOffset); // Remember all selection points. - nsAutoTArray savedRanges; + AutoTArray savedRanges; for (size_t i = 0; i < nsISelectionController::NUM_SELECTIONTYPES - 1; ++i) { SelectionType type(1 << i); SavedRange range; diff --git a/embedding/components/commandhandler/nsCommandGroup.cpp b/embedding/components/commandhandler/nsCommandGroup.cpp index 8619e207ad..696b93f67c 100644 --- a/embedding/components/commandhandler/nsCommandGroup.cpp +++ b/embedding/components/commandhandler/nsCommandGroup.cpp @@ -214,7 +214,7 @@ nsControllerCommandGroup::AddCommandToGroup(const char* aCommand, nsTArray* commandList = mGroupsHash.Get(groupKey); if (!commandList) { // make this list - commandList = new nsAutoTArray; + commandList = new AutoTArray; mGroupsHash.Put(groupKey, commandList); } diff --git a/extensions/cookie/nsPermissionManager.h b/extensions/cookie/nsPermissionManager.h index d3752e39e4..f86032382c 100644 --- a/extensions/cookie/nsPermissionManager.h +++ b/extensions/cookie/nsPermissionManager.h @@ -132,7 +132,7 @@ public: } // Force the hashtable to use the copy constructor when shuffling entries - // around, otherwise the Auto part of our nsAutoTArray won't be happy! + // around, otherwise the Auto part of our AutoTArray won't be happy! enum { ALLOW_MEMMOVE = false }; inline nsTArray & GetPermissions() @@ -161,7 +161,7 @@ public: } private: - nsAutoTArray mPermissions; + AutoTArray mPermissions; }; // nsISupports diff --git a/gfx/2d/StackArray.h b/gfx/2d/StackArray.h index e3c2684a0b..a2451f9305 100644 --- a/gfx/2d/StackArray.h +++ b/gfx/2d/StackArray.h @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* A handy class that will allocate data for size*T objects on the stack and - * otherwise allocate them on the heap. It is similar in purpose to nsAutoTArray */ + * otherwise allocate them on the heap. It is similar in purpose to AutoTArray */ template class StackArray diff --git a/gfx/gl/DecomposeIntoNoRepeatTriangles.h b/gfx/gl/DecomposeIntoNoRepeatTriangles.h index 8e8b27ec5f..f67d6f93e8 100644 --- a/gfx/gl/DecomposeIntoNoRepeatTriangles.h +++ b/gfx/gl/DecomposeIntoNoRepeatTriangles.h @@ -45,8 +45,8 @@ public: } private: // Reserve inline storage for one quad (2 triangles, 3 coords). - nsAutoTArray mVertexCoords; - nsAutoTArray mTexCoords; + AutoTArray mVertexCoords; + AutoTArray mTexCoords; static void AppendRectToCoordArray(InfallibleTArray& array, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1); diff --git a/gfx/gl/GLContextProviderGLX.cpp b/gfx/gl/GLContextProviderGLX.cpp index 62fa4cf873..77084f0b38 100644 --- a/gfx/gl/GLContextProviderGLX.cpp +++ b/gfx/gl/GLContextProviderGLX.cpp @@ -776,7 +776,7 @@ TRY_AGAIN_NO_SHARING: GLXContext glxContext = shareContext ? shareContext->mContext : nullptr; if (glx.HasCreateContextAttribs()) { - nsAutoTArray attrib_list; + AutoTArray attrib_list; if (glx.HasRobustness()) { int robust_attribs[] = { LOCAL_GL_CONTEXT_FLAGS_ARB, LOCAL_GL_CONTEXT_ROBUST_ACCESS_BIT_ARB, diff --git a/gfx/layers/ImageContainer.cpp b/gfx/layers/ImageContainer.cpp index 75b5088b9d..e131a0f40b 100644 --- a/gfx/layers/ImageContainer.cpp +++ b/gfx/layers/ImageContainer.cpp @@ -294,7 +294,7 @@ ImageContainer::SetCurrentImageInTransaction(Image *aImage) NS_ASSERTION(NS_IsMainThread(), "Should be on main thread."); NS_ASSERTION(!mImageClient, "Should use async image transfer with ImageBridge."); - nsAutoTArray images; + AutoTArray images; images.AppendElement(NonOwningImage(aImage)); SetCurrentImageInternal(images); } diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index d20d0369da..6fce2f5a9b 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -634,7 +634,7 @@ public: } private: - nsAutoTArray mImages; + AutoTArray mImages; }; struct PlanarYCbCrData { diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp index ba38c14c14..f5c0693904 100644 --- a/gfx/layers/LayerTreeInvalidation.cpp +++ b/gfx/layers/LayerTreeInvalidation.cpp @@ -21,7 +21,7 @@ #include "nsHashKeys.h" // for nsPtrHashKey #include "nsISupportsImpl.h" // for Layer::AddRef, etc #include "nsRect.h" // for IntRect -#include "nsTArray.h" // for nsAutoTArray, nsTArray_Impl +#include "nsTArray.h" // for AutoTArray, nsTArray_Impl #include "mozilla/layers/ImageHost.h" #include "mozilla/layers/LayerManagerComposite.h" @@ -383,7 +383,7 @@ struct ContainerLayerProperties : public LayerPropertiesBase } // The old list of children: - nsAutoTArray,1> mChildren; + AutoTArray,1> mChildren; float mPreXScale; float mPreYScale; }; diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index c9fbcc120e..eb273cfddc 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -1348,7 +1348,7 @@ ContainerLayer::Collect3DContextLeaves(nsTArray& aToSort) void ContainerLayer::SortChildrenBy3DZOrder(nsTArray& aArray) { - nsAutoTArray toSort; + AutoTArray toSort; for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) { ContainerLayer* container = l->AsContainerLayer(); diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index f699ef11bc..5f3ae03cdd 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -43,7 +43,7 @@ #include "nsPoint.h" // for nsIntPoint #include "nsRect.h" // for mozilla::gfx::IntRect #include "nsRegion.h" // for nsIntRegion, etc -#include "nsTArray.h" // for nsAutoTArray +#include "nsTArray.h" // for AutoTArray #ifdef MOZ_ENABLE_SKIA #include "skia/include/core/SkCanvas.h" // for SkCanvas #include "skia/include/core/SkBitmapDevice.h" // for SkBitmapDevice @@ -884,7 +884,7 @@ BasicLayerManager::PaintSelfOrChildren(PaintLayerContext& aPaintContext, } else { ContainerLayer* container = static_cast(aPaintContext.mLayer); - nsAutoTArray children; + AutoTArray children; container->SortChildrenBy3DZOrder(children); for (uint32_t i = 0; i < children.Length(); i++) { Layer* layer = children.ElementAt(i); diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index f0e4796c69..10df9420be 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -121,7 +121,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) } if (updated) { - nsAutoTArray textures; + AutoTArray textures; CompositableForwarder::TimedTextureClient* t = textures.AppendElement(); t->mTextureClient = mBuffer; t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mBuffer->GetSize()); @@ -473,7 +473,7 @@ CanvasClientSharedSurface::Updated() // Add the new TexClient. MOZ_ALWAYS_TRUE( AddTextureClient(mFront) ); - nsAutoTArray textures; + AutoTArray textures; CompositableForwarder::TimedTextureClient* t = textures.AppendElement(); t->mTextureClient = mFront; t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mFront->GetSize()); diff --git a/gfx/layers/client/ClientContainerLayer.h b/gfx/layers/client/ClientContainerLayer.h index c6ad5b6580..254d2a45a9 100644 --- a/gfx/layers/client/ClientContainerLayer.h +++ b/gfx/layers/client/ClientContainerLayer.h @@ -13,7 +13,7 @@ #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc #include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE #include "nsRegion.h" // for nsIntRegion -#include "nsTArray.h" // for nsAutoTArray +#include "nsTArray.h" // for AutoTArray #include "ReadbackProcessor.h" #include "ClientPaintedLayer.h" @@ -50,7 +50,7 @@ public: DefaultComputeSupportsComponentAlphaChildren(); - nsAutoTArray children; + AutoTArray children; SortChildrenBy3DZOrder(children); ReadbackProcessor readback; diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index 85e2541ec2..aa5e1a0f53 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -26,7 +26,7 @@ #include "ClientReadbackLayer.h" // for ClientReadbackLayer #include "nsAString.h" #include "nsIWidgetListener.h" -#include "nsTArray.h" // for AutoInfallibleTArray +#include "nsTArray.h" // for AutoTArray #include "nsXULAppAPI.h" // for XRE_GetProcessType, etc #include "TiledLayerBuffer.h" #include "mozilla/dom/WindowBinding.h" // for Overfill Callback @@ -603,7 +603,7 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite) // forward this transaction's changeset to our LayerManagerComposite bool sent; - AutoInfallibleTArray replies; + AutoTArray replies; if (mForwarder->EndTransaction(&replies, mRegionToClear, mLatestTransactionId, aScheduleComposite, mPaintSequenceNumber, mIsRepeatTransaction, transactionStart, &sent)) { diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index 7d8b3be4a9..94295c0856 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -350,8 +350,8 @@ private: APZTestData mApzTestData; RefPtr mForwarder; - nsAutoTArray,2> mTexturePools; - nsAutoTArray mOverfillCallbacks; + AutoTArray,2> mTexturePools; + AutoTArray mOverfillCallbacks; mozilla::TimeStamp mTransactionStart; nsTArray mDidCompositeObservers; diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index 1accb03cd8..34944515a4 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -384,7 +384,7 @@ ContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw, mForwarder->UseComponentAlphaTextures(this, mTextureClient, mTextureClientOnWhite); } else { - nsAutoTArray textures; + AutoTArray textures; CompositableForwarder::TimedTextureClient* t = textures.AppendElement(); t->mTextureClient = mTextureClient; IntSize size = mTextureClient->GetSize(); diff --git a/gfx/layers/client/ImageClient.cpp b/gfx/layers/client/ImageClient.cpp index ead0402ce2..7286f57a05 100644 --- a/gfx/layers/client/ImageClient.cpp +++ b/gfx/layers/client/ImageClient.cpp @@ -119,7 +119,7 @@ ImageClientSingle::FlushAllImages(AsyncTransactionWaiter* aAsyncTransactionWaite bool ImageClientSingle::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) { - nsAutoTArray images; + AutoTArray images; uint32_t generationCounter; aContainer->GetCurrentImages(&images, &generationCounter); @@ -145,7 +145,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag } nsTArray newBuffers; - nsAutoTArray textures; + AutoTArray textures; for (auto& img : images) { Image* image = img.mImage; diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 3ddba54f9c..5ba7c49c25 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -1401,7 +1401,7 @@ AsyncCompositionManager::TransformShadowTree(TimeStamp aCurrentFrame, } #endif } else { - nsAutoTArray scrollableLayers; + AutoTArray scrollableLayers; #ifdef MOZ_WIDGET_ANDROID mLayerManager->GetRootScrollableLayers(scrollableLayers); #else diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index db65a61f8e..b750491fff 100755 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -29,7 +29,7 @@ #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc #include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE #include "nsRegion.h" // for nsIntRegion -#include "nsTArray.h" // for nsAutoTArray +#include "nsTArray.h" // for AutoTArray #include "TextRenderer.h" // for TextRenderer #include #include "VRManager.h" // for VRManager @@ -193,7 +193,7 @@ ContainerRenderVR(ContainerT* aContainer, compositor->SetRenderTarget(surface); - nsAutoTArray children; + AutoTArray children; aContainer->SortChildrenBy3DZOrder(children); gfx::Matrix4x4 origTransform = aContainer->GetEffectiveTransform(); @@ -339,7 +339,7 @@ ContainerRenderVR(ContainerT* aContainer, struct PreparedData { RefPtr mTmpTarget; - nsAutoTArray mLayers; + AutoTArray mLayers; bool mNeedsSurfaceCopy; }; @@ -364,7 +364,7 @@ ContainerPrepare(ContainerT* aContainer, /** * Determine which layers to draw. */ - nsAutoTArray children; + AutoTArray children; aContainer->SortChildrenBy3DZOrder(children); for (uint32_t i = 0; i < children.Length(); i++) { diff --git a/gfx/layers/composite/FPSCounter.h b/gfx/layers/composite/FPSCounter.h index bf594093db..7a59267fce 100644 --- a/gfx/layers/composite/FPSCounter.h +++ b/gfx/layers/composite/FPSCounter.h @@ -12,7 +12,7 @@ #include "GLDefs.h" // for GLuint #include "mozilla/RefPtr.h" // for already_AddRefed, RefCounted #include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration -#include "nsTArray.h" // for nsAutoTArray, nsTArray_Impl, etc +#include "nsTArray.h" // for AutoTArray, nsTArray_Impl, etc #include "prio.h" // for NSPR file i/o namespace mozilla { @@ -87,7 +87,7 @@ private: * read at an offset except our latest write * we don't need an explicit read pointer. */ - nsAutoTArray mFrameTimestamps; + AutoTArray mFrameTimestamps; int mWriteIndex; // points to next open write slot int mIteratorIndex; // used only when iterating const char* mFPSName; diff --git a/gfx/layers/composite/FrameUniformityData.h b/gfx/layers/composite/FrameUniformityData.h index 70d9fb0efa..f7e175f367 100644 --- a/gfx/layers/composite/FrameUniformityData.h +++ b/gfx/layers/composite/FrameUniformityData.h @@ -30,7 +30,7 @@ struct LayerTransforms { gfx::Point GetStdDev(); // 60 fps * 5 seconds worth of data - nsAutoTArray mTransforms; + AutoTArray mTransforms; }; class LayerTransformRecorder { diff --git a/gfx/layers/ipc/CompositableTransactionParent.cpp b/gfx/layers/ipc/CompositableTransactionParent.cpp index 0ede49bd77..279100205b 100644 --- a/gfx/layers/ipc/CompositableTransactionParent.cpp +++ b/gfx/layers/ipc/CompositableTransactionParent.cpp @@ -172,7 +172,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation const OpUseTexture& op = aEdit.get_OpUseTexture(); CompositableHost* compositable = AsCompositable(op); - nsAutoTArray textures; + AutoTArray textures; for (auto& timedTexture : op.textures()) { CompositableHost::TimedTexture* t = textures.AppendElement(); t->mTexture = diff --git a/gfx/layers/ipc/CompositorChild.cpp b/gfx/layers/ipc/CompositorChild.cpp index 7ac762c190..46868992ee 100644 --- a/gfx/layers/ipc/CompositorChild.cpp +++ b/gfx/layers/ipc/CompositorChild.cpp @@ -92,7 +92,7 @@ CompositorChild::Destroy() mLayerManager = nullptr; } - nsAutoTArray transactions; + AutoTArray transactions; ManagedPLayerTransactionChild(transactions); for (int i = transactions.Length() - 1; i >= 0; --i) { RefPtr layers = diff --git a/gfx/layers/ipc/CompositorChild.h b/gfx/layers/ipc/CompositorChild.h index 8ca9f84a69..a8ce648ddc 100644 --- a/gfx/layers/ipc/CompositorChild.h +++ b/gfx/layers/ipc/CompositorChild.h @@ -195,7 +195,7 @@ private: DISALLOW_EVIL_CONSTRUCTORS(CompositorChild); // When we receive overfill numbers, notify these client layer managers - nsAutoTArray mOverfillObservers; + AutoTArray mOverfillObservers; // True until the beginning of the two-step shutdown sequence of this actor. bool mCanSend; diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index fd71ccaccf..8b0fcffab2 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -35,8 +35,8 @@ #include "mozilla/mozalloc.h" // for operator new, etc #include "nsAutoPtr.h" // for nsRefPtr #include "nsISupportsImpl.h" // for ImageContainer::AddRef, etc -#include "nsTArray.h" // for nsAutoTArray, nsTArray, etc -#include "nsTArrayForwardDeclare.h" // for AutoInfallibleTArray +#include "nsTArray.h" // for AutoTArray, nsTArray, etc +#include "nsTArrayForwardDeclare.h" // for AutoTArray #include "nsThreadUtils.h" // for NS_IsMainThread #include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop #include "mozilla/StaticPtr.h" // for StaticRefPtr @@ -143,7 +143,7 @@ ImageBridgeChild::UseTextures(CompositableClient* aCompositable, MOZ_ASSERT(aCompositable->GetIPDLActor()); MOZ_ASSERT(aCompositable->IsConnected()); - nsAutoTArray textures; + AutoTArray textures; for (auto& t : aTextures) { MOZ_ASSERT(t.mTextureClient); @@ -648,7 +648,7 @@ ImageBridgeChild::EndTransaction() return; } - AutoInfallibleTArray cset; + AutoTArray cset; cset.SetCapacity(mTxn->mOperations.size()); if (!mTxn->mOperations.empty()) { cset.AppendElements(&mTxn->mOperations.front(), mTxn->mOperations.size()); @@ -658,7 +658,7 @@ ImageBridgeChild::EndTransaction() ShadowLayerForwarder::PlatformSyncBeforeUpdate(); } - AutoInfallibleTArray replies; + AutoTArray replies; if (mTxn->mSwapRequired) { if (!SendUpdate(cset, mTxn->mDestroyedActors, &replies)) { diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp index 28ea33b23f..123918e77c 100644 --- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -328,7 +328,7 @@ ImageBridgeParent::NotifyImageComposites(nsTArray& a uint32_t i = 0; bool ok = true; while (i < aNotifications.Length()) { - nsAutoTArray notifications; + AutoTArray notifications; notifications.AppendElement(aNotifications[i]); uint32_t end = i + 1; MOZ_ASSERT(aNotifications[i].imageContainerParent()); diff --git a/gfx/layers/ipc/ImageContainerParent.h b/gfx/layers/ipc/ImageContainerParent.h index 6f1e10edcc..817aa82316 100644 --- a/gfx/layers/ipc/ImageContainerParent.h +++ b/gfx/layers/ipc/ImageContainerParent.h @@ -26,7 +26,7 @@ public: virtual bool RecvAsyncDelete() override; - nsAutoTArray mImageHosts; + AutoTArray mImageHosts; private: virtual void ActorDestroy(ActorDestroyReason why) override {} diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 95d8048f7a..658042a77c 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -29,7 +29,7 @@ #include "mozilla/layers/TextureClient.h" // for TextureClient #include "mozilla/mozalloc.h" // for operator new, etc #include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc -#include "nsTArray.h" // for nsAutoTArray, nsTArray, etc +#include "nsTArray.h" // for AutoTArray, nsTArray, etc #include "nsXULAppAPI.h" // for XRE_GetProcessType, etc #include "mozilla/ReentrantMonitor.h" @@ -404,7 +404,7 @@ ShadowLayerForwarder::UseTextures(CompositableClient* aCompositable, { MOZ_ASSERT(aCompositable && aCompositable->IsConnected()); - nsAutoTArray textures; + AutoTArray textures; for (auto& t : aTextures) { MOZ_ASSERT(t.mTextureClient); @@ -687,7 +687,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies, mTxn->AddEdit(OpSetLayerAttributes(nullptr, Shadow(shadow), attrs)); } - AutoInfallibleTArray cset; + AutoTArray cset; size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size(); MOZ_ASSERT(nCsets > 0 || mTxn->RotationChanged(), "should have bailed by now"); diff --git a/gfx/layers/opengl/CompositorOGL.h b/gfx/layers/opengl/CompositorOGL.h index bde7a43109..06947781d6 100644 --- a/gfx/layers/opengl/CompositorOGL.h +++ b/gfx/layers/opengl/CompositorOGL.h @@ -28,7 +28,7 @@ #include "nsCOMPtr.h" // for already_AddRefed #include "nsDebug.h" // for NS_ASSERTION, NS_WARNING #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc -#include "nsTArray.h" // for nsAutoTArray, nsTArray, etc +#include "nsTArray.h" // for AutoTArray, nsTArray, etc #include "nsThreadUtils.h" // for nsRunnable #include "nsXULAppAPI.h" // for XRE_GetProcessType #include "nscore.h" // for NS_IMETHOD diff --git a/gfx/src/nsRegion.cpp b/gfx/src/nsRegion.cpp index a90ea659b5..a46944e680 100644 --- a/gfx/src/nsRegion.cpp +++ b/gfx/src/nsRegion.cpp @@ -305,7 +305,7 @@ void nsRegion::SimplifyOutwardByArea(uint32_t aThreshold) pixman_box32_t *topRects = boxes; // we need some temporary storage for merging both rows of rectangles - nsAutoTArray tmpStorage; + AutoTArray tmpStorage; tmpStorage.SetCapacity(n); pixman_box32_t *tmpRect = tmpStorage.Elements(); diff --git a/gfx/thebes/gfxCoreTextShaper.cpp b/gfx/thebes/gfxCoreTextShaper.cpp index ab15e09466..3d46066497 100644 --- a/gfx/thebes/gfxCoreTextShaper.cpp +++ b/gfx/thebes/gfxCoreTextShaper.cpp @@ -349,10 +349,10 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText, // Testing indicates that CTRunGetGlyphsPtr (almost?) always succeeds, // and so allocating a new array and copying data with CTRunGetGlyphs // will be extremely rare. - // If this were not the case, we could use an nsAutoTArray<> to + // If this were not the case, we could use an AutoTArray<> to // try and avoid the heap allocation for small runs. // It's possible that some future change to CoreText will mean that - // CTRunGetGlyphsPtr fails more often; if this happens, nsAutoTArray<> + // CTRunGetGlyphsPtr fails more often; if this happens, AutoTArray<> // may become an attractive option. glyphs = ::CTRunGetGlyphsPtr(aCTRun); if (!glyphs) { @@ -390,7 +390,7 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText, double runWidth = ::CTRunGetTypographicBounds(aCTRun, ::CFRangeMake(0, 0), nullptr, nullptr, nullptr); - nsAutoTArray detailedGlyphs; + AutoTArray detailedGlyphs; gfxShapedText::CompressedGlyph *charGlyphs = aShapedText->GetCharacterGlyphs() + aOffset; @@ -405,7 +405,7 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText, // The charToGlyph array is indexed by char position within the stringRange of the glyph run. static const int32_t NO_GLYPH = -1; - AutoFallibleTArray charToGlyphArray; + AutoTArray charToGlyphArray; if (!charToGlyphArray.SetLength(stringRange.length, fallible)) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index d61037e219..829a27b553 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -70,7 +70,7 @@ GetDirectWriteFontName(IDWriteFont *aFont, nsAString& aFontName) } BOOL exists; - nsAutoTArray faceName; + AutoTArray faceName; UINT32 englishIdx = 0; hr = names->FindLocaleName(L"en-us", &englishIdx, &exists); if (FAILED(hr)) { @@ -114,7 +114,7 @@ GetDirectWriteFaceName(IDWriteFont *aFont, return E_FAIL; } - nsAutoTArray faceName; + AutoTArray faceName; UINT32 englishIdx = 0; hr = infostrings->FindLocaleName(L"en-us", &englishIdx, &exists); if (FAILED(hr)) { @@ -304,7 +304,7 @@ gfxDWriteFontFamily::LocalizedName(nsAString &aLocalizedName) idx = 0; } } - AutoFallibleTArray famName; + AutoTArray famName; UINT32 length; hr = names->GetStringLength(idx, &length); @@ -398,7 +398,7 @@ UsingArabicOrHebrewScriptSystemLocale() nsresult gfxDWriteFontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray &aBuffer) + nsTArray &aBuffer) { gfxDWriteFontList *pFontList = gfxDWriteFontList::PlatformFontList(); @@ -633,7 +633,7 @@ gfxDWriteFontEntry::CreateFontFace(IDWriteFontFace **aFontFace, if (FAILED(mFontFace->GetFiles(&numberOfFiles, nullptr))) { return NS_ERROR_FAILURE; } - nsAutoTArray files; + AutoTArray files; files.AppendElements(numberOfFiles); if (FAILED(mFontFace->GetFiles(&numberOfFiles, files.Elements()))) { return NS_ERROR_FAILURE; @@ -682,7 +682,7 @@ gfxDWriteFontEntry::IsCJKFont() mIsCJK = false; const uint32_t kOS2Tag = TRUETYPE_TAG('O','S','/','2'); - AutoFallibleTArray buffer; + AutoTArray buffer; if (CopyFontTable(kOS2Tag, buffer) != NS_OK) { return mIsCJK; } @@ -1068,7 +1068,7 @@ gfxDWriteFontList::GetFontsFromCollection(IDWriteFontCollection* aCollection) englishIdx = 0; } - AutoFallibleTArray enName; + AutoTArray enName; UINT32 length; hr = names->GetStringLength(englishIdx, &length); @@ -1113,7 +1113,7 @@ gfxDWriteFontList::GetFontsFromCollection(IDWriteFontCollection* aCollection) for (nameIndex = 0; nameIndex < nameCount; nameIndex++) { UINT32 nameLen; - AutoFallibleTArray localizedName; + AutoTArray localizedName; // only add other names if (nameIndex == englishIdx) { @@ -1334,7 +1334,7 @@ static HRESULT GetFamilyName(IDWriteFont *aFont, nsString& aFamilyName) index = 0; } - AutoFallibleTArray name; + AutoTArray name; UINT32 length; hr = familyNames->GetStringLength(index, &length); @@ -1520,7 +1520,7 @@ void DirectWriteFontInfo::LoadFontFamilyData(const nsAString& aFamilyName) { // lookup the family - nsAutoTArray famName; + AutoTArray famName; uint32_t len = aFamilyName.Length(); if(!famName.SetLength(len + 1, fallible)) { diff --git a/gfx/thebes/gfxDWriteFontList.h b/gfx/thebes/gfxDWriteFontList.h index 99e1df3051..0ed9131867 100644 --- a/gfx/thebes/gfxDWriteFontList.h +++ b/gfx/thebes/gfxDWriteFontList.h @@ -175,7 +175,7 @@ protected: friend class gfxDWriteFontList; virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) override; + nsTArray& aBuffer) override; virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold); diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index ed8e3d61bf..4b1fe1cc92 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -457,7 +457,7 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFontInfoData) RefPtr charmap = new gfxCharacterMap(); - AutoFallibleTArray buffer; + AutoTArray buffer; nsresult rv = CopyFontTable(TTAG_cmap, buffer); if (NS_SUCCEEDED(rv)) { @@ -511,8 +511,7 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFontInfoData) } nsresult -FT2FontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) +FT2FontEntry::CopyFontTable(uint32_t aTableTag, nsTArray& aBuffer) { AutoFTFace face(this); if (!face) { @@ -1345,7 +1344,7 @@ gfxFT2FontList::GetSystemFontList(InfallibleTArray* retValue) static void LoadSkipSpaceLookupCheck(nsTHashtable& aSkipSpaceLookupCheck) { - nsAutoTArray skiplist; + AutoTArray skiplist; gfxFontUtils::GetPrefsFontList( "font.whitelist.skip_default_features_space_check", skiplist); diff --git a/gfx/thebes/gfxFT2FontList.h b/gfx/thebes/gfxFT2FontList.h index c5748a704b..05b7ff27cd 100644 --- a/gfx/thebes/gfxFT2FontList.h +++ b/gfx/thebes/gfxFT2FontList.h @@ -78,7 +78,7 @@ public: virtual hb_blob_t* GetFontTable(uint32_t aTableTag) override; virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) override; + nsTArray& aBuffer) override; // Check for various kinds of brokenness, and set flags on the entry // accordingly so that we avoid using bad font tables diff --git a/gfx/thebes/gfxFcPlatformFontList.cpp b/gfx/thebes/gfxFcPlatformFontList.cpp index f445f9edc6..47ffc2e789 100644 --- a/gfx/thebes/gfxFcPlatformFontList.cpp +++ b/gfx/thebes/gfxFcPlatformFontList.cpp @@ -869,7 +869,7 @@ gfxFontconfigFontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle, nsresult gfxFontconfigFontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) + nsTArray& aBuffer) { NS_ASSERTION(!mIsDataUserFont, "data fonts should be reading tables directly from memory"); diff --git a/gfx/thebes/gfxFcPlatformFontList.h b/gfx/thebes/gfxFcPlatformFontList.h index f1f18eee9d..6cedc9bd4e 100644 --- a/gfx/thebes/gfxFcPlatformFontList.h +++ b/gfx/thebes/gfxFcPlatformFontList.h @@ -137,7 +137,7 @@ protected: // override to pull data from FTFace virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) override; + nsTArray& aBuffer) override; // if HB or GR faces are gone, close down the FT_Face void MaybeReleaseFTFace(); diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index c6b01372bd..44f51d6a42 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -347,7 +347,7 @@ LookupAlternateValues(gfxFontFeatureValueSet *featureLookup, uint32_t numAlternates = altValue.Length(); for (uint32_t i = 0; i < numAlternates; i++) { const gfxAlternateValue& av = altValue.ElementAt(i); - nsAutoTArray values; + AutoTArray values; // map ==> bool found = @@ -522,7 +522,7 @@ gfxFontShaper::MergeFontFeatures( // add font-specific feature values from style rules if (aStyle->featureValueLookup && numAlts > 0) { - nsAutoTArray featureList; + AutoTArray featureList; // insert list of alternate feature settings LookupAlternateValues(aStyle->featureValueLookup, aFamilyName, @@ -2190,8 +2190,8 @@ gfxFont::RenderColorGlyph(DrawTarget* aDrawTarget, const mozilla::gfx::Point& aPoint, uint32_t aGlyphId) const { - nsAutoTArray layerGlyphs; - nsAutoTArray layerColors; + AutoTArray layerGlyphs; + AutoTArray layerColors; if (!GetFontEntry()->GetColorLayersInfo(aGlyphId, layerGlyphs, layerColors)) { return false; @@ -3159,8 +3159,8 @@ gfxFont::InitFakeSmallCapsRun(DrawTarget *aDrawTarget, // apply uppercase transform to the string nsDependentSubstring origString(aText + runStart, runLength); nsAutoString convertedString; - nsAutoTArray charsToMergeArray; - nsAutoTArray deletedCharsArray; + AutoTArray charsToMergeArray; + AutoTArray deletedCharsArray; bool mergeNeeded = nsCaseTransformTextRunFactory:: TransformString(origString, diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index d48b24fff3..57ef82e699 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -2084,7 +2084,7 @@ protected: nsExpirationState mExpirationState; gfxFontStyle mStyle; - nsAutoTArray mGlyphExtentsArray; + AutoTArray mGlyphExtentsArray; nsAutoPtr > > mGlyphChangeObservers; gfxFloat mAdjustedSize; diff --git a/gfx/thebes/gfxFontEntry.cpp b/gfx/thebes/gfxFontEntry.cpp index 7dd5d9e573..528a869497 100644 --- a/gfx/thebes/gfxFontEntry.cpp +++ b/gfx/thebes/gfxFontEntry.cpp @@ -523,12 +523,12 @@ gfxFontEntry::TryGetColorGlyphs() class gfxFontEntry::FontTableBlobData { public: - // Adopts the content of aBuffer. - explicit FontTableBlobData(FallibleTArray& aBuffer) - : mHashtable(nullptr), mHashKey(0) + explicit FontTableBlobData(nsTArray&& aBuffer) + : mTableData(Move(aBuffer)) + , mHashtable(nullptr) + , mHashKey(0) { MOZ_COUNT_CTOR(FontTableBlobData); - mTableData.SwapElements(aBuffer); } ~FontTableBlobData() { @@ -570,8 +570,8 @@ public: } private: - // The font table data block, owned (via adoption) - FallibleTArray mTableData; + // The font table data block + nsTArray mTableData; // The blob destroy function needs to know the owning hashtable // and the hashtable key, so that it can remove the entry. @@ -584,12 +584,12 @@ private: hb_blob_t * gfxFontEntry::FontTableHashEntry:: -ShareTableAndGetBlob(FallibleTArray& aTable, +ShareTableAndGetBlob(nsTArray&& aTable, nsTHashtable *aHashtable) { Clear(); // adopts elements of aTable - mSharedBlobData = new FontTableBlobData(aTable); + mSharedBlobData = new FontTableBlobData(Move(aTable)); mBlob = hb_blob_create(mSharedBlobData->GetTable(), mSharedBlobData->GetTableLength(), HB_MEMORY_MODE_READONLY, @@ -656,7 +656,7 @@ gfxFontEntry::GetExistingFontTable(uint32_t aTag, hb_blob_t **aBlob) hb_blob_t * gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag, - FallibleTArray* aBuffer) + nsTArray* aBuffer) { if (MOZ_UNLIKELY(!mFontTableCache)) { // we do this here rather than on fontEntry construction @@ -675,7 +675,7 @@ gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag, return nullptr; } - return entry->ShareTableAndGetBlob(*aBuffer, mFontTableCache); + return entry->ShareTableAndGetBlob(Move(*aBuffer), mFontTableCache); } static int @@ -725,7 +725,7 @@ gfxFontEntry::GetFontTable(uint32_t aTag) return blob; } - FallibleTArray buffer; + nsTArray buffer; bool haveTable = NS_SUCCEEDED(CopyFontTable(aTag, buffer)); return ShareFontTableAndGetBlob(aTag, haveTable ? &buffer : nullptr); @@ -1148,7 +1148,7 @@ gfxFontEntry* gfxFontFamily::FindFontForStyle(const gfxFontStyle& aFontStyle, bool& aNeedsSyntheticBold) { - nsAutoTArray matched; + AutoTArray matched; FindAllFontsForStyle(aFontStyle, matched, aNeedsSyntheticBold); if (!matched.IsEmpty()) { return matched[0]; @@ -1636,7 +1636,7 @@ gfxFontFamily::ReadOtherFamilyNamesForFace(gfxPlatformFontList *aPlatformFontLis { uint32_t dataLength; const char *nameData = hb_blob_get_data(aNameTable, &dataLength); - nsAutoTArray otherFamilyNames; + AutoTArray otherFamilyNames; ReadOtherFamilyNamesForFace(mName, nameData, dataLength, otherFamilyNames, useFullName); @@ -1721,7 +1721,7 @@ gfxFontFamily::ReadFaceNames(gfxPlatformFontList *aPlatformFontList, aFontInfoData->mLoadOtherNames && !asyncFontLoaderDisabled) { - nsAutoTArray otherFamilyNames; + AutoTArray otherFamilyNames; bool foundOtherNames = aFontInfoData->GetOtherFamilyNames(mName, otherFamilyNames); if (foundOtherNames) { diff --git a/gfx/thebes/gfxFontEntry.h b/gfx/thebes/gfxFontEntry.h index d14a214632..f177c4fdaf 100644 --- a/gfx/thebes/gfxFontEntry.h +++ b/gfx/thebes/gfxFontEntry.h @@ -337,7 +337,7 @@ public: // Pass nullptr for aBuffer to indicate that the table is not present and // nullptr will be returned. Also returns nullptr on OOM. hb_blob_t *ShareFontTableAndGetBlob(uint32_t aTag, - FallibleTArray* aTable); + nsTArray* aTable); // Get the font's unitsPerEm from the 'head' table, in the case of an // sfnt resource. Will return kInvalidUPEM for non-sfnt fonts, @@ -469,7 +469,7 @@ protected: // Copy a font table into aBuffer. // The caller will be responsible for ownership of the data. virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) { + nsTArray& aBuffer) { NS_NOTREACHED("forgot to override either GetFontTable or CopyFontTable?"); return NS_ERROR_FAILURE; } @@ -605,7 +605,7 @@ private: // recorded in the hashtable entry so that others may use the same // table. hb_blob_t * - ShareTableAndGetBlob(FallibleTArray& aTable, + ShareTableAndGetBlob(nsTArray&& aTable, nsTHashtable *aHashtable); // Return a strong reference to the blob. diff --git a/gfx/thebes/gfxFontconfigFonts.cpp b/gfx/thebes/gfxFontconfigFonts.cpp index 8440abda8e..f8debfc72e 100644 --- a/gfx/thebes/gfxFontconfigFonts.cpp +++ b/gfx/thebes/gfxFontconfigFonts.cpp @@ -135,7 +135,7 @@ protected: // One pattern is the common case and some subclasses rely on successful // addition of the first element to the array. - AutoFallibleTArray,1> mPatterns; + AutoTArray,1> mPatterns; static cairo_user_data_key_t sFontEntryKey; }; @@ -189,7 +189,7 @@ public: cairo_font_face_reference(mFontFace); cairo_font_face_set_user_data(mFontFace, &sFontEntryKey, this, nullptr); - // mPatterns is an nsAutoTArray with 1 space always available, so the + // mPatterns is an AutoTArray with 1 space always available, so the // AppendElement always succeeds. // FIXME: Make this infallible after bug 968520 is done. MOZ_ALWAYS_TRUE(mPatterns.AppendElement(fallible)); @@ -216,7 +216,7 @@ public: protected: virtual nsresult - CopyFontTable(uint32_t aTableTag, FallibleTArray& aBuffer) override; + CopyFontTable(uint32_t aTableTag, nsTArray& aBuffer) override; void MaybeReleaseFTFace(); @@ -228,7 +228,7 @@ private: nsresult gfxSystemFcFontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) + nsTArray& aBuffer) { if (!mFTFaceInitialized) { mFTFaceInitialized = true; @@ -913,7 +913,7 @@ gfxFcFontSet::SortPreferredFonts(bool &aWaitForUserFont) // but FcConfigSubstitute may add more values (e.g. prepending "en" to // "ja" will use western fonts to render Latin/Arabic numerals in Japanese // text.) - nsAutoTArray requiredLangs; + AutoTArray requiredLangs; for (int v = 0; ; ++v) { FcChar8 *lang; FcResult result = FcPatternGetString(mSortPattern, FC_LANG, v, &lang); @@ -1289,7 +1289,7 @@ gfxPangoFontGroup::FindGenericFontsPFG(FontFamilyType aGenericType, nsIAtom *aLanguage, void *aClosure) { - nsAutoTArray resolvedGenerics; + AutoTArray resolvedGenerics; ResolveGenericFontNamesPFG(aGenericType, aLanguage, resolvedGenerics); uint32_t g = 0, numGenerics = resolvedGenerics.Length(); for (g = 0; g < numGenerics; g++) { @@ -1494,7 +1494,7 @@ gfxPangoFontGroup::MakeFontSet(PangoLanguage *aLang, gfxFloat aSizeAdjustFactor, langGroup = do_GetAtom(lang); } - nsAutoTArray fcFamilyList; + AutoTArray fcFamilyList; EnumerateFontListPFG(langGroup ? langGroup.get() : mStyle.language.get(), &fcFamilyList); diff --git a/gfx/thebes/gfxFontconfigFonts.h b/gfx/thebes/gfxFontconfigFonts.h index d08749745a..76b3e6b0fa 100644 --- a/gfx/thebes/gfxFontconfigFonts.h +++ b/gfx/thebes/gfxFontconfigFonts.h @@ -73,7 +73,7 @@ private: }; // There is only one of entry in this array unless characters from scripts // of other languages are measured. - nsAutoTArray mFontSets; + AutoTArray mFontSets; gfxFloat mSizeAdjustFactor; PangoLanguage *mPangoLanguage; diff --git a/gfx/thebes/gfxFontconfigUtils.cpp b/gfx/thebes/gfxFontconfigUtils.cpp index 6b2633bf43..867f60747e 100644 --- a/gfx/thebes/gfxFontconfigUtils.cpp +++ b/gfx/thebes/gfxFontconfigUtils.cpp @@ -985,7 +985,7 @@ gfxFontconfigUtils::GetLangSupportEntry(const FcChar8 *aLang, bool aWithFonts) #endif }; - nsAutoTArray fonts; + AutoTArray fonts; for (unsigned fs = 0; fs < ArrayLength(fontSets); ++fs) { FcFontSet *fontSet = fontSets[fs]; diff --git a/gfx/thebes/gfxFontconfigUtils.h b/gfx/thebes/gfxFontconfigUtils.h index de9f27f906..86e9a2c3b4 100644 --- a/gfx/thebes/gfxFontconfigUtils.h +++ b/gfx/thebes/gfxFontconfigUtils.h @@ -260,11 +260,11 @@ protected: return mFonts; } - // Don't memmove the nsAutoTArray. + // Don't memmove the AutoTArray. enum { ALLOW_MEMMOVE = false }; private: // There is usually only one font, but sometimes more. - nsAutoTArray,1> mFonts; + AutoTArray,1> mFonts; }; class LangSupportEntry : public CopiedFcStrEntry { diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index 3dc20d1292..52acc8549d 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -173,7 +173,7 @@ GDIFontEntry::ReadCMAP(FontInfoData *aFontInfoData) } else { uint32_t kCMAP = TRUETYPE_TAG('c','m','a','p'); charmap = new gfxCharacterMap(); - AutoFallibleTArray cmap; + AutoTArray cmap; rv = CopyFontTable(kCMAP, cmap); if (NS_SUCCEEDED(rv)) { @@ -234,8 +234,7 @@ GDIFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle, bool aNeedsBold } nsresult -GDIFontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) +GDIFontEntry::CopyFontTable(uint32_t aTableTag, nsTArray& aBuffer) { if (!IsTrueType()) { return NS_ERROR_FAILURE; @@ -1038,7 +1037,7 @@ int CALLBACK GDIFontInfo::EnumerateFontsForFamily( uint32_t kNAME = NativeEndian::swapToBigEndian(TRUETYPE_TAG('n','a','m','e')); uint32_t nameSize; - AutoFallibleTArray nameData; + AutoTArray nameData; nameSize = ::GetFontData(hdc, kNAME, 0, nullptr, 0); if (nameSize != GDI_ERROR && @@ -1081,7 +1080,7 @@ int CALLBACK GDIFontInfo::EnumerateFontsForFamily( uint32_t kCMAP = NativeEndian::swapToBigEndian(TRUETYPE_TAG('c','m','a','p')); uint32_t cmapSize; - AutoFallibleTArray cmapData; + AutoTArray cmapData; cmapSize = ::GetFontData(hdc, kCMAP, 0, nullptr, 0); if (cmapSize != GDI_ERROR && diff --git a/gfx/thebes/gfxGDIFontList.h b/gfx/thebes/gfxGDIFontList.h index 6b65ade604..b9172c8d35 100644 --- a/gfx/thebes/gfxGDIFontList.h +++ b/gfx/thebes/gfxGDIFontList.h @@ -278,7 +278,7 @@ protected: virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold); virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) override; + nsTArray& aBuffer) override; LOGFONTW mLogFont; }; diff --git a/gfx/thebes/gfxGraphiteShaper.cpp b/gfx/thebes/gfxGraphiteShaper.cpp index 97ac0f4d3e..91e9b749e4 100644 --- a/gfx/thebes/gfxGraphiteShaper.cpp +++ b/gfx/thebes/gfxGraphiteShaper.cpp @@ -206,10 +206,10 @@ gfxGraphiteShaper::SetGlyphsFromSegment(DrawTarget *aDrawTarget, uint32_t glyphCount = gr_seg_n_slots(aSegment); // identify clusters; graphite may have reordered/expanded/ligated glyphs. - AutoFallibleTArray clusters; - AutoFallibleTArray gids; - AutoFallibleTArray xLocs; - AutoFallibleTArray yLocs; + AutoTArray clusters; + AutoTArray gids; + AutoTArray xLocs; + AutoTArray yLocs; if (!clusters.SetLength(aLength, fallible) || !gids.SetLength(glyphCount, fallible) || @@ -313,7 +313,7 @@ gfxGraphiteShaper::SetGlyphsFromSegment(DrawTarget *aDrawTarget, charGlyphs[offs].SetSimpleGlyph(appAdvance, gids[c.baseGlyph]); } else { // not a one-to-one mapping with simple metrics: use DetailedGlyph - nsAutoTArray details; + AutoTArray details; float clusterLoc; for (uint32_t j = c.baseGlyph; j < c.baseGlyph + c.nGlyphs; ++j) { gfxShapedText::DetailedGlyph* d = details.AppendElement(); diff --git a/gfx/thebes/gfxHarfBuzzShaper.cpp b/gfx/thebes/gfxHarfBuzzShaper.cpp index dd33adfd05..a8307543ba 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.cpp +++ b/gfx/thebes/gfxHarfBuzzShaper.cpp @@ -1512,7 +1512,7 @@ gfxHarfBuzzShaper::ShapeText(DrawTarget *aDrawTarget, gfxFontEntry *entry = mFont->GetFontEntry(); // insert any merged features into hb_feature array - nsAutoTArray features; + AutoTArray features; MergeFontFeatures(style, entry->mFeatureSettings, aShapedText->DisableLigatures(), @@ -1593,11 +1593,11 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(DrawTarget *aDrawTarget, return NS_OK; } - nsAutoTArray detailedGlyphs; + AutoTArray detailedGlyphs; uint32_t wordLength = aLength; static const int32_t NO_GLYPH = -1; - AutoFallibleTArray charToGlyphArray; + AutoTArray charToGlyphArray; if (!charToGlyphArray.SetLength(wordLength, fallible)) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index 00e47c18e0..75fe3efeed 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -753,7 +753,7 @@ gfxMacPlatformFontList::InitFontList() void gfxMacPlatformFontList::InitSingleFaceList() { - nsAutoTArray singleFaceFonts; + AutoTArray singleFaceFonts; gfxFontUtils::GetPrefsFontList("font.single-face-list", singleFaceFonts); uint32_t numFonts = singleFaceFonts.Length(); @@ -962,7 +962,7 @@ gfxMacPlatformFontList::GlobalFontFallback(const uint32_t aCh, ::CFStringCompare(familyNameRef, CFSTR("LastResort"), kCFCompareCaseInsensitive) != kCFCompareEqualTo) { - nsAutoTArray buffer; + AutoTArray buffer; CFIndex familyNameLen = ::CFStringGetLength(familyNameRef); buffer.SetLength(familyNameLen+1); ::CFStringGetCharacters(familyNameRef, ::CFRangeMake(0, familyNameLen), @@ -1264,7 +1264,7 @@ MacFontInfo::LoadFontFamilyData(const nsAString& aFamilyName) CFStringRef faceName = (CFStringRef) CTFontDescriptorCopyAttribute(faceDesc, kCTFontNameAttribute); - nsAutoTArray buffer; + AutoTArray buffer; CFIndex len = CFStringGetLength(faceName); buffer.SetLength(len+1); CFStringGetCharacters(faceName, ::CFRangeMake(0, len), diff --git a/gfx/thebes/gfxPlatformFontList.cpp b/gfx/thebes/gfxPlatformFontList.cpp index a949dc0ceb..d9d9d94e4a 100644 --- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -389,7 +389,7 @@ gfxPlatformFontList::LookupInFaceNameLists(const nsAString& aFaceName) void gfxPlatformFontList::PreloadNamesList() { - nsAutoTArray preloadFonts; + AutoTArray preloadFonts; gfxFontUtils::GetPrefsFontList("font.preload-names-list", preloadFonts); uint32_t numFonts = preloadFonts.Length(); @@ -409,7 +409,7 @@ gfxPlatformFontList::PreloadNamesList() void gfxPlatformFontList::LoadBadUnderlineList() { - nsAutoTArray blacklist; + AutoTArray blacklist; gfxFontUtils::GetPrefsFontList("font.blacklist.underline_offset", blacklist); uint32_t numFonts = blacklist.Length(); for (uint32_t i = 0; i < numFonts; i++) { @@ -566,7 +566,7 @@ gfxPlatformFontList::CommonFontFallback(uint32_t aCh, uint32_t aNextCh, const gfxFontStyle* aMatchStyle, gfxFontFamily** aMatchedFamily) { - nsAutoTArray defaultFallbacks; + AutoTArray defaultFallbacks; uint32_t i, numFallbacks; gfxPlatform::GetPlatform()->GetCommonFallbackFonts(aCh, aNextCh, @@ -793,7 +793,7 @@ gfxPlatformFontList::ResolveGenericFontNames( return; } - nsAutoTArray genericFamilies; + AutoTArray genericFamilies; // load family for "font.name.generic.lang" nsAutoCString prefFontName("font.name."); diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 12e603e117..694ffb2e9d 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -397,7 +397,7 @@ gfxTextRun::DrawGlyphs(gfxFont *aFont, uint32_t aStart, uint32_t aEnd, uint32_t aSpacingStart, uint32_t aSpacingEnd, TextRunDrawParams& aParams, uint16_t aOrientation) { - nsAutoTArray spacingBuffer; + AutoTArray spacingBuffer; bool haveSpacing = GetAdjustedSpacingArray(aStart, aEnd, aProvider, aSpacingStart, aSpacingEnd, &spacingBuffer); aParams.spacing = haveSpacing ? spacingBuffer.Elements() : nullptr; @@ -698,7 +698,7 @@ gfxTextRun::DrawEmphasisMarks(gfxContext *aContext, gfxTextRun* aMark, inlineCoord += direction * ComputePartialLigatureWidth(start, ligatureRunStart, aProvider); - nsAutoTArray spacingBuffer; + AutoTArray spacingBuffer; bool haveSpacing = GetAdjustedSpacingArray( ligatureRunStart, ligatureRunEnd, aProvider, ligatureRunStart, ligatureRunEnd, &spacingBuffer); @@ -721,7 +721,7 @@ gfxTextRun::AccumulateMetricsForRun(gfxFont *aFont, uint16_t aOrientation, Metrics *aMetrics) { - nsAutoTArray spacingBuffer; + AutoTArray spacingBuffer; bool haveSpacing = GetAdjustedSpacingArray(aStart, aEnd, aProvider, aSpacingStart, aSpacingEnd, &spacingBuffer); Metrics metrics = aFont->Measure(this, aStart, aEnd, aBoundingBoxType, @@ -1014,7 +1014,7 @@ gfxTextRun::GetAdvanceWidth(uint32_t aStart, uint32_t aLength, // processing it along with the glyphs. if (aProvider && (mFlags & gfxTextRunFactory::TEXT_ENABLE_SPACING)) { uint32_t i; - nsAutoTArray spacingBuffer; + AutoTArray spacingBuffer; if (spacingBuffer.AppendElements(aLength)) { GetAdjustedSpacing(this, ligatureRunStart, ligatureRunEnd, aProvider, spacingBuffer.Elements()); @@ -1599,7 +1599,7 @@ gfxFontGroup::BuildFontList() } // initialize fonts in the font family list - nsAutoTArray fonts; + AutoTArray fonts; gfxPlatformFontList *pfl = gfxPlatformFontList::PlatformFontList(); // lookup fonts in the fontlist @@ -1661,7 +1661,7 @@ void gfxFontGroup::AddFamilyToFontList(gfxFontFamily* aFamily) { NS_ASSERTION(aFamily, "trying to add a null font family to fontlist"); - nsAutoTArray fontEntryList; + AutoTArray fontEntryList; bool needsBold; aFamily->FindAllFontsForStyle(mStyle, fontEntryList, needsBold); // add these to the fontlist @@ -1825,7 +1825,7 @@ gfxFontGroup::GetDefaultFont() // that assumes it will be able to get valid metrics for layout, // just look for the first usable font and put in the list. // (see bug 554544) - nsAutoTArray,200> familyList; + AutoTArray,200> familyList; pfl->GetFontFamilyList(familyList); numFonts = familyList.Length(); for (uint32_t i = 0; i < numFonts; ++i) { @@ -2324,7 +2324,7 @@ gfxFontGroup::InitScriptRun(DrawTarget* aDrawTarget, gfxFont *mainFont = GetFirstValidFont(); uint32_t runStart = 0; - nsAutoTArray fontRanges; + AutoTArray fontRanges; ComputeRanges(fontRanges, aString, aLength, aRunScript, aTextRun->GetFlags() & gfxTextRunFactory::TEXT_ORIENT_MASK); uint32_t numRanges = fontRanges.Length(); diff --git a/gfx/thebes/gfxTextRun.h b/gfx/thebes/gfxTextRun.h index f39f1790ec..e1091085c5 100644 --- a/gfx/thebes/gfxTextRun.h +++ b/gfx/thebes/gfxTextRun.h @@ -717,7 +717,7 @@ private: // XXX this should be changed to a GlyphRun plus a maybe-null GlyphRun*, // for smaller size especially in the super-common one-glyphrun case - nsAutoTArray mGlyphRuns; + AutoTArray mGlyphRuns; void *mUserData; gfxFontGroup *mFontGroup; // addrefed on creation, but our reference diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 1b7be02ecb..544db0dff1 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -1278,7 +1278,7 @@ gfxWindowsPlatform::GetDLLVersion(char16ptr_t aDLLPath, nsAString& aVersion) // version info not available case aVersion.AssignLiteral(MOZ_UTF16("0.0.0.0")); versInfoSize = GetFileVersionInfoSizeW(aDLLPath, nullptr); - nsAutoTArray versionInfo; + AutoTArray versionInfo; if (versInfoSize == 0 || !versionInfo.AppendElements(uint32_t(versInfoSize))) diff --git a/hal/WindowIdentifier.h b/hal/WindowIdentifier.h index 9841816ddb..f8b71d618c 100644 --- a/hal/WindowIdentifier.h +++ b/hal/WindowIdentifier.h @@ -98,7 +98,7 @@ private: */ uint64_t GetWindowID() const; - AutoInfallibleTArray mID; + AutoTArray mID; nsCOMPtr mWindow; bool mIsEmpty; }; diff --git a/hal/gonk/GonkSensor.cpp b/hal/gonk/GonkSensor.cpp index 7bffd63fe6..9f94e9b692 100644 --- a/hal/gonk/GonkSensor.cpp +++ b/hal/gonk/GonkSensor.cpp @@ -183,7 +183,7 @@ public: private: SensorData mSensorData; - nsAutoTArray mSensorValues; + AutoTArray mSensorValues; }; namespace hal_impl { diff --git a/hal/sandbox/SandboxHal.cpp b/hal/sandbox/SandboxHal.cpp index 4699cedd3b..376500cc3d 100644 --- a/hal/sandbox/SandboxHal.cpp +++ b/hal/sandbox/SandboxHal.cpp @@ -50,7 +50,7 @@ Vibrate(const nsTArray& pattern, const WindowIdentifier &id) { HAL_LOG("Vibrate: Sending to parent process."); - AutoInfallibleTArray p(pattern); + AutoTArray p(pattern); WindowIdentifier newID(id); newID.AppendProcessID(); diff --git a/image/RasterImage.cpp b/image/RasterImage.cpp index ce0d7782e4..465eefa5c3 100644 --- a/image/RasterImage.cpp +++ b/image/RasterImage.cpp @@ -731,7 +731,7 @@ RasterImage::UpdateImageContainer() } mLastImageContainerDrawResult = drawResult; - nsAutoTArray imageList; + AutoTArray imageList; imageList.AppendElement(ImageContainer::NonOwningImage(image)); container->SetCurrentImages(imageList); } diff --git a/image/decoders/icon/mac/nsIconChannelCocoa.mm b/image/decoders/icon/mac/nsIconChannelCocoa.mm index 2b6c6e12d0..e6208d7be7 100644 --- a/image/decoders/icon/mac/nsIconChannelCocoa.mm +++ b/image/decoders/icon/mac/nsIconChannelCocoa.mm @@ -350,7 +350,7 @@ nsIconChannel::MakeInputStream(nsIInputStream** _retval, // create our buffer int32_t bufferCapacity = 2 + [bitmapRep bytesPerPlane]; - nsAutoTArray iconBuffer; // initial size is for + AutoTArray iconBuffer; // initial size is for // 16x16 iconBuffer.SetLength(bufferCapacity); diff --git a/image/imgLoader.cpp b/image/imgLoader.cpp index 44bbd4ed71..976fccfd76 100644 --- a/image/imgLoader.cpp +++ b/image/imgLoader.cpp @@ -1430,7 +1430,7 @@ NS_IMETHODIMP_(void) imgLoader::ClearCacheForControlledDocument(nsIDocument* aDoc) { MOZ_ASSERT(aDoc); - nsAutoTArray, 128> entriesToBeRemoved; + AutoTArray, 128> entriesToBeRemoved; imgCacheTable& cache = GetCache(false); for (auto iter = cache.Iter(); !iter.Done(); iter.Next()) { auto& key = iter.Key(); diff --git a/intl/hyphenation/glue/nsHyphenator.cpp b/intl/hyphenation/glue/nsHyphenator.cpp index 8a75090e40..bcb87baf60 100644 --- a/intl/hyphenation/glue/nsHyphenator.cpp +++ b/intl/hyphenation/glue/nsHyphenator.cpp @@ -43,8 +43,7 @@ nsHyphenator::IsValid() } nsresult -nsHyphenator::Hyphenate(const nsAString& aString, - FallibleTArray& aHyphens) +nsHyphenator::Hyphenate(const nsAString& aString, nsTArray& aHyphens) { if (!aHyphens.SetLength(aString.Length(), mozilla::fallible)) { return NS_ERROR_OUT_OF_MEMORY; @@ -121,7 +120,7 @@ nsHyphenator::Hyphenate(const nsAString& aString, } } - nsAutoTArray utf8hyphens; + AutoTArray utf8hyphens; utf8hyphens.SetLength(utf8.Length() + 5); char **rep = nullptr; int *pos = nullptr; diff --git a/intl/hyphenation/glue/nsHyphenator.h b/intl/hyphenation/glue/nsHyphenator.h index 37b5613da9..96975d2533 100644 --- a/intl/hyphenation/glue/nsHyphenator.h +++ b/intl/hyphenation/glue/nsHyphenator.h @@ -21,7 +21,7 @@ public: bool IsValid(); - nsresult Hyphenate(const nsAString& aText, FallibleTArray& aHyphens); + nsresult Hyphenate(const nsAString& aText, nsTArray& aHyphens); private: ~nsHyphenator(); diff --git a/intl/locale/mac/nsDateTimeFormatMac.cpp b/intl/locale/mac/nsDateTimeFormatMac.cpp index 2919c3a0eb..497a7ec41a 100644 --- a/intl/locale/mac/nsDateTimeFormatMac.cpp +++ b/intl/locale/mac/nsDateTimeFormatMac.cpp @@ -220,7 +220,7 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale, CFIndex stringLen = CFStringGetLength(formattedDate); - nsAutoTArray stringBuffer; + AutoTArray stringBuffer; stringBuffer.SetLength(stringLen + 1); CFStringGetCharacters(formattedDate, CFRangeMake(0, stringLen), stringBuffer.Elements()); stringOut.Assign(reinterpret_cast(stringBuffer.Elements()), stringLen); diff --git a/intl/locale/nsLocaleService.cpp b/intl/locale/nsLocaleService.cpp index 76d89abcb5..13b3f7f01b 100644 --- a/intl/locale/nsLocaleService.cpp +++ b/intl/locale/nsLocaleService.cpp @@ -178,7 +178,7 @@ nsLocaleService::nsLocaleService(void) CFStringRef userLocaleStr = ::CFLocaleGetIdentifier(userLocaleRef); ::CFRetain(userLocaleStr); - nsAutoTArray buffer; + AutoTArray buffer; int size = ::CFStringGetLength(userLocaleStr); buffer.SetLength(size + 1); CFRange range = ::CFRangeMake(0, size); diff --git a/intl/lwbrk/nsJISx4051LineBreaker.cpp b/intl/lwbrk/nsJISx4051LineBreaker.cpp index 1b2a2382e0..b2d0019df3 100644 --- a/intl/lwbrk/nsJISx4051LineBreaker.cpp +++ b/intl/lwbrk/nsJISx4051LineBreaker.cpp @@ -774,7 +774,7 @@ nsJISx4051LineBreaker::WordMove(const char16_t* aText, uint32_t aLen, } int32_t ret; - nsAutoTArray breakState; + AutoTArray breakState; if (!textNeedsJISx4051 || !breakState.AppendElements(end - begin)) { // No complex text character, do not try to do complex line break. // (This is required for serializers. See Bug #344816.) diff --git a/intl/lwbrk/nsPangoBreaker.cpp b/intl/lwbrk/nsPangoBreaker.cpp index 8d5104c42d..c6fcb37cf8 100644 --- a/intl/lwbrk/nsPangoBreaker.cpp +++ b/intl/lwbrk/nsPangoBreaker.cpp @@ -18,7 +18,7 @@ NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength, memset(aBreakBefore, false, aLength * sizeof(uint8_t)); - nsAutoTArray attrBuffer; + AutoTArray attrBuffer; if (!attrBuffer.AppendElements(aLength + 1)) return; diff --git a/intl/lwbrk/nsUniscribeBreaker.cpp b/intl/lwbrk/nsUniscribeBreaker.cpp index 0d29d284a3..2a1b69b226 100644 --- a/intl/lwbrk/nsUniscribeBreaker.cpp +++ b/intl/lwbrk/nsUniscribeBreaker.cpp @@ -21,7 +21,7 @@ NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength, int outItems = 0; HRESULT result; - nsAutoTArray items; + AutoTArray items; char16ptr_t text = aText; memset(aBreakBefore, false, aLength); @@ -42,7 +42,7 @@ NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength, for (int iItem = 0; iItem < outItems; ++iItem) { uint32_t endOffset = (iItem + 1 == outItems ? aLength : items[iItem + 1].iCharPos); uint32_t startOffset = items[iItem].iCharPos; - nsAutoTArray sla; + AutoTArray sla; if (!sla.AppendElements(endOffset - startOffset)) return; diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h index 4984671631..66ff342c8f 100644 --- a/ipc/glue/IPCMessageUtils.h +++ b/ipc/glue/IPCMessageUtils.h @@ -541,9 +541,9 @@ struct ParamTraits > }; template -struct ParamTraits> : ParamTraits> +struct ParamTraits> : ParamTraits> { - typedef nsAutoTArray paramType; + typedef AutoTArray paramType; }; template<> diff --git a/ipc/glue/WindowsMessageLoop.cpp b/ipc/glue/WindowsMessageLoop.cpp index 5f373f46e3..3e32de68db 100644 --- a/ipc/glue/WindowsMessageLoop.cpp +++ b/ipc/glue/WindowsMessageLoop.cpp @@ -828,7 +828,7 @@ MessageChannel::SyncStackFrame::SyncStackFrame(MessageChannel* channel, bool int if (!mStaticPrev) { NS_ASSERTION(!gNeuteredWindows, "Should only set this once!"); - gNeuteredWindows = new nsAutoTArray(); + gNeuteredWindows = new AutoTArray(); NS_ASSERTION(gNeuteredWindows, "Out of memory!"); } } diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 1042779297..56a82acda9 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -616,9 +616,9 @@ js::ArraySetLength(JSContext* cx, Handle arr, HandleId id, // during the iteration must not be visited, and suppressing them here // would be too costly. ObjectGroup* arrGroup = arr->getGroup(cx); - if (!arr->isIndexed() && - !MOZ_UNLIKELY(!arrGroup || arrGroup->hasAllFlags(OBJECT_FLAG_ITERATED))) - { + if (MOZ_UNLIKELY(!arrGroup)) + return false; + if (!arr->isIndexed() && !MOZ_UNLIKELY(arrGroup->hasAllFlags(OBJECT_FLAG_ITERATED))) { if (!arr->maybeCopyElementsForWrite(cx)) return false; @@ -1194,6 +1194,7 @@ js::array_join(JSContext* cx, unsigned argc, Value* vp) { JS_CHECK_RECURSION(cx, return false); + AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.join"); CallArgs args = CallArgsFromVp(argc, vp); return ArrayJoin(cx, args); } @@ -1310,6 +1311,7 @@ DefineBoxedOrUnboxedFunctor3(ArrayReverseDenseKernel, static bool array_reverse(JSContext* cx, unsigned argc, Value* vp) { + AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.reverse"); CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx, ToObject(cx, args.thisv())); if (!obj) @@ -2012,6 +2014,7 @@ js::NewbornArrayPush(JSContext* cx, HandleObject obj, const Value& v) bool js::array_push(JSContext* cx, unsigned argc, Value* vp) { + AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.push"); CallArgs args = CallArgsFromVp(argc, vp); /* Step 1. */ @@ -2063,6 +2066,7 @@ js::array_push(JSContext* cx, unsigned argc, Value* vp) bool js::array_pop(JSContext* cx, unsigned argc, Value* vp) { + AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.pop"); CallArgs args = CallArgsFromVp(argc, vp); /* Step 1. */ @@ -2133,18 +2137,25 @@ js::ArrayShiftMoveElements(JSObject* obj) template DenseElementResult -ArrayShiftDenseKernel(JSContext* cx, JSObject* obj, Value* rval) +ArrayShiftDenseKernel(JSContext* cx, HandleObject obj, MutableHandleValue rval) { if (ObjectMayHaveExtraIndexedProperties(obj)) return DenseElementResult::Incomplete; + RootedObjectGroup group(cx, obj->getGroup(cx)); + if (MOZ_UNLIKELY(!group)) + return DenseElementResult::Failure; + + if (MOZ_UNLIKELY(group->hasAllFlags(OBJECT_FLAG_ITERATED))) + return DenseElementResult::Incomplete; + size_t initlen = GetBoxedOrUnboxedInitializedLength(obj); if (initlen == 0) return DenseElementResult::Incomplete; - *rval = GetBoxedOrUnboxedDenseElement(obj, 0); - if (rval->isMagic(JS_ELEMENTS_HOLE)) - rval->setUndefined(); + rval.set(GetBoxedOrUnboxedDenseElement(obj, 0)); + if (rval.isMagic(JS_ELEMENTS_HOLE)) + rval.setUndefined(); DenseElementResult result = MoveBoxedOrUnboxedDenseElements(cx, obj, 0, 1, initlen - 1); MOZ_ASSERT(result != DenseElementResult::Incomplete); @@ -2156,12 +2167,13 @@ ArrayShiftDenseKernel(JSContext* cx, JSObject* obj, Value* rval) } DefineBoxedOrUnboxedFunctor3(ArrayShiftDenseKernel, - JSContext*, JSObject*, Value*); + JSContext*, HandleObject, MutableHandleValue); /* ES5 15.4.4.9 */ bool js::array_shift(JSContext* cx, unsigned argc, Value* vp) { + AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.shift"); CallArgs args = CallArgsFromVp(argc, vp); /* Step 1. */ @@ -2188,19 +2200,13 @@ js::array_shift(JSContext* cx, unsigned argc, Value* vp) uint32_t newlen = len - 1; /* Fast paths. */ - ArrayShiftDenseKernelFunctor functor(cx, obj, args.rval().address()); + ArrayShiftDenseKernelFunctor functor(cx, obj, args.rval()); DenseElementResult result = CallBoxedOrUnboxedSpecialization(functor, obj); if (result != DenseElementResult::Incomplete) { if (result == DenseElementResult::Failure) return false; - if (!SetLengthProperty(cx, obj, newlen)) - return false; - - RootedId id(cx); - if (!IndexToId(cx, newlen, &id)) - return false; - return SuppressDeletedProperty(cx, obj, id); + return SetLengthProperty(cx, obj, newlen); } /* Steps 5, 10. */ @@ -2235,6 +2241,7 @@ js::array_shift(JSContext* cx, unsigned argc, Value* vp) bool js::array_unshift(JSContext* cx, unsigned argc, Value* vp) { + AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.unshift"); CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx, ToObject(cx, args.thisv())); if (!obj) @@ -2365,6 +2372,7 @@ array_splice(JSContext* cx, unsigned argc, Value* vp) bool js::array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueIsUsed) { + AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.splice"); CallArgs args = CallArgsFromVp(argc, vp); /* Step 1. */ @@ -2625,6 +2633,7 @@ js::array_concat_dense(JSContext* cx, HandleObject obj1, HandleObject obj2, bool js::array_concat(JSContext* cx, unsigned argc, Value* vp) { + AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.concat"); CallArgs args = CallArgsFromVp(argc, vp); /* Treat our |this| object as the first argument; see ECMA 15.4.4.4. */ @@ -2918,6 +2927,7 @@ NormalizeSliceTerm(T value, uint32_t length) bool js::array_slice(JSContext* cx, unsigned argc, Value* vp) { + AutoSPSEntry pseudoFrame(cx->runtime(), "Array.prototype.slice"); CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx, ToObject(cx, args.thisv())); diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index 4e5570428a..bc8a5f6529 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -298,9 +298,8 @@ js::ReportOutOfMemory(ExclusiveContext* cxArg) AutoSuppressGC suppressGC(cx); /* Report the oom. */ - if (JS::OutOfMemoryCallback oomCallback = cx->runtime()->oomCallback) { + if (JS::OutOfMemoryCallback oomCallback = cx->runtime()->oomCallback) oomCallback(cx, cx->runtime()->oomCallbackData); - } if (cx->options().autoJSAPIOwnsErrorReporting() || JS_IsRunning(cx)) { cx->setPendingException(StringValue(cx->names().outOfMemory)); @@ -318,9 +317,8 @@ js::ReportOutOfMemory(ExclusiveContext* cxArg) PopulateReportBlame(cx, &report); /* Report the error. */ - if (JSErrorReporter onError = cx->runtime()->errorReporter) { + if (JSErrorReporter onError = cx->runtime()->errorReporter) onError(cx, msg, &report); - } /* * We would like to enforce the invariant that any exception reported diff --git a/js/src/tests/ecma_6/Array/shift_for_in.js b/js/src/tests/ecma_6/Array/shift_for_in.js new file mode 100644 index 0000000000..1bbf2d9c2d --- /dev/null +++ b/js/src/tests/ecma_6/Array/shift_for_in.js @@ -0,0 +1,13 @@ +var BUGNUMBER = 1247701; +var summary = 'Array.prototype.shift on a dense array with holes should update for-in enumeration properties.'; + +print(BUGNUMBER + ": " + summary); + +var x = ["a", , "b", , "c", "d" , "e", "f", "g"]; +for (var p in x) { + assertEq(p in x, true); + x.shift(); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index bd310e4ff7..63d8bd97df 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -1286,7 +1286,7 @@ class MOZ_STACK_CLASS CallMethodHelper const uint16_t mVTableIndex; HandleId mIdxValueId; - nsAutoTArray mDispatchParams; + AutoTArray mDispatchParams; uint8_t mJSContextIndex; // TODO make const uint8_t mOptArgcIndex; // TODO make const diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 0bad0ac852..0c193f10c3 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -2892,7 +2892,7 @@ private: JSContext* Pop(); bool Push(JSContext* cx); - AutoInfallibleTArray mStack; + AutoTArray mStack; XPCJSRuntime* mRuntime; JSContext* mSafeJSContext; }; diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index f84aa561ff..9e9ba2b42a 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -213,13 +213,13 @@ FrameLayerBuilder::DisplayItemData::BeginUpdate(Layer* aLayer, LayerState aState // We avoid adding or removing element unnecessarily // since we have to modify userdata each time - nsAutoTArray copy(mFrameList); + AutoTArray copy(mFrameList); if (!copy.RemoveElement(aItem->Frame())) { AddFrame(aItem->Frame()); mFrameListChanges.AppendElement(aItem->Frame()); } - nsAutoTArray mergedFrames; + AutoTArray mergedFrames; aItem->GetMergedFrames(&mergedFrames); for (uint32_t i = 0; i < mergedFrames.Length(); ++i) { if (!copy.RemoveElement(mergedFrames[i])) { @@ -1382,7 +1382,7 @@ protected: * It's essential that this array is only appended to, since PaintedLayerData * records the index of its PaintedLayer in this array. */ - typedef nsAutoTArray AutoLayersArray; + typedef AutoTArray AutoLayersArray; AutoLayersArray mNewChildLayers; nsTHashtable> mPaintedLayersAvailableForRecycling; nscoord mAppUnitsPerDevPixel; @@ -4655,7 +4655,7 @@ ContainerState::SetupScrollingMetadata(NewLayerEntry* aEntry) return; } - nsAutoTArray metricsArray; + AutoTArray metricsArray; if (aEntry->mBaseFrameMetrics) { metricsArray.AppendElement(*aEntry->mBaseFrameMetrics); @@ -4756,7 +4756,7 @@ GetStationaryClipInContainer(Layer* aLayer) void ContainerState::PostprocessRetainedLayers(nsIntRegion* aOpaqueRegionForContainer) { - nsAutoTArray opaqueRegions; + AutoTArray opaqueRegions; bool hideAll = false; int32_t opaqueRegionForContainer = -1; diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index 5f018d0fda..96049dd0e0 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -489,7 +489,7 @@ public: RefPtr mLayer; RefPtr mOptLayer; RefPtr mInactiveManager; - nsAutoTArray mFrameList; + AutoTArray mFrameList; nsAutoPtr mGeometry; DisplayItemClip mClip; uint32_t mDisplayItemKey; @@ -501,7 +501,7 @@ public: * BeginUpdate and EndUpdate. */ nsDisplayItem* mItem; - nsAutoTArray mFrameListChanges; + AutoTArray mFrameListChanges; /** * Used to track if data currently stored in mFramesWithLayers (from an existing diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index 5877736352..52254b0609 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -591,7 +591,7 @@ FindFrameTargetedByInputEvent(WidgetGUIEvent* aEvent, restrictToDescendants, prefs, aFlags); PET_LOG("Expanded point to target rect %s\n", mozilla::layers::Stringify(targetRect).c_str()); - nsAutoTArray candidates; + AutoTArray candidates; nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates, flags); if (NS_FAILED(rv)) { return target; diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index 2f0b914f07..7bb8cb7ab8 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -917,7 +917,7 @@ class MOZ_STACK_CLASS AutoDisplayContentsAncestorPusher final private: TreeMatchContext& mTreeMatchContext; nsPresContext* const mPresContext; - nsAutoTArray mAncestors; + AutoTArray mAncestors; }; } // namespace mozilla diff --git a/layout/base/RestyleTracker.cpp b/layout/base/RestyleTracker.cpp index 0c2237048d..c0ff65e78e 100644 --- a/layout/base/RestyleTracker.cpp +++ b/layout/base/RestyleTracker.cpp @@ -165,7 +165,7 @@ RestyleTracker::DoProcessRestyles() while (mPendingRestyles.Count()) { if (mHaveLaterSiblingRestyles) { // Convert them to individual restyles on all the later siblings - nsAutoTArray, RESTYLE_ARRAY_STACKSIZE> laterSiblingArr; + AutoTArray, RESTYLE_ARRAY_STACKSIZE> laterSiblingArr; for (auto iter = mPendingRestyles.Iter(); !iter.Done(); iter.Next()) { auto element = static_cast(iter.Key()); // Only collect the entries that actually need restyling by us (and @@ -280,7 +280,7 @@ RestyleTracker::DoProcessRestyles() // scratch array instead of calling out to ProcessOneRestyle while // enumerating the hashtable. Use the stack if we can, otherwise // fall back on heap-allocation. - nsAutoTArray restyleArr; + AutoTArray restyleArr; RestyleEnumerateData* restylesToProcess = restyleArr.AppendElements(mPendingRestyles.Count()); if (restylesToProcess) { diff --git a/layout/base/RestyleTracker.h b/layout/base/RestyleTracker.h index e2e7d94355..33bf4a6b7b 100644 --- a/layout/base/RestyleTracker.h +++ b/layout/base/RestyleTracker.h @@ -390,7 +390,7 @@ private: const RestyleHintData& aRestyleHintData); typedef nsClassHashtable PendingRestyleTable; - typedef nsAutoTArray< RefPtr, 32> RestyleRootArray; + typedef AutoTArray< RefPtr, 32> RestyleRootArray; // Our restyle bits. These will be a subset of ELEMENT_ALL_RESTYLE_FLAGS, and // will include one flag from ELEMENT_PENDING_RESTYLE_FLAGS, one flag // from ELEMENT_POTENTIAL_RESTYLE_ROOT_FLAGS, and might also include diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index 721790f29a..f39203e793 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -105,7 +105,7 @@ static char16_t GetBidiControl(nsStyleContext* aStyleContext, struct BidiParagraphData { nsString mBuffer; - nsAutoTArray mEmbeddingStack; + AutoTArray mEmbeddingStack; nsTArray mLogicalFrames; nsTArray mLinePerFrame; nsDataHashtable mContentToFrameIndex; @@ -394,7 +394,7 @@ struct BidiLineData { nsTArray mLogicalFrames; nsTArray mVisualFrames; nsTArray mIndexMap; - nsAutoTArray mLevels; + AutoTArray mLevels; bool mIsReordered; BidiLineData(nsIFrame* aFirstFrameOnLine, int32_t aNumFramesOnLine) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index c546137a9d..4581ed7f84 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1314,7 +1314,7 @@ nsFrameConstructorState::ProcessFrameInsertions(nsAbsoluteItems& aFrameItems, nsIFrame* firstNewFrame = aFrameItems.FirstChild(); // Cache the ancestor chain so that we can reuse it if needed. - nsAutoTArray firstNewFrameAncestors; + AutoTArray firstNewFrameAncestors; nsIFrame* notCommonAncestor = nullptr; if (lastChild) { notCommonAncestor = nsLayoutUtils::FillAncestors(firstNewFrame, @@ -1332,7 +1332,7 @@ nsFrameConstructorState::ProcessFrameInsertions(nsAbsoluteItems& aFrameItems, } else { // Try the other children. First collect them to an array so that a // reasonable fast binary search can be used to find the insertion point. - nsAutoTArray children; + AutoTArray children; for (nsIFrame* f = childList.FirstChild(); f != lastChild; f = f->GetNextSibling()) { children.AppendElement(f); @@ -2844,7 +2844,7 @@ nsCSSFrameConstructor::ConstructAnonymousContentForCanvas(nsFrameConstructorStat { NS_ASSERTION(aFrame->GetType() == nsGkAtoms::canvasFrame, "aFrame should be canvas frame!"); - nsAutoTArray anonymousItems; + AutoTArray anonymousItems; GetAnonymousContent(aDocElement, aFrame, anonymousItems); if (anonymousItems.IsEmpty()) { return; @@ -4039,7 +4039,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState, PendingBinding* aPendingBinding, nsFrameItems& aChildItems) { - nsAutoTArray newAnonymousItems; + AutoTArray newAnonymousItems; nsresult rv = GetAnonymousContent(aParent, aParentFrame, newAnonymousItems); NS_ENSURE_SUCCESS(rv, rv); @@ -10566,7 +10566,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState, // Create any anonymous frames we need here. This must happen before the // non-anonymous children are processed to ensure that popups are never // constructed before the popupset. - nsAutoTArray anonymousItems; + AutoTArray anonymousItems; GetAnonymousContent(aContent, aPossiblyLeafFrame, anonymousItems); #ifdef DEBUG for (uint32_t i = 0; i < anonymousItems.Length(); ++i) { diff --git a/layout/base/nsCounterManager.cpp b/layout/base/nsCounterManager.cpp index 6adf34d06e..0a2424f3bd 100644 --- a/layout/base/nsCounterManager.cpp +++ b/layout/base/nsCounterManager.cpp @@ -94,7 +94,7 @@ nsCounterUseNode::GetText(nsString& aResult) { aResult.Truncate(); - nsAutoTArray stack; + AutoTArray stack; stack.AppendElement(static_cast(this)); if (mAllCounters && mScopeStart) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 632d2b11cb..455fb8514e 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -953,7 +953,7 @@ nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame, void nsDisplayListBuilder::MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame, const nsRect& aDirtyRect) { - nsAutoTArray childListArray; + AutoTArray childListArray; aDirtyFrame->GetChildLists(&childListArray); nsIFrame::ChildListArrayIterator lists(childListArray); for (; !lists.IsDone(); lists.Next()) { @@ -1458,7 +1458,7 @@ nsDisplayList::ComputeVisibilityForSublist(nsDisplayListBuilder* aBuilder, bool anyVisible = false; - nsAutoTArray elements; + AutoTArray elements; MoveListTo(this, &elements); for (int32_t i = elements.Length() - 1; i >= 0; --i) { @@ -1842,7 +1842,7 @@ struct FramesWithDepth {} bool operator<(const FramesWithDepth& aOther) const { - if (mDepth != aOther.mDepth) { + if (!FuzzyEqual(mDepth, aOther.mDepth, 0.1f)) { // We want to sort so that the shallowest item (highest depth value) is first return mDepth > aOther.mDepth; } @@ -1895,7 +1895,7 @@ void nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, aState->mItemBuffer.AppendElement(item); } - nsAutoTArray temp; + AutoTArray temp; for (int32_t i = aState->mItemBuffer.Length() - 1; i >= itemBufferStart; --i) { // Pop element off the end of the buffer. We want to shorten the buffer // so that recursive calls to HitTest have more buffer space. @@ -1905,14 +1905,17 @@ void nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, bool snap; nsRect r = item->GetBounds(aBuilder, &snap).Intersect(aRect); auto itemType = item->GetType(); - bool alwaysIntersect = + bool same3DContext = (itemType == nsDisplayItem::TYPE_TRANSFORM && static_cast(item)->IsParticipating3DContext()) || (itemType == nsDisplayItem::TYPE_PERSPECTIVE && static_cast(item)->Frame()->Extend3DContext()); - if (alwaysIntersect && + if (same3DContext && !static_cast(item)->IsLeafOf3DContext()) { - nsAutoTArray neverUsed; + if (!item->GetClip().MayIntersect(aRect)) { + continue; + } + AutoTArray neverUsed; // Start gethering leaves of the 3D rendering context, and // append leaves at the end of mItemBuffer. Leaves are // processed at following iterations. @@ -1922,8 +1925,8 @@ void nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, i = aState->mItemBuffer.Length(); continue; } - if (alwaysIntersect || item->GetClip().MayIntersect(r)) { - nsAutoTArray outFrames; + if (same3DContext || item->GetClip().MayIntersect(r)) { + AutoTArray outFrames; item->HitTest(aBuilder, aRect, aState, &outFrames); // For 3d transforms with preserve-3d we add hit frames into the temp list @@ -3653,7 +3656,7 @@ nsDisplayBoxShadowOuter::Paint(nsDisplayListBuilder* aBuilder, nsPoint offset = ToReferenceFrame(); nsRect borderRect = mFrame->VisualBorderRectRelativeToSelf() + offset; nsPresContext* presContext = mFrame->PresContext(); - nsAutoTArray rects; + AutoTArray rects; ComputeDisjointRectangles(mVisibleRegion, &rects); PROFILER_LABEL("nsDisplayBoxShadowOuter", "Paint", @@ -3741,7 +3744,7 @@ nsDisplayBoxShadowInner::Paint(nsDisplayListBuilder* aBuilder, nsPoint offset = ToReferenceFrame(); nsRect borderRect = nsRect(offset, mFrame->GetSize()); nsPresContext* presContext = mFrame->PresContext(); - nsAutoTArray rects; + AutoTArray rects; ComputeDisjointRectangles(mVisibleRegion, &rects); PROFILER_LABEL("nsDisplayBoxShadowInner", "Paint", diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 62c2228b32..31e491741e 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -1196,9 +1196,9 @@ private: nsDisplayLayerEventRegions* mLayerEventRegions; PLArenaPool mPool; nsCOMPtr mBoundingSelection; - nsAutoTArray mPresShellStates; - nsAutoTArray mFramesMarkedForDisplay; - nsAutoTArray mThemeGeometries; + AutoTArray mPresShellStates; + AutoTArray mFramesMarkedForDisplay; + AutoTArray mThemeGeometries; nsDisplayTableItem* mCurrentTableItem; DisplayListClipState mClipState; // mCurrentFrame is the frame that we're currently calling (or about to call) @@ -1359,7 +1359,7 @@ public: // Handling transform items for preserve 3D frames. bool mInPreserves3D; - nsAutoTArray mItemBuffer; + AutoTArray mItemBuffer; }; /** diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 86a9cdbf9e..505a35f7bf 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -1759,7 +1759,7 @@ protected: // same update block we have already had other changes that require // the whole document to be restyled (i.e., mStylesHaveChanged is already // true), then we don't bother adding the scope root here. - nsAutoTArray,1> mChangedScopeStyleRoots; + AutoTArray,1> mChangedScopeStyleRoots; static nsIContent* gKeyDownTarget; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 4c0e25c981..b037b25373 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1554,7 +1554,7 @@ nsLayoutUtils::DoCompareTreePosition(nsIContent* aContent1, NS_PRECONDITION(aContent1, "aContent1 must not be null"); NS_PRECONDITION(aContent2, "aContent2 must not be null"); - nsAutoTArray content1Ancestors; + AutoTArray content1Ancestors; nsINode* c1; for (c1 = aContent1; c1 && c1 != aCommonAncestor; c1 = c1->GetParentNode()) { content1Ancestors.AppendElement(c1); @@ -1565,7 +1565,7 @@ nsLayoutUtils::DoCompareTreePosition(nsIContent* aContent1, aCommonAncestor = nullptr; } - nsAutoTArray content2Ancestors; + AutoTArray content2Ancestors; nsINode* c2; for (c2 = aContent2; c2 && c2 != aCommonAncestor; c2 = c2->GetParentNode()) { content2Ancestors.AppendElement(c2); @@ -1659,7 +1659,7 @@ nsLayoutUtils::DoCompareTreePosition(nsIFrame* aFrame1, NS_PRECONDITION(aFrame1, "aFrame1 must not be null"); NS_PRECONDITION(aFrame2, "aFrame2 must not be null"); - nsAutoTArray frame2Ancestors; + AutoTArray frame2Ancestors; nsIFrame* nonCommonAncestor = FillAncestors(aFrame2, aCommonAncestor, &frame2Ancestors); @@ -1686,7 +1686,7 @@ nsLayoutUtils::DoCompareTreePosition(nsIFrame* aFrame1, return 0; } - nsAutoTArray frame1Ancestors; + AutoTArray frame1Ancestors; if (aCommonAncestor && !FillAncestors(aFrame1, aCommonAncestor, &frame1Ancestors)) { // We reached the root of the frame tree ... if aCommonAncestor was set, @@ -2462,8 +2462,8 @@ nsLayoutUtils::FindNearestCommonAncestorFrame(nsIFrame* aFrame1, nsIFrame* aFram return nullptr; } - nsAutoTArray ancestors1; - nsAutoTArray ancestors2; + AutoTArray ancestors1; + AutoTArray ancestors2; nsIFrame* commonAncestor = nullptr; if (aFrame1->PresContext() == aFrame2->PresContext()) { commonAncestor = aFrame1->PresContext()->PresShell()->GetRootFrame(); @@ -2920,7 +2920,7 @@ nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, uint32_t aFlags) js::ProfileEntry::Category::GRAPHICS); nsresult rv; - nsAutoTArray outFrames; + AutoTArray outFrames; rv = GetFramesForArea(aFrame, nsRect(aPt, nsSize(1, 1)), outFrames, aFlags); NS_ENSURE_SUCCESS(rv, nullptr); return outFrames.Length() ? outFrames.ElementAt(0) : nullptr; @@ -5048,7 +5048,7 @@ nsLayoutUtils::ComputeBSizeDependentValue( /* static */ void nsLayoutUtils::MarkDescendantsDirty(nsIFrame *aSubtreeRoot) { - nsAutoTArray subtrees; + AutoTArray subtrees; subtrees.AppendElement(aSubtreeRoot); // dirty descendants, iterating over subtrees that may include @@ -5061,7 +5061,7 @@ nsLayoutUtils::MarkDescendantsDirty(nsIFrame *aSubtreeRoot) // recursion). // Note that nsHTMLReflowState::InitResizeFlags has some similar // code; see comments there for how and why it differs. - nsAutoTArray stack; + AutoTArray stack; stack.AppendElement(subtreeRoot); do { @@ -7510,7 +7510,7 @@ nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame, return total; } - nsAutoTArray childListArray; + AutoTArray childListArray; aFrame->GetChildLists(&childListArray); for (nsIFrame::ChildListArrayIterator childLists(childListArray); diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 680fcbf88d..ea4ebc42df 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -3128,7 +3128,7 @@ SortConfigurations(nsTArray* aConfigurations) continue; LayoutDeviceIntRect bounds; pluginsToMove[j].mChild->GetBounds(bounds); - nsAutoTArray clipRects; + AutoTArray clipRects; pluginsToMove[j].mChild->GetWindowClipRegion(&clipRects); if (HasOverlap(bounds.TopLeft(), clipRects, config->mBounds.TopLeft(), diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 20091e88c9..87487b8259 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -2513,7 +2513,7 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty, } #endif - nsAutoTArray subtrees; + AutoTArray subtrees; subtrees.AppendElement(aFrame); do { @@ -2564,7 +2564,7 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty, // recursion). // Note that nsHTMLReflowState::InitResizeFlags has some similar // code; see comments there for how and why it differs. - nsAutoTArray stack; + AutoTArray stack; stack.AppendElement(subtreeRoot); do { @@ -4343,7 +4343,7 @@ PresShell::ReconstructFrames(void) void nsIPresShell::ReconstructStyleDataInternal() { - nsAutoTArray,1> scopeRoots; + AutoTArray,1> scopeRoots; mChangedScopeStyleRoots.SwapElements(scopeRoots); if (mStylesHaveChanged) { @@ -5885,7 +5885,7 @@ public: nsDisplayListBuilder::EVENT_DELIVERY, /* aBuildCert= */ false); nsDisplayList list; - nsAutoTArray outFrames; + AutoTArray outFrames; nsDisplayItem::HitTestState hitTestState; builder.EnterPresShell(mFrame); nsRect bounds = mShell->GetPresContext()->GetVisibleArea(); @@ -6777,7 +6777,7 @@ PresShell::DispatchAfterKeyboardEvent(nsINode* aTarget, } // Build up a target chain. Each item in the chain will receive an after event. - nsAutoTArray, 5> chain; + AutoTArray, 5> chain; bool targetIsIframe = false; BuildTargetChainForBeforeAfterKeyboardEvent(aTarget, chain, targetIsIframe); DispatchAfterKeyboardEventInternal(chain, aEvent, aEmbeddedCancelled); @@ -6812,7 +6812,7 @@ PresShell::HandleKeyboardEvent(nsINode* aTarget, MOZ_ASSERT(aEvent.mMessage == eKeyDown || aEvent.mMessage == eKeyUp); // Build up a target chain. Each item in the chain will receive a before event. - nsAutoTArray, 5> chain; + AutoTArray, 5> chain; bool targetIsIframe = false; BuildTargetChainForBeforeAfterKeyboardEvent(aTarget, chain, targetIsIframe); diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index c3f4b8de3f..1831b2ed2d 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -1663,7 +1663,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime) if (mPresContext && mPresContext->GetPresShell()) { bool tracingStyleFlush = false; - nsAutoTArray observers; + AutoTArray observers; observers.AppendElements(mStyleFlushObservers); for (uint32_t j = observers.Length(); j && mPresContext && mPresContext->GetPresShell(); --j) { @@ -1703,7 +1703,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime) } else if (i == 1) { // This is the Flush_Layout case. bool tracingLayoutFlush = false; - nsAutoTArray observers; + AutoTArray observers; observers.AppendElements(mLayoutFlushObservers); for (uint32_t j = observers.Length(); j && mPresContext && mPresContext->GetPresShell(); --j) { diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index 52755647d3..e1a167a7c0 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -394,9 +394,9 @@ private: RequestTable mRequests; ImageStartTable mStartTable; - nsAutoTArray mStyleFlushObservers; - nsAutoTArray mLayoutFlushObservers; - nsAutoTArray mPresShellsToInvalidateIfHidden; + AutoTArray mStyleFlushObservers; + AutoTArray mLayoutFlushObservers; + AutoTArray mPresShellsToInvalidateIfHidden; // nsTArray on purpose, because we want to be able to swap. nsTArray mFrameRequestCallbackDocs; nsTArray mThrottledFrameRequestCallbackDocs; diff --git a/layout/base/tests/mochitest.ini b/layout/base/tests/mochitest.ini index d2f227cb8b..8f3e4df76b 100644 --- a/layout/base/tests/mochitest.ini +++ b/layout/base/tests/mochitest.ini @@ -5,6 +5,7 @@ support-files = Ahem.ttf border_radius_hit_testing_iframe.html preserve3d_sorting_hit_testing_iframe.html + preserve3d_sorting_hit_testing2_iframe.html image_rgrg-256x256.png image_rrgg-256x256.png bug369950-subframe.xml @@ -42,6 +43,7 @@ support-files = multi-range-script-select-ref.html [test_preserve3d_sorting_hit_testing.html] +[test_preserve3d_sorting_hit_testing2.html] [test_after_paint_pref.html] [test_bug993936.html] skip-if = e10s diff --git a/layout/base/tests/preserve3d_sorting_hit_testing2_iframe.html b/layout/base/tests/preserve3d_sorting_hit_testing2_iframe.html new file mode 100644 index 0000000000..e9fa71977a --- /dev/null +++ b/layout/base/tests/preserve3d_sorting_hit_testing2_iframe.html @@ -0,0 +1,97 @@ + + + + + + + +
    +
    +

    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sagittis nisi urna, a ultrices est facilisis a. Morbi porttitor vulputate odio, eu lacinia nisi. Suspendisse felis sapien, facilisis nec ex in, blandit tincidunt tellus. Sed at commodo nunc. In nibh lectus, facilisis nec magna nec, bibendum egestas nunc. Nam varius lorem in fringilla cursus. Integer dignissim, lectus vitae sodales molestie, libero purus malesuada arcu, vitae facilisis nunc dolor non mi. In nunc tortor, tempor non pharetra vitae, mattis a purus. Nulla rhoncus vitae metus vel ornare. Nunc augue dui, suscipit ac urna vel, consectetur volutpat ipsum. Nunc ac nulla ut enim laoreet placerat. Sed luctus aliquam purus, sollicitudin blandit dui blandit id. Aenean venenatis risus dolor, at viverra urna aliquam non. Morbi sit amet pellentesque justo, eget viverra augue. +

    +

         + Praesent posuere ultricies orci sit amet lacinia. Suspendisse lacinia scelerisque risus, sodales egestas turpis cursus sed. Proin sed mollis mauris, vitae ultricies nibh. Nulla bibendum leo a mauris luctus, sit amet iaculis arcu blandit. Etiam pulvinar, odio et rutrum egestas, elit mi maximus ex, id elementum est tortor id turpis. Duis rhoncus et lorem vel maximus. Aenean at justo sagittis, aliquet eros eget, iaculis magna. Nam non orci congue, dapibus dui eget, sagittis nisl. Phasellus venenatis id est et tempor. Aenean condimentum tristique nibh sit amet varius. Vestibulum et lectus quis eros dapibus consectetur nec auctor dolor. Sed euismod eu felis aliquam fermentum. Donec lacinia fringilla erat, at eleifend velit tempus at. +

    +
    +

         + Cras justo turpis, vulputate eget venenatis sit amet, bibendum quis dolor. Cras at interdum libero. Quisque convallis rutrum magna in ultrices. Donec ut magna dolor. Mauris pulvinar ut sapien a posuere. Sed nisi elit, tincidunt vitae magna eu, dapibus suscipit purus. Maecenas tincidunt mollis eros et dictum. Duis est nulla, rhoncus tincidunt velit at, venenatis elementum velit. Phasellus lobortis sem tellus, id sodales quam dignissim nec. Phasellus pulvinar metus ex, nec gravida nunc elementum vel. Ut mattis varius fringilla. Phasellus imperdiet sit amet risus a elementum. Donec pulvinar ante sit amet massa blandit ullamcorper. Donec vitae malesuada nisl, et laoreet sem. +

    +

         + Suspendisse bibendum elit blandit arcu vulputate, nec hendrerit dui vehicula. Vestibulum porta finibus odio vitae maximus. Duis in vulputate risus. Donec mattis turpis ex, vitae semper sem ultrices eu. Aliquam in ex blandit erat ultrices sollicitudin. Vestibulum porta nisl in porttitor rutrum. Integer consectetur porttitor ligula facilisis malesuada. Proin placerat enim sed lacus commodo mollis nec eu arcu. In hac habitasse platea dictumst. Curabitur luctus est risus, sit amet fringilla nunc condimentum vel. Integer mauris lorem, molestie ut nisl sit amet, pellentesque mollis quam. Aliquam posuere purus non nisi molestie semper. +

    +
    +

         + Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris facilisis nisi diam, eu pulvinar ex sollicitudin sed. Maecenas sed eros id quam suscipit ultricies ut tincidunt quam. Donec iaculis, justo at fringilla laoreet, quam sem dapibus urna, ut eleifend odio eros et ligula. Proin urna ante, condimentum vitae sollicitudin sit amet, egestas ac nunc. Aenean sapien velit, porta a eros quis, iaculis dignissim felis. Suspendisse mollis vulputate metus vel interdum. Aliquam hendrerit elementum erat, sit amet commodo velit suscipit et. Sed semper sem at mauris rhoncus, id efficitur arcu molestie. Nam feugiat lorem pretium, consectetur felis et, fringilla dolor. Nunc dui velit, elementum non hendrerit nec, sagittis vitae odio. Curabitur nec leo tincidunt, pellentesque metus at, condimentum risus. +

    +
    +
    + + + + + diff --git a/layout/base/tests/test_preserve3d_sorting_hit_testing2.html b/layout/base/tests/test_preserve3d_sorting_hit_testing2.html new file mode 100644 index 0000000000..991b94640d --- /dev/null +++ b/layout/base/tests/test_preserve3d_sorting_hit_testing2.html @@ -0,0 +1,40 @@ + + + + + Test for Bug 1241394 + + + + +Mozilla Bug 1241394 +
    +
    +
    + + diff --git a/layout/generic/FrameChildList.h b/layout/generic/FrameChildList.h index 34bce1e1f4..8ccfa2ff81 100644 --- a/layout/generic/FrameChildList.h +++ b/layout/generic/FrameChildList.h @@ -93,7 +93,7 @@ class MOZ_STACK_CLASS FrameChildListIterator explicit FrameChildListIterator(const nsIFrame* aFrame); protected: - nsAutoTArray mLists; + AutoTArray mLists; }; inline mozilla::layout::FrameChildListIDs diff --git a/layout/generic/MathMLTextRunFactory.cpp b/layout/generic/MathMLTextRunFactory.cpp index 557c1bfc37..1fc3cb148a 100644 --- a/layout/generic/MathMLTextRunFactory.cpp +++ b/layout/generic/MathMLTextRunFactory.cpp @@ -535,10 +535,10 @@ MathMLTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, gfxFontGroup* fontGroup = aTextRun->GetFontGroup(); nsAutoString convertedString; - nsAutoTArray charsToMergeArray; - nsAutoTArray deletedCharsArray; - nsAutoTArray,50> styleArray; - nsAutoTArray canBreakBeforeArray; + AutoTArray charsToMergeArray; + AutoTArray deletedCharsArray; + AutoTArray,50> styleArray; + AutoTArray canBreakBeforeArray; bool mergeNeeded = false; bool singleCharMI = diff --git a/layout/generic/RubyUtils.h b/layout/generic/RubyUtils.h index 1497c93c40..0b610c49b8 100644 --- a/layout/generic/RubyUtils.h +++ b/layout/generic/RubyUtils.h @@ -97,7 +97,7 @@ public: * of the given ruby base container. */ class MOZ_STACK_CLASS AutoRubyTextContainerArray final - : public nsAutoTArray + : public AutoTArray { public: explicit AutoRubyTextContainerArray(nsRubyBaseContainerFrame* aBaseContainer); @@ -131,7 +131,7 @@ private: struct MOZ_STACK_CLASS RubyColumn { nsRubyBaseFrame* mBaseFrame; - nsAutoTArray mTextFrames; + AutoTArray mTextFrames; bool mIsIntraLevelWhitespace; RubyColumn() : mBaseFrame(nullptr), mIsIntraLevelWhitespace(false) { } @@ -204,7 +204,7 @@ private: // Frames in this array are NOT necessary part of the current column. // When in doubt, use GetFrameAtLevel to access it. // See GetFrameAtLevel() and Next() for more info. - nsAutoTArray mFrames; + AutoTArray mFrames; // Whether we are on a column for intra-level whitespaces bool mAtIntraLevelWhitespace; }; diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 6edd2980e3..11bcf8ba4a 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -7288,7 +7288,7 @@ nsBlockFrame::CheckFloats(nsBlockReflowState& aState) bool anyLineDirty = false; // Check that the float list is what we would have built - nsAutoTArray lineFloats; + AutoTArray lineFloats; for (line_iterator line = begin_lines(), line_end = end_lines(); line != line_end; ++line) { if (line->HasFloats()) { @@ -7303,7 +7303,7 @@ nsBlockFrame::CheckFloats(nsBlockReflowState& aState) } } - nsAutoTArray storedFloats; + AutoTArray storedFloats; bool equal = true; uint32_t i = 0; for (nsIFrame* f : mFloats) { diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index d60f91e63f..c6874b3f35 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -1526,7 +1526,7 @@ nsContainerFrame::DeleteNextInFlowChild(nsIFrame* aNextInFlow, // with very many next-in-flows nsIFrame* nextNextInFlow = aNextInFlow->GetNextInFlow(); if (nextNextInFlow) { - nsAutoTArray frames; + AutoTArray frames; for (nsIFrame* f = nextNextInFlow; f; f = f->GetNextInFlow()) { frames.AppendElement(f); } diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 32fe69039f..009f75d084 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -3718,7 +3718,7 @@ nsFlexContainerFrame::Reflow(nsPresContext* aPresContext, nscoord contentBoxMainSize = GetMainSizeFromReflowState(aReflowState, axisTracker); - nsAutoTArray struts; + AutoTArray struts; DoFlexLayout(aPresContext, aDesiredSize, aReflowState, aStatus, contentBoxMainSize, availableBSizeForContent, struts, axisTracker); diff --git a/layout/generic/nsFontInflationData.cpp b/layout/generic/nsFontInflationData.cpp index 42d6877194..3980cb5ba8 100644 --- a/layout/generic/nsFontInflationData.cpp +++ b/layout/generic/nsFontInflationData.cpp @@ -100,7 +100,7 @@ NearestCommonAncestorFirstInFlow(nsIFrame *aFrame1, nsIFrame *aFrame2, aFrame2 = aFrame2->FirstInFlow(); aKnownCommonAncestor = aKnownCommonAncestor->FirstInFlow(); - nsAutoTArray ancestors1, ancestors2; + AutoTArray ancestors1, ancestors2; for (nsIFrame *f = aFrame1; f != aKnownCommonAncestor; (f = f->GetParent()) && (f = f->FirstInFlow())) { ancestors1.AppendElement(f); @@ -132,7 +132,7 @@ ComputeDescendantISize(const nsHTMLReflowState& aAncestorReflowState, return aAncestorReflowState.ComputedISize(); } - AutoInfallibleTArray frames; + AutoTArray frames; for (nsIFrame *f = aDescendantFrame; f != ancestorFrame; f = f->GetParent()->FirstInFlow()) { frames.AppendElement(f); @@ -238,7 +238,7 @@ nsFontInflationData::FindEdgeInflatableFrameIn(nsIFrame* aFrame, } // FIXME: aDirection! - nsAutoTArray lists; + AutoTArray lists; aFrame->GetChildLists(&lists); for (uint32_t i = 0, len = lists.Length(); i < len; ++i) { const nsFrameList& list = diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index aa7547e8be..924a698fe9 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -5238,7 +5238,7 @@ nsIFrame::InvalidateFrameSubtree(uint32_t aDisplayItemKey) AddStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT); - nsAutoTArray childListArray; + AutoTArray childListArray; GetCrossDocChildLists(&childListArray); nsIFrame::ChildListArrayIterator lists(childListArray); @@ -5254,7 +5254,7 @@ void nsIFrame::ClearInvalidationStateBits() { if (HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT)) { - nsAutoTArray childListArray; + AutoTArray childListArray; GetCrossDocChildLists(&childListArray); nsIFrame::ChildListArrayIterator lists(childListArray); @@ -8947,7 +8947,7 @@ nsIFrame::AddInPopupStateBitToDescendants(nsIFrame* aFrame) { aFrame->AddStateBits(NS_FRAME_IN_POPUP); - nsAutoTArray childListArray; + AutoTArray childListArray; aFrame->GetCrossDocChildLists(&childListArray); nsIFrame::ChildListArrayIterator lists(childListArray); @@ -8969,7 +8969,7 @@ nsIFrame::RemoveInPopupStateBitFromDescendants(nsIFrame* aFrame) aFrame->RemoveStateBits(NS_FRAME_IN_POPUP); - nsAutoTArray childListArray; + AutoTArray childListArray; aFrame->GetCrossDocChildLists(&childListArray); nsIFrame::ChildListArrayIterator lists(childListArray); diff --git a/layout/generic/nsFrameState.cpp b/layout/generic/nsFrameState.cpp index 3bfadca7d0..2eec729db2 100644 --- a/layout/generic/nsFrameState.cpp +++ b/layout/generic/nsFrameState.cpp @@ -32,7 +32,7 @@ nsCString GetFrameState(nsIFrame* aFrame) { nsCString result; - nsAutoTArray groups; + AutoTArray groups; nsFrameState state = aFrame->GetStateBits(); diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 20d0747bb5..f4eb2a5bc7 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2690,7 +2690,7 @@ ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder, bool overlayScrollbars = LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0; - nsAutoTArray scrollParts; + AutoTArray scrollParts; for (nsIFrame* kid : mOuter->PrincipalChildList()) { if (kid == mScrolledFrame || (kid->IsAbsPosContaininingBlock() || overlayScrollbars) != aPositioned) diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index 0ac5e89d8d..6c1a1d25e5 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -958,7 +958,7 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Tracks } #endif - nsAutoTArray mSizes; + AutoTArray mSizes; nscoord mContentBoxSize; nscoord mGridGap; LogicalAxis mAxis; @@ -2563,7 +2563,7 @@ nsGridContainerFrame::Tracks::ResolveIntrinsicSize( // http://dev.w3.org/csswg/css-grid/#algo-content // We're also setting mIsFlexing on the item here to speed up // FindUsedFlexFraction later. - nsAutoTArray stateBitsPerSpan; + AutoTArray stateBitsPerSpan; nsTArray step2Items; GridItemCSSOrderIterator& iter = aState.mIter; nsRenderingContext* rc = &aState.mRenderingContext; diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 765d936e94..70430b7e71 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -599,7 +599,7 @@ nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameT // frame tree geometry (the width on an ancestor) rather than // style. - nsAutoTArray stack; + AutoTArray stack; stack.AppendElement(frame); do { diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 3a0d168b0a..837c0e30d7 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -844,7 +844,7 @@ public: nsPoint GetPositionIgnoringScrolling(); - typedef nsAutoTArray ContentArray; + typedef AutoTArray ContentArray; static void DestroyContentArray(ContentArray* aArray); #define NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(prop, type, dtor) \ diff --git a/layout/generic/nsImageMap.h b/layout/generic/nsImageMap.h index 627657b104..50dd737972 100644 --- a/layout/generic/nsImageMap.h +++ b/layout/generic/nsImageMap.h @@ -90,7 +90,7 @@ protected: nsImageFrame* mImageFrame; // the frame that owns us nsCOMPtr mMap; - nsAutoTArray mAreas; // almost always has some entries + AutoTArray mAreas; // almost always has some entries bool mContainsBlockContents; }; diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index 18adb7238e..ccaab85fd2 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -313,7 +313,7 @@ nsPluginFrame::PrepForDrawing(nsIWidget *aWidget) // will be reset when nsRootPresContext computes our true // geometry. The plugin window does need to have a good size here, so // set the size explicitly to a reasonable guess. - nsAutoTArray configurations; + AutoTArray configurations; nsIWidget::Configuration* configuration = configurations.AppendElement(); nscoord appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel(); configuration->mChild = mWidget; diff --git a/layout/generic/nsRubyBaseContainerFrame.cpp b/layout/generic/nsRubyBaseContainerFrame.cpp index 364324babe..72262b25d3 100644 --- a/layout/generic/nsRubyBaseContainerFrame.cpp +++ b/layout/generic/nsRubyBaseContainerFrame.cpp @@ -334,8 +334,8 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext, // Since there are pointers refer to reflow states and line layouts, // it is necessary to guarantee that they won't be moved. For this // reason, they are wrapped in UniquePtr here. - nsAutoTArray, RTC_ARRAY_SIZE> reflowStates; - nsAutoTArray, RTC_ARRAY_SIZE> lineLayouts; + AutoTArray, RTC_ARRAY_SIZE> reflowStates; + AutoTArray, RTC_ARRAY_SIZE> lineLayouts; reflowStates.SetCapacity(rtcCount); lineLayouts.SetCapacity(rtcCount); @@ -451,7 +451,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext, struct MOZ_STACK_CLASS nsRubyBaseContainerFrame::PullFrameState { ContinuationTraversingState mBase; - nsAutoTArray mTexts; + AutoTArray mTexts; const AutoRubyTextContainerArray& mTextContainers; PullFrameState(nsRubyBaseContainerFrame* aBaseContainer, diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 8c270b8897..f92d838722 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -3688,7 +3688,7 @@ Selection::AddItem(nsRange* aItem, int32_t* aOutIndex, bool aNoStartSelect) */ #if 0 if (mUserInitiated) { - nsAutoTArray, 4> rangesToAdd; + AutoTArray, 4> rangesToAdd; *aOutIndex = -1; nsIDocument* doc = GetParentObject(); diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 706e497785..ca51a45ec0 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -1020,10 +1020,10 @@ public: }; private: - nsAutoTArray mMappedFlows; - nsAutoTArray mLineBreakBeforeFrames; - nsAutoTArray,10> mBreakSinks; - nsAutoTArray mTextRunsToDelete; + AutoTArray mMappedFlows; + AutoTArray mLineBreakBeforeFrames; + AutoTArray,10> mBreakSinks; + AutoTArray mTextRunsToDelete; nsLineBreaker mLineBreaker; gfxTextRun* mCurrentFramesAllSameTextRun; DrawTarget* mDrawTarget; @@ -1502,7 +1502,7 @@ void BuildTextRunsScanner::FlushFrames(bool aFlushLineBreaks, bool aSuppressTrai mNextRunContextInfo |= nsTextFrameUtils::INCOMING_ARABICCHAR; } } else { - AutoFallibleTArray buffer; + AutoTArray buffer; uint32_t bufferSize = mMaxTextLength*(mDoubleByteText ? 2 : 1); if (bufferSize < mMaxTextLength || bufferSize == UINT32_MAX || !buffer.AppendElements(bufferSize, fallible)) { @@ -1925,7 +1925,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) textFlags |= gfxTextRunFactory::TEXT_INCOMING_ARABICCHAR; } - nsAutoTArray textBreakPoints; + AutoTArray textBreakPoints; TextRunUserData dummyData; TextRunMappedFlow dummyMappedFlow; @@ -2095,7 +2095,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) if (mDoubleByteText) { // Need to expand the text. First transform it into a temporary buffer, // then expand. - AutoFallibleTArray tempBuf; + AutoTArray tempBuf; uint8_t* bufStart = tempBuf.AppendElements(contentLength, fallible); if (!bufStart) { DestroyUserData(userDataToDestroy); @@ -2176,7 +2176,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) NS_ASSERTION(nextBreakIndex == mLineBreakBeforeFrames.Length(), "Didn't find all the frames to break-before..."); gfxSkipCharsIterator iter(skipChars); - nsAutoTArray textBreakPointsAfterTransform; + AutoTArray textBreakPointsAfterTransform; for (uint32_t i = 0; i < textBreakPoints.Length(); ++i) { nsTextFrameUtils::AppendLineBreakOffset(&textBreakPointsAfterTransform, iter.ConvertOriginalToSkipped(textBreakPoints[i])); @@ -2306,7 +2306,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) bool BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun) { - AutoFallibleTArray buffer; + AutoTArray buffer; uint32_t bufferSize = mMaxTextLength*(mDoubleByteText ? 2 : 1); if (bufferSize < mMaxTextLength || bufferSize == UINT32_MAX) { return false; @@ -2318,7 +2318,7 @@ BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun) gfxSkipChars skipChars; - nsAutoTArray textBreakPoints; + AutoTArray textBreakPoints; TextRunUserData dummyData; TextRunMappedFlow dummyMappedFlow; @@ -2383,7 +2383,7 @@ BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun) if (mDoubleByteText) { // Need to expand the text. First transform it into a temporary buffer, // then expand. - AutoFallibleTArray tempBuf; + AutoTArray tempBuf; uint8_t* bufStart = tempBuf.AppendElements(contentLength, fallible); if (!bufStart) { DestroyUserData(userDataToDestroy); @@ -5987,7 +5987,7 @@ nsTextFrame::PaintTextWithSelectionColors(gfxContext* aCtx, nsTextFrame::DrawPathCallbacks* aCallbacks) { // Figure out which selections control the colors to use for each character. - AutoFallibleTArray prevailingSelectionsBuffer; + AutoTArray prevailingSelectionsBuffer; SelectionDetails** prevailingSelections = prevailingSelectionsBuffer.AppendElements(aContentLength, fallible); if (!prevailingSelections) { @@ -6127,7 +6127,7 @@ nsTextFrame::PaintTextSelectionDecorations(gfxContext* aCtx, return; // Figure out which characters will be decorated for this selection. - AutoFallibleTArray selectedCharsBuffer; + AutoTArray selectedCharsBuffer; SelectionDetails** selectedChars = selectedCharsBuffer.AppendElements(aContentLength, fallible); if (!selectedChars) { @@ -7894,7 +7894,7 @@ nsTextFrame::AddInlineMinISizeForFlow(nsRenderingContext *aRenderingContext, uint32_t start = FindStartAfterSkippingWhitespace(&provider, aData, textStyle, &iter, flowEndInTextRun); - AutoFallibleTArray hyphBuffer; + AutoTArray hyphBuffer; bool *hyphBreakBefore = nullptr; if (hyphenating) { hyphBreakBefore = hyphBuffer.AppendElements(flowEndInTextRun - start, diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index 904da87b0d..f05b15ddd4 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -676,7 +676,7 @@ protected: } }; struct TextDecorations { - nsAutoTArray mOverlines, mUnderlines, mStrikes; + AutoTArray mOverlines, mUnderlines, mStrikes; TextDecorations() { } diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp index a6b021f7a6..d5b702ddce 100644 --- a/layout/generic/nsTextRunTransformations.cpp +++ b/layout/generic/nsTextRunTransformations.cpp @@ -133,7 +133,7 @@ MergeCharactersInTextRun(gfxTextRun* aDest, gfxTextRun* aSrc, gfxTextRun::GlyphRunIterator iter(aSrc, 0, aSrc->GetLength()); uint32_t offset = 0; - nsAutoTArray glyphs; + AutoTArray glyphs; while (iter.NextRun()) { gfxTextRun::GlyphRun* run = iter.GetGlyphRun(); nsresult rv = aDest->AddGlyphRun(run->mFont, run->mMatchType, @@ -617,10 +617,10 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, gfxMissingFontRecorder* aMFR) { nsAutoString convertedString; - nsAutoTArray charsToMergeArray; - nsAutoTArray deletedCharsArray; - nsAutoTArray canBreakBeforeArray; - nsAutoTArray,50> styleArray; + AutoTArray charsToMergeArray; + AutoTArray deletedCharsArray; + AutoTArray canBreakBeforeArray; + AutoTArray,50> styleArray; bool mergeNeeded = TransformString(aTextRun->mString, convertedString, diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index ee977a0ab0..9d71213c55 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -91,7 +91,7 @@ inDOMUtils::GetAllStyleSheets(nsIDOMDocument *aDocument, uint32_t *aLength, for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) { sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i)); } - nsAutoTArray xblSheetArray; + AutoTArray xblSheetArray; styleSet->AppendAllXBLStyleSheets(xblSheetArray); // The XBL stylesheet array will quite often be full of duplicates. Cope: diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp index 79741dbe9d..51697a4095 100644 --- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -1089,7 +1089,7 @@ public: bool mTryParts; private: - nsAutoTArray mTablesTried; + AutoTArray mTablesTried; bool& mGlyphFound; }; @@ -1655,7 +1655,7 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext, // really shouldn't be doing things this way but for now // insert fallbacks into the list - nsAutoTArray mathFallbacks; + AutoTArray mathFallbacks; gfxFontUtils::GetPrefsFontList("font.name.serif.x-math", mathFallbacks); gfxFontUtils::AppendPrefsFontList("font.name-list.serif.x-math", mathFallbacks); diff --git a/layout/mathml/nsMathMLmmultiscriptsFrame.cpp b/layout/mathml/nsMathMLmmultiscriptsFrame.cpp index 126f54ca30..01a3599fe3 100644 --- a/layout/mathml/nsMathMLmmultiscriptsFrame.cpp +++ b/layout/mathml/nsMathMLmmultiscriptsFrame.cpp @@ -59,7 +59,7 @@ nsMathMLmmultiscriptsFrame::TransmitAutomaticData() int32_t count = 0; bool isSubScript = !mContent->IsMathMLElement(nsGkAtoms::msup_); - nsAutoTArray subScriptFrames; + AutoTArray subScriptFrames; nsIFrame* childFrame = mFrames.FirstChild(); while (childFrame) { if (childFrame->GetContent()->IsMathMLElement(nsGkAtoms::mprescripts_)) { diff --git a/layout/style/CSSStyleSheet.cpp b/layout/style/CSSStyleSheet.cpp index 11b4c18042..1a82d3f14c 100644 --- a/layout/style/CSSStyleSheet.cpp +++ b/layout/style/CSSStyleSheet.cpp @@ -1328,7 +1328,7 @@ nsresult CSSStyleSheet::AddRuleProcessor(nsCSSRuleProcessor* aProcessor) { if (! mRuleProcessors) { - mRuleProcessors = new nsAutoTArray(); + mRuleProcessors = new AutoTArray(); if (!mRuleProcessors) return NS_ERROR_OUT_OF_MEMORY; } diff --git a/layout/style/CSSStyleSheet.h b/layout/style/CSSStyleSheet.h index 3a61cb7a32..940d7a78de 100644 --- a/layout/style/CSSStyleSheet.h +++ b/layout/style/CSSStyleSheet.h @@ -111,7 +111,7 @@ private: size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const; - nsAutoTArray mSheets; + AutoTArray mSheets; nsCOMPtr mSheetURI; // for error reports, etc. nsCOMPtr mOriginalSheetURI; // for GetHref. Can be null. nsCOMPtr mBaseURI; // for resolving relative URIs @@ -412,7 +412,7 @@ protected: CSSStyleSheetInner* mInner; - nsAutoTArray* mRuleProcessors; + AutoTArray* mRuleProcessors; nsTArray mStyleSets; friend class ::nsMediaList; diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp index 8846f80daa..0055ef2c99 100644 --- a/layout/style/CounterStyleManager.cpp +++ b/layout/style/CounterStyleManager.cpp @@ -121,7 +121,7 @@ GetAlphabeticCounterText(CounterValue aOrdinal, // The precise length of this array should be // ceil(log((double) aOrdinal / n * (n - 1) + 1) / log(n)). // The max length is slightly smaller than which defined below. - nsAutoTArray::digits> indexes; + AutoTArray::digits> indexes; while (aOrdinal > 0) { --aOrdinal; indexes.AppendElement(aOrdinal % n); @@ -150,7 +150,7 @@ GetNumericCounterText(CounterValue aOrdinal, } auto n = aSymbols.Length(); - nsAutoTArray::digits> indexes; + AutoTArray::digits> indexes; while (aOrdinal > 0) { indexes.AppendElement(aOrdinal % n); aOrdinal /= n; diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index c8a07a1c76..8dc4a02b4f 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -1371,7 +1371,7 @@ Declaration::ToString(nsAString& aString) const int32_t count = mOrder.Length(); int32_t index; - nsAutoTArray shorthandsUsed; + AutoTArray shorthandsUsed; for (index = 0; index < count; index++) { nsCSSProperty property = GetPropertyAt(index); diff --git a/layout/style/Declaration.h b/layout/style/Declaration.h index b044c53943..07e8a706cd 100644 --- a/layout/style/Declaration.h +++ b/layout/style/Declaration.h @@ -414,7 +414,7 @@ private: // Subtracting eCSSProperty_COUNT from those values that represent custom // properties results in an index into mVariableOrder, which identifies the // specific variable the custom property declaration is for. - nsAutoTArray mOrder; + AutoTArray mOrder; // variable names of custom properties found in mOrder nsTArray mVariableOrder; diff --git a/layout/style/FontFace.h b/layout/style/FontFace.h index e7605535b1..41085dd564 100644 --- a/layout/style/FontFace.h +++ b/layout/style/FontFace.h @@ -54,14 +54,14 @@ public: virtual void SetLoadState(UserFontLoadState aLoadState) override; virtual void GetUserFontSets(nsTArray& aResult) override; - const nsAutoTArray& GetFontFaces() { return mFontFaces; } + const AutoTArray& GetFontFaces() { return mFontFaces; } protected: // The FontFace objects that use this user font entry. We need to store // an array of these, not just a single pointer, since the user font // cache can return the same entry for different FontFaces that have // the same descriptor values and come from the same origin. - nsAutoTArray mFontFaces; + AutoTArray mFontFaces; }; NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 8079a501e3..af3c18ab4d 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -282,7 +282,7 @@ FontFaceSet::FindMatchingFontFaces(const nsAString& aFont, continue; } - nsAutoTArray entries; + AutoTArray entries; bool needsBold; family->FindAllFontsForStyle(style, entries, needsBold); diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index e28fae692a..db9e89be26 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -1800,7 +1800,7 @@ Loader::SheetComplete(SheetLoadData* aLoadData, nsresult aStatus) // 8 is probably big enough for all our common cases. It's not likely that // imports will nest more than 8 deep, and multiple sheets with the same URI // are rare. - nsAutoTArray, 8> datasToNotify; + AutoTArray, 8> datasToNotify; DoSheetComplete(aLoadData, aStatus, datasToNotify); // Now it's safe to go ahead and notify observers diff --git a/layout/style/Loader.h b/layout/style/Loader.h index d2082eb2a5..8b6117e2ab 100644 --- a/layout/style/Loader.h +++ b/layout/style/Loader.h @@ -553,7 +553,7 @@ private: // We're not likely to have many levels of @import... But likely to have // some. Allocate some storage, what the hell. - nsAutoTArray mParsingDatas; + AutoTArray mParsingDatas; // The array of posted stylesheet loaded events (SheetLoadDatas) we have. // Note that these are rare. diff --git a/layout/style/StyleAnimationValue.cpp b/layout/style/StyleAnimationValue.cpp index c286726cd4..60e6390613 100644 --- a/layout/style/StyleAnimationValue.cpp +++ b/layout/style/StyleAnimationValue.cpp @@ -2567,7 +2567,7 @@ StyleAnimationValue::ComputeValue(nsCSSProperty aProperty, return true; } - nsAutoTArray values; + AutoTArray values; bool ok = ComputeValues(aProperty, nsCSSProps::eIgnoreEnabledState, aTargetElement, styleRule, values, aIsContextSensitive); diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index d53479d8b4..4b789a6d1d 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -562,7 +562,7 @@ nsCSSSelector::ToString(nsAString& aString, CSSStyleSheet* aSheet, // selectors are linked from right-to-left, so the next selector in // the linked list actually precedes this one in the resulting string - nsAutoTArray stack; + AutoTArray stack; for (const nsCSSSelector *s = this; s; s = s->mNext) { stack.AppendElement(s); } diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index d6c023ef20..fbdcbf6a1b 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -669,7 +669,7 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext, // the replacement on a per-property basis rather than a per-rule // basis, just like everything else in CSS. - AutoInfallibleTArray sortedKeyframes; + AutoTArray sortedKeyframes; for (uint32_t ruleIdx = 0, ruleEnd = rule->StyleRuleCount(); ruleIdx != ruleEnd; ++ruleIdx) { @@ -730,7 +730,7 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext, // means we need every keyframe with the property in it, except // for those keyframes where a later keyframe with the *same key* // also has the property. - AutoInfallibleTArray keyframesWithProperty; + AutoTArray keyframesWithProperty; float lastKey = 100.0f; // an invalid key for (uint32_t kfIdx = 0, kfEnd = sortedKeyframes.Length(); kfIdx != kfEnd; ++kfIdx) { diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 60c4639f62..26560236f5 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -623,7 +623,7 @@ protected: void SkipUntilOneOf(const char16_t* aStopSymbolChars); // For each character in aStopSymbolChars from the end of the array // to the start, calls SkipUntil with that character. - typedef nsAutoTArray StopSymbolCharStack; + typedef AutoTArray StopSymbolCharStack; void SkipUntilAllOf(const StopSymbolCharStack& aStopSymbolChars); // returns true if the stop symbol or EOF is found, and false for an // unexpected ')', ']' or '}'; this not safe to call outside variable @@ -2535,7 +2535,7 @@ CSSParserImpl::ResolveValueWithVariableReferencesRec( MOZ_ASSERT(aResult.IsEmpty()); // Stack of closing characters for currently open constructs. - nsAutoTArray stack; + AutoTArray stack; // The resolved value for this ResolveValueWithVariableReferencesRec call. nsString value; @@ -4169,7 +4169,7 @@ CSSParserImpl::ParseFontFeatureValueSet(nsCSSFontFeatureValuesRule } // -- ident integer+ [, ident integer+] - nsAutoTArray values; + AutoTArray values; // list of font-feature-values-declaration's for (;;) { @@ -4212,7 +4212,7 @@ CSSParserImpl::ParseFontFeatureValueSet(nsCSSFontFeatureValuesRule } // value list - nsAutoTArray featureSelectors; + AutoTArray featureSelectors; nsCSSValue intValue; while (ParseNonNegativeInteger(intValue)) { @@ -5051,7 +5051,7 @@ bool CSSParserImpl::SkipUntil(char16_t aStopSymbol) { nsCSSToken* tk = &mToken; - nsAutoTArray stack; + AutoTArray stack; stack.AppendElement(aStopSymbol); for (;;) { if (!GetToken(true)) { @@ -5087,7 +5087,7 @@ bool CSSParserImpl::SkipBalancedContentUntil(char16_t aStopSymbol) { nsCSSToken* tk = &mToken; - nsAutoTArray stack; + AutoTArray stack; stack.AppendElement(aStopSymbol); for (;;) { if (!GetToken(true)) { @@ -15135,7 +15135,7 @@ CSSParserImpl::ParseFunction(nsCSSKeyword aFunction, * functions. The number 16 is coming from the number of arguments that * matrix3d() accepts. */ - AutoInfallibleTArray foundValues; + AutoTArray foundValues; if (!ParseFunctionInternals(aAllowedTypes, aAllowedTypesAll, aMinElems, aMaxElems, foundValues)) { return false; @@ -16863,7 +16863,7 @@ CSSParserImpl::ParseValueWithVariables(CSSVariableDeclarations::Type* aType, // Indexes into ')' characters in |stack| that correspond to "var(". This // is used to stop parsing when we encounter a '!' or ';' at the top level // of a variable reference's fallback. - nsAutoTArray references; + AutoTArray references; if (!GetToken(false)) { // Variable value was empty since we reached EOF. diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index b69399b73e..c3e98f6f2a 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -175,7 +175,7 @@ struct RuleHashTableEntry : public PLDHashEntryHdr { // If you add members that have heap allocated memory be sure to change the // logic in SizeOfRuleHashTable(). // Auto length 1, because we always have at least one entry in mRules. - nsAutoTArray mRules; + AutoTArray mRules; }; struct RuleHashTagTableEntry : public RuleHashTableEntry { @@ -812,7 +812,7 @@ struct AtomSelectorEntry : public PLDHashEntryHdr { nsIAtom *mAtom; // Auto length 2, because a decent fraction of these arrays ends up // with 2 elements, and each entry is cheap. - nsAutoTArray mSelectors; + AutoTArray mSelectors; }; static void @@ -4026,7 +4026,7 @@ TreeMatchContext::InitAncestors(Element *aElement) "for the assumption that GetParentNode() is non-null " "on all element ancestors of aElement to be true"); // Collect up the ancestors - nsAutoTArray ancestors; + AutoTArray ancestors; Element* cur = aElement; do { ancestors.AppendElement(cur); @@ -4048,7 +4048,7 @@ TreeMatchContext::InitStyleScopes(Element* aElement) if (MOZ_LIKELY(aElement)) { // Collect up the ancestors - nsAutoTArray ancestors; + AutoTArray ancestors; Element* cur = aElement; do { ancestors.AppendElement(cur); diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index e078cb19ed..33384d369b 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -1641,7 +1641,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, // functional values const nsCSSValueList *list = GetPairValue().mYValue.GetListValue(); - nsAutoTArray altValues; + AutoTArray altValues; nsStyleUtil::ComputeFunctionalAlternates(list, altValues); nsStyleUtil::SerializeFunctionalAlternates(altValues, out); diff --git a/layout/style/nsFontFaceUtils.cpp b/layout/style/nsFontFaceUtils.cpp index 92f6bd8276..02bac4342c 100644 --- a/layout/style/nsFontFaceUtils.cpp +++ b/layout/style/nsFontFaceUtils.cpp @@ -107,7 +107,7 @@ ScheduleReflow(nsIPresShell* aShell, nsIFrame* aFrame) nsFontFaceUtils::MarkDirtyForFontChange(nsIFrame* aSubtreeRoot, const gfxUserFontEntry* aFont) { - nsAutoTArray subtrees; + AutoTArray subtrees; subtrees.AppendElement(aSubtreeRoot); nsIPresShell* ps = aSubtreeRoot->PresContext()->PresShell(); @@ -119,7 +119,7 @@ nsFontFaceUtils::MarkDirtyForFontChange(nsIFrame* aSubtreeRoot, subtrees.RemoveElementAt(subtrees.Length() - 1); // Check all descendants to see if they use the font - nsAutoTArray stack; + AutoTArray stack; stack.AppendElement(subtreeRoot); do { diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 69f50e8e81..44b086de13 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -3957,7 +3957,7 @@ nsRuleNode::SetGenericFont(nsPresContext* aPresContext, nsStyleFont* aFont) { // walk up the contexts until a context with the desired generic font - nsAutoTArray contextPath; + AutoTArray contextPath; contextPath.AppendElement(aContext); nsStyleContext* higherContext = aContext->GetParent(); while (higherContext) { @@ -6659,8 +6659,8 @@ template static void SetImageLayerList(nsStyleContext* aStyleContext, const nsCSSValue& aValue, - nsAutoTArray< nsStyleImageLayers::Layer, 1> &aLayers, - const nsAutoTArray &aParentLayers, + AutoTArray< nsStyleImageLayers::Layer, 1> &aLayers, + const AutoTArray &aParentLayers, ComputedValueItem nsStyleImageLayers::Layer::* aResultLocation, ComputedValueItem aInitialValue, uint32_t aParentItemCount, @@ -6724,8 +6724,8 @@ template static void SetImageLayerPairList(nsStyleContext* aStyleContext, const nsCSSValue& aValue, - nsAutoTArray< nsStyleImageLayers::Layer, 1> &aLayers, - const nsAutoTArray + AutoTArray< nsStyleImageLayers::Layer, 1> &aLayers, + const AutoTArray &aParentLayers, ComputedValueItem nsStyleImageLayers::Layer::* aResultLocation, @@ -6791,7 +6791,7 @@ SetImageLayerPairList(nsStyleContext* aStyleContext, template static void -FillBackgroundList(nsAutoTArray< nsStyleImageLayers::Layer, 1> &aLayers, +FillBackgroundList(AutoTArray< nsStyleImageLayers::Layer, 1> &aLayers, ComputedValueItem nsStyleImageLayers::Layer::* aResultLocation, uint32_t aItemCount, uint32_t aFillCount) { @@ -9878,7 +9878,7 @@ nsRuleNode::Sweep() return true; } - nsAutoTArray sweepQueue; + AutoTArray sweepQueue; sweepQueue.AppendElement(this); while (!sweepQueue.IsEmpty()) { nsTArray::index_type last = sweepQueue.Length() - 1; diff --git a/layout/style/nsRuleProcessorData.h b/layout/style/nsRuleProcessorData.h index 0e84d96b73..3c31e1c3a7 100644 --- a/layout/style/nsRuleProcessorData.h +++ b/layout/style/nsRuleProcessorData.h @@ -336,7 +336,7 @@ struct MOZ_STACK_CLASS TreeMatchContext { nsRuleWalker::VisitedHandlingType mVisitedHandling; // For matching :scope - nsAutoTArray mScopes; + AutoTArray mScopes; public: // The document we're working with. nsIDocument* const mDocument; @@ -380,7 +380,7 @@ struct MOZ_STACK_CLASS TreeMatchContext { // List of ancestor elements that define a style scope (due to having a //