2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Simon Hausmann <hausmann@kde.org>
4 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
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.
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.
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.
23 #ifndef RenderFrameSet_h
24 #define RenderFrameSet_h
26 #include "RenderBox.h"
30 class HTMLFrameSetElement;
34 enum FrameEdge { LeftFrameEdge, RightFrameEdge, TopFrameEdge, BottomFrameEdge };
36 struct FrameEdgeInfo {
37 FrameEdgeInfo(bool preventResize = false, bool allowBorder = true)
41 m_preventResize.fill(preventResize);
42 m_allowBorder.fill(allowBorder);
45 bool preventResize(FrameEdge edge) const { return m_preventResize[edge]; }
46 bool allowBorder(FrameEdge edge) const { return m_allowBorder[edge]; }
48 void setPreventResize(FrameEdge edge, bool preventResize) { m_preventResize[edge] = preventResize; }
49 void setAllowBorder(FrameEdge edge, bool allowBorder) { m_allowBorder[edge] = allowBorder; }
52 Vector<bool> m_preventResize;
53 Vector<bool> m_allowBorder;
56 class RenderFrameSet : public RenderBox {
58 RenderFrameSet(HTMLFrameSetElement*);
59 virtual ~RenderFrameSet();
61 const RenderObjectChildList* children() const { return &m_children; }
62 RenderObjectChildList* children() { return &m_children; }
64 FrameEdgeInfo edgeInfo() const;
66 bool userResize(MouseEvent*);
68 bool isResizingRow() const;
69 bool isResizingColumn() const;
71 bool canResizeRow(const IntPoint&) const;
72 bool canResizeColumn(const IntPoint&) const;
74 void notifyFrameEdgeInfoChanged();
77 static const int noSplit = -1;
80 WTF_MAKE_NONCOPYABLE(GridAxis);
86 Vector<bool> m_preventResize;
87 Vector<bool> m_allowBorder;
88 int m_splitBeingResized;
89 int m_splitResizeOffset;
92 virtual RenderObjectChildList* virtualChildren() { return children(); }
93 virtual const RenderObjectChildList* virtualChildren() const { return children(); }
95 virtual const char* renderName() const { return "RenderFrameSet"; }
96 virtual bool isFrameSet() const { return true; }
98 virtual void layout();
99 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
100 virtual void paint(PaintInfo&, const LayoutPoint&);
101 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
102 virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const;
104 inline HTMLFrameSetElement* frameSet() const;
106 bool flattenFrameSet() const;
108 void setIsResizing(bool);
110 void layOutAxis(GridAxis&, const Length*, int availableSpace);
111 void computeEdgeInfo();
112 void fillFromEdgeInfo(const FrameEdgeInfo& edgeInfo, int r, int c);
113 void positionFrames();
114 void positionFramesWithFlattening();
116 int splitPosition(const GridAxis&, int split) const;
117 int hitTestSplit(const GridAxis&, int position) const;
119 void startResizing(GridAxis&, int position);
120 void continueResizing(GridAxis&, int position);
122 void paintRowBorder(const PaintInfo&, const IntRect&);
123 void paintColumnBorder(const PaintInfo&, const IntRect&);
125 RenderObjectChildList m_children;
131 bool m_isChildResizing;
135 inline RenderFrameSet* toRenderFrameSet(RenderObject* object)
137 ASSERT(!object || object->isFrameSet());
138 return static_cast<RenderFrameSet*>(object);
141 // This will catch anyone doing an unnecessary cast.
142 void toRenderFrameSet(const RenderFrameSet*);
144 } // namespace WebCore
146 #endif // RenderFrameSet_h