2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2009, 2010 Apple Inc. All rights reserved.
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.
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.
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.
22 #ifndef RenderWidget_h
23 #define RenderWidget_h
25 #include "OverlapTestRequestClient.h"
26 #include "RenderReplaced.h"
31 class RenderWidget : public RenderReplaced, private OverlapTestRequestClient {
33 virtual ~RenderWidget();
35 Widget* widget() const { return m_widget.get(); }
36 virtual void setWidget(PassRefPtr<Widget>);
38 static RenderWidget* find(const Widget*);
40 void updateWidgetPosition();
41 void widgetPositionsUpdated();
42 IntRect windowClipRect() const;
44 void notifyWidget(WidgetNotification);
46 static void suspendWidgetHierarchyUpdates();
47 static void resumeWidgetHierarchyUpdates();
49 RenderArena* ref() { ++m_refCount; return renderArena(); }
50 void deref(RenderArena*);
55 FrameView* frameView() const { return m_frameView; }
59 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
60 virtual void layout();
61 virtual void paint(PaintInfo&, const LayoutPoint&);
64 virtual bool isWidget() const { return true; }
66 virtual void willBeDestroyed();
67 virtual void destroy();
68 virtual void setSelectionState(SelectionState);
69 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
70 virtual void setOverlapTestResult(bool);
72 bool setWidgetGeometry(const IntRect&, const IntSize&);
74 RefPtr<Widget> m_widget;
75 FrameView* m_frameView;
76 IntRect m_clipRect; // The rectangle needs to remain correct after scrolling, so it is stored in content view coordinates, and not clipped to window.
80 inline RenderWidget* toRenderWidget(RenderObject* object)
82 ASSERT(!object || object->isWidget());
83 return static_cast<RenderWidget*>(object);
86 inline const RenderWidget* toRenderWidget(const RenderObject* object)
88 ASSERT(!object || object->isWidget());
89 return static_cast<const RenderWidget*>(object);
92 // This will catch anyone doing an unnecessary cast.
93 void toRenderWidget(const RenderWidget*);
95 } // namespace WebCore
97 #endif // RenderWidget_h