Changeset 249908 in webkit
- Timestamp:
- Sep 16, 2019 11:44:36 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r249905 r249908 1 2019-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 1 21 2019-09-16 Jon Davis <jond@apple.com> 2 22 -
trunk/Source/WebCore/layout/FormattingContext.h
r249879 r249908 94 94 class Geometry { 95 95 public: 96 Geometry(const FormattingContext&);97 98 96 VerticalGeometry outOfFlowVerticalGeometry(const Box&, UsedHorizontalValues, UsedVerticalValues) const; 99 97 HorizontalGeometry outOfFlowHorizontalGeometry(const Box&, UsedHorizontalValues); … … 127 125 128 126 protected: 127 friend class FormattingContext; 128 Geometry(const FormattingContext&); 129 129 130 enum class HeightType { Min, Max, Normal }; 130 131 Optional<LayoutUnit> computedHeightValue(const Box&, HeightType, Optional<UsedVerticalValues> = WTF::nullopt) const; … … 155 156 class Quirks { 156 157 public: 158 LayoutUnit heightValueOfNearestContainingBlockWithFixedHeight(const Box&); 159 160 protected: 161 friend class FormattingContext; 157 162 Quirks(const FormattingContext&); 158 163 159 LayoutUnit heightValueOfNearestContainingBlockWithFixedHeight(const Box&);160 161 protected:162 164 const LayoutState& layoutState() const { return m_formattingContext.layoutState(); } 163 165 LayoutState& layoutState() { return m_formattingContext.layoutState(); } -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h
r249900 r249908 76 76 class Geometry : public FormattingContext::Geometry { 77 77 public: 78 Geometry(const BlockFormattingContext&);79 80 78 HeightAndMargin inFlowHeightAndMargin(const Box&, UsedHorizontalValues, UsedVerticalValues); 81 79 WidthAndMargin inFlowWidthAndMargin(const Box&, UsedHorizontalValues); … … 88 86 89 87 private: 88 friend class BlockFormattingContext; 89 Geometry(const BlockFormattingContext&); 90 90 91 HeightAndMargin inFlowNonReplacedHeightAndMargin(const Box&, UsedHorizontalValues, UsedVerticalValues); 91 92 WidthAndMargin inFlowNonReplacedWidthAndMargin(const Box&, UsedHorizontalValues) const; … … 100 101 class MarginCollapse { 101 102 public: 102 MarginCollapse(const BlockFormattingContext&);103 104 103 UsedVerticalMargin::CollapsedValues collapsedVerticalValues(const Box&, const UsedVerticalMargin::NonCollapsedValues&); 105 104 … … 123 122 124 123 private: 124 friend class BlockFormattingContext; 125 MarginCollapse(const BlockFormattingContext&); 126 125 127 enum class MarginType { Before, After }; 126 128 PositiveAndNegativeVerticalMargin::Values positiveNegativeValues(const Box&, MarginType); … … 139 141 class Quirks : public FormattingContext::Quirks { 140 142 public: 141 Quirks(const BlockFormattingContext&);142 143 143 bool needsStretching(const Box&) const; 144 144 HeightAndMargin stretchedInFlowHeight(const Box&, HeightAndMargin); … … 149 149 150 150 private: 151 friend class BlockFormattingContext; 152 Quirks(const BlockFormattingContext&); 153 151 154 const BlockFormattingContext& formattingContext() const { return downcast<BlockFormattingContext>(FormattingContext::Quirks::formattingContext()); } 152 155 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
r249903 r249908 85 85 auto* lastInFlowChild = layoutContainer.lastInFlowChild(); 86 86 ASSERT(lastInFlowChild); 87 auto marginCollapse = MarginCollapse(formattingContext()); 88 if (!marginCollapse.marginAfterCollapsesWithParentMarginAfter(*lastInFlowChild)) { 87 if (!formattingContext().marginCollapse().marginAfterCollapsesWithParentMarginAfter(*lastInFlowChild)) { 89 88 auto& lastInFlowBoxGeometry = formattingContext().geometryForBox(*lastInFlowChild); 90 89 auto bottomEdgeOfBottomMargin = lastInFlowBoxGeometry.bottom() + (lastInFlowBoxGeometry.hasCollapsedThroughMargin() ? LayoutUnit() : lastInFlowBoxGeometry.marginAfter()); … … 94 93 // 3. the bottom border edge of the last in-flow child whose top margin doesn't collapse with the element's bottom margin 95 94 auto* inFlowChild = lastInFlowChild; 96 while (inFlowChild && marginCollapse.marginBeforeCollapsesWithParentMarginAfter(*inFlowChild))95 while (inFlowChild && formattingContext().marginCollapse().marginBeforeCollapsesWithParentMarginAfter(*inFlowChild)) 97 96 inFlowChild = inFlowChild->previousInFlowSibling(); 98 97 if (inFlowChild) { -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp
r249834 r249908 90 90 91 91 auto nonCollapsedMargin = heightAndMargin.nonCollapsedMargin; 92 auto collapsedMargin = MarginCollapse(formattingContext).collapsedVerticalValues(layoutBox, nonCollapsedMargin);92 auto collapsedMargin = formattingContext.marginCollapse().collapsedVerticalValues(layoutBox, nonCollapsedMargin); 93 93 totalVerticalMargin = collapsedMargin.before.valueOr(nonCollapsedMargin.before); 94 94 totalVerticalMargin += collapsedMargin.isCollapsedThrough ? nonCollapsedMargin.after : collapsedMargin.after.valueOr(nonCollapsedMargin.after); -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h
r249878 r249908 72 72 class Quirks : public FormattingContext::Quirks { 73 73 public: 74 Quirks(const InlineFormattingContext&);75 76 74 bool lineDescentNeedsCollapsing(const Line::Content&) const; 77 75 Line::InitialConstraints::HeightAndBaseline lineHeightConstraints(const Box& formattingRoot) const; 78 76 79 77 private: 78 friend class InlineFormattingContext; 79 Quirks(const InlineFormattingContext&); 80 80 81 const InlineFormattingContext& formattingContext() const { return downcast<InlineFormattingContext>(FormattingContext::Quirks::formattingContext()); } 81 82 … … 85 86 class Geometry : public FormattingContext::Geometry { 86 87 public: 87 Geometry(const InlineFormattingContext&);88 89 88 HeightAndMargin inlineBlockHeightAndMargin(const Box&, UsedHorizontalValues) const; 90 89 WidthAndMargin inlineBlockWidthAndMargin(const Box&, UsedHorizontalValues); 91 90 92 91 private: 92 friend class InlineFormattingContext; 93 Geometry(const InlineFormattingContext&); 94 93 95 const InlineFormattingContext& formattingContext() const { return downcast<InlineFormattingContext>(FormattingContext::Geometry::formattingContext()); } 94 96 -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h
r249849 r249908 46 46 class Geometry : public FormattingContext::Geometry { 47 47 public: 48 Geometry(const TableFormattingContext&);49 50 48 HeightAndMargin tableCellHeightAndMargin(const Box&) const; 51 49 52 50 private: 51 friend class TableFormattingContext; 52 Geometry(const TableFormattingContext&); 53 53 54 const TableFormattingContext& formattingContext() const { return downcast<TableFormattingContext>(FormattingContext::Geometry::formattingContext()); } 54 55 };
Note: See TracChangeset
for help on using the changeset viewer.