зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1348481 Part 1b: Generalize FindDocStyleSheetInsertionPoint so it doesn't require an array of RefPtrs. r=heycam
MozReview-Commit-ID: Aqnow6hFw5i --HG-- extra : rebase_source : 9fc2ecbd81eecf8e1d6cceb8e8fa4a4e44bbdac9
This commit is contained in:
Родитель
983e2dbe07
Коммит
0214fa7d70
|
@ -1234,11 +1234,13 @@ public:
|
|||
* sheets for this document, returns the index that aSheet should
|
||||
* be inserted at to maintain document ordering.
|
||||
*
|
||||
* Type T has to cast to StyleSheet*.
|
||||
*
|
||||
* Defined in nsIDocumentInlines.h.
|
||||
*/
|
||||
template<typename T>
|
||||
size_t FindDocStyleSheetInsertionPoint(const nsTArray<RefPtr<T>>& aDocSheets,
|
||||
T* aSheet);
|
||||
size_t FindDocStyleSheetInsertionPoint(const nsTArray<T>& aDocSheets,
|
||||
mozilla::StyleSheet* aSheet);
|
||||
|
||||
/**
|
||||
* Get this document's CSSLoader. This is guaranteed to not return null.
|
||||
|
|
|
@ -19,8 +19,8 @@ nsIDocument::GetBodyElement()
|
|||
template<typename T>
|
||||
size_t
|
||||
nsIDocument::FindDocStyleSheetInsertionPoint(
|
||||
const nsTArray<RefPtr<T>>& aDocSheets,
|
||||
T* aSheet)
|
||||
const nsTArray<T>& aDocSheets,
|
||||
mozilla::StyleSheet* aSheet)
|
||||
{
|
||||
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
||||
|
||||
|
@ -30,13 +30,12 @@ nsIDocument::FindDocStyleSheetInsertionPoint(
|
|||
int32_t count = aDocSheets.Length();
|
||||
int32_t index;
|
||||
for (index = 0; index < count; index++) {
|
||||
T* sheet = aDocSheets[index];
|
||||
mozilla::StyleSheet* sheet = static_cast<mozilla::StyleSheet*>(
|
||||
aDocSheets[index]);
|
||||
int32_t sheetDocIndex = GetIndexOfStyleSheet(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
|
||||
|
@ -45,11 +44,11 @@ nsIDocument::FindDocStyleSheetInsertionPoint(
|
|||
if (sheetService) {
|
||||
auto& authorSheets =
|
||||
*sheetService->AuthorStyleSheets(GetStyleBackendType());
|
||||
if (authorSheets.IndexOf(sheetHandle) != authorSheets.NoIndex) {
|
||||
if (authorSheets.IndexOf(sheet) != authorSheets.NoIndex) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sheetHandle == GetFirstAdditionalAuthorSheet()) {
|
||||
if (sheet == GetFirstAdditionalAuthorSheet()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче