Bug 103919

Summary: Flex item auto margins in the cross direction should safe center
Product: WebKit Reporter: Tony Chang <tony>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, eric, ojan, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://plexode.com/eval3/#ht=%3Cdiv%20style%3D%22display%3A%20-webkit-flex%3B%20width%3A%20100px%3B%20height%3A%20100px%3B%20background-color%3A%20grey%3B%22%3E%0A%20%20%3Cdiv%20style%3D%22background-color%3A%20green%3B%20height%3A%20200px%3B%20width%3A%2020px%3B%20margin%3A%20auto%22%3E%3C%2Fdiv%3E%0A%3C%2Fdiv%3E
Bug Depends on:    
Bug Blocks: 62048    
Attachments:
Description Flags
Patch none

Description Tony Chang 2012-12-03 13:08:29 PST
See example in the URL.  setting the margin to auto shouldn't overflow out the top of the flexbox.
Comment 1 Tony Chang 2012-12-03 13:08:47 PST
This would be a pretty easy bug to fix.
Comment 2 Carlos Garcia Campos 2012-12-04 08:24:00 PST
Created attachment 177488 [details]
Patch
Comment 3 Ojan Vafai 2012-12-04 09:52:21 PST
Comment on attachment 177488 [details]
Patch

Can you also add asserts in updateAutoMarginsInCrossAxis and updateAutoMarginsInMainAxis that the LayoutUnit passed in is >= 0?
Comment 4 Tony Chang 2012-12-04 13:40:58 PST
Comment on attachment 177488 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=177488&action=review

> LayoutTests/css3/flexbox/flex-flow-auto-margins-no-available-space.html:4
> +<style>
> +body {

Please use resources/flexbox.css and the styles defined there when possible. This makes the tests runnable in Firefox and makes it easy to add other vendor prefixes to the tests.
Comment 5 Carlos Garcia Campos 2012-12-05 02:26:43 PST
Comment on attachment 177488 [details]
Patch

Committed r136660: <http://trac.webkit.org/changeset/136660>