Changeset 249908 in webkit


Ignore:
Timestamp:
Sep 16, 2019 11:44:36 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC] Make the nested Geometry/MarginCollapse/Quirks c'tors private.
https://bugs.webkit.org/show_bug.cgi?id=201825
<rdar://problem/55403474>

Reviewed by Antti Koivisto.

The Geometry/MarginCollapse/Quirks objects should be constructed through the corresponding accessor functions.
This is also a preparation for being able to pass the layout box in to these stack objects and call geometry(layoutBox)->outOfFlowVerticalGeometry() vs. geometry()->outOfFlowVerticalGeometry(layoutBox).

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

(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):

  • layout/blockformatting/BlockFormattingContextQuirks.cpp:

(WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):

  • layout/inlineformatting/InlineFormattingContext.h:
  • layout/tableformatting/TableFormattingContext.h:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r249905 r249908  
     12019-09-16  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Make the nested Geometry/MarginCollapse/Quirks c'tors private.
     4        https://bugs.webkit.org/show_bug.cgi?id=201825
     5        <rdar://problem/55403474>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        The Geometry/MarginCollapse/Quirks objects should be constructed through the corresponding accessor functions.
     10        This is also a preparation for being able to pass the layout box in to these stack objects and call geometry(layoutBox)->outOfFlowVerticalGeometry() vs. geometry()->outOfFlowVerticalGeometry(layoutBox).
     11
     12        * layout/FormattingContext.h:
     13        * layout/blockformatting/BlockFormattingContext.h:
     14        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
     15        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
     16        * layout/blockformatting/BlockFormattingContextQuirks.cpp:
     17        (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
     18        * layout/inlineformatting/InlineFormattingContext.h:
     19        * layout/tableformatting/TableFormattingContext.h:
     20
    1212019-09-16  Jon Davis  <jond@apple.com>
    222
  • trunk/Source/WebCore/layout/FormattingContext.h

    r249879 r249908  
    9494    class Geometry {
    9595    public:
    96         Geometry(const FormattingContext&);
    97 
    9896        VerticalGeometry outOfFlowVerticalGeometry(const Box&, UsedHorizontalValues, UsedVerticalValues) const;
    9997        HorizontalGeometry outOfFlowHorizontalGeometry(const Box&, UsedHorizontalValues);
     
    127125
    128126    protected:
     127        friend class FormattingContext;
     128        Geometry(const FormattingContext&);
     129
    129130        enum class HeightType { Min, Max, Normal };
    130131        Optional<LayoutUnit> computedHeightValue(const Box&, HeightType, Optional<UsedVerticalValues> = WTF::nullopt) const;
     
    155156    class Quirks {
    156157    public:
     158        LayoutUnit heightValueOfNearestContainingBlockWithFixedHeight(const Box&);
     159
     160    protected:
     161        friend class FormattingContext;
    157162        Quirks(const FormattingContext&);
    158163
    159         LayoutUnit heightValueOfNearestContainingBlockWithFixedHeight(const Box&);
    160 
    161     protected:
    162164        const LayoutState& layoutState() const { return m_formattingContext.layoutState(); }
    163165        LayoutState& layoutState() { return m_formattingContext.layoutState(); }
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h

    r249900 r249908  
    7676    class Geometry : public FormattingContext::Geometry {
    7777    public:
    78         Geometry(const BlockFormattingContext&);
    79 
    8078        HeightAndMargin inFlowHeightAndMargin(const Box&, UsedHorizontalValues, UsedVerticalValues);
    8179        WidthAndMargin inFlowWidthAndMargin(const Box&, UsedHorizontalValues);
     
    8886
    8987    private:
     88        friend class BlockFormattingContext;
     89        Geometry(const BlockFormattingContext&);
     90
    9091        HeightAndMargin inFlowNonReplacedHeightAndMargin(const Box&, UsedHorizontalValues, UsedVerticalValues);
    9192        WidthAndMargin inFlowNonReplacedWidthAndMargin(const Box&, UsedHorizontalValues) const;
     
    100101    class MarginCollapse {
    101102    public:
    102         MarginCollapse(const BlockFormattingContext&);
    103 
    104103        UsedVerticalMargin::CollapsedValues collapsedVerticalValues(const Box&, const UsedVerticalMargin::NonCollapsedValues&);
    105104
     
    123122
    124123    private:
     124        friend class BlockFormattingContext;
     125        MarginCollapse(const BlockFormattingContext&);
     126
    125127        enum class MarginType { Before, After };
    126128        PositiveAndNegativeVerticalMargin::Values positiveNegativeValues(const Box&, MarginType);
     
    139141    class Quirks : public FormattingContext::Quirks {
    140142    public:
    141         Quirks(const BlockFormattingContext&);
    142 
    143143        bool needsStretching(const Box&) const;
    144144        HeightAndMargin stretchedInFlowHeight(const Box&, HeightAndMargin);
     
    149149
    150150    private:
     151        friend class BlockFormattingContext;
     152        Quirks(const BlockFormattingContext&);
     153
    151154        const BlockFormattingContext& formattingContext() const { return downcast<BlockFormattingContext>(FormattingContext::Quirks::formattingContext()); }
    152155
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp

    r249903 r249908  
    8585        auto* lastInFlowChild = layoutContainer.lastInFlowChild();
    8686        ASSERT(lastInFlowChild);
    87         auto marginCollapse = MarginCollapse(formattingContext());
    88         if (!marginCollapse.marginAfterCollapsesWithParentMarginAfter(*lastInFlowChild)) {
     87        if (!formattingContext().marginCollapse().marginAfterCollapsesWithParentMarginAfter(*lastInFlowChild)) {
    8988            auto& lastInFlowBoxGeometry = formattingContext().geometryForBox(*lastInFlowChild);
    9089            auto bottomEdgeOfBottomMargin = lastInFlowBoxGeometry.bottom() + (lastInFlowBoxGeometry.hasCollapsedThroughMargin() ? LayoutUnit() : lastInFlowBoxGeometry.marginAfter());
     
    9493        // 3. the bottom border edge of the last in-flow child whose top margin doesn't collapse with the element's bottom margin
    9594        auto* inFlowChild = lastInFlowChild;
    96         while (inFlowChild && marginCollapse.marginBeforeCollapsesWithParentMarginAfter(*inFlowChild))
     95        while (inFlowChild && formattingContext().marginCollapse().marginBeforeCollapsesWithParentMarginAfter(*inFlowChild))
    9796            inFlowChild = inFlowChild->previousInFlowSibling();
    9897        if (inFlowChild) {
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp

    r249834 r249908  
    9090
    9191        auto nonCollapsedMargin = heightAndMargin.nonCollapsedMargin;
    92         auto collapsedMargin = MarginCollapse(formattingContext).collapsedVerticalValues(layoutBox, nonCollapsedMargin);
     92        auto collapsedMargin = formattingContext.marginCollapse().collapsedVerticalValues(layoutBox, nonCollapsedMargin);
    9393        totalVerticalMargin = collapsedMargin.before.valueOr(nonCollapsedMargin.before);
    9494        totalVerticalMargin += collapsedMargin.isCollapsedThrough ? nonCollapsedMargin.after : collapsedMargin.after.valueOr(nonCollapsedMargin.after);
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h

    r249878 r249908  
    7272    class Quirks : public FormattingContext::Quirks {
    7373    public:
    74         Quirks(const InlineFormattingContext&);
    75 
    7674        bool lineDescentNeedsCollapsing(const Line::Content&) const;
    7775        Line::InitialConstraints::HeightAndBaseline lineHeightConstraints(const Box& formattingRoot) const;
    7876
    7977    private:
     78        friend class InlineFormattingContext;
     79        Quirks(const InlineFormattingContext&);
     80
    8081        const InlineFormattingContext& formattingContext() const { return downcast<InlineFormattingContext>(FormattingContext::Quirks::formattingContext()); }
    8182
     
    8586    class Geometry : public FormattingContext::Geometry {
    8687    public:
    87         Geometry(const InlineFormattingContext&);
    88 
    8988        HeightAndMargin inlineBlockHeightAndMargin(const Box&, UsedHorizontalValues) const;
    9089        WidthAndMargin inlineBlockWidthAndMargin(const Box&, UsedHorizontalValues);
    9190
    9291    private:
     92        friend class InlineFormattingContext;
     93        Geometry(const InlineFormattingContext&);
     94
    9395        const InlineFormattingContext& formattingContext() const { return downcast<InlineFormattingContext>(FormattingContext::Geometry::formattingContext()); }
    9496
  • trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h

    r249849 r249908  
    4646    class Geometry : public FormattingContext::Geometry {
    4747    public:
    48         Geometry(const TableFormattingContext&);
    49 
    5048        HeightAndMargin tableCellHeightAndMargin(const Box&) const;
    5149
    5250    private:
     51        friend class TableFormattingContext;
     52        Geometry(const TableFormattingContext&);
     53
    5354        const TableFormattingContext& formattingContext() const { return downcast<TableFormattingContext>(FormattingContext::Geometry::formattingContext()); }
    5455    };
Note: See TracChangeset for help on using the changeset viewer.