Percentage margins thrown on the floor during bidi reordering. Bug 413542, r+sr=dbaron, blocking1.9=schrep

This commit is contained in:
smontagu@smontagu.org 2008-01-26 22:54:08 -08:00
parent 2815fb857a
commit 2550756945
6 changed files with 93 additions and 6 deletions

View File

@ -825,8 +825,10 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
else
aFrame->RemoveStateBits(NS_INLINE_FRAME_BIDI_VISUAL_IS_RIGHT_MOST);
}
nsMargin margin;
aFrame->GetMargin(margin);
// This method is called from nsBlockFrame::PlaceLine via the call to
// bidiUtils->ReorderFrames, so this is guaranteed to be after the inlines
// have been reflowed, which is required for GetUsedMargin/Border/Padding
nsMargin margin = aFrame->GetUsedMargin();
if (isLeftMost)
aLeft += margin.left;
@ -835,8 +837,7 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
if (!IsBidiLeaf(aFrame))
{
nscoord x = 0;
nsMargin borderPadding;
aFrame->GetBorderAndPadding(borderPadding);
nsMargin borderPadding = aFrame->GetUsedBorderAndPadding();
if (isLeftMost) {
x += borderPadding.left;
}
@ -905,12 +906,14 @@ nsBidiPresUtils::InitContinuationStates(nsIFrame* aFrame,
void
nsBidiPresUtils::RepositionInlineFrames(nsIFrame* aFirstChild) const
{
nsMargin margin;
const nsStyleVisibility* vis = aFirstChild->GetStyleVisibility();
PRBool isLTR = (NS_STYLE_DIRECTION_LTR == vis->mDirection);
nscoord leftSpace = 0;
aFirstChild->GetMargin(margin);
// This method is called from nsBlockFrame::PlaceLine via the call to
// bidiUtils->ReorderFrames, so this is guaranteed to be after the inlines
// have been reflowed, which is required for GetUsedMargin/Border/Padding
nsMargin margin = aFirstChild->GetUsedMargin();
if (!aFirstChild->GetPrevContinuation())
leftSpace = isLTR ? margin.left : margin.right;

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Percentage padding on inlines ignored in presence of certain characters in source</title>
<style type="text/css">
#test {
border: 1px solid #000;
width: 500px;
}
#test span {
border: 1px solid #f00;
padding: 0 10%;
}
</style>
</head>
<body>
<div id="test"><span>one</span><span>two</span></div>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Percentage padding on inlines ignored in presence of certain characters in source</title>
<style type="text/css">
#test {
border: 1px solid #000;
width: 500px;
}
#test span {
border: 1px solid #f00;
padding: 0 10%;
}
</style>
</head>
<body>
<!-- To enable bidi: א -->
<div id="test"><span>one</span><span>two</span></div>
</body>
</html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Percentage margin on inlines ignored in presence of certain characters in source</title>
<style type="text/css">
#test {
border: 1px solid #000;
width: 500px;
}
#test span {
border: 1px solid #f00;
margin: 0 10%;
}
</style>
</head>
<body>
<div id="test"><span>one</span><span>two</span></div>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Percentage margin on inlines ignored in presence of certain characters in source</title>
<style type="text/css">
#test {
border: 1px solid #000;
width: 500px;
}
#test span {
border: 1px solid #f00;
margin: 0 10%;
}
</style>
</head>
<body>
<!-- To enable bidi: א -->
<div id="test"><span>one</span><span>two</span></div>
</body>
</html>

View File

@ -19,3 +19,5 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == mixedChartype-03.html mixedChartype-03-
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == mixedChartype-03-j.html mixedChartype-03-ref.html
== 386339.html 386339-ref.html
fails-if(MOZ_WIDGET_TOOLKIT!="gtk2") == 387653.html 387653-ref.html # Linux-specific bug
== 413542-1.html 413542-1-ref.html
== 413542-2.html 413542-2-ref.html