trigger fixed layout if the width cahnges from auto to fixed, bug 426629r/sr=dbaron

This commit is contained in:
Bernd 2008-10-18 19:25:26 +02:00
Родитель 23999b15f9
Коммит c095f87dba
5 изменённых файлов: 62 добавлений и 0 удалений

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

@ -0,0 +1,18 @@
<!DOCTYPE HTML PUBLIC "-//W#C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> fixed layout not triggered by changing width from auto to coordinate</title>
<script type="text/javascript">
function doTest(){
t1 = document.getElementById('target1');
t1.style.width="20px";
}
</script>
</head>
<body onload="doTest();">
<table border style="table-layout:fixed; width:400px" id="target1">
<tr><td>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</td></tr>
</table>
</body>
</html>

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

@ -0,0 +1,19 @@
<!DOCTYPE HTML PUBLIC "-//W#C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> fixed layout not triggered by changing width from auto to coordinate</title>
<script type="text/javascript">
function doTest(){
t1 = document.getElementById('target2');
t1.style.width="20px";
}
</script>
</head>
<body onload="doTest();">
<table border style="table-layout:fixed;" id="target2">
<tr><td>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</td></tr>
</table>
</body>
</html>

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

@ -871,6 +871,7 @@ fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 424074-1-ref2.xul 424074-1-ref3.xul
== 425972-1.html 425972-1-ref.html == 425972-1.html 425972-1-ref.html
== 425972-2.html 425972-2-ref.html == 425972-2.html 425972-2-ref.html
!= 425972-1.html 425972-2.html != 425972-1.html 425972-2.html
== 426629-1.html 426629-1-ref.html
!= 427017-1.xhtml about:blank # crash test (needs reftest-print) != 427017-1.xhtml about:blank # crash test (needs reftest-print)
== 427129-scrollframe.html 427129-ref.html == 427129-scrollframe.html 427129-ref.html
== 427129-table.html 427129-ref.html == 427129-table.html 427129-ref.html

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

@ -2226,6 +2226,27 @@ nsTableFrame::GetCollapsedWidth(nsMargin aBorderPadding)
return width; return width;
} }
/* virtual */ void
nsTableFrame::DidSetStyleContext()
{
//avoid this on init or nextinflow
if (!mTableLayoutStrategy || GetPrevInFlow())
return;
PRBool isAuto = IsAutoLayout();
if (isAuto != (LayoutStrategy()->GetType() == nsITableLayoutStrategy::Auto)) {
nsITableLayoutStrategy* temp;
if (isAuto)
temp = new BasicTableLayoutStrategy(this);
else
temp = new FixedTableLayoutStrategy(this);
if (temp) {
delete mTableLayoutStrategy;
mTableLayoutStrategy = temp;
}
}
}

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

@ -196,6 +196,9 @@ public:
/** @see nsIFrame::Destroy */ /** @see nsIFrame::Destroy */
virtual void Destroy(); virtual void Destroy();
/** @see nsIFrame::DidSetStyleContext */
virtual void DidSetStyleContext();
NS_IMETHOD AppendFrames(nsIAtom* aListName, NS_IMETHOD AppendFrames(nsIAtom* aListName,
nsIFrame* aFrameList); nsIFrame* aFrameList);