mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1116714
part 2 - Don't create a frame for the custom content container when it has no children. r=roc
This commit is contained in:
parent
ff5524e902
commit
19090c22bf
@ -5252,6 +5252,7 @@ nsIDocument::InsertAnonymousContent(Element& aElement, ErrorResult& aRv)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
nsCOMPtr<Element> container = shell->GetCanvasFrame()
|
||||
->GetCustomContentContainer();
|
||||
if (!container) {
|
||||
@ -5276,6 +5277,8 @@ nsIDocument::InsertAnonymousContent(Element& aElement, ErrorResult& aRv)
|
||||
new AnonymousContent(clonedElement->AsElement());
|
||||
mAnonymousContents.AppendElement(anonymousContent);
|
||||
|
||||
shell->GetCanvasFrame()->ShowCustomContentContainer();
|
||||
|
||||
return anonymousContent.forget();
|
||||
}
|
||||
|
||||
@ -5289,6 +5292,7 @@ nsIDocument::RemoveAnonymousContent(AnonymousContent& aContent,
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
nsCOMPtr<Element> container = shell->GetCanvasFrame()
|
||||
->GetCustomContentContainer();
|
||||
if (!container) {
|
||||
@ -5314,6 +5318,9 @@ nsIDocument::RemoveAnonymousContent(AnonymousContent& aContent,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mAnonymousContents.IsEmpty()) {
|
||||
shell->GetCanvasFrame()->HideCustomContentContainer();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -53,6 +53,24 @@ NS_QUERYFRAME_HEAD(nsCanvasFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
|
||||
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
||||
|
||||
void
|
||||
nsCanvasFrame::ShowCustomContentContainer()
|
||||
{
|
||||
if (mCustomContentContainer) {
|
||||
mCustomContentContainer->UnsetAttr(kNameSpaceID_None, nsGkAtoms::hidden, true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsCanvasFrame::HideCustomContentContainer()
|
||||
{
|
||||
if (mCustomContentContainer) {
|
||||
mCustomContentContainer->SetAttr(kNameSpaceID_None, nsGkAtoms::hidden,
|
||||
NS_LITERAL_STRING("true"),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCanvasFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
{
|
||||
@ -126,6 +144,11 @@ nsCanvasFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
mCustomContentContainer->AppendChildTo(node->AsContent(), true);
|
||||
}
|
||||
|
||||
// Only create a frame for mCustomContentContainer if it has some children.
|
||||
if (len == 0) {
|
||||
HideCustomContentContainer();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,18 @@ public:
|
||||
return mCustomContentContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unhide the CustomContentContainer. This call only has an effect if
|
||||
* mCustomContentContainer is non-null.
|
||||
*/
|
||||
void ShowCustomContentContainer();
|
||||
|
||||
/**
|
||||
* Hide the CustomContentContainer. This call only has an effect if
|
||||
* mCustomContentContainer is non-null.
|
||||
*/
|
||||
void HideCustomContentContainer();
|
||||
|
||||
/** SetHasFocus tells the CanvasFrame to draw with focus ring
|
||||
* @param aHasFocus true to show focus ring, false to hide it
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user