Commit c230576d authored by darin's avatar darin

LayoutTests:

        Reviewed and refined by Darin.

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=3579
          In-place style-switching is leaving junk behind, messing up styles

        * fast/css/margin-top-bottom-dynamic-expected.checksum: Added.
        * fast/css/margin-top-bottom-dynamic-expected.png: Added.
        * fast/css/margin-top-bottom-dynamic-expected.txt: Added.
        * fast/css/margin-top-bottom-dynamic.html: Added.

WebCore:

        Reviewed by Hyatt.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3579
          In-place style-switching is leaving junk behind, messing up styles

        * khtml/rendering/render_block.h: (khtml::RenderBlock::initMaxMarginValues):
        Set all margin values in all cases.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11826 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b990c07f
2005-12-29 Graham Dennis <Graham.Dennis@gmail.com>
Reviewed and refined by Darin.
- test for http://bugzilla.opendarwin.org/show_bug.cgi?id=3579
In-place style-switching is leaving junk behind, messing up styles
* fast/css/margin-top-bottom-dynamic-expected.checksum: Added.
* fast/css/margin-top-bottom-dynamic-expected.png: Added.
* fast/css/margin-top-bottom-dynamic-expected.txt: Added.
* fast/css/margin-top-bottom-dynamic.html: Added.
2005-12-29 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
......
e31144e36735ab0af649d9f406e75dd9
\ No newline at end of file
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {P} at (0,0) size 784x18
RenderText {TEXT} at (0,0) size 249x18
text run at (0,0) width 249: "What it should look like (positive case):"
RenderBlock {DIV} at (0,34) size 784x72 [border: (1px solid #008000)]
RenderBlock {DIV} at (1,11) size 782x20 [border: (1px solid #0000FF)]
RenderText {TEXT} at (1,1) size 84x18
text run at (1,1) width 84: "Lorem ipsum"
RenderBlock {DIV} at (1,41) size 782x20 [border: (1px dotted #0000FF)]
RenderText {TEXT} at (1,1) size 84x18
text run at (1,1) width 84: "Lorem ipsum"
RenderBlock {P} at (0,122) size 784x18
RenderText {TEXT} at (0,0) size 253x18
text run at (0,0) width 253: "What it should look like (negative case):"
RenderBlock {DIV} at (0,156) size 784x32 [border: (1px solid #008000)]
RenderBlock {DIV} at (1,11) size 782x20 [border: (1px solid #0000FF)]
RenderText {TEXT} at (1,1) size 84x18
text run at (1,1) width 84: "Lorem ipsum"
RenderBlock {DIV} at (1,21) size 782x20 [border: (1px dotted #0000FF)]
RenderText {TEXT} at (1,1) size 84x18
text run at (1,1) width 84: "Lorem ipsum"
RenderBlock {P} at (0,204) size 784x18
RenderText {TEXT} at (0,0) size 369x18
text run at (0,0) width 369: "Dynamic case (automatically testing positive --> negative):"
RenderBlock {DIV} at (0,238) size 784x32 [border: (1px solid #008000)]
RenderBlock {DIV} at (1,11) size 782x20 [border: (1px solid #0000FF)]
RenderText {TEXT} at (1,1) size 84x18
text run at (1,1) width 84: "Lorem ipsum"
RenderBlock {DIV} at (1,21) size 782x20 [border: (1px dotted #0000FF)]
RenderText {TEXT} at (1,1) size 84x18
text run at (1,1) width 84: "Lorem ipsum"
RenderBlock (anonymous) at (0,270) size 784x40
RenderBR {BR} at (0,0) size 0x18
RenderButton {INPUT} at (2,20) size 104x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 88x13
RenderText at (0,0) size 88x13
text run at (0,0) width 88: "Negative margin"
RenderText {TEXT} at (108,19) size 4x18
text run at (108,19) width 4: " "
RenderButton {INPUT} at (114,20) size 98x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 82x13
RenderText at (0,0) size 82x13
text run at (0,0) width 82: "Positive margin"
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {P} at (0,326) size 784x18
RenderText {TEXT} at (0,0) size 445x18
text run at (0,0) width 445: "Dynamic case (automatically testing positive --> negative --> positive):"
RenderBlock {DIV} at (0,360) size 784x72 [border: (1px solid #008000)]
RenderBlock {DIV} at (1,11) size 782x20 [border: (1px solid #0000FF)]
RenderText {TEXT} at (1,1) size 84x18
text run at (1,1) width 84: "Lorem ipsum"
RenderBlock {DIV} at (1,41) size 782x20 [border: (1px dotted #0000FF)]
RenderText {TEXT} at (1,1) size 84x18
text run at (1,1) width 84: "Lorem ipsum"
RenderBlock (anonymous) at (0,432) size 784x40
RenderBR {BR} at (0,0) size 0x18
RenderButton {INPUT} at (2,20) size 104x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 88x13
RenderText at (0,0) size 88x13
text run at (0,0) width 88: "Negative margin"
RenderText {TEXT} at (108,19) size 4x18
text run at (108,19) width 4: " "
RenderButton {INPUT} at (114,20) size 98x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 82x13
RenderText at (0,0) size 82x13
text run at (0,0) width 82: "Positive margin"
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
<html><head>
<script type="text/javascript">
<!--
function setNegativeMargin(element)
{
document.getElementById(element).style["margin"] = "-10px 0px -10px 0px";
}
function setPositiveMargin(element)
{
document.getElementById(element).style["margin"] = "10px 0px 10px 0px";
}
function test()
{
setNegativeMargin("bar");
// The following line forces a layout in Safari.
window.scrollX;
setNegativeMargin("foo");
setPositiveMargin("bar");
}
//-->
</script></head>
<body onLoad="test();">
<p>What it should look like (positive case): </p>
<div style="border: 1px solid green; ">
<div style="margin-top: 10px; border:1px solid blue;">Lorem ipsum</div>
<div style="margin-top: 10px; margin-bottom: 10px; border:1px dotted blue;">Lorem ipsum</div>
</div>
<p>What it should look like (negative case):</p>
<div style="border: 1px solid green; ">
<div style="margin-top: 10px; border:1px solid blue;">Lorem ipsum</div>
<div style="margin-top: -10px; margin-bottom: -10px; border:1px dotted blue;">Lorem ipsum</div>
</div>
<p>Dynamic case (automatically testing positive --&gt; negative):</p>
<div style="border: 1px solid green; ">
<div style="margin-top: 10px; border:1px solid blue;">Lorem ipsum</div>
<div style="margin-top: 10px; margin-bottom: 10px; border:1px dotted blue;" id="foo">Lorem ipsum</div>
</div>
<br />
<input type="submit" value="Negative margin" onClick="setNegativeMargin('foo');"/>
<input type="submit" value="Positive margin" onClick="setPositiveMargin('foo');"/>
<p>Dynamic case (automatically testing positive --&gt; negative --&gt; positive):</p>
<div style="border: 1px solid green; ">
<div style="margin-top: 10px; border:1px solid blue;">Lorem ipsum</div>
<div style="margin-top: 10px; margin-bottom: 10px; border:1px dotted blue;" id="bar">Lorem ipsum</div>
</div>
<br />
<input type="submit" value="Negative margin" onClick="setNegativeMargin('bar');"/>
<input type="submit" value="Positive margin" onClick="setPositiveMargin('bar');"/>
</body>
</html>
2005-12-29 Graham Dennis <Graham.Dennis@gmail.com>
Reviewed by Hyatt.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3579
In-place style-switching is leaving junk behind, messing up styles
* khtml/rendering/render_block.h: (khtml::RenderBlock::initMaxMarginValues):
Set all margin values in all cases.
2005-12-29 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
......
......@@ -90,14 +90,20 @@ public:
}
void initMaxMarginValues() {
if (m_marginTop >= 0)
if (m_marginTop >= 0) {
m_maxTopPosMargin = m_marginTop;
else
m_maxTopNegMargin = 0;
} else {
m_maxTopNegMargin = -m_marginTop;
if (m_marginBottom >= 0)
m_maxTopPosMargin = 0;
}
if (m_marginBottom >= 0) {
m_maxBottomPosMargin = m_marginBottom;
else
m_maxBottomNegMargin = 0;
} else {
m_maxBottomNegMargin = -m_marginBottom;
m_maxBottomPosMargin = 0;
}
}
virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment