mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 10:07:30 +09:00
Bug 1343937 - Fix a crash in nsWrapperCache.h
* Implement and use GetInFlowParent * Exempt scrollbar NAC from the new NAC semantics Tag #1375
This commit is contained in:
parent
e5725baa34
commit
8e51f64cad
5 changed files with 41 additions and 4 deletions
|
|
@ -950,6 +950,14 @@ public:
|
||||||
return false;
|
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
|
// Overloaded from nsINode
|
||||||
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10730,6 +10730,12 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
|
||||||
// first element that is not itself NAC (distinct from whether it happens
|
// first element that is not itself NAC (distinct from whether it happens
|
||||||
// to be in a NAC subtree).
|
// 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
|
// To implement all this, we need to pass the correct parent style context
|
||||||
// here because SetPrimaryFrame() may not have been called on the content
|
// here because SetPrimaryFrame() may not have been called on the content
|
||||||
// yet and thus ResolveStyleContext can't find it otherwise.
|
// yet and thus ResolveStyleContext can't find it otherwise.
|
||||||
|
|
@ -10739,9 +10745,12 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
|
||||||
// to worry about anonymous boxes, which CorrectStyleParentFrame handles
|
// to worry about anonymous boxes, which CorrectStyleParentFrame handles
|
||||||
// for us.
|
// for us.
|
||||||
nsIFrame* inheritFrame = aFrame;
|
nsIFrame* inheritFrame = aFrame;
|
||||||
while (inheritFrame->GetContent()->IsNativeAnonymous()) {
|
if (!content->IsNativeScrollbarContent()) {
|
||||||
inheritFrame = inheritFrame->GetParent();
|
while (inheritFrame->GetContent()->IsNativeAnonymous()) {
|
||||||
|
inheritFrame = inheritFrame->GetInFlowParent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inheritFrame->GetType() == nsGkAtoms::canvasFrame) {
|
if (inheritFrame->GetType() == nsGkAtoms::canvasFrame) {
|
||||||
// CorrectStyleParentFrame returns nullptr if the prospective parent is
|
// CorrectStyleParentFrame returns nullptr if the prospective parent is
|
||||||
// the canvas frame, so avoid calling it in that situation.
|
// the canvas frame, so avoid calling it in that situation.
|
||||||
|
|
|
||||||
|
|
@ -8951,10 +8951,10 @@ GetCorrectedParent(const nsIFrame* aFrame)
|
||||||
nsIContent* content = aFrame->GetContent();
|
nsIContent* content = aFrame->GetContent();
|
||||||
Element* element =
|
Element* element =
|
||||||
content && content->IsElement() ? content->AsElement() : nullptr;
|
content && content->IsElement() ? content->AsElement() : nullptr;
|
||||||
if (element && element->IsNativeAnonymous() &&
|
if (element && element->IsNativeAnonymous() && !element->IsNativeScrollbarContent() &&
|
||||||
element->GetPseudoElementType() == aFrame->StyleContext()->GetPseudoType()) {
|
element->GetPseudoElementType() == aFrame->StyleContext()->GetPseudoType()) {
|
||||||
while (parent->GetContent() && parent->GetContent()->IsNativeAnonymous()) {
|
while (parent->GetContent() && parent->GetContent()->IsNativeAnonymous()) {
|
||||||
parent = parent->GetParent();
|
parent = parent->GetInFlowParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -721,6 +721,13 @@ public:
|
||||||
* Accessor functions for geometric parent.
|
* Accessor functions for geometric parent.
|
||||||
*/
|
*/
|
||||||
nsContainerFrame* GetParent() const { return mParent; }
|
nsContainerFrame* GetParent() const { return mParent; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the parent of a frame, using the parent of the placeholder for
|
||||||
|
* out-of-flow frames.
|
||||||
|
*/
|
||||||
|
inline nsContainerFrame* GetInFlowParent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set this frame's parent to aParent.
|
* Set this frame's parent to aParent.
|
||||||
* If the frame may have moved into or out of a scrollframe's
|
* If the frame may have moved into or out of a scrollframe's
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,10 @@
|
||||||
#define nsIFrameInlines_h___
|
#define nsIFrameInlines_h___
|
||||||
|
|
||||||
#include "nsContainerFrame.h"
|
#include "nsContainerFrame.h"
|
||||||
|
#include "nsPlaceholderFrame.h"
|
||||||
#include "nsStyleStructInlines.h"
|
#include "nsStyleStructInlines.h"
|
||||||
#include "nsCSSAnonBoxes.h"
|
#include "nsCSSAnonBoxes.h"
|
||||||
|
#include "nsFrameManager.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsIFrame::IsFlexItem() const
|
nsIFrame::IsFlexItem() const
|
||||||
|
|
@ -160,4 +162,15 @@ nsIFrame::BaselineBOffset(mozilla::WritingMode aWM,
|
||||||
return SynthesizeBaselineBOffsetFromBorderBox(aWM, aBaselineGroup);
|
return SynthesizeBaselineBOffsetFromBorderBox(aWM, aBaselineGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsContainerFrame*
|
||||||
|
nsIFrame::GetInFlowParent()
|
||||||
|
{
|
||||||
|
if (GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
|
||||||
|
nsFrameManager* fm = PresContext()->FrameManager();
|
||||||
|
return fm->GetPlaceholderFrameFor(FirstContinuation())->GetParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetParent();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue