зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1363572 Part 2: Change ServoStyleSet to use uint64_t for entry unique IDs. r=heycam
MozReview-Commit-ID: 50whQ71j4B5 --HG-- extra : rebase_source : 9f4fa6aa77d43c609c9b9c3af9d10dac54ced649
This commit is contained in:
Родитель
cb93fc35dd
Коммит
1abf09eb7e
|
@ -52,19 +52,19 @@ SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
|
|||
SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
|
||||
RawServoStyleSetBorrowed set,
|
||||
RawServoStyleSheetBorrowed sheet,
|
||||
uint32_t unique_id)
|
||||
uint64_t unique_id)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
|
||||
RawServoStyleSetBorrowed set,
|
||||
RawServoStyleSheetBorrowed sheet,
|
||||
uint32_t unique_id)
|
||||
uint64_t unique_id)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
|
||||
RawServoStyleSetBorrowed set,
|
||||
uint32_t unique_id)
|
||||
uint64_t unique_id)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
|
||||
RawServoStyleSetBorrowed set,
|
||||
RawServoStyleSheetBorrowed sheet,
|
||||
uint32_t unique_id,
|
||||
uint32_t before_unique_id)
|
||||
uint64_t unique_id,
|
||||
uint64_t before_unique_id)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_FlushStyleSheets, void, RawServoStyleSetBorrowed set)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_NoteStyleSheetsChanged, void,
|
||||
RawServoStyleSetBorrowed set, bool author_style_disabled)
|
||||
|
|
|
@ -575,8 +575,8 @@ ServoStyleSet::AppendStyleSheet(SheetType aType,
|
|||
// If we were already tracking aSheet, the newUniqueID will be the same
|
||||
// as the oldUniqueID. In that case, Servo will remove aSheet from its
|
||||
// original position as part of the call to Servo_StyleSet_AppendStyleSheet.
|
||||
uint32_t oldUniqueID = RemoveSheetOfType(aType, aSheet);
|
||||
uint32_t newUniqueID = AppendSheetOfType(aType, aSheet, oldUniqueID);
|
||||
uint64_t oldUniqueID = RemoveSheetOfType(aType, aSheet);
|
||||
uint64_t newUniqueID = AppendSheetOfType(aType, aSheet, oldUniqueID);
|
||||
|
||||
if (mRawSet) {
|
||||
// Maintain a mirrored list of sheets on the servo side.
|
||||
|
@ -601,8 +601,8 @@ ServoStyleSet::PrependStyleSheet(SheetType aType,
|
|||
// If we were already tracking aSheet, the newUniqueID will be the same
|
||||
// as the oldUniqueID. In that case, Servo will remove aSheet from its
|
||||
// original position as part of the call to Servo_StyleSet_PrependStyleSheet.
|
||||
uint32_t oldUniqueID = RemoveSheetOfType(aType, aSheet);
|
||||
uint32_t newUniqueID = PrependSheetOfType(aType, aSheet, oldUniqueID);
|
||||
uint64_t oldUniqueID = RemoveSheetOfType(aType, aSheet);
|
||||
uint64_t newUniqueID = PrependSheetOfType(aType, aSheet, oldUniqueID);
|
||||
|
||||
if (mRawSet) {
|
||||
// Maintain a mirrored list of sheets on the servo side.
|
||||
|
@ -622,7 +622,7 @@ ServoStyleSet::RemoveStyleSheet(SheetType aType,
|
|||
MOZ_ASSERT(aSheet);
|
||||
MOZ_ASSERT(nsStyleSet::IsCSSSheetType(aType));
|
||||
|
||||
uint32_t uniqueID = RemoveSheetOfType(aType, aSheet);
|
||||
uint64_t uniqueID = RemoveSheetOfType(aType, aSheet);
|
||||
if (mRawSet && uniqueID) {
|
||||
// Maintain a mirrored list of sheets on the servo side.
|
||||
Servo_StyleSet_RemoveStyleSheet(mRawSet.get(), uniqueID);
|
||||
|
@ -653,7 +653,7 @@ ServoStyleSet::ReplaceSheets(SheetType aType,
|
|||
|
||||
// Add in all the new sheets.
|
||||
for (auto& sheet : aNewSheets) {
|
||||
uint32_t uniqueID = AppendSheetOfType(aType, sheet);
|
||||
uint64_t uniqueID = AppendSheetOfType(aType, sheet);
|
||||
if (mRawSet) {
|
||||
MOZ_ASSERT(sheet->RawSheet(), "Raw sheet should be in place before replacement.");
|
||||
Servo_StyleSet_AppendStyleSheet(mRawSet.get(),
|
||||
|
@ -677,7 +677,7 @@ ServoStyleSet::InsertStyleSheetBefore(SheetType aType,
|
|||
MOZ_ASSERT(aNewSheet->RawSheet(), "Raw sheet should be in place before insertion.");
|
||||
MOZ_ASSERT(aReferenceSheet->RawSheet(), "Reference sheet should have a raw sheet.");
|
||||
|
||||
uint32_t beforeUniqueID = FindSheetOfType(aType, aReferenceSheet);
|
||||
uint64_t beforeUniqueID = FindSheetOfType(aType, aReferenceSheet);
|
||||
if (beforeUniqueID == 0) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
@ -685,8 +685,8 @@ ServoStyleSet::InsertStyleSheetBefore(SheetType aType,
|
|||
// If we were already tracking aNewSheet, the newUniqueID will be the same
|
||||
// as the oldUniqueID. In that case, Servo will remove aNewSheet from its
|
||||
// original position as part of the call to Servo_StyleSet_InsertStyleSheetBefore.
|
||||
uint32_t oldUniqueID = RemoveSheetOfType(aType, aNewSheet);
|
||||
uint32_t newUniqueID = InsertSheetOfType(aType,
|
||||
uint64_t oldUniqueID = RemoveSheetOfType(aType, aNewSheet);
|
||||
uint64_t newUniqueID = InsertSheetOfType(aType,
|
||||
aNewSheet,
|
||||
beforeUniqueID,
|
||||
oldUniqueID);
|
||||
|
@ -733,15 +733,15 @@ ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
|
|||
|
||||
RefPtr<StyleSheet> strong(aSheet);
|
||||
|
||||
uint32_t oldUniqueID = RemoveSheetOfType(SheetType::Doc, aSheet);
|
||||
uint64_t oldUniqueID = RemoveSheetOfType(SheetType::Doc, aSheet);
|
||||
|
||||
size_t index =
|
||||
aDocument->FindDocStyleSheetInsertionPoint(mEntries[SheetType::Doc], aSheet);
|
||||
|
||||
if (index < mEntries[SheetType::Doc].Length()) {
|
||||
// This case is insert before.
|
||||
uint32_t beforeUniqueID = mEntries[SheetType::Doc][index].uniqueID;
|
||||
uint32_t newUniqueID = InsertSheetOfType(SheetType::Doc,
|
||||
uint64_t beforeUniqueID = mEntries[SheetType::Doc][index].uniqueID;
|
||||
uint64_t newUniqueID = InsertSheetOfType(SheetType::Doc,
|
||||
aSheet,
|
||||
beforeUniqueID,
|
||||
oldUniqueID);
|
||||
|
@ -756,7 +756,7 @@ ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
|
|||
}
|
||||
} else {
|
||||
// This case is append.
|
||||
uint32_t newUniqueID = AppendSheetOfType(SheetType::Doc,
|
||||
uint64_t newUniqueID = AppendSheetOfType(SheetType::Doc,
|
||||
aSheet,
|
||||
oldUniqueID);
|
||||
|
||||
|
@ -1073,7 +1073,7 @@ ServoStyleSet::RebuildStylist()
|
|||
mStylistMayNeedRebuild = false;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint64_t
|
||||
ServoStyleSet::FindSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet)
|
||||
{
|
||||
|
@ -1085,10 +1085,10 @@ ServoStyleSet::FindSheetOfType(SheetType aType,
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint64_t
|
||||
ServoStyleSet::PrependSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet,
|
||||
uint32_t aReuseUniqueID)
|
||||
uint64_t aReuseUniqueID)
|
||||
{
|
||||
Entry* entry = mEntries[aType].InsertElementAt(0);
|
||||
entry->uniqueID = aReuseUniqueID ? aReuseUniqueID : ++mUniqueIDCounter;
|
||||
|
@ -1096,10 +1096,10 @@ ServoStyleSet::PrependSheetOfType(SheetType aType,
|
|||
return entry->uniqueID;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint64_t
|
||||
ServoStyleSet::AppendSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet,
|
||||
uint32_t aReuseUniqueID)
|
||||
uint64_t aReuseUniqueID)
|
||||
{
|
||||
Entry* entry = mEntries[aType].AppendElement();
|
||||
entry->uniqueID = aReuseUniqueID ? aReuseUniqueID : ++mUniqueIDCounter;
|
||||
|
@ -1107,11 +1107,11 @@ ServoStyleSet::AppendSheetOfType(SheetType aType,
|
|||
return entry->uniqueID;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint64_t
|
||||
ServoStyleSet::InsertSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet,
|
||||
uint32_t aBeforeUniqueID,
|
||||
uint32_t aReuseUniqueID)
|
||||
uint64_t aBeforeUniqueID,
|
||||
uint64_t aReuseUniqueID)
|
||||
{
|
||||
for (uint32_t i = 0; i < mEntries[aType].Length(); ++i) {
|
||||
if (mEntries[aType][i].uniqueID == aBeforeUniqueID) {
|
||||
|
@ -1124,13 +1124,13 @@ ServoStyleSet::InsertSheetOfType(SheetType aType,
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint64_t
|
||||
ServoStyleSet::RemoveSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet)
|
||||
{
|
||||
for (uint32_t i = 0; i < mEntries[aType].Length(); ++i) {
|
||||
if (mEntries[aType][i].sheet == aSheet) {
|
||||
uint32_t uniqueID = mEntries[aType][i].uniqueID;
|
||||
uint64_t uniqueID = mEntries[aType][i].uniqueID;
|
||||
mEntries[aType].RemoveElementAt(i);
|
||||
return uniqueID;
|
||||
}
|
||||
|
|
|
@ -440,27 +440,27 @@ private:
|
|||
|
||||
void RunPostTraversalTasks();
|
||||
|
||||
uint32_t FindSheetOfType(SheetType aType,
|
||||
uint64_t FindSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet);
|
||||
|
||||
uint32_t PrependSheetOfType(SheetType aType,
|
||||
uint64_t PrependSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet,
|
||||
uint32_t aReuseUniqueID = 0);
|
||||
uint64_t aReuseUniqueID = 0);
|
||||
|
||||
uint32_t AppendSheetOfType(SheetType aType,
|
||||
uint64_t AppendSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet,
|
||||
uint32_t aReuseUniqueID = 0);
|
||||
uint64_t aReuseUniqueID = 0);
|
||||
|
||||
uint32_t InsertSheetOfType(SheetType aType,
|
||||
uint64_t InsertSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet,
|
||||
uint32_t aBeforeUniqueID,
|
||||
uint32_t aReuseUniqueID = 0);
|
||||
uint64_t aBeforeUniqueID,
|
||||
uint64_t aReuseUniqueID = 0);
|
||||
|
||||
uint32_t RemoveSheetOfType(SheetType aType,
|
||||
uint64_t RemoveSheetOfType(SheetType aType,
|
||||
ServoStyleSheet* aSheet);
|
||||
|
||||
struct Entry {
|
||||
uint32_t uniqueID;
|
||||
uint64_t uniqueID;
|
||||
RefPtr<ServoStyleSheet> sheet;
|
||||
|
||||
// Provide a cast operator to simplify calling
|
||||
|
@ -472,7 +472,7 @@ private:
|
|||
UniquePtr<RawServoStyleSet> mRawSet;
|
||||
EnumeratedArray<SheetType, SheetType::Count,
|
||||
nsTArray<Entry>> mEntries;
|
||||
uint32_t mUniqueIDCounter;
|
||||
uint64_t mUniqueIDCounter;
|
||||
bool mAllowResolveStaleStyles;
|
||||
bool mAuthorStyleDisabled;
|
||||
bool mStylistMayNeedRebuild;
|
||||
|
|
Загрузка…
Ссылка в новой задаче