зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1468020 - Extract helper function to avoid duplicated code. r=mstange
MozReview-Commit-ID: JuirkAId7Km --HG-- extra : rebase_source : c9d15e9fd4a823b321aff9c1048b659f87d03823
This commit is contained in:
Родитель
ad4d295efb
Коммит
533c8b4d83
|
@ -248,6 +248,12 @@ struct Grouper
|
|||
wr::IpcResourceUpdateQueue& aResources,
|
||||
DIGroup* aGroup, nsDisplayList* aList,
|
||||
const StackingContextHelper& aSc);
|
||||
// Helper method for processing a single inactive item
|
||||
void ConstructItemInsideInactive(WebRenderCommandBuilder* aCommandBuilder,
|
||||
wr::DisplayListBuilder& aBuilder,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
DIGroup* aGroup, nsDisplayItem* aItem,
|
||||
const StackingContextHelper& aSc);
|
||||
~Grouper() {
|
||||
}
|
||||
};
|
||||
|
@ -972,7 +978,6 @@ Grouper::ConstructGroups(nsDisplayListBuilder* aDisplayListBuilder,
|
|||
nsDisplayItem* item = aList->GetBottom();
|
||||
nsDisplayItem* startOfCurrentGroup = item;
|
||||
while (item) {
|
||||
nsDisplayList* children = item->GetChildren();
|
||||
if (IsItemProbablyActive(item, mDisplayListBuilder)) {
|
||||
currentGroup->EndGroup(aCommandBuilder->mManager, aDisplayListBuilder, aBuilder, aResources, this, startOfCurrentGroup, item);
|
||||
mClipManager.BeginItem(item, aSc);
|
||||
|
@ -1020,31 +1025,8 @@ Grouper::ConstructGroups(nsDisplayListBuilder* aDisplayListBuilder,
|
|||
|
||||
startOfCurrentGroup = item->GetAbove();
|
||||
} else { // inactive item
|
||||
|
||||
if (item->GetType() == DisplayItemType::TYPE_TRANSFORM) {
|
||||
nsDisplayTransform* transformItem = static_cast<nsDisplayTransform*>(item);
|
||||
const Matrix4x4Flagged& t = transformItem->GetTransform();
|
||||
Matrix t2d;
|
||||
bool is2D = t.Is2D(&t2d);
|
||||
MOZ_RELEASE_ASSERT(is2D, "Non-2D transforms should be treated as active");
|
||||
|
||||
// Save the current transform.
|
||||
Matrix m = mTransform;
|
||||
|
||||
GP("t2d: %f %f\n", t2d._31, t2d._32);
|
||||
mTransform.PreMultiply(t2d);
|
||||
GP("mTransform: %f %f\n", mTransform._31, mTransform._32);
|
||||
ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, currentGroup, children, aSc);
|
||||
|
||||
mTransform = m; // restore it
|
||||
} else if (children) {
|
||||
ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, currentGroup, children, aSc);
|
||||
}
|
||||
|
||||
GP("Including %s of %d\n", item->Name(), currentGroup->mDisplayItems.Count());
|
||||
|
||||
BlobItemData* data = GetBlobItemDataForGroup(item, currentGroup);
|
||||
currentGroup->ComputeGeometryChange(item, data, mTransform, mDisplayListBuilder); // we compute the geometry change here because we have the transform around still
|
||||
ConstructItemInsideInactive(aCommandBuilder, aBuilder, aResources,
|
||||
currentGroup, item, aSc);
|
||||
}
|
||||
|
||||
item = item->GetAbove();
|
||||
|
@ -1062,40 +1044,48 @@ Grouper::ConstructGroupInsideInactive(WebRenderCommandBuilder* aCommandBuilder,
|
|||
DIGroup* aGroup, nsDisplayList* aList,
|
||||
const StackingContextHelper& aSc)
|
||||
{
|
||||
DIGroup* currentGroup = aGroup;
|
||||
|
||||
nsDisplayItem* item = aList->GetBottom();
|
||||
while (item) {
|
||||
nsDisplayList* children = item->GetChildren();
|
||||
|
||||
if (item->GetType() == DisplayItemType::TYPE_TRANSFORM) {
|
||||
nsDisplayTransform* transformItem = static_cast<nsDisplayTransform*>(item);
|
||||
const Matrix4x4Flagged& t = transformItem->GetTransform();
|
||||
Matrix t2d;
|
||||
bool is2D = t.Is2D(&t2d);
|
||||
MOZ_RELEASE_ASSERT(is2D, "Non-2D transforms should be treated as active");
|
||||
|
||||
Matrix m = mTransform;
|
||||
|
||||
GP("t2d: %f %f\n", t2d._31, t2d._32);
|
||||
mTransform.PreMultiply(t2d);
|
||||
GP("mTransform: %f %f\n", mTransform._31, mTransform._32);
|
||||
ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, currentGroup, children, aSc);
|
||||
|
||||
mTransform = m;
|
||||
} else if (children) {
|
||||
ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, currentGroup, children, aSc);
|
||||
}
|
||||
|
||||
GP("Including %s of %d\n", item->Name(), currentGroup->mDisplayItems.Count());
|
||||
|
||||
BlobItemData* data = GetBlobItemDataForGroup(item, currentGroup);
|
||||
currentGroup->ComputeGeometryChange(item, data, mTransform, mDisplayListBuilder); // we compute the geometry change here because we have the transform around still
|
||||
|
||||
ConstructItemInsideInactive(aCommandBuilder, aBuilder, aResources,
|
||||
aGroup, item, aSc);
|
||||
item = item->GetAbove();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Grouper::ConstructItemInsideInactive(WebRenderCommandBuilder* aCommandBuilder,
|
||||
wr::DisplayListBuilder& aBuilder,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
DIGroup* aGroup, nsDisplayItem* aItem,
|
||||
const StackingContextHelper& aSc)
|
||||
{
|
||||
nsDisplayList* children = aItem->GetChildren();
|
||||
|
||||
if (aItem->GetType() == DisplayItemType::TYPE_TRANSFORM) {
|
||||
nsDisplayTransform* transformItem = static_cast<nsDisplayTransform*>(aItem);
|
||||
const Matrix4x4Flagged& t = transformItem->GetTransform();
|
||||
Matrix t2d;
|
||||
bool is2D = t.Is2D(&t2d);
|
||||
MOZ_RELEASE_ASSERT(is2D, "Non-2D transforms should be treated as active");
|
||||
|
||||
Matrix m = mTransform;
|
||||
|
||||
GP("t2d: %f %f\n", t2d._31, t2d._32);
|
||||
mTransform.PreMultiply(t2d);
|
||||
GP("mTransform: %f %f\n", mTransform._31, mTransform._32);
|
||||
ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, aGroup, children, aSc);
|
||||
|
||||
mTransform = m;
|
||||
} else if (children) {
|
||||
ConstructGroupInsideInactive(aCommandBuilder, aBuilder, aResources, aGroup, children, aSc);
|
||||
}
|
||||
|
||||
GP("Including %s of %d\n", aItem->Name(), aGroup->mDisplayItems.Count());
|
||||
|
||||
BlobItemData* data = GetBlobItemDataForGroup(aItem, aGroup);
|
||||
aGroup->ComputeGeometryChange(aItem, data, mTransform, mDisplayListBuilder); // we compute the geometry change here because we have the transform around still
|
||||
}
|
||||
|
||||
/* This is just a copy of nsRect::ScaleToOutsidePixels with an offset added in.
|
||||
* The offset is applied just before the rounding. It's in the scaled space. */
|
||||
static mozilla::gfx::IntRect
|
||||
|
|
Загрузка…
Ссылка в новой задаче