Changeset 247927 in webkit


Ignore:
Timestamp:
Jul 29, 2019 4:04:43 PM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][TFC] Introduce Box::establishesTableFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=200060

Reviewed by Antti Koivisto.

https://www.w3.org/TR/CSS22/tables.html

The table generates a principal block container box called the table wrapper box that contains the table box itself and any caption boxes.
The table box is a block-level box that contains the table's internal table boxes.
The table wrapper box is block-level for 'display: table', and inline-level; for 'display: inline-table'. The table wrapper box establishes a block
formatting context, and the table box establishes a table formatting context."

  • layout/layouttree/LayoutBox.cpp:

(WebCore::Layout::Box::establishesFormattingContext const):
(WebCore::Layout::Box::establishesTableFormattingContext const):
(WebCore::Layout::Box::isBlockLevelBox const):
(WebCore::Layout::Box::isInlineLevelBox const):
(WebCore::Layout::Box::isBlockContainerBox const):

  • layout/layouttree/LayoutBox.h:

(WebCore::Layout::Box::isTableWrapperBox const):
(WebCore::Layout::Box::isTableBox const):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r247926 r247927  
     12019-07-29  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][TFC] Introduce Box::establishesTableFormattingContext
     4        https://bugs.webkit.org/show_bug.cgi?id=200060
     5
     6        Reviewed by Antti Koivisto.
     7
     8        https://www.w3.org/TR/CSS22/tables.html
     9
     10        The table generates a principal block container box called the table wrapper box that contains the table box itself and any caption boxes.
     11        The table box is a block-level box that contains the table's internal table boxes.
     12        The table wrapper box is block-level for 'display: table', and inline-level; for 'display: inline-table'. The table wrapper box establishes a block
     13        formatting context, and the table box establishes a table formatting context."
     14
     15        * layout/layouttree/LayoutBox.cpp:
     16        (WebCore::Layout::Box::establishesFormattingContext const):
     17        (WebCore::Layout::Box::establishesTableFormattingContext const):
     18        (WebCore::Layout::Box::isBlockLevelBox const):
     19        (WebCore::Layout::Box::isInlineLevelBox const):
     20        (WebCore::Layout::Box::isBlockContainerBox const):
     21        * layout/layouttree/LayoutBox.h:
     22        (WebCore::Layout::Box::isTableWrapperBox const):
     23        (WebCore::Layout::Box::isTableBox const):
     24
    1252019-07-29  Zalan Bujtas  <zalan@apple.com>
    226
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp

    r247198 r247927  
    5858bool Box::establishesFormattingContext() const
    5959{
    60     return establishesBlockFormattingContext() || establishesInlineFormattingContext();
     60    return establishesBlockFormattingContext() || establishesInlineFormattingContext() || establishesTableFormattingContext();
    6161}
    6262
     
    8181
    8282    return false;
     83}
     84
     85bool Box::establishesTableFormattingContext() const
     86{
     87    return isTableBox();
    8388}
    8489
     
    222227    // Block level elements generate block level boxes.
    223228    auto display = m_style.display();
    224     return display == DisplayType::Block || display == DisplayType::ListItem || display == DisplayType::Table;
     229    return display == DisplayType::Block || display == DisplayType::ListItem || (display == DisplayType::Table && !isTableWrapperBox());
    225230}
    226231
     
    229234    // Inline level elements generate inline level boxes.
    230235    auto display = m_style.display();
    231     return display == DisplayType::Inline || display == DisplayType::InlineBlock || display == DisplayType::InlineTable;
     236    return display == DisplayType::Inline || isInlineBlockBox() || display == DisplayType::InlineTable;
    232237}
    233238
    234239bool Box::isBlockContainerBox() const
    235240{
    236     // Inline level elements generate inline level boxes.
    237241    auto display = m_style.display();
    238     return display == DisplayType::Block || display == DisplayType::ListItem || display == DisplayType::InlineBlock || display == DisplayType::TableCell || display == DisplayType::TableCaption; // TODO && !replaced element
     242    return display == DisplayType::Block || display == DisplayType::ListItem || isInlineBlockBox() || isTableWrapperBox() || isTableCell() || display == DisplayType::TableCaption; // TODO && !replaced element
    239243}
    240244
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.h

    r247198 r247927  
    4646        Document,
    4747        Body,
     48        TableWrapperBox, // The table generates a principal block container box called the table wrapper box that contains the table box and any caption boxes.
     49        TableBox, // The table box is a block-level box that contains the table's internal table boxes.
    4850        TableCell,
    4951        TableColumn,
     
    7779    bool establishesFormattingContext() const;
    7880    bool establishesBlockFormattingContext() const;
     81    bool establishesTableFormattingContext() const;
    7982    bool establishesBlockFormattingContextOnly() const;
    8083    virtual bool establishesInlineFormattingContext() const { return false; }
     
    114117    bool isDocumentBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Document; }
    115118    bool isBodyBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Body; }
     119    bool isTableWrapperBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::TableWrapperBox; }
     120    bool isTableBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::TableBox; }
    116121    bool isTableCell() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::TableCell; }
    117122    bool isReplaced() const { return isImage() || isIFrame(); }
Note: See TracChangeset for help on using the changeset viewer.