Absolute positioned elements in a relative positioned CSS3 Flexbox fail to display...
[WebKit-https.git] / Source / WebCore / rendering / RenderFlexibleBox.h
index 3613e20..d923a53 100644 (file)
@@ -33,8 +33,6 @@
 
 #include "RenderBlock.h"
 
-#if ENABLE(CSS3_FLEXBOX)
-
 namespace WebCore {
 
 class RenderFlexibleBox : public RenderBlock {
@@ -45,22 +43,98 @@ public:
     virtual const char* renderName() const;
 
     virtual bool isFlexibleBox() const { return true; }
+    virtual void computePreferredLogicalWidths();
+    virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0);
 
-    virtual void layoutBlock(bool relayoutChildren, int pageLogicalHeight = 0, BlockLayoutPass = NormalLayoutPass);
+    bool isHorizontalFlow() const;
 
 private:
-    class FlexibleBoxIterator;
+    enum FlexSign {
+        PositiveFlexibility,
+        NegativeFlexibility,
+    };
+
+    enum PositionedLayoutMode {
+        FlipForRowReverse,
+        NoFlipForRowReverse,
+    };
+
+    struct FlexOrderHashTraits;
+    typedef HashSet<int, DefaultHash<int>::Hash, FlexOrderHashTraits> FlexOrderHashSet;
+
+    class FlexOrderIterator;
     typedef WTF::HashMap<const RenderBox*, LayoutUnit> InflexibleFlexItemSize;
+    typedef WTF::Vector<RenderBox*> OrderedFlexItemList;
+
+    struct LineContext;
+    struct Violation;
 
-    void layoutHorizontalBlock(bool relayoutChildren);
+    bool hasOrthogonalFlow(RenderBox* child) const;
+    bool isColumnFlow() const;
+    bool isLeftToRightFlow() const;
+    bool isMultiline() const;
+    Length crossAxisLength() const;
+    Length preferredLengthForChild(RenderBox* child) const;
+    void setCrossAxisExtent(LayoutUnit);
+    LayoutUnit crossAxisExtentForChild(RenderBox* child);
+    LayoutUnit mainAxisExtentForChild(RenderBox* child);
+    LayoutUnit crossAxisExtent() const;
+    LayoutUnit mainAxisExtent() const;
+    LayoutUnit crossAxisContentExtent() const;
+    LayoutUnit mainAxisContentExtent() const;
+    WritingMode transformedWritingMode() const;
+    LayoutUnit flowAwareBorderStart() const;
+    LayoutUnit flowAwareBorderEnd() const;
+    LayoutUnit flowAwareBorderBefore() const;
+    LayoutUnit flowAwareBorderAfter() const;
+    LayoutUnit flowAwarePaddingStart() const;
+    LayoutUnit flowAwarePaddingEnd() const;
+    LayoutUnit flowAwarePaddingBefore() const;
+    LayoutUnit flowAwarePaddingAfter() const;
+    LayoutUnit flowAwareMarginStartForChild(RenderBox* child) const;
+    LayoutUnit flowAwareMarginEndForChild(RenderBox* child) const;
+    LayoutUnit flowAwareMarginBeforeForChild(RenderBox* child) const;
+    LayoutUnit flowAwareMarginAfterForChild(RenderBox* child) const;
+    LayoutUnit crossAxisMarginExtentForChild(RenderBox* child) const;
+    LayoutUnit crossAxisScrollbarExtent() const;
+    LayoutPoint flowAwareLocationForChild(RenderBox* child) const;
+    // FIXME: Supporting layout deltas.
+    void setFlowAwareLocationForChild(RenderBox* child, const LayoutPoint&);
+    void adjustAlignmentForChild(RenderBox* child, LayoutUnit);
+    LayoutUnit mainAxisBorderAndPaddingExtentForChild(RenderBox* child) const;
+    LayoutUnit mainAxisScrollbarExtentForChild(RenderBox* child) const;
+    LayoutUnit preferredMainAxisContentExtentForChild(RenderBox* child) const;
 
-    void computePreferredSizeHorizontal(bool relayoutChildren, FlexibleBoxIterator&, LayoutUnit&, float& totalPositiveFlexibility, float& totalNegativeFlexibility);
-    bool runFreeSpaceAllocationAlgorithmHorizontal(LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes);
-    void layoutAndPlaceChildrenHorizontal(const WTF::Vector<LayoutUnit>& childSizes, LayoutUnit availableFreeSpace, float totalPositiveFlexibility);
+    void layoutFlexItems(FlexOrderIterator&, WTF::Vector<LineContext>&);
+    LayoutUnit autoMarginOffsetInMainAxis(const OrderedFlexItemList&, LayoutUnit& availableFreeSpace);
+    void updateAutoMarginsInMainAxis(RenderBox* child, LayoutUnit autoMarginOffset);
+    bool hasAutoMarginsInCrossAxis(RenderBox* child);
+    bool updateAutoMarginsInCrossAxis(RenderBox* child, LayoutUnit availableAlignmentSpace);
+    void repositionLogicalHeightDependentFlexItems(FlexOrderIterator&, WTF::Vector<LineContext>&, LayoutUnit& oldClientAfterEdge);
+
+    LayoutUnit availableAlignmentSpaceForChild(LayoutUnit lineCrossAxisExtent, RenderBox*);
+    LayoutUnit marginBoxAscentForChild(RenderBox*);
+
+    void computeMainAxisPreferredSizes(bool relayoutChildren, FlexOrderHashSet&);
+    LayoutUnit lineBreakLength();
+    LayoutUnit adjustChildSizeForMinAndMax(RenderBox*, LayoutUnit childSize, LayoutUnit flexboxAvailableContentExtent);
+    bool computeNextFlexLine(FlexOrderIterator&, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, LayoutUnit& minMaxAppliedMainAxisExtent);
+    LayoutUnit computeAvailableFreeSpace(LayoutUnit preferredMainAxisExtent);
+
+    bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes);
+    void freezeViolations(const WTF::Vector<Violation>&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, InflexibleFlexItemSize&);
+
+    void setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize);
+    void prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode);
+    void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexItemList&, const WTF::Vector<LayoutUnit>& childSizes, LayoutUnit availableFreeSpace, WTF::Vector<LineContext>&);
+    void layoutColumnReverse(const OrderedFlexItemList&, const WTF::Vector<LayoutUnit>& childSizes, LayoutUnit crossAxisOffset, LayoutUnit availableFreeSpace);
+    void packFlexLines(FlexOrderIterator&, WTF::Vector<LineContext>&);
+    void alignChildren(FlexOrderIterator&, const WTF::Vector<LineContext>&);
+    void applyStretchAlignmentToChild(RenderBox*, LayoutUnit lineCrossAxisExtent);
+    void flipForRightToLeftColumn(FlexOrderIterator&);
+    void flipForWrapReverse(FlexOrderIterator&, const WTF::Vector<LineContext>&, LayoutUnit crossAxisStartEdge);
 };
 
 } // namespace WebCore
 
-#endif // ENABLE(CSS3_FLEXBOX)
-
 #endif // RenderFlexibleBox_h