RESOLVED FIXED 4379
negative margins allowed where they should not
https://bugs.webkit.org/show_bug.cgi?id=4379
Summary negative margins allowed where they should not
Antti Koivisto
Reported 2005-08-10 18:55:01 PDT
When making window narrow, the navigation bar on top of moneycentral.msn.com flows out of the view from left. The behavior is different from Gecko/IE where it stays fully in the view even when window is narrow. The problem is that in webcore a table with margin-left:auto is allowed to have negative calculated margin. Acutally, it seems that the following rule (css2.1, 10.3.3) is not respected, even with normal block boxes: If 'width' is not 'auto' and 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' (plus any of 'margin-left' or 'margin-right' that are not 'auto') is larger than the width of the containing block, then any 'auto' values for 'margin-left' or 'margin-right' are, for the following rules, treated as zero.
Attachments
test case for tables (413 bytes, text/html)
2005-08-10 19:00 PDT, Antti Koivisto
no flags
test case for blocks (252 bytes, text/html)
2005-08-10 19:01 PDT, Antti Koivisto
no flags
margin calculation patch (1.55 KB, patch)
2005-08-11 17:00 PDT, David Carson
hyatt: review+
margin calculation patch with comment (1.84 KB, patch)
2005-08-12 12:13 PDT, Antti Koivisto
darin: review+
cleaned up test case with an explanation (747 bytes, text/html)
2005-08-15 21:29 PDT, Antti Koivisto
no flags
Antti Koivisto
Comment 1 2005-08-10 19:00:53 PDT
Created attachment 3330 [details] test case for tables make page narrow to see the problem
Antti Koivisto
Comment 2 2005-08-10 19:01:35 PDT
Created attachment 3331 [details] test case for blocks
David Carson
Comment 3 2005-08-11 17:00:22 PDT
Created attachment 3347 [details] margin calculation patch for boxes in normal flow with non-auto width, treat auto margins as 0 if width>containing width
Dave Hyatt
Comment 4 2005-08-11 22:56:17 PDT
Yup, this patch is a flawless fix. Good job. r=me
Dave Hyatt
Comment 5 2005-08-11 22:58:02 PDT
Comment on attachment 3347 [details] margin calculation patch r=me. Might be worth adding a comment that when you fall into the final else case, auto margins will end up being 0 when you call minWidth and assign into m_marginLeft and m_marginRight.
Antti Koivisto
Comment 6 2005-08-12 12:13:14 PDT
Created attachment 3356 [details] margin calculation patch with comment (i was apparently logged in as David when submitting the patch) Added comment
Darin Adler
Comment 7 2005-08-14 20:41:01 PDT
I'm ready to land this, but I'll need to change the test cases into suitable files for the layout-tests directory (explaining what they are testing and what good vs. bad results look like).
Darin Adler
Comment 8 2005-08-14 22:02:57 PDT
I tried, but I can't figure out the desired results from the test cases. I'm going to leave this patch until someone who does understand them (Antti or Dave perhaps?) turns them into suitable layout tests by adding some explanation, or puts notes here enough to let me do that.
Darin Adler
Comment 9 2005-08-14 22:03:12 PDT
I tried, but I can't figure out the desired results from the test cases. I'm going to leave this patch until someone who does understand them (Antti or Dave perhaps?) turns them into suitable layout tests by adding some explanation, or puts notes here enough to let me do that.
Antti Koivisto
Comment 10 2005-08-15 21:29:45 PDT
Created attachment 3417 [details] cleaned up test case with an explanation
Note You need to log in before you can comment on or make changes to this bug.