Bug 569006. Skip probing for ::before/::after during reresolve if we're not redoing matching on kids, since those can't appear/disappear without either a reframe or a change in what selectors we match. r=dbaron

This commit is contained in:
Boris Zbarsky 2010-06-18 12:23:05 -04:00
Родитель fa30dc0437
Коммит 6b42fb408a
5 изменённых файлов: 39 добавлений и 3 удалений

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

@ -1312,7 +1312,11 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
}
}
if (!(aMinChange & nsChangeHint_ReconstructFrame)) {
// Check whether we might need to create a new ::before frame.
// There's no need to do this if we're planning to reframe already
// or if we're not forcing restyles on kids.
if (!(aMinChange & nsChangeHint_ReconstructFrame) &&
childRestyleHint) {
// Make sure not to do this for pseudo-frames -- those can't have :before
// or :after content. Neither can non-elements or leaf frames.
if (!pseudoTag && localContent && localContent->IsElement() &&
@ -1336,8 +1340,11 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
}
}
if (!(aMinChange & nsChangeHint_ReconstructFrame)) {
// Check whether we might need to create a new ::after frame.
// There's no need to do this if we're planning to reframe already
// or if we're not forcing restyles on kids.
if (!(aMinChange & nsChangeHint_ReconstructFrame) &&
childRestyleHint) {
// Make sure not to do this for pseudo-frames -- those can't have :before
// or :after content. Neither can non-elements or leaf frames.
if (!pseudoTag && localContent && localContent->IsElement() &&

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

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
This text should be visible
</body>
</html>

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

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<style>
body::before { content: inherit; }
</style>
</head>
<body onload="document.body.style.content = '&quot;This text should be visible&quot;';">
</body>
</html>

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

@ -1444,6 +1444,7 @@ random-if(!haveTestPlugin) == 546071-1.html 546071-1-ref.html
== 564054-1.html 564054-1-ref.html
== 565819-1.html 565819-ref.html
== 565819-2.html 565819-ref.html
== 569006-1.html 569006-1-ref.html
== 571281-1a.html 571281-1-ref.html
== 571281-1b.html 571281-1-ref.html
== 571281-1c.html 571281-1-ref.html

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

@ -2124,6 +2124,18 @@ nsStyleContent::nsStyleContent(const nsStyleContent& aSource)
nsChangeHint nsStyleContent::CalcDifference(const nsStyleContent& aOther) const
{
// In ReResolveStyleContext we assume that if there's no existing
// ::before or ::after and we don't have to restyle children of the
// node then we can't end up with a ::before or ::after due to the
// restyle of the node itself. That's not quite true, but the only
// exception to the above is when the 'content' property of the node
// changes and the pseudo-element inherits the changed value. Since
// the code here triggers a frame change on the node in that case,
// the optimization in ReResolveStyleContext is ok. But if we ever
// change this code to not reconstruct frames on changes to the
// 'content' property, then we will need to revisit the optimization
// in ReResolveStyleContext.
if (mContentCount != aOther.mContentCount ||
mIncrementCount != aOther.mIncrementCount ||
mResetCount != aOther.mResetCount) {