Bug 841192. Part 1: Make <frame> elements behave more like <iframe>s, in particular supporting padding and borders (but not border-radius). r=mats

--HG--
extra : rebase_source : b49a430b7a54bc0579f4f109afa001634a2b8930
This commit is contained in:
Robert O'Callahan 2013-04-03 00:03:03 +13:00
parent b36ba54ca7
commit 6709e4eafc
6 changed files with 27 additions and 22 deletions

View File

@ -749,7 +749,9 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
nsIntPoint* aCellIndex)
{
// reflow the child
nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild, aSize);
nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild, aSize);
reflowState.SetComputedWidth(std::max(0, aSize.width - reflowState.mComputedBorderPadding.LeftRight()));
reflowState.SetComputedHeight(std::max(0, aSize.height - reflowState.mComputedBorderPadding.TopBottom()));
nsHTMLReflowMetrics metrics;
metrics.width = aSize.width;
metrics.height= aSize.height;

View File

@ -677,28 +677,19 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
NS_ASSERTION(mContent->GetPrimaryFrame() == this,
"Shouldn't happen");
// XUL <iframe> or <browser>, or HTML <iframe>, <object> or <embed>
nsresult rv = nsLeafFrame::DoReflow(aPresContext, aDesiredSize, aReflowState,
aStatus);
NS_ENSURE_SUCCESS(rv, rv);
// "offset" is the offset of our content area from our frame's
// top-left corner.
nsPoint offset(0, 0);
if (IsInline()) {
// XUL <iframe> or <browser>, or HTML <iframe>, <object> or <embed>
nsresult rv = nsLeafFrame::DoReflow(aPresContext, aDesiredSize, aReflowState,
aStatus);
NS_ENSURE_SUCCESS(rv, rv);
offset = nsPoint(aReflowState.mComputedBorderPadding.left,
aReflowState.mComputedBorderPadding.top);
} else {
// HTML <frame>
SizeToAvailSize(aReflowState, aDesiredSize);
}
nsPoint offset = nsPoint(aReflowState.mComputedBorderPadding.left,
aReflowState.mComputedBorderPadding.top);
nsSize innerSize(aDesiredSize.width, aDesiredSize.height);
if (IsInline()) {
innerSize.width -= aReflowState.mComputedBorderPadding.LeftRight();
innerSize.height -= aReflowState.mComputedBorderPadding.TopBottom();
}
innerSize.width -= aReflowState.mComputedBorderPadding.LeftRight();
innerSize.height -= aReflowState.mComputedBorderPadding.TopBottom();
if (mInnerView) {
nsViewManager* vm = mInnerView->GetViewManager();

View File

@ -0,0 +1,6 @@
<!DOCTYPE HTML>
<html>
<body style="margin:0; position:absolute; left:0; top:0; right:0; bottom:0; padding:10px; border:5px solid lime;">
<div style="height:100%; background:yellow;"></div>
</body>
</html>

View File

@ -0,0 +1,5 @@
<!DOCTYPE HTML>
<frameset>
<frame style="padding:10px; border:5px solid lime; border-radius:20px"
src="data:text/html,<body style='background:yellow'>">
</frame>

View File

@ -1748,7 +1748,8 @@ skip-if(B2G) == 818276-1.html 818276-1-ref.html
== 827577-1b.html 827577-1-ref.html
== 827799-1.html about:blank
== 836844-1.html 836844-1-ref.html
== 848421-1.html 848421-1-ref.html
== 847850-1.html 847850-1-ref.html
== 841192-1.html 841192-1-ref.html
== 846144-1.html 846144-1-ref.html
== 847850-1.html 847850-1-ref.html
== 848421-1.html 848421-1-ref.html
test-pref(layout.css.flexbox.enabled,true) == 849407-1.html 849407-1-ref.html

View File

@ -659,7 +659,7 @@ frameset {
}
frame {
border: none ! important;
border-radius: 0 ! important;
}
iframe {