-
-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
web: Fix 100% height when that equals 0 #13030
Closed
danielhjacobs
wants to merge
1
commit into
ruffle-rs:master
from
danielhjacobs:fix-100-percent-height
Closed
web: Fix 100% height when that equals 0 #13030
danielhjacobs
wants to merge
1
commit into
ruffle-rs:master
from
danielhjacobs:fix-100-percent-height
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
danielhjacobs
force-pushed
the
fix-100-percent-height
branch
2 times, most recently
from
September 5, 2023 14:43
5aead46
to
66c5fc3
Compare
danielhjacobs
force-pushed
the
fix-100-percent-height
branch
2 times, most recently
from
September 8, 2023 19:57
020c34a
to
de3d7c9
Compare
danielhjacobs
force-pushed
the
fix-100-percent-height
branch
3 times, most recently
from
September 8, 2023 20:36
fd926fe
to
f6b2cff
Compare
danielhjacobs
force-pushed
the
fix-100-percent-height
branch
6 times, most recently
from
September 11, 2023 19:17
18f8fd2
to
2d1c0a6
Compare
danielhjacobs
commented
Sep 11, 2023
web/packages/selfhosted/test/polyfill/percent-height-when-zero/index.html
Outdated
Show resolved
Hide resolved
danielhjacobs
force-pushed
the
fix-100-percent-height
branch
11 times, most recently
from
September 12, 2023 19:33
9c142da
to
3eb23ae
Compare
I also tested this, but a bunch of setTimeout calls does not make for a good test: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PERCENT-BASED-HEIGHT</title>
</head>
<body style="height: 0px;">
<div id="middle-div">
<embed id="content" width="100%" height="100%" src="https://cdn.jsdelivr.net/gh/ruffle-rs/demo/logo-anim.swf"></embed>
</div>
<div id="result"></div>
<script>
let index = 1;
function writeResult(res) {
const resultDiv = document.createElement("div");
resultDiv.textContent = res;
resultDiv.id = "result_" + index;
const result = document.getElementById("result");
result.appendChild(resultDiv);
index++;
}
function checkClientHeight() {
const content = document.getElementById("content");
writeResult(content.clientHeight);
}
function changeContentHeightAttribute(height) {
const content = document.getElementById("content");
content.setAttribute("height", height);
}
function changeBodyHeightStyle(height) {
const body = document.querySelector("body");
body.style.height = height;
}
function removeBodyStyle() {
const body = document.querySelector("body");
body.removeAttribute("style");
}
function removeMiddleDiv() {
const middleDiv = document.getElementById("middle-div");
const content = document.getElementById("content");
middleDiv.replaceWith(content);
}
document.addEventListener("DOMContentLoaded", () => {
const resizeObserver = new ResizeObserver(() => {
checkClientHeight();
});
setTimeout(() => {
// 100% width and 100% height of content, middle-div, 0px body height
const content = document.getElementById("content");
resizeObserver.observe(content)
// 100% width and 100% height of content, 0px body height
setTimeout(removeMiddleDiv, 1000); // 0
// 100% width and 100% height of content, 50px body height
setTimeout(() => changeBodyHeightStyle("50px"), 2000); // 50
// 100% width and 100% height of content, no styling for body
setTimeout(removeBodyStyle, 3000) // 200
// 100% width and 50px height of content, no styling for body
setTimeout(() => changeContentHeightAttribute("50px"), 4000); // 50
// 100% width and 0px height of content, no styling for body
setTimeout(() => changeContentHeightAttribute("0px"), 5000); // 0
const contentDupe = document.createElement("embed");
contentDupe.src = "https://cdn.jsdelivr.net/gh/ruffle-rs/demo/logo-anim.swf";
contentDupe.setAttribute("height", "100%");
contentDupe.setAttribute("width", "100%");
setTimeout(() => document.querySelector("body").appendChild(contentDupe), 7000);
}, 5000);
});
</script>
</body>
</html> This PR vs Flash: Screencast.from.2023-09-12.16-06-12.webmFor reference, this is the same page before this PR: Screencast.from.2023-09-12.16-30-32.webm |
danielhjacobs
force-pushed
the
fix-100-percent-height
branch
from
September 12, 2023 20:08
3eb23ae
to
3f7d9a3
Compare
danielhjacobs
commented
Sep 12, 2023
web/packages/selfhosted/test/polyfill/percent-height-when-zero/expected.html
Show resolved
Hide resolved
danielhjacobs
commented
Sep 12, 2023
web/packages/selfhosted/test/polyfill/percent-height-when-zero/index.html
Show resolved
Hide resolved
danielhjacobs
force-pushed
the
fix-100-percent-height
branch
4 times, most recently
from
September 15, 2023 14:26
06cfc5c
to
35e7889
Compare
danielhjacobs
force-pushed
the
fix-100-percent-height
branch
from
September 15, 2023 14:26
35e7889
to
420c164
Compare
This was referenced Sep 18, 2023
Replaced by #13256 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
200px
is what it is on Pale Moon. Other browsers may vary.Main Test (200px height) :
Other tests:
50px height:
0px height:
0px height:
50px height:
200px height:
Test on Flash browser
Screencast.from.2023-09-08.15-54-25.webm
Test using this PR:
Screencast.from.2023-09-08.15-55-28.webm