зеркало из https://github.com/mozilla/gecko-dev.git
Bug 458898. Make sizeToContent work for HTML documents by ensuring CanvasFrame converts an UNCONSTRAINEDSIZE computed height into its actual desired height. r+sr=dbaron
This commit is contained in:
Родитель
b56fcea574
Коммит
f1991097c1
|
@ -427,7 +427,7 @@ public:
|
|||
|
||||
/**
|
||||
* Get the visible area associated with this presentation context.
|
||||
* This is the size of the visiable area that is used for
|
||||
* This is the size of the visible area that is used for
|
||||
* presenting the document. The returned value is in the standard
|
||||
* nscoord units (as scaled by the device context).
|
||||
*/
|
||||
|
|
|
@ -94,6 +94,7 @@ _TEST_FILES = \
|
|||
test_bug445810.html \
|
||||
test_bug449781.html \
|
||||
test_bug450930.xhtml \
|
||||
test_bug458898.html \
|
||||
$(NULL)
|
||||
# test_bug396024.html is currently disabled because it interacts badly with
|
||||
# the "You can't print-preview while the page is loading" dialog.
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=458898
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 458898</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=458898">Mozilla Bug 458898</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var win = window.openDialog("data:text/html,<div style='height:200px; width:100px;'>");
|
||||
|
||||
function loaded() {
|
||||
win.sizeToContent();
|
||||
ok(win.innerWidth >= 100, "innerWidth");
|
||||
ok(win.innerHeight >= 200, "innerHeight");
|
||||
win.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
win.addEventListener("load", loaded, false);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -709,9 +709,16 @@ CanvasFrame::Reflow(nsPresContext* aPresContext,
|
|||
viewport->Invalidate(nsRect(nsPoint(0, 0), viewport->GetSize()));
|
||||
}
|
||||
|
||||
// Return our desired size (which doesn't matter)
|
||||
// Return our desired size. Normally it's what we're told, but
|
||||
// sometimes we can be given an unconstrained height (when a window
|
||||
// is sizing-to-content), and we should compute our desired height.
|
||||
aDesiredSize.width = aReflowState.ComputedWidth();
|
||||
aDesiredSize.height = aReflowState.ComputedHeight();
|
||||
if (aReflowState.ComputedHeight() == NS_UNCONSTRAINEDSIZE) {
|
||||
aDesiredSize.height = kidFrame->GetRect().height +
|
||||
kidReflowState.mComputedMargin.TopBottom();
|
||||
} else {
|
||||
aDesiredSize.height = aReflowState.ComputedHeight();
|
||||
}
|
||||
|
||||
aDesiredSize.mOverflowArea.UnionRect(
|
||||
nsRect(0, 0, aDesiredSize.width, aDesiredSize.height),
|
||||
|
|
Загрузка…
Ссылка в новой задаче