From 98b4f62a61e2d77c3682db3b5b86492326982e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 7 May 2019 17:04:36 +0000 Subject: [PATCH] Bug 1549691 - nsLayoutUtils::GetRealPrimaryFrameFor makes no sense. r=jwatt The primary frame is always the out of flow frame. Differential Revision: https://phabricator.services.mozilla.com/D30182 --HG-- extra : moz-landing-system : lando --- dom/base/nsIContentInlines.h | 1 + layout/base/nsDocumentViewer.cpp | 3 +-- layout/base/nsLayoutUtils.cpp | 10 ---------- layout/base/nsLayoutUtils.h | 9 --------- 4 files changed, 2 insertions(+), 21 deletions(-) diff --git a/dom/base/nsIContentInlines.h b/dom/base/nsIContentInlines.h index 9adc5c3f39cf..a0fc003d8d9c 100644 --- a/dom/base/nsIContentInlines.h +++ b/dom/base/nsIContentInlines.h @@ -50,6 +50,7 @@ inline void nsIContent::SetPrimaryFrame(nsIFrame* aFrame) { "Losing track of existing primary frame"); if (aFrame) { + MOZ_ASSERT(!aFrame->IsPlaceholderFrame()); if (MOZ_LIKELY(!IsHTMLElement(nsGkAtoms::area)) || aFrame->GetContent() == this) { aFrame->SetIsPrimaryFrame(true); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index d4069e27d9f1..373169f12e63 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -2420,8 +2420,7 @@ nsView* nsDocumentViewer::FindContainerView() { return nullptr; } - nsIFrame* subdocFrame = - nsLayoutUtils::GetRealPrimaryFrameFor(containerElement); + nsIFrame* subdocFrame = containerElement->GetPrimaryFrame(); if (!subdocFrame) { // XXX Silenced by default in bug 1175289 LAYOUT_WARNING("Subdocument container has no frame"); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 696451af783a..ad2c6487174b 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1579,16 +1579,6 @@ bool nsLayoutUtils::IsPrimaryStyleFrame(const nsIFrame* aFrame) { return aFrame->IsPrimaryFrame(); } -/* static */ -nsIFrame* nsLayoutUtils::GetRealPrimaryFrameFor(const nsIContent* aContent) { - nsIFrame* frame = aContent->GetPrimaryFrame(); - if (!frame) { - return nullptr; - } - - return nsPlaceholderFrame::GetRealFrameFor(frame); -} - nsIFrame* nsLayoutUtils::GetFloatFromPlaceholder(nsIFrame* aFrame) { NS_ASSERTION(aFrame->IsPlaceholderFrame(), "Must have a placeholder here"); if (aFrame->GetStateBits() & PLACEHOLDER_FOR_FLOAT) { diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 696afdc00d3e..72e99bc57c02 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -434,15 +434,6 @@ class nsLayoutUtils { */ static bool IsPrimaryStyleFrame(const nsIFrame* aFrame); - /** - * Gets the real primary frame associated with the content object. - * - * In the case of absolutely positioned elements and floated elements, - * the real primary frame is the frame that is out of the flow and not the - * placeholder frame. - */ - static nsIFrame* GetRealPrimaryFrameFor(const nsIContent* aContent); - #ifdef DEBUG // TODO: remove, see bug 598468. static bool gPreventAssertInCompareTreePosition;