

#ifndef LayoutRubyBase_h
#define LayoutRubyBase_h

#include "core/layout/LayoutBlockFlow.h"

namespace blink {

class LayoutRubyRun;

class LayoutRubyBase final : public LayoutBlockFlow {
public:
    virtual ~LayoutRubyBase();

    static LayoutRubyBase* createAnonymous(Document*);

    virtual const char* name() const override { return "LayoutRubyBase"; }

    virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectRubyBase || LayoutBlockFlow::isOfType(type); }

    virtual bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override;

private:
    LayoutRubyBase();

    virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const override;
    virtual void adjustInlineDirectionLineBounds(unsigned expansionOpportunityCount, LayoutUnit& logicalLeft, LayoutUnit& logicalWidth) const override;

    void moveChildren(LayoutRubyBase* toBase, LayoutObject* beforeChild = nullptr);
    void moveInlineChildren(LayoutRubyBase* toBase, LayoutObject* beforeChild = nullptr);
    void moveBlockChildren(LayoutRubyBase* toBase, LayoutObject* beforeChild = nullptr);

    // Allow LayoutRubyRun to manipulate the children within ruby bases.
    friend class LayoutRubyRun;
};

} // namespace blink

#endif // LayoutRubyBase_h
