⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 238668 in webkit


Ignore:
Timestamp:
Nov 29, 2018, 7:30:27 AM (8 years ago)
Author:
Alan Bujtas
Message:

[LFC][BFC][Quirk] Width does not need stretching quirk.
https://bugs.webkit.org/show_bug.cgi?id=192135

Reviewed by Antti Koivisto.

In BFC the block box's width (auto) always streches to the content width of the containing block.

  • layout/blockformatting/BlockFormattingContext.h:
  • layout/blockformatting/BlockFormattingContextGeometry.cpp:

(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):

  • layout/blockformatting/BlockFormattingContextQuirks.cpp:

(WebCore::Layout::BlockFormattingContext::Quirks::needsStretching):
(WebCore::Layout::BlockFormattingContext::Quirks::isStretchedToInitialContainingBlock): Deleted.
(WebCore::Layout::BlockFormattingContext::Quirks::stretchedWidth): Deleted.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r238667 r238668  
     12018-11-29  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][BFC][Quirk] Width does not need stretching quirk.
     4        https://bugs.webkit.org/show_bug.cgi?id=192135
     5
     6        Reviewed by Antti Koivisto.
     7
     8        In BFC the block box's width (auto) always streches to the content width of the containing block.
     9
     10        * layout/blockformatting/BlockFormattingContext.h:
     11        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
     12        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
     13        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
     14        * layout/blockformatting/BlockFormattingContextQuirks.cpp:
     15        (WebCore::Layout::BlockFormattingContext::Quirks::needsStretching):
     16        (WebCore::Layout::BlockFormattingContext::Quirks::isStretchedToInitialContainingBlock): Deleted.
     17        (WebCore::Layout::BlockFormattingContext::Quirks::stretchedWidth): Deleted.
     18
    1192018-11-29  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h

    r238667 r238668  
    113113    class Quirks {
    114114    public:
    115         static bool isStretchedToInitialContainingBlock(const LayoutState&, const Box&);
     115        static bool needsStretching(const LayoutState&, const Box&);
    116116        static HeightAndMargin stretchedHeight(const LayoutState&, const Box&, HeightAndMargin);
    117         static WidthAndMargin stretchedWidth(const LayoutState&, const Box&, WidthAndMargin);
     117
    118118        static bool shouldIgnoreMarginTop(const LayoutState&, const Box&);
    119119    };
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp

    r238667 r238668  
    196196
    197197    auto widthAndMargin = compute();
    198     if (!Quirks::isStretchedToInitialContainingBlock(layoutState, layoutBox)) {
    199         LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")");
    200         return widthAndMargin;
    201     }
    202 
    203     widthAndMargin = Quirks::stretchedWidth(layoutState, layoutBox, widthAndMargin);
    204 
    205     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> streched to viewport-> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")");
     198    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")");
    206199    return widthAndMargin;
    207200}
     
    265258    }
    266259
    267     if (!Quirks::isStretchedToInitialContainingBlock(layoutState, layoutBox))
     260    if (!Quirks::needsStretching(layoutState, layoutBox))
    268261        return heightAndMargin;
    269262
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp

    r238667 r238668  
    5454}
    5555
    56 bool BlockFormattingContext::Quirks::isStretchedToInitialContainingBlock(const LayoutState& layoutState, const Box& layoutBox)
     56bool BlockFormattingContext::Quirks::needsStretching(const LayoutState& layoutState, const Box& layoutBox)
    5757{
    5858    ASSERT(layoutBox.isInFlow());
    59     // In quirks mode, body and html stretch to the viewport.
     59    // In quirks mode, body stretches to html and html to the initial containing block (height: auto only).
    6060    if (!layoutState.inQuirksMode())
    6161        return false;
     
    8282}
    8383
    84 WidthAndMargin BlockFormattingContext::Quirks::stretchedWidth(const LayoutState& layoutState, const Box& layoutBox, WidthAndMargin widthAndMargin)
    85 {
    86     auto initialContainingBlockWidth = layoutState.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxWidth();
    87     auto horizontalMargins = widthAndMargin.margin.left + widthAndMargin.margin.right;
    88     // Stretch but never overstretch with the margins.
    89     if (widthAndMargin.width + horizontalMargins < initialContainingBlockWidth)
    90         widthAndMargin.width = initialContainingBlockWidth - horizontalMargins;
    91 
    92     return widthAndMargin;
    93 }
    94 
    9584bool BlockFormattingContext::Quirks::shouldIgnoreMarginTop(const LayoutState& layoutState, const Box& layoutBox)
    9685{
Note: See TracChangeset for help on using the changeset viewer.