summaryrefslogtreecommitdiffstats
path: root/layout/base
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 06:03:18 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 06:03:18 -0400
commit2bcd8923f776e1c7bc716bd42c7e7912c4fe8709 (patch)
treea34044005727184886ddd210962ec70aa285a9da /layout/base
parent4d1d777e706322cb9aca8ed2d5a6e50b805d3bd1 (diff)
downloadUXP-2bcd8923f776e1c7bc716bd42c7e7912c4fe8709.tar
UXP-2bcd8923f776e1c7bc716bd42c7e7912c4fe8709.tar.gz
UXP-2bcd8923f776e1c7bc716bd42c7e7912c4fe8709.tar.lz
UXP-2bcd8923f776e1c7bc716bd42c7e7912c4fe8709.tar.xz
UXP-2bcd8923f776e1c7bc716bd42c7e7912c4fe8709.zip
Bug 1368802 - nsFrameIterator::GetPlaceholderFrame should only try to get the placeholder for out-of-flow frames, because in-flow frames never have a placeholder
Tag #1375
Diffstat (limited to 'layout/base')
-rw-r--r--layout/base/nsFrameTraversal.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/layout/base/nsFrameTraversal.cpp b/layout/base/nsFrameTraversal.cpp
index 40fb5ff30..9ea6349f4 100644
--- a/layout/base/nsFrameTraversal.cpp
+++ b/layout/base/nsFrameTraversal.cpp
@@ -82,6 +82,10 @@ protected:
virtual nsIFrame* GetNextSiblingInner(nsIFrame* aFrame);
virtual nsIFrame* GetPrevSiblingInner(nsIFrame* aFrame);
+ /**
+ * Return the placeholder frame for aFrame if it has one, otherwise return
+ * aFrame itself.
+ */
nsIFrame* GetPlaceholderFrame(nsIFrame* aFrame);
bool IsPopupFrame(nsIFrame* aFrame);
@@ -486,18 +490,12 @@ nsFrameIterator::GetPrevSiblingInner(nsIFrame* aFrame) {
nsIFrame*
nsFrameIterator::GetPlaceholderFrame(nsIFrame* aFrame)
{
- nsIFrame* result = aFrame;
- nsIPresShell *presShell = mPresContext->GetPresShell();
- if (presShell) {
- nsIFrame* placeholder = presShell->GetPlaceholderFrameFor(aFrame);
- if (placeholder)
- result = placeholder;
+ if (MOZ_LIKELY(!aFrame || !aFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW))) {
+ return aFrame;
}
-
- if (result != aFrame)
- result = GetPlaceholderFrame(result);
-
- return result;
+ nsIFrame* placeholder =
+ aFrame->PresContext()->PresShell()->GetPlaceholderFrameFor(aFrame);
+ return placeholder ? placeholder : aFrame;
}
bool