Bug 1343937 - Exempt scrollbar NAC from the new NAC semantics. r=bz

MozReview-Commit-ID: 8TbFkirYOy2
This commit is contained in:
Bobby Holley 2017-03-06 14:34:53 -08:00
Родитель 3439f1454b
Коммит b0a17f9f9c
3 изменённых файлов: 20 добавлений и 3 удалений

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

@ -959,6 +959,14 @@ public:
return false;
}
// Returns true if this element is native-anonymous scrollbar content.
bool IsNativeScrollbarContent() const {
return IsNativeAnonymous() &&
IsAnyOfXULElements(nsGkAtoms::scrollbar,
nsGkAtoms::resizer,
nsGkAtoms::scrollcorner);
}
// Overloaded from nsINode
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;

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

@ -10858,6 +10858,12 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
// first element that is not itself NAC (distinct from whether it happens
// to be in a NAC subtree).
//
// The one exception to all of this is scrollbar content, which we parent
// directly to the scrollframe. This is because the special-snowflake
// construction of scroll frames doesn't result in the placeholder frame
// being constructed until later, which means that GetInFlowParent() doesn't
// work right in the case of out-of-flow scrollframes.
//
// To implement all this, we need to pass the correct parent style context
// here because SetPrimaryFrame() may not have been called on the content
// yet and thus ResolveStyleContext can't find it otherwise.
@ -10867,9 +10873,12 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
// to worry about anonymous boxes, which CorrectStyleParentFrame handles
// for us.
nsIFrame* inheritFrame = aFrame;
while (inheritFrame->GetContent()->IsNativeAnonymous()) {
inheritFrame = inheritFrame->GetInFlowParent();
if (!content->IsNativeScrollbarContent()) {
while (inheritFrame->GetContent()->IsNativeAnonymous()) {
inheritFrame = inheritFrame->GetInFlowParent();
}
}
if (inheritFrame->GetType() == nsGkAtoms::canvasFrame) {
// CorrectStyleParentFrame returns nullptr if the prospective parent is
// the canvas frame, so avoid calling it in that situation.

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

@ -9157,7 +9157,7 @@ GetCorrectedParent(const nsIFrame* aFrame)
nsIContent* content = aFrame->GetContent();
Element* element =
content && content->IsElement() ? content->AsElement() : nullptr;
if (element && element->IsNativeAnonymous() &&
if (element && element->IsNativeAnonymous() && !element->IsNativeScrollbarContent() &&
element->GetPseudoElementType() == aFrame->StyleContext()->GetPseudoType()) {
while (parent->GetContent() && parent->GetContent()->IsNativeAnonymous()) {
parent = parent->GetInFlowParent();