summaryrefslogtreecommitdiffstats
path: root/dom/base/nsIDocumentInlines.h
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-04-17 16:02:56 +0200
committerGitHub <noreply@github.com>2020-04-17 16:02:56 +0200
commitd5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf (patch)
tree2bfef192cbb748b675ce8308c242a376798e265d /dom/base/nsIDocumentInlines.h
parent5caf99795aa81e1fc145b8e937b1ee8197ed2486 (diff)
parentf35aa3e15fedf3cd4ad163d60ab74a9537ca5c82 (diff)
downloadUXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar
UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.gz
UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.lz
UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.xz
UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.zip
Merge pull request #1518 from MoonchildProductions/shadowdom-merge
Incremental shadowdom-merge
Diffstat (limited to 'dom/base/nsIDocumentInlines.h')
-rw-r--r--dom/base/nsIDocumentInlines.h25
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;
}
}