Changeset 121613 in webkit


Ignore:
Timestamp:
Jun 29, 2012 8:16:23 PM (12 years ago)
Author:
tony@chromium.org
Message:

All child elements of a flex container should be turned into a flex item
https://bugs.webkit.org/show_bug.cgi?id=90323

Reviewed by Ojan Vafai.

Source/WebCore:

We used to only convert some elements to blocks, but now we convert everything except text nodes.
This was recently changed here:
http://wiki.csswg.org/topics/css3-flexbox-flexbox-replaced-children

Tests: css3/flexbox/anonymous-block.html : Add new test case.

css3/flexbox/flexitem.html: Update results.

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::collectMatchingRulesForList):

LayoutTests:

  • css3/flexbox/anonymous-block-expected.html:
  • css3/flexbox/anonymous-block.html:
  • css3/flexbox/flexitem-expected.txt:
  • css3/flexbox/flexitem.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121611 r121613  
     12012-06-29  Tony Chang  <tony@chromium.org>
     2
     3        All child elements of a flex container should be turned into a flex item
     4        https://bugs.webkit.org/show_bug.cgi?id=90323
     5
     6        Reviewed by Ojan Vafai.
     7
     8        * css3/flexbox/anonymous-block-expected.html:
     9        * css3/flexbox/anonymous-block.html:
     10        * css3/flexbox/flexitem-expected.txt:
     11        * css3/flexbox/flexitem.html:
     12
    1132012-06-29  Tony Chang  <tony@chromium.org>
    214
  • trunk/LayoutTests/css3/flexbox/anonymous-block-expected.html

    r99120 r121613  
    22<html>
    33<body>
     4<p>This tests that text nodes that have a flexbox as a parent are wrapped in
     5anonymous blocks.</p>
    46<div>This text should be visible.</div>
     7<table cellpadding=0 cellspacing=0 style="width: 100%"><tr>
     8  <td>spacer</td>
     9  <td style="text-align: center">middle</td>
     10  <td style="text-align: right">spacer</td>
     11</tr></table>
    512</body>
    613</html>
  • trunk/LayoutTests/css3/flexbox/anonymous-block.html

    r117385 r121613  
    22<html>
    33<body>
     4<p>This tests that text nodes that have a flexbox as a parent are wrapped in
     5anonymous blocks.</p>
    46<div style="display: -webkit-flex">This text should be visible.</div>
     7<div style="display: -webkit-flex; -webkit-justify-content: space-between">
     8    spacer<span>middle</span>spacer
     9</div>
    510</body>
    611</html>
  • trunk/LayoutTests/css3/flexbox/flexitem-expected.txt

    r120132 r121613  
    2727</div>
    2828PASS
    29  button
    30  PASS
    31  PASS
     29button
     30PASS
     31PASS
    3232FAIL:
    3333Expected 600 for width, but got 0.
  • trunk/LayoutTests/css3/flexbox/flexitem.html

    r120330 r121613  
    7171
    7272<div class="flexbox">
    73   <!-- The <spans> get wrapped in anonymous blocks that have the default value
    74   of flex: 0 1 auto. Setting a flex: on these spans should do nothing. -->
    75   <span style="-webkit-flex: 5 0 0"></span>
    76   <button data-expected-display="block" data-expected-width="600" style="-webkit-flex: 1 0 0">button</button>
    77   <span style="-webkit-lex: 2 2 100px"></span>
     73  <span data-expected-display="block" data-expected-width="200" style="-webkit-flex: 2 0 0"></span>
     74  <button data-expected-display="block" data-expected-width="100" style="-webkit-flex: 1 0 0">button</button>
     75  <span data-expected-display="block" data-expected-width="300" style="-webkit-flex: 2 2 100px"></span>
    7876</div>
    7977
    80 <div class="flexbox">
     78<div class="flexbox" style="width: 700px">
    8179  <div data-expected-display="block" data-expected-width="100" style="display: inline-block;"></div>
    8280  <div data-expected-display="-webkit-box" data-expected-width="100" style="display: -webkit-inline-box;"></div>
     
    8583  <div data-expected-display="block" data-expected-width="100" style="display: compact"></div>
    8684  <div data-expected-display="block" data-expected-width="100" style="display: run-in"></div>
    87   <!-- This inline should be wrapping in an anonymous block, which gets the
    88   default flex: 0 1 auto. -->
    89   <div data-expected-display="inline" data-expected-width="0" style="display: inline;"></div>
     85  <div data-expected-display="block" data-expected-width="100" style="display: inline;"></div>
    9086</div>
    9187
  • trunk/Source/WebCore/ChangeLog

    r121612 r121613  
     12012-06-29  Tony Chang  <tony@chromium.org>
     2
     3        All child elements of a flex container should be turned into a flex item
     4        https://bugs.webkit.org/show_bug.cgi?id=90323
     5
     6        Reviewed by Ojan Vafai.
     7
     8        We used to only convert some elements to blocks, but now we convert everything except text nodes.
     9        This was recently changed here:
     10        http://wiki.csswg.org/topics/css3-flexbox-flexbox-replaced-children
     11
     12        Tests: css3/flexbox/anonymous-block.html : Add new test case.
     13               css3/flexbox/flexitem.html: Update results.
     14
     15        * css/StyleResolver.cpp:
     16        (WebCore::StyleResolver::collectMatchingRulesForList):
     17
    1182012-06-29  Joshua Bell  <jsbell@chromium.org>
    219
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r121513 r121613  
    19821982}
    19831983
    1984 static bool shouldBecomeBlockWhenParentIsFlexbox(const Element* element)
    1985 {
    1986     return element->hasTagName(imgTag)
    1987         || element->hasTagName(canvasTag)
    1988 #if ENABLE(SVG)
    1989         || element->hasTagName(SVGNames::svgTag)
    1990 #endif
    1991 #if ENABLE(MATHML)
    1992         || element->hasTagName(MathMLNames::mathTag)
    1993 #endif
    1994 #if ENABLE(VIDEO)
    1995         || element->hasTagName(audioTag)
    1996         || element->hasTagName(videoTag)
    1997 #endif
    1998         || element->hasTagName(iframeTag)
    1999         || element->hasTagName(objectTag)
    2000         || element->hasTagName(embedTag)
    2001         || element->hasTagName(appletTag)
    2002 #if ENABLE(PROGRESS_TAG)
    2003         || element->hasTagName(progressTag)
    2004 #endif
    2005 #if ENABLE(METER_TAG)
    2006         || element->hasTagName(meterTag)
    2007 #endif
    2008         || element->hasTagName(inputTag)
    2009         || element->hasTagName(buttonTag)
    2010         || element->hasTagName(selectTag)
    2011         || element->hasTagName(textareaTag);
    2012 }
    2013 
    20141984static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool strictParsing)
    20151985{
     
    21562126            style->setWritingMode(TopToBottomWritingMode);
    21572127
    2158         if (e && e->parentNode() && e->parentNode()->renderer() && e->parentNode()->renderer()->isFlexibleBox()) {
    2159             if (shouldBecomeBlockWhenParentIsFlexbox(e))
    2160                 style->setDisplay(BLOCK);
    2161             else if (style->display() != INLINE)
    2162                 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing()));
    2163         }
     2128        if (e && e->parentNode() && e->parentNode()->renderer() && e->parentNode()->renderer()->isFlexibleBox())
     2129            style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing()));
    21642130    }
    21652131
Note: See TracChangeset for help on using the changeset viewer.