зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1479528: Make the ShouldSuppressFrameIn* functions take references. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D2562 MozReview-Commit-ID: 8lcn1XW4aik
This commit is contained in:
Родитель
a8f7b3a10f
Коммит
48b9fd1d39
|
@ -5432,7 +5432,7 @@ nsCSSFrameConstructor::AddFrameConstructionItems(nsFrameConstructorState& aState
|
||||||
// XXXbz it's not clear how this should best work with XBL.
|
// XXXbz it's not clear how this should best work with XBL.
|
||||||
static bool
|
static bool
|
||||||
ShouldSuppressFrameInSelect(const nsIContent* aParent,
|
ShouldSuppressFrameInSelect(const nsIContent* aParent,
|
||||||
const nsIContent* aChild)
|
const nsIContent& aChild)
|
||||||
{
|
{
|
||||||
if (!aParent ||
|
if (!aParent ||
|
||||||
!aParent->IsAnyOfHTMLElements(nsGkAtoms::select, nsGkAtoms::optgroup)) {
|
!aParent->IsAnyOfHTMLElements(nsGkAtoms::select, nsGkAtoms::optgroup)) {
|
||||||
|
@ -5443,23 +5443,23 @@ ShouldSuppressFrameInSelect(const nsIContent* aParent,
|
||||||
//
|
//
|
||||||
// We can't be regular NAC, since display: contents has no frame to generate
|
// We can't be regular NAC, since display: contents has no frame to generate
|
||||||
// them off.
|
// them off.
|
||||||
if (aChild->GetParent() != aParent) {
|
if (aChild.GetParent() != aParent) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option is always fine.
|
// Option is always fine.
|
||||||
if (aChild->IsHTMLElement(nsGkAtoms::option)) {
|
if (aChild.IsHTMLElement(nsGkAtoms::option)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <optgroup> is OK in <select> but not in <optgroup>.
|
// <optgroup> is OK in <select> but not in <optgroup>.
|
||||||
if (aChild->IsHTMLElement(nsGkAtoms::optgroup) &&
|
if (aChild.IsHTMLElement(nsGkAtoms::optgroup) &&
|
||||||
aParent->IsHTMLElement(nsGkAtoms::select)) {
|
aParent->IsHTMLElement(nsGkAtoms::select)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow native anonymous content no matter what.
|
// Allow native anonymous content no matter what.
|
||||||
if (aChild->IsRootOfAnonymousSubtree()) {
|
if (aChild.IsRootOfAnonymousSubtree()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5468,13 +5468,13 @@ ShouldSuppressFrameInSelect(const nsIContent* aParent,
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
ShouldSuppressFrameInNonOpenDetails(const HTMLDetailsElement* aDetails,
|
ShouldSuppressFrameInNonOpenDetails(const HTMLDetailsElement* aDetails,
|
||||||
const nsIContent* aChild)
|
const nsIContent& aChild)
|
||||||
{
|
{
|
||||||
if (!aDetails || aDetails->Open()) {
|
if (!aDetails || aDetails->Open()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aChild->GetParent() != aDetails) {
|
if (aChild.GetParent() != aDetails) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5484,9 +5484,9 @@ ShouldSuppressFrameInNonOpenDetails(const HTMLDetailsElement* aDetails,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't suppress NAC, unless it's ::before or ::after.
|
// Don't suppress NAC, unless it's ::before or ::after.
|
||||||
if (aChild->IsRootOfAnonymousSubtree() &&
|
if (aChild.IsRootOfAnonymousSubtree() &&
|
||||||
!aChild->IsGeneratedContentContainerForBefore() &&
|
!aChild.IsGeneratedContentContainerForBefore() &&
|
||||||
!aChild->IsGeneratedContentContainerForAfter()) {
|
!aChild.IsGeneratedContentContainerForAfter()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5599,8 +5599,9 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsIContent* parent = aParentFrame ? aParentFrame->GetContent() : nullptr;
|
nsIContent* parent = aParentFrame ? aParentFrame->GetContent() : nullptr;
|
||||||
if (ShouldSuppressFrameInSelect(parent, aContent)) {
|
if (ShouldSuppressFrameInSelect(parent, *aContent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5610,7 +5611,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
||||||
// ::before and ::after); we always want to create "internal" anonymous
|
// ::before and ::after); we always want to create "internal" anonymous
|
||||||
// content.
|
// content.
|
||||||
auto* details = HTMLDetailsElement::FromNodeOrNull(parent);
|
auto* details = HTMLDetailsElement::FromNodeOrNull(parent);
|
||||||
if (ShouldSuppressFrameInNonOpenDetails(details, aContent)) {
|
if (ShouldSuppressFrameInNonOpenDetails(details, *aContent)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче