1/*
2 * Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB.  If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21#ifndef RenderDetails_h
22#define RenderDetails_h
23
24#include "RenderFlexibleBox.h"
25#include "Timer.h"
26#include <wtf/OwnPtr.h>
27
28namespace WebCore {
29
30class RenderDetails : public RenderBlock {
31public:
32    explicit RenderDetails(Node*);
33
34    bool isOpen() const;
35    void summaryDestroyed(RenderObject*);
36
37private:
38    virtual const char* renderName() const { return "RenderDetails"; }
39    virtual bool isDetails() const { return true; }
40
41    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
42
43    virtual void addChild(RenderObject* newChild, RenderObject *beforeChild = 0);
44    virtual void removeChild(RenderObject*);
45    virtual void removeLeftoverAnonymousBlock(RenderBlock*) { }
46    virtual bool createsAnonymousWrapper() const { return true; }
47
48    virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
49
50    virtual void layout();
51
52    void replaceMainSummary(RenderObject*);
53    void moveSummaryToContents();
54    void checkMainSummary();
55    RenderObject* getRenderPosition(RenderObject*);
56
57    RenderBlock* summaryBlock();
58    RenderBlock* contentBlock();
59
60    RenderBlock* m_summaryBlock;
61    RenderBlock* m_contentBlock;
62
63    RenderObject* m_mainSummary;
64};
65
66inline RenderDetails* toRenderDetails(RenderObject* object)
67{
68    ASSERT(!object || object->isDetails());
69    return static_cast<RenderDetails*>(object);
70}
71
72// This will catch anyone doing an unnecessary cast.
73void toRenderDetails(const RenderDetails*);
74
75} // namespace WebCore
76
77#endif // RenderDetails_h
78