diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/RenderFlexibleBox.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/rendering/RenderFlexibleBox.h')
-rw-r--r-- | Source/WebCore/rendering/RenderFlexibleBox.h | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h index 91b547aca..3a19bcbff 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.h +++ b/Source/WebCore/rendering/RenderFlexibleBox.h @@ -28,8 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef RenderFlexibleBox_h -#define RenderFlexibleBox_h +#pragma once #include "OrderIterator.h" #include "RenderBlock.h" @@ -38,22 +37,21 @@ namespace WebCore { class RenderFlexibleBox : public RenderBlock { public: - RenderFlexibleBox(Element&, PassRef<RenderStyle>); - RenderFlexibleBox(Document&, PassRef<RenderStyle>); + RenderFlexibleBox(Element&, RenderStyle&&); + RenderFlexibleBox(Document&, RenderStyle&&); virtual ~RenderFlexibleBox(); - virtual const char* renderName() const override; + const char* renderName() const override; - virtual bool isFlexibleBox() const override final { return true; } - virtual bool avoidsFloats() const override final { return true; } - virtual bool canCollapseAnonymousBlockChild() const override final { return false; } - virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override final; + bool avoidsFloats() const final { return true; } + bool canDropAnonymousBlockChild() const final { return false; } + void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final; - virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override; - virtual int firstLineBaseline() const override; - virtual int inlineBlockBaseline(LineDirectionMode) const override; + int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override; + std::optional<int> firstLineBaseline() const override; + std::optional<int> inlineBlockBaseline(LineDirectionMode) const override; - virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) override; + void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) override; bool isHorizontalFlow() const; @@ -61,10 +59,10 @@ public: bool isLeftLayoutOverflowAllowed() const override; protected: - virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; - virtual void computePreferredLogicalWidths() override; + void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; + void computePreferredLogicalWidths() override; - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; + void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; private: enum FlexSign { @@ -86,7 +84,8 @@ private: // Use an inline capacity of 8, since flexbox containers usually have less than 8 children. typedef Vector<LayoutRect, 8> ChildFrameRects; - bool hasOrthogonalFlow(RenderBox& child) const; + bool isFlexibleBox() const final { return true; } + bool hasOrthogonalFlow(const RenderBox& child) const; bool isColumnFlow() const; bool isLeftToRightFlow() const; bool isMultiline() const; @@ -98,7 +97,7 @@ private: LayoutUnit mainAxisExtent() const; LayoutUnit crossAxisContentExtent() const; LayoutUnit mainAxisContentExtent(LayoutUnit contentLogicalHeight); - LayoutUnit computeMainAxisExtentForChild(RenderBox& child, SizeType, const Length& size); + std::optional<LayoutUnit> computeMainAxisExtentForChild(const RenderBox& child, SizeType, const Length& size); WritingMode transformedWritingMode() const; LayoutUnit flowAwareBorderStart() const; LayoutUnit flowAwareBorderEnd() const; @@ -118,10 +117,11 @@ private: // FIXME: Supporting layout deltas. void setFlowAwareLocationForChild(RenderBox& child, const LayoutPoint&); void adjustAlignmentForChild(RenderBox& child, LayoutUnit); - EAlignItems alignmentForChild(RenderBox& child) const; + ItemPosition alignmentForChild(RenderBox& child) const; LayoutUnit mainAxisBorderAndPaddingExtentForChild(RenderBox& child) const; LayoutUnit mainAxisScrollbarExtentForChild(RenderBox& child) const; LayoutUnit preferredMainAxisContentExtentForChild(RenderBox& child, bool hasInfiniteLineLength); + EOverflow mainAxisOverflowForChild(const RenderBox&) const; void layoutFlexItems(bool relayoutChildren, Vector<LineContext>&); LayoutUnit autoMarginOffsetInMainAxis(const OrderedFlexItemList&, LayoutUnit& availableFreeSpace); @@ -137,8 +137,9 @@ private: LayoutUnit marginBoxAscentForChild(RenderBox&); LayoutUnit computeChildMarginValue(const Length& margin); - void computeMainAxisPreferredSizes(OrderIterator::OrderValues&); - LayoutUnit adjustChildSizeForMinAndMax(RenderBox&, LayoutUnit childSize); + void prepareOrderIteratorAndMargins(); + LayoutUnit adjustChildSizeForMinAndMax(const RenderBox&, LayoutUnit childSize); + LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax(const RenderBox&, LayoutUnit childSize); bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, double& totalFlexGrow, double& totalWeightedFlexShrink, LayoutUnit& minMaxAppliedMainAxisExtent, bool& hasInfiniteLineLength); bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit& availableFreeSpace, double& totalFlexGrow, double& totalWeightedFlexShrink, InflexibleFlexItemSize&, Vector<LayoutUnit>& childSizes, bool hasInfiniteLineLength); @@ -157,12 +158,17 @@ private: void flipForRightToLeftColumn(); void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStartEdge); + bool mainAxisLengthIsDefinite(const RenderBox&, const Length&) const; + bool crossAxisLengthIsDefinite(const RenderBox&, const Length&) const; + bool useChildAspectRatio(const RenderBox&) const; + std::optional<LayoutUnit> computeMainSizeFromAspectRatioUsing(const RenderBox& child, Length crossSizeLength) const; + + virtual bool isFlexibleBoxImpl() const { return false; }; + mutable OrderIterator m_orderIterator; int m_numberOfInFlowChildrenOnFirstLine; }; -RENDER_OBJECT_TYPE_CASTS(RenderFlexibleBox, isFlexibleBox()) - } // namespace WebCore -#endif // RenderFlexibleBox_h +SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderFlexibleBox, isFlexibleBox()) |