--- /dev/null
+layer at (0,0) size 800x1022
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x1022
+ RenderBlock {HTML} at (0,0) size 800x1022
+ RenderBody {BODY} at (8,8) size 784x1006
+ RenderBlock {DIV} at (0,0) size 784x110 [border: (5px solid #000000)]
+ RenderBlock (anonymous) at (5,5) size 774x0
+ RenderBlock (floating) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderImage {IMG} at (205,5) size 100x100 [bgcolor=#800080]
+ RenderBlock (anonymous) at (0,110) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock {DIV} at (0,128) size 784x110 [border: (5px solid #000000)]
+ RenderBlock (floating) {DIV} at (5,5) size 100x100 [bgcolor=#008000]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderImage {IMG} at (305,5) size 100x100 [bgcolor=#800080]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,238) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock {DIV} at (0,256) size 784x110 [border: (5px solid #000000)]
+ RenderBlock (anonymous) at (5,5) size 774x0
+ RenderBlock (floating) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderImage {IMG} at (55,5) size 100x100 [bgcolor=#800080]
+ RenderBlock (anonymous) at (0,366) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock {DIV} at (0,384) size 784x110 [border: (5px solid #000000)]
+ RenderBlock (floating) {DIV} at (5,5) size 100x100 [bgcolor=#008000]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderImage {IMG} at (55,5) size 100x100 [bgcolor=#800080]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,494) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock {DIV} at (0,512) size 784x110 [border: (5px solid #000000)]
+ RenderBlock (anonymous) at (5,5) size 774x0
+ RenderBlock (floating) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderLineEdit {INPUT} at (205,5) size 100x18 [bgcolor=#800080]
+ RenderBlock (anonymous) at (0,622) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock {DIV} at (0,640) size 784x110 [border: (5px solid #000000)]
+ RenderBlock (floating) {DIV} at (5,5) size 100x100 [bgcolor=#008000]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderLineEdit {INPUT} at (305,5) size 100x18 [bgcolor=#800080]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock (anonymous) at (0,750) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock {DIV} at (0,768) size 784x110 [border: (5px solid #000000)]
+ RenderBlock (anonymous) at (5,5) size 774x0
+ RenderBlock (floating) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderLineEdit {INPUT} at (55,5) size 100x18 [bgcolor=#800080]
+ RenderBlock (anonymous) at (0,878) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderBlock {DIV} at (0,896) size 784x110 [border: (5px solid #000000)]
+ RenderBlock (floating) {DIV} at (5,5) size 100x100 [bgcolor=#008000]
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderLineEdit {INPUT} at (55,5) size 100x18 [bgcolor=#800080]
+ RenderText {TEXT} at (0,0) size 0x0
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<style>
+body > div { border:5px solid black; height: 100px }
+.float { float: left; width:100px; height:100px; background-color: green }
+.normal { width: 100px; height:100px; background-color: purple }
+.left { margin-left: 200px; }
+.negleft { margin-left: -50px; }
+.block { display: block }
+</style>
+</head>
+<body>
+<div>
+ <div class="float"></div>
+ <img class="block normal left">
+</div>
+
+<br clear="all">
+
+<div>
+ <div class="float"></div>
+ <img class="normal left">
+</div>
+
+<br clear="all">
+
+<div>
+ <div class="float"></div>
+ <img class="block normal negleft">
+</div>
+
+<br clear="all">
+
+<div>
+ <div class="float"></div>
+ <img class="normal negleft">
+</div>
+
+<br clear="all">
+
+<div>
+ <div class="float"></div>
+ <input class="block normal left">
+</div>
+
+<br clear="all">
+
+<div>
+ <div class="float"></div>
+ <input class="normal left">
+</div>
+
+<br clear="all">
+
+<div>
+ <div class="float"></div>
+ <input class="block normal negleft">
+</div>
+
+<br clear="all">
+
+<div>
+ <div class="float"></div>
+ <input class="normal negleft">
+</div>
+
// to shift over as necessary to dodge any floats that might get in the way.
if (child->avoidsFloats()) {
int leftOff = leftOffset(m_height);
- if (style()->textAlign() != KHTML_CENTER && child->style()->marginLeft().type != Variable)
+ if (style()->textAlign() != KHTML_CENTER && child->style()->marginLeft().type != Variable) {
+ if (child->marginLeft() < 0)
+ leftOff += child->marginLeft();
chPos = kMax(chPos, leftOff); // Let the float sit in the child's margin if it can fit.
+ }
else if (leftOff != xPos) {
// The object is shifting right. The object might be centered, so we need to
// recalculate our horizontal margins. Note that the containing block content
chPos -= child->width() + child->marginRight();
if (child->avoidsFloats()) {
int rightOff = rightOffset(m_height);
- if (style()->textAlign() != KHTML_CENTER && child->style()->marginRight().type != Variable)
+ if (style()->textAlign() != KHTML_CENTER && child->style()->marginRight().type != Variable) {
+ if (child->marginRight() < 0)
+ rightOff -= child->marginRight();
chPos = kMin(chPos, rightOff - child->width()); // Let the float sit in the child's margin if it can fit.
- else if (rightOff != xPos) {
+ } else if (rightOff != xPos) {
// The object is shifting left. The object might be centered, so we need to
// recalculate our horizontal margins. Note that the containing block content
// width computation will take into account the delta between |rightOff| and |xPos|