root/trunk/WebCore/rendering/RenderReplaced.h

Revision 37464, 2.8 kB (checked in by simon.fraser@apple.com, 2 days ago)

2008-10-09 Simon Fraser <simon.fraser@apple.com>

Reviewed by Dave Hyatt

https://bugs.webkit.org/show_bug.cgi?id=20947

Refactor setStyle() methods into styleWillChange()
and styleDidChange(), so most of the setStyle() overrides can
be removed.

  • Property svn:eol-style set to native
Line 
1/*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc.
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
27namespace WebCore {
28
29class RenderReplaced : public RenderBox {
30public:
31    RenderReplaced(Node*);
32    RenderReplaced(Node*, const IntSize& intrinsicSize);
33    virtual ~RenderReplaced();
34
35    virtual const char* renderName() const { return "RenderReplaced"; }
36
37    virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
38    virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;
39
40    virtual void calcPrefWidths();
41   
42    virtual void layout();
43    virtual int minimumReplacedHeight() const { return 0; }
44
45    virtual void paint(PaintInfo&, int tx, int ty);
46    virtual void paintReplaced(PaintInfo&, int tx, int ty) { }
47
48    virtual IntSize intrinsicSize() const;
49
50    virtual int overflowHeight(bool includeInterior = true) const;
51    virtual int overflowWidth(bool includeInterior = true) const;
52    virtual int overflowLeft(bool includeInterior = true) const;
53    virtual int overflowTop(bool includeInterior = true) const;
54    virtual IntRect overflowRect(bool includeInterior = true) const;
55
56    virtual unsigned caretMaxRenderedOffset() const;
57    virtual VisiblePosition positionForCoordinates(int x, int y);
58   
59    virtual bool canBeSelectionLeaf() const { return true; }
60    virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
61    virtual void setSelectionState(SelectionState);
62    virtual IntRect selectionRect(bool clipToVisibleContent = true);
63
64    bool isSelected() const;
65
66protected:
67    virtual void styleDidChange(RenderStyle::Diff, const RenderStyle* oldStyle);
68
69    void setIntrinsicSize(const IntSize&);
70    virtual void intrinsicSizeChanged();
71
72    bool shouldPaint(PaintInfo&, int& tx, int& ty);
73    void adjustOverflowForBoxShadow();
74
75private:
76    IntSize m_intrinsicSize;
77   
78    unsigned m_selectionState : 3; // SelectionState
79    bool m_hasOverflow : 1;
80};
81
82}
83
84#endif
Note: See TracBrowser for help on using the browser.