зеркало из https://github.com/mozilla/gecko-dev.git
Bug 996796 patch 12 - Fix the visited rule node handling in ResolveStyleWithReplacement. r=heycam
The added test passes locally on Linux with OMT compositing and OMT animations enabled. However, it also passes without the patch because the calls to FlushAnimations and FlushTransitions from PresShell::FlushPendingNotifications cover up the damage done by bugs in the animation-only style flush. Unfortunately due to lack of global history on B2G and not running OMT animations tests on any other platforms, the new test won't actually run in automation right now.
This commit is contained in:
Родитель
65f9ff29a5
Коммит
a5f4dcf547
|
@ -1426,7 +1426,18 @@ nsStyleSet::ResolveStyleWithReplacement(Element* aElement,
|
|||
RuleNodeWithReplacement(aElement, aOldStyleContext->RuleNode(),
|
||||
aOldStyleContext->GetPseudoType(), aReplacements);
|
||||
|
||||
// FIXME: Does this handle visited contexts correctly???
|
||||
nsRuleNode* visitedRuleNode = nullptr;
|
||||
nsStyleContext* oldStyleIfVisited = aOldStyleContext->GetStyleIfVisited();
|
||||
if (oldStyleIfVisited) {
|
||||
if (oldStyleIfVisited->RuleNode() == aOldStyleContext->RuleNode()) {
|
||||
visitedRuleNode = ruleNode;
|
||||
} else {
|
||||
visitedRuleNode =
|
||||
RuleNodeWithReplacement(aElement, oldStyleIfVisited->RuleNode(),
|
||||
oldStyleIfVisited->GetPseudoType(),
|
||||
aReplacements);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t flags = eNoFlags;
|
||||
if (aOldStyleContext->IsLinkContext()) {
|
||||
|
@ -1440,7 +1451,7 @@ nsStyleSet::ResolveStyleWithReplacement(Element* aElement,
|
|||
}
|
||||
}
|
||||
|
||||
return GetContext(aNewParentContext, ruleNode, nullptr,
|
||||
return GetContext(aNewParentContext, ruleNode, visitedRuleNode,
|
||||
nullptr, nsCSSPseudoElements::ePseudo_NotPseudoElement,
|
||||
nullptr, flags);
|
||||
}
|
||||
|
|
|
@ -151,6 +151,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=964646
|
|||
height: 100px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#visitedLink:link { background-color: yellow }
|
||||
#visitedLink:visited { background-color: blue }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -2024,6 +2027,59 @@ addAsyncAnimTest(function *() {
|
|||
done_div();
|
||||
});
|
||||
|
||||
// Bug 996796 patch 12 - test for correct visited styles during
|
||||
// animation-only style flush.
|
||||
addAsyncAnimTest(function *() {
|
||||
var div1 = document.createElement("div");
|
||||
div1.classList.add("target");
|
||||
div1.style.height = "10px";
|
||||
div1.style.animation = "anim2 linear 1s";
|
||||
|
||||
var visitedLink = document.createElement("a");
|
||||
visitedLink.setAttribute("href", "");
|
||||
visitedLink.setAttribute("id", "visitedLink");
|
||||
visitedLink.classList.add("target");
|
||||
visitedLink.style.display = "block";
|
||||
visitedLink.style.height = "10px";
|
||||
visitedLink.style.animation = "anim2 linear 1s";
|
||||
|
||||
gDisplay.appendChild(div1);
|
||||
gDisplay.appendChild(visitedLink);
|
||||
|
||||
// Wait for animations to start and for visited link coloring.
|
||||
yield waitForPaintsFlushed();
|
||||
|
||||
var bgColor = SpecialPowers.DOMWindowUtils
|
||||
.getVisitedDependentComputedStyle(visitedLink, "", "background-color");
|
||||
var isb2g = SpecialPowers.Services.appinfo.name == "B2G";
|
||||
// No global history in B2G.
|
||||
(isb2g ? todo_is : is)(bgColor, "rgb(0, 0, 255)",
|
||||
"initial visited link background color");
|
||||
|
||||
if (isb2g) {
|
||||
// The above failure makes the rest of the test pointless.
|
||||
div1.remove();
|
||||
visitedLink.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
advance_clock(250);
|
||||
|
||||
// Trigger a style change on div1 that will force us to do a miniflush,
|
||||
// but which will not trigger a style change on visitedLink.
|
||||
div1.style.color = "blue";
|
||||
advance_clock(250);
|
||||
|
||||
bgColor = SpecialPowers.DOMWindowUtils
|
||||
.getVisitedDependentComputedStyle(visitedLink, "", "background-color");
|
||||
|
||||
is(bgColor, "rgb(0, 0, 255)",
|
||||
"visited link background color after animation-only flush");
|
||||
|
||||
div1.remove();
|
||||
visitedLink.remove();
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// Helper functions from test_animations.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче