1 | /* |
2 | * This file is part of the render object implementation for KHTML. |
3 | * |
4 | * Copyright (C) 2003 Apple Inc. |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public License |
17 | * along with this library; see the file COPYING.LIB. If not, write to |
18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | * Boston, MA 02110-1301, USA. |
20 | * |
21 | */ |
22 | |
23 | #pragma once |
24 | |
25 | #include "RenderBlock.h" |
26 | |
27 | namespace WebCore { |
28 | |
29 | class FlexBoxIterator; |
30 | |
31 | class RenderDeprecatedFlexibleBox final : public RenderBlock { |
32 | WTF_MAKE_ISO_ALLOCATED(RenderDeprecatedFlexibleBox); |
33 | public: |
34 | RenderDeprecatedFlexibleBox(Element&, RenderStyle&&); |
35 | virtual ~RenderDeprecatedFlexibleBox(); |
36 | |
37 | Element& element() const { return downcast<Element>(nodeForNonAnonymous()); } |
38 | |
39 | const char* renderName() const override; |
40 | |
41 | void styleWillChange(StyleDifference, const RenderStyle& newStyle) override; |
42 | |
43 | void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0_lu) override; |
44 | void layoutHorizontalBox(bool relayoutChildren); |
45 | void layoutVerticalBox(bool relayoutChildren); |
46 | |
47 | bool isStretchingChildren() const { return m_stretchingChildren; } |
48 | |
49 | bool avoidsFloats() const override { return true; } |
50 | bool canDropAnonymousBlockChild() const override { return false; } |
51 | |
52 | void placeChild(RenderBox* child, const LayoutPoint& location, LayoutSize* childLayoutDelta = nullptr); |
53 | |
54 | private: |
55 | bool isDeprecatedFlexibleBox() const override { return true; } |
56 | void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; |
57 | void computePreferredLogicalWidths() override; |
58 | |
59 | LayoutUnit allowedChildFlex(RenderBox* child, bool expanding, unsigned group); |
60 | |
61 | bool hasMultipleLines() const { return style().boxLines() == BoxLines::Multiple; } |
62 | bool isVertical() const { return style().boxOrient() == BoxOrient::Vertical; } |
63 | bool isHorizontal() const { return style().boxOrient() == BoxOrient::Horizontal; } |
64 | |
65 | void applyLineClamp(FlexBoxIterator&, bool relayoutChildren); |
66 | void clearLineClamp(); |
67 | |
68 | bool m_stretchingChildren; |
69 | }; |
70 | |
71 | } // namespace WebCore |
72 | |
73 | SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderDeprecatedFlexibleBox, isDeprecatedFlexibleBox()) |
74 | |