diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-16 17:51:36 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-16 17:52:30 -0400 |
commit | e484678480bd301013d1d0ffc469fa99a8651cc3 (patch) | |
tree | 2b9107c18edfe1752152febbc68f938050136d84 /layout/generic | |
parent | 5c78654f6f98e911677919e66995a338b30d5cf8 (diff) | |
download | uxp-e484678480bd301013d1d0ffc469fa99a8651cc3.tar.gz |
Bug 1343937 - Fix a crash in nsWrapperCache.h
* Implement and use GetInFlowParent
* Exempt scrollbar NAC from the new NAC semantics
Tag mcp-graveyard/UXP#1375
Diffstat (limited to 'layout/generic')
-rw-r--r-- | layout/generic/nsFrame.cpp | 4 | ||||
-rw-r--r-- | layout/generic/nsIFrame.h | 7 | ||||
-rw-r--r-- | layout/generic/nsIFrameInlines.h | 13 |
3 files changed, 22 insertions, 2 deletions
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 2b81ce83b9..71f6172bd5 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -8964,10 +8964,10 @@ 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->GetParent(); + parent = parent->GetInFlowParent(); } } diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 93eb95099a..3137aaee27 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -721,6 +721,13 @@ public: * Accessor functions for geometric parent. */ 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. * If the frame may have moved into or out of a scrollframe's diff --git a/layout/generic/nsIFrameInlines.h b/layout/generic/nsIFrameInlines.h index eb9a7202a3..3068c9f79d 100644 --- a/layout/generic/nsIFrameInlines.h +++ b/layout/generic/nsIFrameInlines.h @@ -8,8 +8,10 @@ #define nsIFrameInlines_h___ #include "nsContainerFrame.h" +#include "nsPlaceholderFrame.h" #include "nsStyleStructInlines.h" #include "nsCSSAnonBoxes.h" +#include "nsFrameManager.h" bool nsIFrame::IsFlexItem() const @@ -160,4 +162,15 @@ nsIFrame::BaselineBOffset(mozilla::WritingMode aWM, 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 |