Changeset 107112 in webkit


Ignore:
Timestamp:
Feb 8, 2012 11:58:35 AM (12 years ago)
Author:
ojan@chromium.org
Message:

Floated flexboxes render as regular RenderBlocks
https://bugs.webkit.org/show_bug.cgi?id=77909

Reviewed by Eric Seidel.

Source/WebCore:

Add grid/flexbox cases to adjusting the display of floated/positioned
elements. Also, move this logic into a switch statement. This makes
the code more readable and gives compile warnings when new display types
are added that aren't handled here.

Test: css3/flexbox/floated-flexbox.html

  • css/CSSStyleSelector.cpp:

(WebCore::adjustDisplay):
(WebCore):
(WebCore::CSSStyleSelector::adjustRenderStyle):

LayoutTests:

  • css3/flexbox/floated-flexbox-expected.txt: Added.
  • css3/flexbox/floated-flexbox.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r107109 r107112  
     12012-02-07  Ojan Vafai  <ojan@chromium.org>
     2
     3        Floated flexboxes render as regular RenderBlocks
     4        https://bugs.webkit.org/show_bug.cgi?id=77909
     5
     6        Reviewed by Eric Seidel.
     7
     8        * css3/flexbox/floated-flexbox-expected.txt: Added.
     9        * css3/flexbox/floated-flexbox.html: Added.
     10
    1112012-02-08  Julien Chaffraix  <jchaffraix@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r107108 r107112  
     12012-02-07  Ojan Vafai  <ojan@chromium.org>
     2
     3        Floated flexboxes render as regular RenderBlocks
     4        https://bugs.webkit.org/show_bug.cgi?id=77909
     5
     6        Reviewed by Eric Seidel.
     7
     8        Add grid/flexbox cases to adjusting the display of floated/positioned
     9        elements. Also, move this logic into a switch statement. This makes
     10        the code more readable and gives compile warnings when new display types
     11        are added that aren't handled here.
     12
     13        Test: css3/flexbox/floated-flexbox.html
     14
     15        * css/CSSStyleSelector.cpp:
     16        (WebCore::adjustDisplay):
     17        (WebCore):
     18        (WebCore::CSSStyleSelector::adjustRenderStyle):
     19
    1202012-02-08  Dirk Schulze  <krit@webkit.org>
    221
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r106756 r107112  
    17281728}
    17291729
     1730static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool strictParsing)
     1731{
     1732    switch (display) {
     1733    case BLOCK:
     1734    case TABLE:
     1735    case BOX:
     1736    case FLEXBOX:
     1737#if ENABLE(CSS_GRID_LAYOUT)
     1738    case GRID:
     1739#endif
     1740        return display;
     1741
     1742    case LIST_ITEM:
     1743        // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk, but only in quirks mode.
     1744        if (!strictParsing && isFloating)
     1745            return BLOCK;
     1746        return display;
     1747    case INLINE_TABLE:
     1748        return TABLE;
     1749    case INLINE_BOX:
     1750        return BOX;
     1751    case INLINE_FLEXBOX:
     1752        return FLEXBOX;
     1753#if ENABLE(CSS_GRID_LAYOUT)
     1754    case INLINE_GRID:
     1755        return GRID;
     1756#endif
     1757
     1758    case INLINE:
     1759    case RUN_IN:
     1760    case COMPACT:
     1761    case INLINE_BLOCK:
     1762    case TABLE_ROW_GROUP:
     1763    case TABLE_HEADER_GROUP:
     1764    case TABLE_FOOTER_GROUP:
     1765    case TABLE_ROW:
     1766    case TABLE_COLUMN_GROUP:
     1767    case TABLE_COLUMN:
     1768    case TABLE_CELL:
     1769    case TABLE_CAPTION:
     1770        return BLOCK;
     1771    case NONE:
     1772        ASSERT_NOT_REACHED();
     1773        return NONE;
     1774    }
     1775    ASSERT_NOT_REACHED();
     1776    return BLOCK;
     1777}
     1778
    17301779void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e)
    17311780{
     
    17771826            style->setDisplay(BLOCK);
    17781827
    1779         // Mutate the display to BLOCK or TABLE for certain cases, e.g., if someone attempts to
    1780         // position or float an inline, compact, or run-in.  Cache the original display, since it
    1781         // may be needed for positioned elements that have to compute their static normal flow
    1782         // positions.  We also force inline-level roots to be block-level.
    1783         if (style->display() != BLOCK && style->display() != TABLE && style->display() != BOX &&
    1784             (style->position() == AbsolutePosition || style->position() == FixedPosition || style->isFloating() ||
    1785              (e && e->document()->documentElement() == e))) {
    1786             if (style->display() == INLINE_TABLE)
    1787                 style->setDisplay(TABLE);
    1788             else if (style->display() == INLINE_BOX)
    1789                 style->setDisplay(BOX);
    1790             else if (style->display() == LIST_ITEM) {
    1791                 // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk,
    1792                 // but only in quirks mode.
    1793                 if (!m_checker.strictParsing() && style->isFloating())
    1794                     style->setDisplay(BLOCK);
    1795             }
    1796             else
    1797                 style->setDisplay(BLOCK);
    1798         }
     1828        // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display.
     1829        if (style->position() == AbsolutePosition || style->position() == FixedPosition || style->isFloating() || (e && e->document()->documentElement() == e))
     1830            style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing()));
    17991831
    18001832        // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely
Note: See TracChangeset for help on using the changeset viewer.