mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bug 532569. Support 'transparent' attribute on XUL IFRAMEs to integrate content documents into the chrome rendering hierarchy, with their background defaulting to transparent. r=mats,sr=bz
This commit is contained in:
parent
644854d3f7
commit
85b786641d
@ -2292,13 +2292,17 @@ DocumentViewerImpl::FindContainerView()
|
|||||||
{
|
{
|
||||||
nsIView* containerView = nsnull;
|
nsIView* containerView = nsnull;
|
||||||
|
|
||||||
if (mParentWidget) {
|
nsCOMPtr<nsIContent> containerElement;
|
||||||
containerView = nsIView::GetViewFor(mParentWidget);
|
|
||||||
} else if (mContainer) {
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> docShellItem = do_QueryReferent(mContainer);
|
nsCOMPtr<nsIDocShellTreeItem> docShellItem = do_QueryReferent(mContainer);
|
||||||
nsCOMPtr<nsPIDOMWindow> pwin(do_GetInterface(docShellItem));
|
nsCOMPtr<nsPIDOMWindow> pwin(do_GetInterface(docShellItem));
|
||||||
if (pwin) {
|
if (pwin) {
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(pwin->GetFrameElementInternal());
|
containerElement = do_QueryInterface(pwin->GetFrameElementInternal());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mParentWidget) {
|
||||||
|
containerView = nsIView::GetViewFor(mParentWidget);
|
||||||
|
} else {
|
||||||
|
if (mContainer) {
|
||||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||||
if (docShellItem) {
|
if (docShellItem) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> parentDocShellItem;
|
nsCOMPtr<nsIDocShellTreeItem> parentDocShellItem;
|
||||||
@ -2308,12 +2312,12 @@ DocumentViewerImpl::FindContainerView()
|
|||||||
parentDocShell->GetPresShell(getter_AddRefs(parentPresShell));
|
parentDocShell->GetPresShell(getter_AddRefs(parentPresShell));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!content) {
|
if (!containerElement) {
|
||||||
NS_WARNING("Subdocument container has no content");
|
NS_WARNING("Subdocument container has no content");
|
||||||
} else if (!parentPresShell) {
|
} else if (!parentPresShell) {
|
||||||
NS_WARNING("Subdocument container has no presshell");
|
NS_WARNING("Subdocument container has no presshell");
|
||||||
} else {
|
} else {
|
||||||
nsIFrame* f = parentPresShell->GetRealPrimaryFrameFor(content);
|
nsIFrame* f = parentPresShell->GetRealPrimaryFrameFor(containerElement);
|
||||||
if (f) {
|
if (f) {
|
||||||
nsIFrame* subdocFrame = f->GetContentInsertionFrame();
|
nsIFrame* subdocFrame = f->GetContentInsertionFrame();
|
||||||
// subdocFrame might not be a subdocument frame; the frame
|
// subdocFrame might not be a subdocument frame; the frame
|
||||||
@ -2339,6 +2343,10 @@ DocumentViewerImpl::FindContainerView()
|
|||||||
if (!containerView)
|
if (!containerView)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
|
if (containerElement &&
|
||||||
|
containerElement->HasAttr(kNameSpaceID_None, nsGkAtoms::transparent))
|
||||||
|
return containerView;
|
||||||
|
|
||||||
nsIWidget* outerWidget = containerView->GetNearestWidget(nsnull);
|
nsIWidget* outerWidget = containerView->GetNearestWidget(nsnull);
|
||||||
if (outerWidget &&
|
if (outerWidget &&
|
||||||
outerWidget->GetTransparencyMode() == eTransparencyTransparent)
|
outerWidget->GetTransparencyMode() == eTransparencyTransparent)
|
||||||
|
@ -55,6 +55,8 @@ _CHROME_FILES = \
|
|||||||
test_printpreview.xul \
|
test_printpreview.xul \
|
||||||
printpreview_helper.xul \
|
printpreview_helper.xul \
|
||||||
test_bug533845.xul \
|
test_bug533845.xul \
|
||||||
|
chrome_content_integration_window.xul \
|
||||||
|
test_chrome_content_integration.xul \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libs:: $(_CHROME_FILES)
|
libs:: $(_CHROME_FILES)
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||||
|
<window title="Content/chrome integration subwindow"
|
||||||
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
onload="runTests()"
|
||||||
|
style="background:black; -moz-appearance:none;">
|
||||||
|
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||||
|
|
||||||
|
<stack style="height:300px; width:200px;">
|
||||||
|
<!-- the bottom 100px is a strip of black that should be vixible through the content iframe -->
|
||||||
|
<vbox style="background:pink; border-bottom:100px solid black"/>
|
||||||
|
<!-- the middle 100px is a strip of black in the content iframe -->
|
||||||
|
<!-- the bottom 100px of the iframe is transparent, the top 100px is yellow -->
|
||||||
|
<iframe type="content" style="border:none;"
|
||||||
|
transparent="transparent"
|
||||||
|
src="data:text/html,<div style='position:absolute;left:0;top:0;width:100%;height:100px;background:yellow;border-bottom:100px solid black'>"/>
|
||||||
|
<!-- the top 100px is a strip of black above the content iframe -->
|
||||||
|
<vbox style="border-top:100px solid black;"/>
|
||||||
|
</stack>
|
||||||
|
|
||||||
|
<script type="application/javascript">
|
||||||
|
<![CDATA[
|
||||||
|
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
|
||||||
|
for each (var import in imports) {
|
||||||
|
window[import] = window.opener.wrappedJSObject[import];
|
||||||
|
}
|
||||||
|
|
||||||
|
var HTMLNS = "http://www.w3.org/1999/xhtml";
|
||||||
|
|
||||||
|
function runTests() {
|
||||||
|
var testCanvas = snapshotWindow(window);
|
||||||
|
|
||||||
|
var refCanvas = snapshotWindow(window);
|
||||||
|
var ctx = refCanvas.getContext('2d');
|
||||||
|
ctx.fillStyle = "black";
|
||||||
|
ctx.fillRect(0, 0, refCanvas.width, refCanvas.height);
|
||||||
|
|
||||||
|
var comparison = compareSnapshots(testCanvas, refCanvas, true);
|
||||||
|
ok(comparison[0], "Rendering OK, got " + comparison[1] + ", expected " + comparison[2]);
|
||||||
|
dump(comparison[1] + "\n");
|
||||||
|
dump(comparison[2] + "\n");
|
||||||
|
|
||||||
|
var tester = window.SimpleTest;
|
||||||
|
window.close();
|
||||||
|
tester.finish();
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
</window>
|
23
layout/base/tests/chrome/test_chrome_content_integration.xul
Normal file
23
layout/base/tests/chrome/test_chrome_content_integration.xul
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||||
|
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||||
|
type="text/css"?>
|
||||||
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
|
||||||
|
<!-- test results are displayed in the html:body -->
|
||||||
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<!-- test code goes here -->
|
||||||
|
<script type="application/javascript">
|
||||||
|
<![CDATA[
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
window.open("chrome_content_integration_window.xul", "chrome_content_integration",
|
||||||
|
"chrome,width=200,height=300");
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
</window>
|
Loading…
x
Reference in New Issue
Block a user