initial import
[vuplus_webkit] / Source / WebCore / rendering / RenderReplaced.h
1 /*
2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3  * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  */
21
22 #ifndef RenderReplaced_h
23 #define RenderReplaced_h
24
25 #include "RenderBox.h"
26
27 namespace WebCore {
28
29 class RenderReplaced : public RenderBox {
30 public:
31     RenderReplaced(Node*);
32     RenderReplaced(Node*, const IntSize& intrinsicSize);
33     virtual ~RenderReplaced();
34
35     virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
36     virtual LayoutUnit computeReplacedLogicalHeight() const;
37
38 protected:
39     virtual void willBeDestroyed();
40
41     virtual void layout();
42
43     virtual IntSize intrinsicSize() const;
44
45     virtual int minimumReplacedHeight() const { return 0; }
46
47     virtual void setSelectionState(SelectionState);
48
49     bool isSelected() const;
50
51     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
52
53     void setIntrinsicSize(const IntSize&);
54     virtual void intrinsicSizeChanged();
55     void setHasIntrinsicSize() { m_hasIntrinsicSize = true; }
56
57     virtual void paint(PaintInfo&, const LayoutPoint&);
58     bool shouldPaint(PaintInfo&, const LayoutPoint&);
59     IntRect localSelectionRect(bool checkWhetherSelected = true) const; // This is in local coordinates, but it's a physical rect (so the top left corner is physical top left).
60
61 private:
62     virtual RenderBox* embeddedContentBox() const { return 0; }
63     int computeIntrinsicLogicalWidth(RenderBox* contentRenderer, bool includeMaxWidth) const;
64     int computeIntrinsicLogicalHeight(RenderBox* contentRenderer) const;
65     bool logicalHeightIsAuto() const;
66
67     virtual const char* renderName() const { return "RenderReplaced"; }
68
69     virtual bool canHaveChildren() const { return false; }
70
71     virtual void computePreferredLogicalWidths();
72
73     int calcAspectRatioLogicalWidth() const;
74     int calcAspectRatioLogicalHeight() const;
75
76     virtual void paintReplaced(PaintInfo&, const LayoutPoint&) { }
77
78     virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
79
80     virtual unsigned caretMaxRenderedOffset() const;
81     virtual VisiblePosition positionForPoint(const LayoutPoint&);
82     
83     virtual bool canBeSelectionLeaf() const { return true; }
84
85     virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);
86
87     IntSize m_intrinsicSize;
88     bool m_hasIntrinsicSize;
89 };
90
91 }
92
93 #endif