Changeset 231958 in webkit


Ignore:
Timestamp:
May 18, 2018 9:32:14 AM (6 years ago)
Author:
Alan Bujtas
Message:

[LFC] Implement height computation for non-replaced floating elements.
https://bugs.webkit.org/show_bug.cgi?id=185767

Reviewed by Antti Koivisto.

  • layout/FormattingContext.cpp:

(WebCore::Layout::FormattingContext::computeFloatingHeight const):
(WebCore::Layout::FormattingContext::computeFloatingNonReplacedHeight const):
(WebCore::Layout::FormattingContext::contentHeightForFormattingContextRoot const):

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r231955 r231958  
     12018-05-18  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Implement height computation for non-replaced floating elements.
     4        https://bugs.webkit.org/show_bug.cgi?id=185767
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * layout/FormattingContext.cpp:
     9        (WebCore::Layout::FormattingContext::computeFloatingHeight const):
     10        (WebCore::Layout::FormattingContext::computeFloatingNonReplacedHeight const):
     11        (WebCore::Layout::FormattingContext::contentHeightForFormattingContextRoot const):
     12        * layout/FormattingContext.h:
     13
    1142018-05-18  Dirk Schulze  <krit@webkit.org>
    215
  • trunk/Source/WebCore/layout/FormattingContext.cpp

    r231953 r231958  
    109109{
    110110    if (!layoutBox.replaced()) {
    111         ASSERT_NOT_IMPLEMENTED_YET();
     111        computeFloatingNonReplacedHeight(layoutContext, layoutBox, displayBox);
    112112        return;
    113113    }
     
    216216
    217217    displayBox.setHeight(computedHeightValue);
     218}
     219
     220void FormattingContext::computeFloatingNonReplacedHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
     221{
     222    ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced());
     223    // 10.6.6 Complicated cases
     224    //
     225    // Floating, non-replaced elements.
     226    //
     227    // If 'height' is 'auto', the height depends on the element's descendants per 10.6.7.
     228    auto height = layoutBox.style().logicalHeight();
     229    displayBox.setHeight(height.isAuto() ? contentHeightForFormattingContextRoot(layoutContext, layoutBox) : LayoutUnit(height.value()));
    218230}
    219231
     
    318330LayoutUnit FormattingContext::contentHeightForFormattingContextRoot(LayoutContext& layoutContext, const Box& layoutBox) const
    319331{
    320     ASSERT(layoutBox.style().logicalHeight().isAuto());
    321 
    322     if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild())
    323         return 0;
    324 
    325     auto& formattingRootContainer = downcast<Container>(layoutBox);
     332    ASSERT(layoutBox.style().logicalHeight().isAuto() && layoutBox.establishesFormattingContext());
    326333    // 10.6.7 'Auto' heights for block formatting context roots
    327334
     
    333340    // then the height is increased to include those edges. Only floats that participate in this block formatting context are taken
    334341    // into account, e.g., floats inside absolutely positioned descendants or other floats are not.
     342    if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild())
     343        return 0;
     344
     345    auto& formattingRootContainer = downcast<Container>(layoutBox);
    335346    if (formattingRootContainer.establishesInlineFormattingContext())
    336347        return 0;
  • trunk/Source/WebCore/layout/FormattingContext.h

    r231953 r231958  
    9797    void computeOutOfFlowReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
    9898
     99    void computeFloatingNonReplacedHeight(LayoutContext&, const Box&, Display::Box&) const;
    99100    void computeFloatingNonReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;
    100101
Note: See TracChangeset for help on using the changeset viewer.