diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform/Widget.h')
-rw-r--r-- | src/3rdparty/webkit/WebCore/platform/Widget.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/Widget.h b/src/3rdparty/webkit/WebCore/platform/Widget.h index b6c0054144..5fd18faf13 100644 --- a/src/3rdparty/webkit/WebCore/platform/Widget.h +++ b/src/3rdparty/webkit/WebCore/platform/Widget.h @@ -73,6 +73,8 @@ typedef wxWindow* PlatformWidget; #include "IntRect.h" #include "IntSize.h" +#include <wtf/RefCounted.h> + namespace WebCore { class Cursor; @@ -81,7 +83,6 @@ class Font; class GraphicsContext; class PlatformMouseEvent; class ScrollView; -class WidgetClient; class WidgetPrivate; // The Widget class serves as a base class for three kinds of objects: @@ -99,11 +100,11 @@ class WidgetPrivate; // Scrollbar - Mac, Gtk // Plugin - Mac, Windows (windowed only), Qt (windowed only, widget is an HWND on windows), Gtk (windowed only) // -class Widget { +class Widget : public RefCounted<Widget> { public: Widget(PlatformWidget = 0); virtual ~Widget(); - + PlatformWidget platformWidget() const { return m_widget; } void setPlatformWidget(PlatformWidget widget) { @@ -164,9 +165,10 @@ public: // up with an inaccurate rect. Always make sure to use the rect-based convertFromContainingWindow method // when converting window rects. IntRect convertToContainingWindow(const IntRect&) const; - IntPoint convertToContainingWindow(const IntPoint&) const; - IntPoint convertFromContainingWindow(const IntPoint&) const; // See comment above about when not to use this method. IntRect convertFromContainingWindow(const IntRect&) const; + + IntPoint convertToContainingWindow(const IntPoint&) const; + IntPoint convertFromContainingWindow(const IntPoint&) const; virtual void frameRectsChanged() {} @@ -179,12 +181,26 @@ public: void removeFromSuperview(); #endif + // Virtual methods to convert points to/from the containing ScrollView + virtual IntRect convertToContainingView(const IntRect&) const; + virtual IntRect convertFromContainingView(const IntRect&) const; + virtual IntPoint convertToContainingView(const IntPoint&) const; + virtual IntPoint convertFromContainingView(const IntPoint&) const; + private: void init(PlatformWidget); // Must be called by all Widget constructors to initialize cross-platform data. void releasePlatformWidget(); void retainPlatformWidget(); + // These methods are used to convert from the root widget to the containing window, + // which has behavior that may differ between platforms (e.g. Mac uses flipped window coordinates). + static IntRect convertFromRootToContainingWindow(const Widget* rootWidget, const IntRect&); + static IntRect convertFromContainingWindowToRoot(const Widget* rootWidget, const IntRect&); + + static IntPoint convertFromRootToContainingWindow(const Widget* rootWidget, const IntPoint&); + static IntPoint convertFromContainingWindowToRoot(const Widget* rootWidget, const IntPoint&); + private: ScrollView* m_parent; PlatformWidget m_widget; |