Bug 1433850 - layout.display-list.retain.verify.order to also check RDL ordering - r=mattwoodrow

MozReview-Commit-ID: 2foGnuSCwUX

--HG--
extra : rebase_source : a46779e0db3d4452561b52e047daa3716280fde4
This commit is contained in:
Gerald Squelart 2018-01-29 18:23:14 +11:00
Родитель be42ffae02
Коммит a2ff96a775
2 изменённых файлов: 39 добавлений и 0 удалений

Просмотреть файл

@ -664,6 +664,7 @@ private:
DECL_GFX_PREF(Live, "layout.display-list.retain", LayoutRetainDisplayList, bool, true);
DECL_GFX_PREF(Live, "layout.display-list.retain.chrome", LayoutRetainDisplayListChrome, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.retain.verify", LayoutVerifyRetainDisplayList, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.retain.verify.order", LayoutVerifyRetainDisplayListOrder, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.rebuild-frame-limit", LayoutRebuildFrameLimit, uint32_t, 500);
DECL_GFX_PREF(Live, "layout.display-list.dump", LayoutDumpDisplayList, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.dump-content", LayoutDumpDisplayListContent, bool, false);

Просмотреть файл

@ -6,6 +6,7 @@
#include "DisplayListChecker.h"
#include "gfxPrefs.h"
#include "nsDisplayList.h"
namespace mozilla {
@ -93,6 +94,7 @@ private:
unsigned& aIndex);
std::vector<DisplayItemBlueprint> mItems;
const bool mVerifyOrder = gfxPrefs::LayoutVerifyRetainDisplayListOrder();
};
// Object representing one display item, with just enough information to
@ -264,12 +266,47 @@ DisplayListBlueprint::CompareList(
const DisplayItemBlueprintStack& aStackOther) const
{
bool same = true;
unsigned previousFoundIndex = 0;
const DisplayItemBlueprint* previousFoundItemBefore = nullptr;
const DisplayItemBlueprint* previousFoundItemAfter = nullptr;
for (const DisplayItemBlueprint& itemBefore : mItems) {
bool found = false;
unsigned foundIndex = 0;
for (const DisplayItemBlueprint& itemAfter : aOther.mItems) {
if (itemBefore.CompareItem(itemAfter, aDiff)) {
found = true;
if (mVerifyOrder) {
if (foundIndex < previousFoundIndex) {
same = false;
aDiff << "\n";
if (aStack.Output(aDiff)) {
aDiff << " > ";
}
aDiff << itemBefore.mDescription;
aDiff << "\n * Corresponding item in unexpected order: ";
if (aStackOther.Output(aDiff)) {
aDiff << " > ";
}
aDiff << itemAfter.mDescription;
aDiff << "\n * Was expected after: ";
if (aStackOther.Output(aDiff)) {
aDiff << " > ";
}
MOZ_ASSERT(previousFoundItemAfter);
aDiff << previousFoundItemAfter->mDescription;
aDiff << "\n which corresponds to: ";
if (aStack.Output(aDiff)) {
aDiff << " > ";
}
MOZ_ASSERT(previousFoundItemBefore);
aDiff << previousFoundItemBefore->mDescription;
}
previousFoundIndex = foundIndex;
previousFoundItemBefore = &itemBefore;
previousFoundItemAfter = &itemAfter;
}
const DisplayItemBlueprintStack stack = { &aStack, &itemBefore };
const DisplayItemBlueprintStack stackOther = { &aStackOther,
&itemAfter };
@ -283,6 +320,7 @@ DisplayListBlueprint::CompareList(
}
break;
}
++foundIndex;
}
if (!found) {
same = false;