diff options
Diffstat (limited to 'dom/base/nsIDocumentInlines.h')
-rw-r--r-- | dom/base/nsIDocumentInlines.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/dom/base/nsIDocumentInlines.h b/dom/base/nsIDocumentInlines.h index 4ba21dfe6..5b95a1bd3 100644 --- a/dom/base/nsIDocumentInlines.h +++ b/dom/base/nsIDocumentInlines.h @@ -19,24 +19,23 @@ nsIDocument::GetBodyElement() template<typename T> size_t nsIDocument::FindDocStyleSheetInsertionPoint( - const nsTArray<RefPtr<T>>& aDocSheets, - T* aSheet) + const nsTArray<T>& aDocSheets, + const mozilla::StyleSheet& aSheet) { nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance(); // lowest index first - int32_t newDocIndex = GetIndexOfStyleSheet(aSheet); - - int32_t count = aDocSheets.Length(); - int32_t index; - for (index = 0; index < count; index++) { - T* sheet = aDocSheets[index]; - int32_t sheetDocIndex = GetIndexOfStyleSheet(sheet); + int32_t newDocIndex = IndexOfSheet(aSheet); + + size_t count = aDocSheets.Length(); + size_t index = 0; + for (; index < count; index++) { + auto* sheet = static_cast<mozilla::StyleSheet*>(aDocSheets[index]); + MOZ_ASSERT(sheet); + int32_t sheetDocIndex = IndexOfSheet(*sheet); if (sheetDocIndex > newDocIndex) break; - mozilla::StyleSheet* sheetHandle = sheet; - // If the sheet is not owned by the document it can be an author // sheet registered at nsStyleSheetService or an additional author // sheet on the document, which means the new @@ -44,11 +43,11 @@ nsIDocument::FindDocStyleSheetInsertionPoint( if (sheetDocIndex < 0) { if (sheetService) { auto& authorSheets = *sheetService->AuthorStyleSheets(); - if (authorSheets.IndexOf(sheetHandle) != authorSheets.NoIndex) { + if (authorSheets.IndexOf(sheet) != authorSheets.NoIndex) { break; } } - if (sheetHandle == GetFirstAdditionalAuthorSheet()) { + if (sheet == GetFirstAdditionalAuthorSheet()) { break; } } |