зеркало из https://github.com/mozilla/gecko-dev.git
Bug 862180. Part 1: Remove null checks on the result of nsDisplayItem::GetUnderlyingFrame(). r=mattwoodrow
This commit is contained in:
Родитель
ab49deb669
Коммит
75d8c0a950
|
@ -1128,7 +1128,6 @@ FrameLayerBuilder::GetOldLayerFor(nsDisplayItem* aItem,
|
|||
uint32_t key = aItem->GetPerFrameKey();
|
||||
nsIFrame* frame = aItem->GetUnderlyingFrame();
|
||||
|
||||
if (frame) {
|
||||
DisplayItemData* oldData = GetOldLayerForFrame(frame, key);
|
||||
if (oldData) {
|
||||
if (aOldGeometry) {
|
||||
|
@ -1145,7 +1144,6 @@ FrameLayerBuilder::GetOldLayerFor(nsDisplayItem* aItem,
|
|||
}
|
||||
return oldData->mLayer;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2233,8 +2231,6 @@ ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem,
|
|||
const nsPoint& aTopLeft,
|
||||
nsDisplayItemGeometry *aGeometry)
|
||||
{
|
||||
NS_ASSERTION(aItem->GetUnderlyingFrame(),
|
||||
"Display items that render using Thebes must have a frame");
|
||||
NS_ASSERTION(aItem->GetPerFrameKey(),
|
||||
"Display items that render using Thebes must have a key");
|
||||
nsDisplayItemGeometry *oldGeometry = NULL;
|
||||
|
@ -2383,7 +2379,6 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer,
|
|||
if (entry->mContainerLayerGeneration == 0) {
|
||||
entry->mContainerLayerGeneration = mContainerLayerGeneration;
|
||||
}
|
||||
NS_ASSERTION(aItem->GetUnderlyingFrame(), "Must have frame");
|
||||
if (tempManager) {
|
||||
FrameLayerBuilder* layerBuilder = new FrameLayerBuilder();
|
||||
layerBuilder->Init(mDisplayListBuilder, tempManager);
|
||||
|
@ -2960,8 +2955,6 @@ Layer*
|
|||
FrameLayerBuilder::GetLeafLayerFor(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayItem* aItem)
|
||||
{
|
||||
NS_ASSERTION(aItem->GetUnderlyingFrame(),
|
||||
"Can only call GetLeafLayerFor on items that have a frame");
|
||||
Layer* layer = GetOldLayerFor(aItem);
|
||||
if (!layer)
|
||||
return nullptr;
|
||||
|
@ -3293,9 +3286,7 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
|
|||
PaintInactiveLayer(builder, cdi->mInactiveLayerManager, cdi->mItem, aContext, rc);
|
||||
} else {
|
||||
nsIFrame* frame = cdi->mItem->GetUnderlyingFrame();
|
||||
if (frame) {
|
||||
frame->AddStateBits(NS_FRAME_PAINTED_THEBES);
|
||||
}
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
|
||||
if (gfxUtils::sDumpPainting) {
|
||||
|
|
|
@ -939,7 +939,7 @@ TreatAsOpaque(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
|
|||
// be treated as opaque (and their bounds is just the union of their
|
||||
// children, which might be a large area their contents don't really cover).
|
||||
nsIFrame* f = aItem->GetUnderlyingFrame();
|
||||
if (f && f->PresContext()->IsChrome() && !aItem->GetChildren() &&
|
||||
if (f->PresContext()->IsChrome() && !aItem->GetChildren() &&
|
||||
f->StyleDisplay()->mOpacity != 0.0) {
|
||||
opaque = aItem->GetBounds(aBuilder, &snap);
|
||||
}
|
||||
|
@ -1440,8 +1440,7 @@ static bool IsContentLEQ(nsDisplayItem* aItem1, nsDisplayItem* aItem2,
|
|||
|
||||
static bool IsZOrderLEQ(nsDisplayItem* aItem1, nsDisplayItem* aItem2,
|
||||
void* aClosure) {
|
||||
// These GetUnderlyingFrame calls return non-null because we're only used
|
||||
// in sorting. Note that we can't just take the difference of the two
|
||||
// Note that we can't just take the difference of the two
|
||||
// z-indices here, because that might overflow a 32-bit int.
|
||||
int32_t index1 = nsLayoutUtils::GetZIndex(aItem1->GetUnderlyingFrame());
|
||||
int32_t index2 = nsLayoutUtils::GetZIndex(aItem2->GetUnderlyingFrame());
|
||||
|
@ -2649,10 +2648,9 @@ nsDisplayWrapList::RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
|
|||
LayerState result = LAYER_INACTIVE;
|
||||
for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
|
||||
nsIFrame* f = i->GetUnderlyingFrame();
|
||||
if (f) {
|
||||
nsIFrame* activeScrolledRoot =
|
||||
nsLayoutUtils::GetActiveScrolledRootFor(f, nullptr);
|
||||
if (activeScrolledRoot != aActiveScrolledRoot && result == LAYER_INACTIVE)
|
||||
if (activeScrolledRoot != aActiveScrolledRoot && result == LAYER_INACTIVE) {
|
||||
result = LAYER_ACTIVE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1081,9 +1081,6 @@ nsLayoutUtils::GetActiveScrolledRootFor(nsDisplayItem* aItem,
|
|||
if (aShouldFixToViewport) {
|
||||
*aShouldFixToViewport = false;
|
||||
}
|
||||
if (!f) {
|
||||
return nullptr;
|
||||
}
|
||||
if (aItem->ShouldFixToViewport(aBuilder)) {
|
||||
if (aShouldFixToViewport) {
|
||||
*aShouldFixToViewport = true;
|
||||
|
|
|
@ -4493,7 +4493,6 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
|
|||
// temporary list. If null, no item should be inserted.
|
||||
nsDisplayItem* itemToInsert = nullptr;
|
||||
nsIFrame* frame = i->GetUnderlyingFrame();
|
||||
if (frame) {
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (content) {
|
||||
bool atStart = (content == aRange->GetStartParent());
|
||||
|
@ -4545,7 +4544,6 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// insert the item into the list if necessary. If the item has a child
|
||||
// list, insert that as well
|
||||
|
@ -5282,7 +5280,6 @@ PresShell::MarkImagesInListVisible(const nsDisplayList& aList)
|
|||
nsIFrame* f = item->GetUnderlyingFrame();
|
||||
// We could check the type of the display item, only a handful can hold an
|
||||
// image loading content.
|
||||
if (f) {
|
||||
// dont bother nscomptr here, it is wasteful
|
||||
nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(f->GetContent()));
|
||||
if (content) {
|
||||
|
@ -5295,7 +5292,6 @@ PresShell::MarkImagesInListVisible(const nsDisplayList& aList)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PresShell::RebuildImageVisibility(const nsDisplayList& aList)
|
||||
|
|
|
@ -627,7 +627,7 @@ TextOverflow::PruneDisplayListContents(nsDisplayList* aList,
|
|||
nsDisplayItem* item;
|
||||
while ((item = aList->RemoveBottom())) {
|
||||
nsIFrame* itemFrame = item->GetUnderlyingFrame();
|
||||
if (itemFrame && IsFrameDescendantOfAny(itemFrame, aFramesToHide, mBlock)) {
|
||||
if (IsFrameDescendantOfAny(itemFrame, aFramesToHide, mBlock)) {
|
||||
item->~nsDisplayItem();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1673,8 +1673,7 @@ WrapPreserve3DListInternal(nsIFrame* aFrame, nsDisplayListBuilder *aBuilder, nsD
|
|||
// and then flush this list into aOutput by wrapping the whole lot with a single
|
||||
// nsDisplayTransform.
|
||||
|
||||
if (childFrame &&
|
||||
childFrame->GetParent() &&
|
||||
if (childFrame->GetParent() &&
|
||||
(childFrame->GetParent()->Preserves3DChildren() || childFrame == aFrame)) {
|
||||
switch (item->GetType()) {
|
||||
case nsDisplayItem::TYPE_TRANSFORM: {
|
||||
|
@ -1869,7 +1868,6 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
|
|||
nsDisplayItem* item = set.PositionedDescendants()->GetBottom();
|
||||
if (item) {
|
||||
nsIFrame* f = item->GetUnderlyingFrame();
|
||||
NS_ASSERTION(f, "After sorting, every item in the list should have an underlying frame");
|
||||
if (nsLayoutUtils::GetZIndex(f) < 0) {
|
||||
set.PositionedDescendants()->RemoveBottom();
|
||||
resultList.AppendToTop(item);
|
||||
|
|
|
@ -421,7 +421,7 @@ PruneDisplayListForExtraPage(nsDisplayListBuilder* aBuilder,
|
|||
i->UpdateBounds(aBuilder);
|
||||
} else {
|
||||
nsIFrame* f = i->GetUnderlyingFrame();
|
||||
if (!f || !nsLayoutUtils::IsProperAncestorFrameCrossDoc(aPage, f)) {
|
||||
if (!nsLayoutUtils::IsProperAncestorFrameCrossDoc(aPage, f)) {
|
||||
// We're throwing this away so call its destructor now. The memory
|
||||
// is owned by aBuilder which destroys all items at once.
|
||||
i->~nsDisplayItem();
|
||||
|
|
Загрузка…
Ссылка в новой задаче