summaryrefslogtreecommitdiffstats
path: root/layout/base
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-14 22:04:32 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-14 22:04:32 -0400
commite215bfbb802a4c854aa7323c698ea5dff4045e25 (patch)
treef58f4b3dc8d9440f40840f635b39c8eefefe6cca /layout/base
parentb356448d145cbd294d051624512bfbfaaf18d9b6 (diff)
downloadUXP-e215bfbb802a4c854aa7323c698ea5dff4045e25.tar
UXP-e215bfbb802a4c854aa7323c698ea5dff4045e25.tar.gz
UXP-e215bfbb802a4c854aa7323c698ea5dff4045e25.tar.lz
UXP-e215bfbb802a4c854aa7323c698ea5dff4045e25.tar.xz
UXP-e215bfbb802a4c854aa7323c698ea5dff4045e25.zip
Bug 1334247 - Remove nsIAnonymousContentCreator::CreateFrameFor
Tag #1375
Diffstat (limited to 'layout/base')
-rw-r--r--layout/base/nsCSSFrameConstructor.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index 37cd3e45e..d5b21f8d1 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -43,6 +43,7 @@
#include "nsContainerFrame.h"
#include "nsNameSpaceManager.h"
#include "nsIComboboxControlFrame.h"
+#include "nsComboboxControlFrame.h"
#include "nsIListControlFrame.h"
#include "nsIDOMCharacterData.h"
#include "nsPlaceholderFrame.h"
@@ -4121,9 +4122,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState,
ancestorPusher.PushStyleScope(aParent->AsElement());
}
- nsIAnonymousContentCreator* creator = do_QueryFrame(aParentFrame);
- NS_ASSERTION(creator,
- "How can that happen if we have nodes to construct frames for?");
+ nsComboboxControlFrame* comboboxFrame = do_QueryFrame(aParentFrame);
InsertionPoint insertion(aParentFrame, aParent);
for (uint32_t i=0; i < count; i++) {
@@ -4135,12 +4134,15 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState,
"nsIAnonymousContentCreator::CreateAnonymousContent to "
"output a list where the items have their own children");
- nsIFrame* newFrame = creator->CreateFrameFor(content);
- if (newFrame) {
- NS_ASSERTION(content->GetPrimaryFrame(),
- "Content must have a primary frame now");
- newFrame->AddStateBits(NS_FRAME_ANONYMOUSCONTENTCREATOR_CONTENT);
- aChildItems.AddChild(newFrame);
+ if (comboboxFrame && comboboxFrame->GetDisplayNode() == content) {
+ // Combo box frames have a custom hook to create frames for the anonymous
+ // text node. This is the last vestigial trace of an old custom hook that
+ // allowed arbitrary custom frame creation by any nsIAnonymousContentCreator
+ // implementation. It's possible that this could all be refactored away.
+ nsIFrame* customFrame = comboboxFrame->CreateFrameForDisplayNode();
+ MOZ_ASSERT(customFrame);
+ customFrame->AddStateBits(NS_FRAME_ANONYMOUSCONTENTCREATOR_CONTENT);
+ aChildItems.AddChild(customFrame);
} else {
FrameConstructionItemList items;
{
@@ -10660,13 +10662,6 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
{
for (uint32_t i = 0; i < aAnonymousItems.Length(); ++i) {
nsIContent* content = aAnonymousItems[i].mContent;
-#ifdef DEBUG
- nsIAnonymousContentCreator* creator = do_QueryFrame(aFrame);
- NS_ASSERTION(!creator || !creator->CreateFrameFor(content),
- "If you need to use CreateFrameFor, you need to call "
- "CreateAnonymousFrames manually and not follow the standard "
- "ProcessChildren() codepath for this frame");
-#endif
// Gecko-styled nodes should have no pending restyle flags.
MOZ_ASSERT_IF(!content->IsStyledByServo(),
!content->IsElement() ||