From d6046f62215398a43536af685e491508b2f7bfcc Mon Sep 17 00:00:00 2001 From: "tony@chromium.org" Date: Mon, 30 Jul 2012 18:39:53 +0000 Subject: [PATCH] [CherryPick] new flexbox should ignore float set on flexitems [Title] [CherryPick] new flexbox should ignore float set on flexitems [Issue] TWEB-826 [Problem] WebAPI/W3C_CSS3/FlexibleBox/CSS3FlexBox_display_float.html test case failed. [Cause] In the test case, the item in flexbox have float:right, but it should be disallowed. [Solution] Cherry-pick the opensource patch. [Cherry-Picker] KyungTae Kim new flexbox should ignore float set on flexitems https://bugs.webkit.org/show_bug.cgi?id=70792 Reviewed by Ojan Vafai. Source/WebCore: Force flex items to not float. Test: css3/flexbox/floated-flexitem.html * css/StyleResolver.cpp: (WebCore::StyleResolver::adjustRenderStyle): Force NoFloat on flex items. LayoutTests: Make an example in the spec into a ref test. Add some styles to make it a bit more clear what's happening. * css3/flexbox/floated-flexitem-expected.html: Added. * css3/flexbox/floated-flexitem.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124064 268f45cc-cd09-0410-ab3c-d52691b4dbfc Change-Id: I1b17a729a10edc4d9cc9e74ab4e038630b1eadad --- .../css3/flexbox/floated-flexitem-expected.html | 28 ++++++++++++++++ LayoutTests/css3/flexbox/floated-flexitem.html | 37 ++++++++++++++++++++++ Source/WebCore/css/StyleResolver.cpp | 4 ++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 LayoutTests/css3/flexbox/floated-flexitem-expected.html create mode 100644 LayoutTests/css3/flexbox/floated-flexitem.html diff --git a/LayoutTests/css3/flexbox/floated-flexitem-expected.html b/LayoutTests/css3/flexbox/floated-flexitem-expected.html new file mode 100644 index 0000000..ae0cd2e --- /dev/null +++ b/LayoutTests/css3/flexbox/floated-flexitem-expected.html @@ -0,0 +1,28 @@ + + + + +

+This example is from the spec. There should be four flex items. Anonymous item 3 shouldn't have +a green border because the anonymous block is the flex item. +

+
+
block
float
anonymous item 3
+ item 4
+ item 4
+ item 4 +
+
+ + diff --git a/LayoutTests/css3/flexbox/floated-flexitem.html b/LayoutTests/css3/flexbox/floated-flexitem.html new file mode 100644 index 0000000..ecfee1a --- /dev/null +++ b/LayoutTests/css3/flexbox/floated-flexitem.html @@ -0,0 +1,37 @@ + + + + +

+This example is from the spec. There should be four flex items. Anonymous item 3 shouldn't have +a green border because the anonymous block is the flex item. +

+
+ + +
block
+ + +
float
+ + + anonymous item 3 + + + + item 4 + +
item 4
+ item 4 +
+
+ + diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index 5505126..5940d84 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -2143,8 +2143,10 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX)) style->setWritingMode(TopToBottomWritingMode); - if (e && e->parentNode() && e->parentNode()->renderer() && e->parentNode()->renderer()->isFlexibleBox()) + if (e && e->parentNode() && e->parentNode()->renderer() && e->parentNode()->renderer()->isFlexibleBox()) { + style->setFloating(NoFloat); style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing())); + } } // Make sure our z-index value is only applied if the object is positioned. -- 2.7.4