Bug 1395591. When looking for our layout parent style, make sure to start with the placeholder if we're out of flow. r=emilio

MozReview-Commit-ID: 1M52bi3oQFX
This commit is contained in:
Boris Zbarsky 2017-08-31 22:46:35 -04:00
Родитель 056d8fe612
Коммит 11a90dfbd9
5 изменённых файлов: 30 добавлений и 3 удалений

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

@ -1554,9 +1554,15 @@ ServoRestyleManager::DoReparentStyleContext(nsIFrame* aFrame,
if (!providerFrame) {
// No providerFrame means we inherited from a display:contents thing. Our
// layout parent style is the style of our nearest ancestor frame.
providerFrame = nsFrame::CorrectStyleParentFrame(aFrame->GetParent(),
oldContext->GetPseudo());
// layout parent style is the style of our nearest ancestor frame. But we have
// to be careful to do that with our placeholder, not with us, if we're out of
// flow.
if (aFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) {
aFrame->GetPlaceholderFrame()->GetLayoutParentStyleForOutOfFlow(&providerFrame);
} else {
providerFrame = nsFrame::CorrectStyleParentFrame(aFrame->GetParent(),
oldContext->GetPseudo());
}
}
ServoStyleContext* layoutParent = providerFrame->StyleContext()->AsServo();

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

@ -0,0 +1,11 @@
<!DOCTYPE html>
<style>
span {
position: fixed;
}
div {
display: contents
}
body::first-line {}
</style>
<div><span></span></div>

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

@ -495,3 +495,4 @@ load 1362423-1.html
load 1381323.html
asserts-if(!stylo,1) load 1388625-1.html # bug 1389286
load 1390389.html
load 1395591-1.html

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

@ -203,6 +203,12 @@ nsPlaceholderFrame::GetParentStyleContextForOutOfFlow(nsIFrame** aProviderFrame)
}
}
return GetLayoutParentStyleForOutOfFlow(aProviderFrame);
}
nsStyleContext*
nsPlaceholderFrame::GetLayoutParentStyleForOutOfFlow(nsIFrame** aProviderFrame) const
{
nsIFrame* parentFrame = GetParent();
// Placeholder of backdrop frame is a child of the corresponding top
// layer frame, and its style context inherits from that frame. In

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

@ -146,6 +146,9 @@ public:
nsStyleContext* GetParentStyleContextForOutOfFlow(nsIFrame** aProviderFrame) const;
// Like GetParentStyleContextForOutOfFlow, but ignores display:contents bits.
nsStyleContext* GetLayoutParentStyleForOutOfFlow(nsIFrame** aProviderFrame) const;
bool RenumberFrameAndDescendants(int32_t* aOrdinal,
int32_t aDepth,
int32_t aIncrement,