mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 952087 Anchor scroll fails if the anchor is created between DOMContentLoaded and onload r=smaug
This commit is contained in:
parent
4d46ad1708
commit
796419d6e8
@ -8821,6 +8821,10 @@ void
|
||||
nsDocument::ScrollToRef()
|
||||
{
|
||||
if (mScrolledToRefAlready) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
shell->ScrollToAnchor();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1025,15 +1025,20 @@ nsDocumentViewer::LoadComplete(nsresult aStatus)
|
||||
}
|
||||
}
|
||||
|
||||
// Now that the document has loaded, we can tell the presshell
|
||||
// to unsuppress painting.
|
||||
if (mPresShell && !mStopped) {
|
||||
nsCOMPtr<nsIPresShell> shellDeathGrip(mPresShell);
|
||||
mPresShell->UnsuppressPainting();
|
||||
// mPresShell could have been removed now, see bug 378682/421432
|
||||
if (!mStopped) {
|
||||
if (mDocument) {
|
||||
mDocument->ScrollToRef();
|
||||
}
|
||||
|
||||
// Now that the document has loaded, we can tell the presshell
|
||||
// to unsuppress painting.
|
||||
if (mPresShell) {
|
||||
mPresShell->ScrollToAnchor();
|
||||
mPresShell->LoadComplete();
|
||||
nsCOMPtr<nsIPresShell> shellDeathGrip(mPresShell);
|
||||
mPresShell->UnsuppressPainting();
|
||||
// mPresShell could have been removed now, see bug 378682/421432
|
||||
if (mPresShell) {
|
||||
mPresShell->LoadComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
14
layout/reftests/scrolling/deferred-anchor-ref.html
Normal file
14
layout/reftests/scrolling/deferred-anchor-ref.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
</head>
|
||||
<body style="margin: 0;">
|
||||
<div>
|
||||
<div style="height: 50px; width: 50px; background-color: red;"></div>
|
||||
<div style="height: 1000px;"></div>
|
||||
<div id="d" style="height: 50px; width: 50px; background-color: green;"></div>
|
||||
<div style="height: 1000px;"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
17
layout/reftests/scrolling/deferred-anchor.html
Normal file
17
layout/reftests/scrolling/deferred-anchor.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = function() {
|
||||
document.body.appendChild(document.importNode(this.responseXML.getElementsByTagName("div")[0], true));
|
||||
};
|
||||
xhr.open("get", "deferred-anchor-ref.html");
|
||||
xhr.responseType = "document";
|
||||
xhr.send();
|
||||
</script>
|
||||
</head>
|
||||
<body style="margin: 0;">
|
||||
</body>
|
||||
</html>
|
@ -1,3 +1,4 @@
|
||||
== deferred-anchor.html#d deferred-anchor-ref.html#d
|
||||
HTTP == fixed-1.html fixed-1.html?ref
|
||||
HTTP == fixed-opacity-1.html fixed-opacity-1.html?ref
|
||||
skip-if(B2G) HTTP == fixed-opacity-2.html fixed-opacity-2.html?ref
|
||||
|
Loading…
Reference in New Issue
Block a user