Bug 4379 - negative margins allowed where they should not
Summary: negative margins allowed where they should not
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Dave Hyatt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-10 18:55 PDT by Antti Koivisto
Modified: 2005-08-19 15:11 PDT (History)
1 user (show)

See Also:


Attachments
test case for tables (413 bytes, text/html)
2005-08-10 19:00 PDT, Antti Koivisto
no flags Details
test case for blocks (252 bytes, text/html)
2005-08-10 19:01 PDT, Antti Koivisto
no flags Details
margin calculation patch (1.55 KB, patch)
2005-08-11 17:00 PDT, David Carson
hyatt: review+
Details | Formatted Diff | Diff
margin calculation patch with comment (1.84 KB, patch)
2005-08-12 12:13 PDT, Antti Koivisto
darin: review+
Details | Formatted Diff | Diff
cleaned up test case with an explanation (747 bytes, text/html)
2005-08-15 21:29 PDT, Antti Koivisto
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 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.
Comment 1 Antti Koivisto 2005-08-10 19:00:53 PDT
Created attachment 3330 [details]
test case for tables

make page narrow to see the problem
Comment 2 Antti Koivisto 2005-08-10 19:01:35 PDT
Created attachment 3331 [details]
test case for blocks
Comment 3 David Carson 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
Comment 4 Dave Hyatt 2005-08-11 22:56:17 PDT
Yup, this patch is a flawless fix.  Good job.  r=me
Comment 5 Dave Hyatt 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.
Comment 6 Antti Koivisto 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
Comment 7 Darin Adler 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).
Comment 8 Darin Adler 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.
Comment 9 Darin Adler 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.
Comment 10 Antti Koivisto 2005-08-15 21:29:45 PDT
Created attachment 3417 [details]
cleaned up test case with an explanation