Changeset 231894 in webkit


Ignore:
Timestamp:
May 17, 2018 7:07:49 AM (6 years ago)
Author:
Alan Bujtas
Message:

[LFC] Implement width computation for replaced out if flow elements.
https://bugs.webkit.org/show_bug.cgi?id=185701

Reviewed by Antti Koivisto.

The used value of 'width' is determined as for inline replaced elements.

  • layout/FormattingContext.cpp:

(WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
(WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
(WebCore::Layout::FormattingContext::computeOutOfFlowReplacedWidth const):

  • layout/FormattingContext.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r231891 r231894  
     12018-05-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Implement width computation for replaced out if flow elements.
     4        https://bugs.webkit.org/show_bug.cgi?id=185701
     5
     6        Reviewed by Antti Koivisto.
     7       
     8        The used value of 'width' is determined as for inline replaced elements.
     9
     10        * layout/FormattingContext.cpp:
     11        (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
     12        (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
     13        (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedWidth const):
     14        * layout/FormattingContext.h:
     15
    1162018-05-17  Thibault Saunier  <tsaunier@igalia.com>
    217
  • trunk/Source/WebCore/layout/FormattingContext.cpp

    r231847 r231894  
    9494        return;
    9595    }
    96     computeInFlowReplacedWidth(layoutContext, layoutBox, displayBox);
     96    computeReplacedWidth(layoutContext, layoutBox, displayBox);
    9797}
    9898
     
    155155void FormattingContext::computeOutOfFlowNonReplacedHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
    156156{
     157    ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.isReplaced());
     158
     159    // 10.6.4 Absolutely positioned, non-replaced elements
     160    //
    157161    // For absolutely positioned elements, the used values of the vertical dimensions must satisfy this constraint:
    158162    // 'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom'
     
    209213}
    210214
    211 void FormattingContext::computeInFlowReplacedWidth(LayoutContext&, const Box& layoutBox, Display::Box& displayBox) const
    212 {
    213     // 10.3.4 Block-level, replaced elements in normal flow: The used value of 'width' is determined as for inline replaced elements
    214     // 10.3.6 Floating, replaced elements: The used value of 'width' is determined as for inline replaced elements.   
     215void FormattingContext::computeReplacedWidth(LayoutContext&, const Box& layoutBox, Display::Box& displayBox) const
     216{
     217    ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.isReplaced());
     218
     219    // 10.3.4 Block-level, replaced elements in normal flow: The used value of 'width' is determined as for inline replaced elements.
     220    // 10.3.6 Floating, replaced elements: The used value of 'width' is determined as for inline replaced elements.
     221    // 10.3.8 Absolutely positioned, replaced elements: The used value of 'width' is determined as for inline replaced elements.
    215222
    216223    // 10.3.2 Inline, replaced elements
     
    261268{
    262269    ASSERT(layoutBox.style().logicalHeight().isAuto());
     270
    263271    if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild())
    264272        return 0;
     
    288296void FormattingContext::computeOutOfFlowNonReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
    289297{
     298    ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.isReplaced());
     299   
     300    // 10.3.7 Absolutely positioned, non-replaced elements
     301    //
    290302    // 'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right'
    291303    // = width of containing block
     
    336348}
    337349
     350void FormattingContext::computeOutOfFlowReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
     351{
     352    ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.isReplaced());
     353    // 10.3.8 Absolutely positioned, replaced elements
     354    //
     355    // The used value of 'width' is determined as for inline replaced elements.
     356    computeReplacedWidth(layoutContext, layoutBox, displayBox);
     357}
     358
    338359LayoutUnit FormattingContext::shrinkToFitWidth(LayoutContext&, const Box&) const
    339360{
  • trunk/Source/WebCore/layout/FormattingContext.h

    r231847 r231894  
    8888    void layoutOutOfFlowDescendants(LayoutContext&s) const;
    8989
    90     void computeInFlowReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
     90    void computeReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
    9191
    9292private:
    9393    void computeOutOfFlowNonReplacedHeight(LayoutContext&, const Box&, Display::Box&) const;
    9494    void computeOutOfFlowNonReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
     95    void computeOutOfFlowReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
    9596
    9697    LayoutUnit contentHeightForFormattingContextRoot(LayoutContext&, const Box&) const;
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp

    r231847 r231894  
    150150        return;
    151151    }
    152     computeInFlowReplacedWidth(layoutContext, layoutBox, displayBox);
     152    computeReplacedWidth(layoutContext, layoutBox, displayBox);
    153153}
    154154
    155155void BlockFormattingContext::computeInFlowNonReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
    156156{
     157    ASSERT(layoutBox.isInFlow() && !layoutBox.isReplaced());
     158
    157159    // 10.3.3 Block-level, non-replaced elements in normal flow
    158160    // The following constraints must hold among the used values of the other properties:
     
    203205void BlockFormattingContext::computeInFlowNonReplacedHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
    204206{
     207    ASSERT(layoutBox.isInFlow() && !layoutBox.isReplaced());
     208
    205209    // https://www.w3.org/TR/CSS22/visudet.html
    206210    // If 'height' is 'auto', the height depends on whether the element has any block-level children and whether it has padding or borders:
Note: See TracChangeset for help on using the changeset viewer.