Changeset 120132 in webkit


Ignore:
Timestamp:
Jun 12, 2012 3:39:01 PM (12 years ago)
Author:
tony@chromium.org
Message:

Replaced items in a flexbox should be coerced to display:block
https://bugs.webkit.org/show_bug.cgi?id=87068

Reviewed by Ojan Vafai.

Source/WebCore:

The flexbox spec lists HTML tags that should automatically be converted
to display:block when a flex child. It also says that atomic inline-level
children should become block (e.g., inline-table should be treated as table).
http://dev.w3.org/csswg/css3-flexbox/#flex-items

Test: css3/flexbox/flexitem.html

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::collectMatchingRulesForList):

LayoutTests:

  • css3/flexbox/flexitem-expected.txt: Added.
  • css3/flexbox/flexitem.html: Added.
  • css3/flexbox/resources/flexbox.js:

(checkExpectedValues):

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r120131 r120132  
     12012-06-12  Tony Chang  <tony@chromium.org>
     2
     3        Replaced items in a flexbox should be coerced to display:block
     4        https://bugs.webkit.org/show_bug.cgi?id=87068
     5
     6        Reviewed by Ojan Vafai.
     7
     8        * css3/flexbox/flexitem-expected.txt: Added.
     9        * css3/flexbox/flexitem.html: Added.
     10        * css3/flexbox/resources/flexbox.js:
     11        (checkExpectedValues):
     12
    1132012-06-12  Joshua Bell  <jsbell@chromium.org>
    214
  • trunk/LayoutTests/css3/flexbox/resources/flexbox.js

    r97783 r120132  
    6666            failures.push("Expected " + expectedOffset + " for clientTop+offsetTop, but got " + totalTop + ", clientTop: " + node.clientTop + ", + offsetTop: " + node.offsetTop + ". ");
    6767    }
     68
     69    var expectedDisplay = node.getAttribute && node.getAttribute("data-expected-display");
     70    if (expectedDisplay) {
     71        var actualDisplay = getComputedStyle(node).display;
     72        if (actualDisplay != expectedDisplay)
     73            failures.push("Expected " + expectedDisplay + " for display, but got " + actualDisplay + ". ");
     74    }
    6875}
    6976
  • trunk/Source/WebCore/ChangeLog

    r120131 r120132  
     12012-06-12  Tony Chang  <tony@chromium.org>
     2
     3        Replaced items in a flexbox should be coerced to display:block
     4        https://bugs.webkit.org/show_bug.cgi?id=87068
     5
     6        Reviewed by Ojan Vafai.
     7
     8        The flexbox spec lists HTML tags that should automatically be converted
     9        to display:block when a flex child. It also says that atomic inline-level
     10        children should become block (e.g., inline-table should be treated as table).
     11        http://dev.w3.org/csswg/css3-flexbox/#flex-items
     12
     13        Test: css3/flexbox/flexitem.html
     14
     15        * css/StyleResolver.cpp:
     16        (WebCore::StyleResolver::collectMatchingRulesForList):
     17
    1182012-06-12  Joshua Bell  <jsbell@chromium.org>
    219
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r120080 r120132  
    7474#include "LinkHash.h"
    7575#include "LocaleToScriptMapping.h"
     76#include "MathMLNames.h"
    7677#include "Matrix3DTransformOperation.h"
    7778#include "MatrixTransformOperation.h"
     
    19201921}
    19211922
     1923static bool shouldBecomeBlockWhenParentIsFlexbox(const Element* element)
     1924{
     1925    return element->hasTagName(imgTag)
     1926        || element->hasTagName(canvasTag)
     1927#if ENABLE(SVG)
     1928        || element->hasTagName(SVGNames::svgTag)
     1929#endif
     1930#if ENABLE(MATHML)
     1931        || element->hasTagName(MathMLNames::mathTag)
     1932#endif
     1933#if ENABLE(VIDEO)
     1934        || element->hasTagName(audioTag)
     1935        || element->hasTagName(videoTag)
     1936#endif
     1937        || element->hasTagName(iframeTag)
     1938        || element->hasTagName(objectTag)
     1939        || element->hasTagName(embedTag)
     1940        || element->hasTagName(appletTag)
     1941#if ENABLE(PROGRESS_TAG)
     1942        || element->hasTagName(progressTag)
     1943#endif
     1944#if ENABLE(METER_TAG)
     1945        || element->hasTagName(meterTag)
     1946#endif
     1947        || element->hasTagName(inputTag)
     1948        || element->hasTagName(buttonTag)
     1949        || element->hasTagName(selectTag)
     1950        || element->hasTagName(textareaTag);
     1951}
     1952
    19221953static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool strictParsing)
    19231954{
     
    20622093        if (style->writingMode() != TopToBottomWritingMode && (style->display() == BOX || style->display() == INLINE_BOX))
    20632094            style->setWritingMode(TopToBottomWritingMode);
     2095
     2096        if (e && e->parentNode() && e->parentNode()->renderer() && e->parentNode()->renderer()->isFlexibleBox()) {
     2097            if (shouldBecomeBlockWhenParentIsFlexbox(e))
     2098                style->setDisplay(BLOCK);
     2099            else if (style->display() != INLINE)
     2100                style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing()));
     2101        }
    20642102    }
    20652103
Note: See TracChangeset for help on using the changeset viewer.