Bug 1473108 - Part 2: Make PresShell not point to unbound NAC in event content stack; r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D8042

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Edgar Chen 2018-10-09 12:16:15 +00:00
Родитель 92ec9a1f2a
Коммит 4026ebce41
5 изменённых файлов: 71 добавлений и 0 удалений

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

@ -0,0 +1,50 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1473108
-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Test for Bug 1473108</title>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<style>
.a {
background: green;
height: 64px;
width: 32px;
display: block;
}
span::before {
content: "";
background: red;
height: 32px;
width: 32px;
display: block;
}
span:active::after {
content: "";
}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1473108">Mozilla Bug 1473108</a>
<a class="a" id="event"><span id="target"></span></a>
<script type="application/javascript">
waitUntilApzStable().then(() => {
let target = document.getElementById("target");
target.addEventListener('click', function(e) {
is(e.target, target, `Clicked on at (${e.clientX}, ${e.clientY})`);
subtestDone();
});
synthesizeNativeTap(target, 5, 5);
});
</script>
</body>
</html>

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

@ -23,6 +23,8 @@ var subtests = [
// Tests that touch-action CSS properties are handled in APZ without waiting
// on the main-thread, when possible
{'file': 'helper_touch_action_regions.html', 'prefs': touch_action_prefs},
// touch-action tests with :active::after CSS property
{'file': 'helper_bug1473108.html'},
// Add new subtests here. If this starts timing out because it's taking too
// long, create a test_group_touchevents-4.html file. Refer to 1423011#c57
// for more details.

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

@ -2094,6 +2094,22 @@ PresShell::FireResizeEvent()
}
}
void
nsIPresShell::NativeAnonymousContentRemoved(nsIContent* aAnonContent)
{
if (aAnonContent == mCurrentEventContent) {
mCurrentEventContent = aAnonContent->GetFlattenedTreeParent();
mCurrentEventFrame = nullptr;
}
for (unsigned int i = 0; i < mCurrentEventContentStack.Length(); i++) {
if (aAnonContent == mCurrentEventContentStack.ElementAt(i)) {
mCurrentEventContentStack.ReplaceObjectAt(aAnonContent->GetFlattenedTreeParent(), i);
mCurrentEventFrameStack[i] = nullptr;
}
}
}
void
PresShell::SetIgnoreFrameDestruction(bool aIgnore)
{

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

@ -1626,6 +1626,8 @@ public:
virtual void FireResizeEvent() = 0;
void NativeAnonymousContentRemoved(nsIContent* aAnonContent);
protected:
/**
* Refresh observer management.

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

@ -251,6 +251,7 @@ nsIFrame::DestroyAnonymousContent(nsPresContext* aPresContext,
{
if (nsCOMPtr<nsIContent> content = aContent) {
aPresContext->EventStateManager()->NativeAnonymousContentRemoved(content);
aPresContext->PresShell()->NativeAnonymousContentRemoved(content);
content->UnbindFromTree();
}
}