Bug 1223561 - Support putting <table> into fullscreen. r=dbaron

MozReview-Commit-ID: 5ohJW9U65dr

--HG--
extra : rebase_source : 6354a9d2f351a926c8dfb97fac342f634364cf57
This commit is contained in:
Xidorn Quan 2016-11-22 16:31:56 +11:00
Родитель 6fe3399188
Коммит e1ee43ee63
5 изменённых файлов: 98 добавлений и 23 удалений

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

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test for Bug 1223561</title>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="text/javascript" src="file_fullscreen-utils.js"></script>
</head>
<body>
<table style="background-color: green"></table>
<script>
"use strict";
function ok(condition, msg) {
opener.ok(condition, "[table] " + msg);
}
function is(a, b, msg) {
opener.is(a, b, "[table] " + msg);
}
function info(msg) {
opener.info("[table] " + msg);
}
const gTable = document.querySelector("table");
function begin() {
info("The default background of window should be white");
addFullscreenChangeContinuation("enter", enteredFullscreen);
assertWindowPureColor(window, "white");
gTable.requestFullscreen();
}
function enteredFullscreen() {
info("The table with green background should be in fullscreen");
assertWindowPureColor(window, "green");
gTable.style = "background: transparent";
info("When the table becames transparent, the black backdrop should appear");
assertWindowPureColor(window, "black");
addFullscreenChangeContinuation("exit", exitedFullscreen);
document.exitFullscreen();
}
function exitedFullscreen() {
opener.nextTest();
}
</script>
</body>
</html>

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

@ -53,28 +53,6 @@ support-files =
file_bug1260704.png
file_formSubmission_img.jpg
file_formSubmission_text.txt
file_fullscreen-api.html
file_fullscreen-backdrop.html
file_fullscreen-denied-inner.html
file_fullscreen-denied.html
file_fullscreen-esc-exit-inner.html
file_fullscreen-esc-exit.html
file_fullscreen-hidden.html
file_fullscreen-lenient-setters.html
file_fullscreen-multiple-inner.html
file_fullscreen-multiple.html
file_fullscreen-navigation.html
file_fullscreen-nested.html
file_fullscreen-prefixed.html
file_fullscreen-plugins.html
file_fullscreen-rollback.html
file_fullscreen-scrollbar.html
file_fullscreen-selector.html
file_fullscreen-svg-element.html
file_fullscreen-top-layer.html
file_fullscreen-unprefix-disabled-inner.html
file_fullscreen-unprefix-disabled.html
file_fullscreen-utils.js
file_iframe_sandbox_a_if1.html
file_iframe_sandbox_a_if10.html
file_iframe_sandbox_a_if11.html
@ -461,6 +439,30 @@ skip-if = toolkit == 'android'
[test_fullscreen-api.html]
tags = fullscreen
skip-if = toolkit == 'android'
support-files =
file_fullscreen-api.html
file_fullscreen-backdrop.html
file_fullscreen-denied-inner.html
file_fullscreen-denied.html
file_fullscreen-esc-exit-inner.html
file_fullscreen-esc-exit.html
file_fullscreen-hidden.html
file_fullscreen-lenient-setters.html
file_fullscreen-multiple-inner.html
file_fullscreen-multiple.html
file_fullscreen-navigation.html
file_fullscreen-nested.html
file_fullscreen-prefixed.html
file_fullscreen-plugins.html
file_fullscreen-rollback.html
file_fullscreen-scrollbar.html
file_fullscreen-selector.html
file_fullscreen-svg-element.html
file_fullscreen-table.html
file_fullscreen-top-layer.html
file_fullscreen-unprefix-disabled-inner.html
file_fullscreen-unprefix-disabled.html
file_fullscreen-utils.js
[test_fullscreen-api-race.html]
tags = fullscreen
skip-if = toolkit == 'android' # just copy the conditions from the test above

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

@ -45,6 +45,7 @@ var gTestWindows = [
"file_fullscreen-prefixed.html",
"file_fullscreen-unprefix-disabled.html",
"file_fullscreen-lenient-setters.html",
"file_fullscreen-table.html",
];
var testWindow = null;

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

@ -206,10 +206,26 @@ nsPlaceholderFrame::GetParentStyleContext(nsIFrame** aProviderFrame) const
}
}
nsIFrame* parentFrame = GetParent();
// Placeholder of backdrop frame is a child of the corresponding top
// layer frame, and its style context inherits from that frame. In
// case of table, the top layer frame is the table wrapper frame.
// However, it will be skipped in CorrectStyleParentFrame below, so
// we need to handle it specially here.
if ((GetStateBits() & PLACEHOLDER_FOR_TOPLAYER) &&
parentFrame->GetType() == nsGkAtoms::tableWrapperFrame) {
MOZ_ASSERT(mOutOfFlowFrame->GetType() == nsGkAtoms::backdropFrame,
"Only placeholder of backdrop frame can be put inside "
"a table wrapper frame");
*aProviderFrame = parentFrame;
return parentFrame->StyleContext();
}
// Lie about our pseudo so we can step out of all anon boxes and
// pseudo-elements. The other option would be to reimplement the
// {ib} split gunk here.
*aProviderFrame = CorrectStyleParentFrame(GetParent(), nsGkAtoms::placeholderFrame);
*aProviderFrame = CorrectStyleParentFrame(parentFrame,
nsGkAtoms::placeholderFrame);
return *aProviderFrame ? (*aProviderFrame)->StyleContext() : nullptr;
}

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

@ -22,7 +22,11 @@
}
*|*::-moz-table-wrapper {
/* The inherited properties here need to be safe to have on both the
* table and the table wrapper, generally because code ignores them
* for the table. */
display: inherit !important; /* table or inline-table */
-moz-top-layer: inherit !important;
margin: inherit ! important;
padding: 0 ! important;
border: none ! important;