Bug 1591297 - Remove XBL binding loading code in the frame constructor. r=TYLin

Differential Revision: https://phabricator.services.mozilla.com/D50555

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-10-25 18:46:59 +00:00
Родитель 6a021aec24
Коммит 576949a095
2 изменённых файлов: 50 добавлений и 295 удалений

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

@ -62,11 +62,6 @@
#include "nsCSSAnonBoxes.h"
#include "nsTextFragment.h"
#include "nsIAnonymousContentCreator.h"
#ifdef MOZ_XBL
# include "nsBindingManager.h"
# include "nsXBLBinding.h"
# include "nsXBLService.h"
#endif
#include "nsContentUtils.h"
#include "nsIScriptError.h"
#ifdef XP_MACOSX
@ -666,21 +661,6 @@ class MOZ_STACK_CLASS nsFrameConstructorSaveState {
friend class nsFrameConstructorState;
};
// Structure used to keep track of a list of bindings we need to call
// AddToAttachedQueue on. These should be in post-order depth-first
// flattened tree traversal order.
struct PendingBinding : public LinkedListElement<PendingBinding> {
#ifdef NS_BUILD_REFCNT_LOGGING
PendingBinding() { MOZ_COUNT_CTOR(PendingBinding); }
~PendingBinding() { MOZ_COUNT_DTOR(PendingBinding); }
#endif
#ifdef MOZ_XBL
// TODO: remove all of this struct.
RefPtr<nsXBLBinding> mBinding;
#endif
};
// Structure used for maintaining state information during the
// frame construction process
class MOZ_STACK_CLASS nsFrameConstructorState {
@ -830,45 +810,6 @@ class MOZ_STACK_CLASS nsFrameConstructorState {
return mFixedPosIsAbsPos ? mAbsoluteList : mFixedList;
}
/**
* class to automatically push and pop a pending binding in the frame
* constructor state. See nsCSSFrameConstructor::FrameConstructionItem
* mPendingBinding documentation.
*/
class PendingBindingAutoPusher;
friend class PendingBindingAutoPusher;
class MOZ_STACK_CLASS PendingBindingAutoPusher {
public:
PendingBindingAutoPusher(nsFrameConstructorState& aState,
PendingBinding* aPendingBinding)
: mState(aState),
mPendingBinding(aState.mCurrentPendingBindingInsertionPoint) {
if (aPendingBinding) {
aState.mCurrentPendingBindingInsertionPoint = aPendingBinding;
}
}
~PendingBindingAutoPusher() {
mState.mCurrentPendingBindingInsertionPoint = mPendingBinding;
}
private:
nsFrameConstructorState& mState;
PendingBinding* mPendingBinding;
};
/**
* Add a new pending binding to the list
*/
void AddPendingBinding(UniquePtr<PendingBinding> aPendingBinding) {
if (mCurrentPendingBindingInsertionPoint) {
mCurrentPendingBindingInsertionPoint->setPrevious(
aPendingBinding.release());
} else {
mPendingBindings.insertBack(aPendingBinding.release());
}
}
protected:
friend class nsFrameConstructorSaveState;
@ -894,12 +835,6 @@ class MOZ_STACK_CLASS nsFrameConstructorState {
nsFrameState* aPlaceholderType);
void ConstructBackdropFrameFor(nsIContent* aContent, nsIFrame* aFrame);
// Our list of all pending bindings. When we're done, we need to call
// AddToAttachedQueue on all of them, in order.
LinkedList<PendingBinding> mPendingBindings;
PendingBinding* mCurrentPendingBindingInsertionPoint;
};
nsFrameConstructorState::nsFrameConstructorState(
@ -928,8 +863,7 @@ nsFrameConstructorState::nsFrameConstructorState(
// frames.
mFixedPosIsAbsPos(aFixedContainingBlock == aAbsoluteContainingBlock),
mHavePendingPopupgroup(false),
mCreatingExtraFrames(false),
mCurrentPendingBindingInsertionPoint(nullptr) {
mCreatingExtraFrames(false) {
#ifdef MOZ_XUL
nsIPopupContainer* popupContainer =
nsIPopupContainer::GetPopupContainer(aPresShell);
@ -955,17 +889,6 @@ nsFrameConstructorState::~nsFrameConstructorState() {
for (auto& content : Reversed(mGeneratedContentWithInitializer)) {
content->DeleteProperty(nsGkAtoms::genConInitializerProperty);
}
#ifdef MOZ_XBL
if (!mPendingBindings.isEmpty()) {
nsBindingManager* bindingManager =
mPresShell->GetDocument()->BindingManager();
do {
UniquePtr<PendingBinding> pendingBinding(mPendingBindings.popFirst());
bindingManager->AddToAttachedQueue(pendingBinding->mBinding);
} while (!mPendingBindings.isEmpty());
mCurrentPendingBindingInsertionPoint = nullptr;
}
#endif
}
void nsFrameConstructorState::ProcessFrameInsertionsForAllLists() {
@ -1968,7 +1891,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
aItem.mFCData->mBits & FCDATA_IS_WRAPPER_ANON_BOX, childList);
} else {
ProcessChildren(aState, content, computedStyle, innerFrame, true, childList,
false, aItem.mPendingBinding);
false);
}
nsFrameList captionList;
@ -2041,7 +1964,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructTableRowOrRowGroup(
aItem.mFCData->mBits & FCDATA_IS_WRAPPER_ANON_BOX, childList);
} else {
ProcessChildren(aState, content, computedStyle, newFrame, true, childList,
false, aItem.mPendingBinding);
false);
}
newFrame->SetInitialChildList(kPrincipalList, childList);
@ -2152,7 +2075,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructTableCell(
} else {
// Process the child content
ProcessChildren(aState, content, computedStyle, cellInnerFrame, true,
childList, isBlock, aItem.mPendingBinding);
childList, isBlock);
}
cellInnerFrame->SetInitialChildList(kPrincipalList, childList);
@ -2271,38 +2194,6 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
const nsStyleDisplay* display = computedStyle->StyleDisplay();
#ifdef MOZ_XBL
// Ensure that our XBL bindings are installed.
//
// FIXME(emilio): Can we remove support for bindings on the root?
if (display->mBinding.IsUrl()) {
// Get the XBL loader.
nsresult rv;
nsXBLService* xblService = nsXBLService::GetInstance();
if (!xblService) {
return nullptr;
}
const auto& url = display->mBinding.AsUrl();
RefPtr<nsXBLBinding> binding;
rv = xblService->LoadBindings(aDocElement, url.GetURI(),
url.ExtraData().Principal(),
getter_AddRefs(binding));
if (NS_FAILED(rv) && rv != NS_ERROR_XBL_BLOCKED) {
// Binding will load asynchronously.
return nullptr;
}
if (binding) {
// For backwards compat, keep firing the root's constructor
// after all of its kids' constructors. So tell the binding
// manager about it right now.
mDocument->BindingManager()->AddToAttachedQueue(binding);
}
}
#endif
// --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
NS_ASSERTION(!display->IsScrollableOverflow() ||
@ -2401,9 +2292,8 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
// FrameConstructionData/Item, then we'd need the right function
// here... but would probably be able to get away with less code in this
// function in general.
// Use a null PendingBinding, since our binding is not in fact pending.
static const FrameConstructionData rootSVGData = FCDATA_DECL(0, nullptr);
AutoFrameConstructionItem item(this, &rootSVGData, aDocElement, nullptr,
AutoFrameConstructionItem item(this, &rootSVGData, aDocElement,
do_AddRef(computedStyle), true);
contentFrame = static_cast<nsContainerFrame*>(ConstructOuterSVG(
@ -2435,9 +2325,8 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
// FrameConstructionData/Item, then we'd need the right function
// here... but would probably be able to get away with less code in this
// function in general.
// Use a null PendingBinding, since our binding is not in fact pending.
static const FrameConstructionData rootTableData = FCDATA_DECL(0, nullptr);
AutoFrameConstructionItem item(this, &rootTableData, aDocElement, nullptr,
AutoFrameConstructionItem item(this, &rootTableData, aDocElement,
do_AddRef(computedStyle), true);
// if the document is a table then just populate it.
@ -2446,7 +2335,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
} else if (display->DisplayInside() == StyleDisplayInside::Ruby) {
static const FrameConstructionData data =
FULL_CTOR_FCDATA(0, &nsCSSFrameConstructor::ConstructBlockRubyFrame);
AutoFrameConstructionItem item(this, &data, aDocElement, nullptr,
AutoFrameConstructionItem item(this, &data, aDocElement,
do_AddRef(computedStyle), true);
contentFrame = static_cast<nsContainerFrame*>(ConstructBlockRubyFrame(
state, item,
@ -2457,13 +2346,12 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
display->mDisplay == StyleDisplay::FlowRoot,
"Unhandled display type for root element");
contentFrame = NS_NewBlockFormattingContext(mPresShell, computedStyle);
// Use a null PendingBinding, since our binding is not in fact pending.
ConstructBlock(
state, aDocElement,
state.GetGeometricParent(*display, mDocElementContainingBlock),
mDocElementContainingBlock, computedStyle, &contentFrame, frameList,
display->IsAbsPosContainingBlock(contentFrame) ? contentFrame : nullptr,
nullptr);
display->IsAbsPosContainingBlock(contentFrame) ? contentFrame
: nullptr);
}
MOZ_ASSERT(frameList.FirstChild());
@ -2495,9 +2383,8 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
NS_ASSERTION(!contentFrame->IsBlockFrameOrSubclass() &&
!contentFrame->IsFrameOfType(nsIFrame::eSVG),
"Only XUL frames should reach here");
// Use a null PendingBinding, since our binding is not in fact pending.
ProcessChildren(state, aDocElement, computedStyle, contentFrame, true,
childList, false, nullptr);
childList, false);
// Set the initial child lists
contentFrame->SetInitialChildList(kPrincipalList, childList);
@ -2933,8 +2820,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructSelectFrame(
NS_NewSelectsAreaFrame(mPresShell, computedStyle, flags);
InitializeSelectFrame(aState, listFrame, scrolledFrame, content,
comboboxFrame, listStyle, true, aItem.mPendingBinding,
childList);
comboboxFrame, listStyle, true, childList);
NS_ASSERTION(listFrame->GetView(), "ListFrame's view is nullptr");
@ -2995,8 +2881,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructSelectFrame(
// please adjust this code to use BuildScrollFrame.
InitializeSelectFrame(aState, listFrame, scrolledFrame, content, aParentFrame,
computedStyle, false, aItem.mPendingBinding,
aFrameList);
computedStyle, false, aFrameList);
return listFrame;
}
@ -3010,8 +2895,7 @@ void nsCSSFrameConstructor::InitializeSelectFrame(
nsFrameConstructorState& aState, nsContainerFrame* scrollFrame,
nsContainerFrame* scrolledFrame, nsIContent* aContent,
nsContainerFrame* aParentFrame, ComputedStyle* aComputedStyle,
bool aBuildCombobox, PendingBinding* aPendingBinding,
nsFrameList& aFrameList) {
bool aBuildCombobox, nsFrameList& aFrameList) {
// Initialize it
nsContainerFrame* geometricParent =
aState.GetGeometricParent(*aComputedStyle->StyleDisplay(), aParentFrame);
@ -3038,7 +2922,7 @@ void nsCSSFrameConstructor::InitializeSelectFrame(
nsFrameList childList;
ProcessChildren(aState, aContent, aComputedStyle, scrolledFrame, false,
childList, false, aPendingBinding);
childList, false);
// Set the scrolled frame's initial child lists
scrolledFrame->SetInitialChildList(kPrincipalList, childList);
@ -3134,7 +3018,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructFieldSetFrame(
}
ProcessChildren(aState, content, computedStyle, contentFrame, true, childList,
true, aItem.mPendingBinding);
true);
nsFrameList fieldsetKids;
fieldsetKids.AppendFrame(nullptr,
@ -3833,7 +3717,7 @@ void nsCSSFrameConstructor::ConstructFrameFromItemInternal(
ProcessChildren(aState, content, computedStyle, newFrameAsContainer,
!(bits & FCDATA_DISALLOW_GENERATED_CONTENT), childList,
(bits & FCDATA_ALLOW_BLOCK_STYLES) != 0,
aItem.mPendingBinding, possiblyLeafFrame);
possiblyLeafFrame);
}
if (bits & FCDATA_WRAP_KIDS_IN_BLOCKS) {
@ -4683,8 +4567,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructScrollableBlockWithConstructor(
ConstructBlock(
aState, content, newFrame, newFrame, scrolledContentStyle, &scrolledFrame,
blockList,
aDisplay->IsAbsPosContainingBlock(newFrame) ? newFrame : nullptr,
aItem.mPendingBinding);
aDisplay->IsAbsPosContainingBlock(newFrame) ? newFrame : nullptr);
MOZ_ASSERT(blockList.OnlyChild() == scrolledFrame,
"Scrollframe's frameList should be exactly the scrolled frame!");
@ -4730,8 +4613,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructNonScrollableBlockWithConstructor(
aState, aItem.mContent,
aState.GetGeometricParent(*aDisplay, aParentFrame), aParentFrame,
computedStyle, &newFrame, aFrameList,
aDisplay->IsAbsPosContainingBlock(newFrame) ? newFrame : nullptr,
aItem.mPendingBinding);
aDisplay->IsAbsPosContainingBlock(newFrame) ? newFrame : nullptr);
return newFrame;
}
@ -4957,7 +4839,7 @@ nsContainerFrame* nsCSSFrameConstructor::ConstructFrameWithAnonymousChild(
aItem.mFCData->mBits & FCDATA_IS_WRAPPER_ANON_BOX, childList);
} else {
ProcessChildren(aState, content, computedStyle, innerFrame, true, childList,
false, aItem.mPendingBinding);
false);
}
// Set the inner wrapper frame's initial primary list
@ -5238,8 +5120,8 @@ void nsCSSFrameConstructor::AddPageBreakItem(
static const FrameConstructionData sPageBreakData =
FCDATA_DECL(FCDATA_SKIP_FRAMESET, NS_NewPageBreakFrame);
aItems.AppendItem(this, &sPageBreakData, aContent, nullptr,
pseudoStyle.forget(), true);
aItems.AppendItem(this, &sPageBreakData, aContent, pseudoStyle.forget(),
true);
}
bool nsCSSFrameConstructor::ShouldCreateItemsForChild(
@ -5451,47 +5333,6 @@ nsCSSFrameConstructor::FindElementTagData(const Element& aElement,
}
}
#ifdef MOZ_XBL
nsCSSFrameConstructor::XBLBindingLoadInfo::XBLBindingLoadInfo(
UniquePtr<PendingBinding> aPendingBinding)
: mPendingBinding(std::move(aPendingBinding)), mSuccess(true) {}
nsCSSFrameConstructor::XBLBindingLoadInfo::XBLBindingLoadInfo() = default;
nsCSSFrameConstructor::XBLBindingLoadInfo
nsCSSFrameConstructor::LoadXBLBindingIfNeeded(nsIContent& aContent,
const ComputedStyle& aStyle,
uint32_t aFlags) {
if (!(aFlags & ITEM_ALLOW_XBL_BASE)) {
return XBLBindingLoadInfo(nullptr);
}
const auto& binding = aStyle.StyleDisplay()->mBinding;
if (binding.IsNone()) {
return XBLBindingLoadInfo(nullptr);
}
nsXBLService* xblService = nsXBLService::GetInstance();
if (!xblService) {
return {};
}
auto newPendingBinding = MakeUnique<PendingBinding>();
const auto& url = binding.AsUrl();
nsresult rv = xblService->LoadBindings(
aContent.AsElement(), url.GetURI(), url.ExtraData().Principal(),
getter_AddRefs(newPendingBinding->mBinding));
if (NS_FAILED(rv)) {
if (rv == NS_ERROR_XBL_BLOCKED) {
return XBLBindingLoadInfo(nullptr);
}
return {};
}
return XBLBindingLoadInfo(std::move(newPendingBinding));
}
#endif
void nsCSSFrameConstructor::AddFrameConstructionItemsInternal(
nsFrameConstructorState& aState, nsIContent* aContent,
nsContainerFrame* aParentFrame, bool aSuppressWhiteSpaceOptimizations,
@ -5503,22 +5344,6 @@ void nsCSSFrameConstructor::AddFrameConstructionItemsInternal(
MOZ_ASSERT(!aContent->GetPrimaryFrame() || aState.mCreatingExtraFrames ||
aContent->NodeInfo()->NameAtom() == nsGkAtoms::area);
PendingBinding* pendingBinding = nullptr;
#ifdef MOZ_XBL
{
XBLBindingLoadInfo xblInfo =
LoadXBLBindingIfNeeded(*aContent, *aComputedStyle, aFlags);
if (!xblInfo.mSuccess) {
return;
}
if (xblInfo.mPendingBinding && xblInfo.mPendingBinding->mBinding) {
pendingBinding = xblInfo.mPendingBinding.get();
aState.AddPendingBinding(std::move(xblInfo.mPendingBinding));
}
}
#endif
const bool withinSVGText = !!(aFlags & ITEM_IS_WITHIN_SVG_TEXT);
const bool isGeneratedContent = !!(aFlags & ITEM_IS_GENERATED_CONTENT);
MOZ_ASSERT(!isGeneratedContent || aComputedStyle->IsPseudoElement(),
@ -5627,15 +5452,13 @@ void nsCSSFrameConstructor::AddFrameConstructionItemsInternal(
if (summary && summary->IsMainSummary()) {
// If details is open, the main summary needs to be rendered as if it is
// the first child, so add the item to the front of the item list.
item = aItems.PrependItem(this, data, aContent, pendingBinding,
do_AddRef(aComputedStyle),
item = aItems.PrependItem(this, data, aContent, do_AddRef(aComputedStyle),
aSuppressWhiteSpaceOptimizations);
}
}
if (!item) {
item = aItems.AppendItem(this, data, aContent, pendingBinding,
do_AddRef(aComputedStyle),
item = aItems.AppendItem(this, data, aContent, do_AddRef(aComputedStyle),
aSuppressWhiteSpaceOptimizations);
}
item->mIsText = !aContent->IsElement();
@ -6674,11 +6497,7 @@ nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aStartChild,
// If the children of the container may be distributed to different insertion
// points, insert them separately and bail out, letting ContentInserted handle
// the mess.
if (parent->GetShadowRoot()
#ifdef MOZ_XBL
|| parent->GetXBLBinding()
#endif
) {
if (parent->GetShadowRoot()) {
IssueSingleInsertNofications(aStartChild, aEndChild, aInsertionKind);
return {};
}
@ -9066,12 +8885,10 @@ void nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
FCDATA_IS_WRAPPER_ANON_BOX,
NS_NewBlockFormattingContext);
FrameConstructionItem* newItem =
new (this) FrameConstructionItem(&sBlockFormattingContextFCData,
// Use the content of our parent frame
parentContent,
// no pending binding
nullptr, wrapperStyle.forget(), true);
FrameConstructionItem* newItem = new (this)
FrameConstructionItem(&sBlockFormattingContextFCData,
// Use the content of our parent frame
parentContent, wrapperStyle.forget(), true);
newItem->mIsAllInline =
newItem->mComputedStyle->StyleDisplay()->IsInlineOutsideStyle();
@ -9547,12 +9364,10 @@ void nsCSSFrameConstructor::WrapItemsInPseudoParent(
pseudoType);
}
FrameConstructionItem* newItem =
new (this) FrameConstructionItem(&pseudoData.mFCData,
// Use the content of our parent frame
aParentContent,
// no pending binding
nullptr, wrapperStyle.forget(), true);
FrameConstructionItem* newItem = new (this)
FrameConstructionItem(&pseudoData.mFCData,
// Use the content of our parent frame
aParentContent, wrapperStyle.forget(), true);
const nsStyleDisplay* disp = newItem->mComputedStyle->StyleDisplay();
// Here we're cheating a tad... technically, table-internal items should be
@ -9606,12 +9421,10 @@ void nsCSSFrameConstructor::CreateNeededPseudoSiblings(
RefPtr<ComputedStyle> pseudoStyle =
mPresShell->StyleSet()->ResolveInheritingAnonymousBoxStyle(
pseudoData.mPseudoType, aParentFrame->Style());
FrameConstructionItem* newItem =
new (this) FrameConstructionItem(&pseudoData.mFCData,
// Use the content of the parent frame
aParentFrame->GetContent(),
// no pending binding
nullptr, pseudoStyle.forget(), true);
FrameConstructionItem* newItem = new (this) FrameConstructionItem(
&pseudoData.mFCData,
// Use the content of the parent frame
aParentFrame->GetContent(), pseudoStyle.forget(), true);
newItem->mIsAllInline = true;
newItem->mChildItems.SetParentHasNoXBLChildren(true);
iter.InsertItem(newItem);
@ -9747,8 +9560,7 @@ void nsCSSFrameConstructor::ProcessChildren(
nsFrameConstructorState& aState, nsIContent* aContent,
ComputedStyle* aComputedStyle, nsContainerFrame* aFrame,
const bool aCanHaveGeneratedContent, nsFrameList& aFrameList,
const bool aAllowBlockStyles, PendingBinding* aPendingBinding,
nsIFrame* aPossiblyLeafFrame) {
const bool aAllowBlockStyles, nsIFrame* aPossiblyLeafFrame) {
MOZ_ASSERT(aFrame, "Must have parent frame here");
MOZ_ASSERT(aFrame->GetContentInsertionFrame() == aFrame,
"Parent frame in ProcessChildren should be its own "
@ -9786,9 +9598,6 @@ void nsCSSFrameConstructor::ProcessChildren(
aState.PushFloatContainingBlock(aFrame, floatSaveState);
}
nsFrameConstructorState::PendingBindingAutoPusher pusher(aState,
aPendingBinding);
AutoFrameConstructionItemList itemsToConstruct(this);
// If we have first-letter or first-line style then frames can get
@ -10636,8 +10445,7 @@ void nsCSSFrameConstructor::ConstructBlock(
nsFrameConstructorState& aState, nsIContent* aContent,
nsContainerFrame* aParentFrame, nsContainerFrame* aContentParentFrame,
ComputedStyle* aComputedStyle, nsContainerFrame** aNewFrame,
nsFrameList& aFrameList, nsIFrame* aPositionedFrameForAbsPosContainer,
PendingBinding* aPendingBinding) {
nsFrameList& aFrameList, nsIFrame* aPositionedFrameForAbsPosContainer) {
// clang-format off
//
// If a block frame is in a multi-column subtree, its children may need to
@ -10765,7 +10573,7 @@ void nsCSSFrameConstructor::ConstructBlock(
// Process the child content
nsFrameList childList;
ProcessChildren(aState, aContent, aComputedStyle, blockFrame, true, childList,
true, aPendingBinding);
true);
if (!StaticPrefs::layout_css_column_span_enabled()) {
// Set the frame's initial child list
@ -11337,11 +11145,6 @@ void nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
void nsCSSFrameConstructor::BuildInlineChildItems(
nsFrameConstructorState& aState, FrameConstructionItem& aParentItem,
bool aItemIsWithinSVGText, bool aItemAllowsTextPathChild) {
// XXXbz should we preallocate aParentItem.mChildItems to some sane
// length? Maybe even to parentContent->GetChildCount()?
nsFrameConstructorState::PendingBindingAutoPusher pusher(
aState, aParentItem.mPendingBinding);
ComputedStyle* const parentComputedStyle = aParentItem.mComputedStyle;
nsIContent* const parentContent = aParentItem.mContent;
@ -11913,11 +11716,8 @@ void nsCSSFrameConstructor::GenerateChildFrames(nsContainerFrame* aFrame) {
nsAutoScriptBlocker scriptBlocker;
nsFrameList childList;
nsFrameConstructorState state(mPresShell, nullptr, nullptr, nullptr);
// We don't have a parent frame with a pending binding constructor here,
// so no need to worry about ordering of the kids' constructors with it.
// Pass null for the PendingBinding.
ProcessChildren(state, aFrame->GetContent(), aFrame->Style(), aFrame, false,
childList, false, nullptr);
childList, false);
aFrame->SetInitialChildList(kPrincipalList, childList);
}
@ -11930,11 +11730,6 @@ void nsCSSFrameConstructor::GenerateChildFrames(nsContainerFrame* aFrame) {
}
}
#endif
#ifdef MOZ_XBL
// call XBL constructors after the frames are created
mPresShell->GetDocument()->BindingManager()->ProcessAttachedQueue();
#endif
}
//////////////////////////////////////////////////////////

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

@ -37,7 +37,6 @@ class nsCSSAnonBoxPseudoStaticAtom;
class nsPageSequenceFrame;
class nsPageContentFrame;
struct PendingBinding;
class nsFrameConstructorState;
@ -769,26 +768,6 @@ class nsCSSFrameConstructor final : public nsFrameManager {
pseudo-frames as needed */
static const PseudoParentData sPseudoParentData[eParentTypeCount];
#ifdef MOZ_XBL
// The information that concerns the frame constructor after loading an XBL
// binding.
//
// This is expected to just be used temporarily to aggregate the different
// objects that LoadXBLBindingIfNeeded returns.
struct MOZ_STACK_CLASS XBLBindingLoadInfo {
mozilla::UniquePtr<PendingBinding> mPendingBinding;
bool mSuccess = false;
// For the error case.
XBLBindingLoadInfo();
explicit XBLBindingLoadInfo(mozilla::UniquePtr<PendingBinding>);
};
// Returns null mStyle member to signal an error.
XBLBindingLoadInfo LoadXBLBindingIfNeeded(nsIContent&, const ComputedStyle&,
uint32_t aFlags);
#endif
const FrameConstructionData* FindDataForContent(nsIContent&, ComputedStyle&,
nsIFrame* aParentFrame,
uint32_t aFlags);
@ -863,12 +842,11 @@ class nsCSSFrameConstructor final : public nsFrameManager {
// Also, the return value is always non-null, thanks to infallible 'new'.
FrameConstructionItem* AppendItem(
nsCSSFrameConstructor* aFCtor, const FrameConstructionData* aFCData,
nsIContent* aContent, PendingBinding* aPendingBinding,
already_AddRefed<ComputedStyle>&& aComputedStyle,
nsIContent* aContent, already_AddRefed<ComputedStyle>&& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations) {
FrameConstructionItem* item = new (aFCtor) FrameConstructionItem(
aFCData, aContent, aPendingBinding, std::move(aComputedStyle),
aSuppressWhiteSpaceOptimizations);
FrameConstructionItem* item = new (aFCtor)
FrameConstructionItem(aFCData, aContent, std::move(aComputedStyle),
aSuppressWhiteSpaceOptimizations);
mItems.insertBack(item);
++mItemCount;
++mDesiredParentCounts[item->DesiredParentType()];
@ -878,12 +856,11 @@ class nsCSSFrameConstructor final : public nsFrameManager {
// Arguments are the same as AppendItem().
FrameConstructionItem* PrependItem(
nsCSSFrameConstructor* aFCtor, const FrameConstructionData* aFCData,
nsIContent* aContent, PendingBinding* aPendingBinding,
already_AddRefed<ComputedStyle>&& aComputedStyle,
nsIContent* aContent, already_AddRefed<ComputedStyle>&& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations) {
FrameConstructionItem* item = new (aFCtor) FrameConstructionItem(
aFCData, aContent, aPendingBinding, std::move(aComputedStyle),
aSuppressWhiteSpaceOptimizations);
FrameConstructionItem* item = new (aFCtor)
FrameConstructionItem(aFCData, aContent, std::move(aComputedStyle),
aSuppressWhiteSpaceOptimizations);
mItems.insertFront(item);
++mItemCount;
++mDesiredParentCounts[item->DesiredParentType()];
@ -1098,12 +1075,11 @@ class nsCSSFrameConstructor final : public nsFrameManager {
struct FrameConstructionItem final
: public mozilla::LinkedListElement<FrameConstructionItem> {
FrameConstructionItem(const FrameConstructionData* aFCData,
nsIContent* aContent, PendingBinding* aPendingBinding,
nsIContent* aContent,
already_AddRefed<ComputedStyle>&& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations)
: mFCData(aFCData),
mContent(aContent),
mPendingBinding(aPendingBinding),
mComputedStyle(std::move(aComputedStyle)),
mSuppressWhiteSpaceOptimizations(aSuppressWhiteSpaceOptimizations),
mIsText(false),
@ -1159,15 +1135,6 @@ class nsCSSFrameConstructor final : public nsFrameManager {
const FrameConstructionData* mFCData;
// The nsIContent node to use when initializing the new frame.
nsIContent* mContent;
// The PendingBinding for this frame construction item, if any. May be
// null. We maintain a list of PendingBindings in the frame construction
// state in the order in which AddToAttachedQueue should be called on them:
// depth-first, post-order traversal order. Since we actually traverse the
// DOM in a mix of breadth-first and depth-first, it is the responsibility
// of whoever constructs FrameConstructionItem kids of a given
// FrameConstructionItem to push its mPendingBinding as the current
// insertion point before doing so and pop it afterward.
PendingBinding* mPendingBinding;
// The style to use for creating the new frame.
RefPtr<ComputedStyle> mComputedStyle;
// Whether optimizations to skip constructing textframes around
@ -1627,8 +1594,6 @@ class nsCSSFrameConstructor final : public nsFrameManager {
* @param aFrameList the list in which we should place the in-flow children
* @param aAllowBlockStyles Whether to allow first-letter and first-line
* styles on the parent.
* @param aPendingBinding Make sure to push this into aState before doing any
* child item construction.
* @param aPossiblyLeafFrame if non-null, this should be used for the isLeaf
* test and the anonymous content creation. If null, aFrame will be
* used.
@ -1638,7 +1603,6 @@ class nsCSSFrameConstructor final : public nsFrameManager {
nsContainerFrame* aParentFrame,
const bool aCanHaveGeneratedContent,
nsFrameList& aFrameList, const bool aAllowBlockStyles,
PendingBinding* aPendingBinding,
nsIFrame* aPossiblyLeafFrame = nullptr);
/**
@ -1688,7 +1652,6 @@ class nsCSSFrameConstructor final : public nsFrameManager {
nsIContent* aContent,
nsContainerFrame* aParentFrame,
ComputedStyle* aComputedStyle, bool aBuildCombobox,
PendingBinding* aPendingBinding,
nsFrameList& aFrameList);
/**
@ -1763,15 +1726,12 @@ class nsCSSFrameConstructor final : public nsFrameManager {
// @param aPositionedFrameForAbsPosContainer if non-null, then the new
// block should be an abs-pos container and aPositionedFrameForAbsPosContainer
// is the frame whose style is making this block an abs-pos container.
// @param aPendingBinding the pending binding from this block's frame
// construction item.
void ConstructBlock(nsFrameConstructorState& aState, nsIContent* aContent,
nsContainerFrame* aParentFrame,
nsContainerFrame* aContentParentFrame,
ComputedStyle* aComputedStyle,
nsContainerFrame** aNewFrame, nsFrameList& aFrameList,
nsIFrame* aPositionedFrameForAbsPosContainer,
PendingBinding* aPendingBinding);
nsIFrame* aPositionedFrameForAbsPosContainer);
// Build the initial column hierarchy around aColumnContent. This function
// should be called before constructing aColumnContent's children.