Skip to content
Permalink
Browse files
2008-09-18 David Hyatt <hyatt@apple.com>
        Move to only one constructor for Widgets.  Rename data to m_data and make
        it have an #ifdef only for platforms that have platform-specific data (Mac
        and Gtk).

        Reviewed by Sam Weinig

        * WebCore.base.exp:
        * platform/Widget.cpp:
        (WebCore::Widget::init):
        * platform/Widget.h:
        * platform/gtk/WidgetGtk.cpp:
        (WebCore::Widget::Widget):
        (WebCore::Widget::~Widget):
        (WebCore::Widget::cursor):
        (WebCore::Widget::setCursor):
        * platform/mac/WidgetMac.mm:
        (WebCore::Widget::Widget):
        (WebCore::Widget::~Widget):
        (WebCore::Widget::addToSuperview):
        (WebCore::Widget::removeFromSuperview):
        (WebCore::Widget::beforeMouseDown):
        (WebCore::Widget::afterMouseDown):
        * platform/qt/WidgetQt.cpp:
        (WebCore::Widget::Widget):
        * platform/win/WidgetWin.cpp:
        (WebCore::Widget::Widget):
        * platform/wx/WidgetWx.cpp:
        (WebCore::Widget::Widget):



Canonical link: https://commits.webkit.org/28926@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@36647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
David Hyatt committed Sep 19, 2008
1 parent 2ad8b82 commit b237c55e5e330830b82c7366add3befe3db3542f
Showing 9 changed files with 63 additions and 65 deletions.
@@ -1,3 +1,34 @@
2008-09-18 David Hyatt <hyatt@apple.com>

Move to only one constructor for Widgets. Rename data to m_data and make
it have an #ifdef only for platforms that have platform-specific data (Mac
and Gtk).

Reviewed by Sam Weinig

* WebCore.base.exp:
* platform/Widget.cpp:
(WebCore::Widget::init):
* platform/Widget.h:
* platform/gtk/WidgetGtk.cpp:
(WebCore::Widget::Widget):
(WebCore::Widget::~Widget):
(WebCore::Widget::cursor):
(WebCore::Widget::setCursor):
* platform/mac/WidgetMac.mm:
(WebCore::Widget::Widget):
(WebCore::Widget::~Widget):
(WebCore::Widget::addToSuperview):
(WebCore::Widget::removeFromSuperview):
(WebCore::Widget::beforeMouseDown):
(WebCore::Widget::afterMouseDown):
* platform/qt/WidgetQt.cpp:
(WebCore::Widget::Widget):
* platform/win/WidgetWin.cpp:
(WebCore::Widget::Widget):
* platform/wx/WidgetWx.cpp:
(WebCore::Widget::Widget):

2008-09-18 David Hyatt <hyatt@apple.com>

Move Qt's isNPAPIPlugin boolean from Widget down to PluginView, since there
@@ -542,7 +542,6 @@ __ZN7WebCore6Widget4showEv
__ZN7WebCore6Widget5paintEPNS_15GraphicsContextERKNS_7IntRectE
__ZN7WebCore6Widget8setFocusEv
__ZN7WebCore6WidgetC1EP6NSView
__ZN7WebCore6WidgetC1Ev
__ZN7WebCore6WidgetC2EP6NSView
__ZN7WebCore6WidgetD2Ev
__ZN7WebCore7IntSizeC1ERK7_NSSize
@@ -33,13 +33,15 @@

namespace WebCore {

void Widget::init()
void Widget::init(PlatformWidget widget)
{
m_parent = 0;
m_widget = 0;
m_selfVisible = false;
m_parentVisible = false;
m_containingWindow = 0;
m_widget = widget;
if (m_widget)
retainPlatformWidget();
}

void Widget::setParent(ScrollView* view)
@@ -102,8 +102,7 @@ class WidgetPrivate;
//
class Widget {
public:
Widget();
Widget(PlatformWidget);
Widget(PlatformWidget = 0);
virtual ~Widget();

PlatformWidget platformWidget() const { return m_widget; }
@@ -187,7 +186,7 @@ class Widget {
#endif

private:
void init(); // Must be called by all Widget constructors to initialize cross-platform data.
void init(PlatformWidget); // Must be called by all Widget constructors to initialize cross-platform data.

void releasePlatformWidget();
void retainPlatformWidget();
@@ -202,7 +201,7 @@ class Widget {
PlatformWindow m_containingWindow; // Not used when a native widget exists.

#if PLATFORM(MAC) || PLATFORM(GTK)
WidgetPrivate* data;
WidgetPrivate* m_data;
#endif
};

@@ -45,25 +45,17 @@ class WidgetPrivate {
GdkCursor* cursor;
};

Widget::Widget()
: data(new WidgetPrivate)
{
init();
data->cursor = 0;
}

Widget::Widget(PlatformWidget widget)
: data(new WidgetPrivate)
: m_data(new WidgetPrivate)
{
init();
m_widget = widget;
data->cursor = 0;
init(widget);
m_data->cursor = 0;
}

Widget::~Widget()
{
ASSERT(!parent());
delete data;
delete m_data;
}

PlatformWidget Widget::containingWindow() const
@@ -78,7 +70,7 @@ void Widget::setFocus()

Cursor Widget::cursor()
{
return Cursor(data->cursor);
return Cursor(m_data->cursor);
}

static GdkDrawable* gdkDrawable(PlatformWidget widget)
@@ -96,11 +88,11 @@ void Widget::setCursor(const Cursor& cursor)
// gdk_window_set_cursor() in certain GDK backends seems to be an
// expensive operation, so avoid it if possible.

if (pcur == data->cursor)
if (pcur == m_data->cursor)
return;

gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(containingWindow())->window, pcur);
data->cursor = pcur;
m_data->cursor = pcur;
}

void Widget::show()
@@ -75,25 +75,18 @@ static void safeRemoveFromSuperview(NSView *view)
[window _setNeedsToResetDragMargins:resetDragMargins];
}

Widget::Widget() : data(new WidgetPrivate)
Widget::Widget(NSView* view)
: m_data(new WidgetPrivate)
{
init();
data->mustStayInWindow = false;
data->removeFromSuperviewSoon = false;
}

Widget::Widget(NSView* view) : data(new WidgetPrivate)
{
init();
setPlatformWidget(view);
data->mustStayInWindow = false;
data->removeFromSuperviewSoon = false;
init(view);
m_data->mustStayInWindow = false;
m_data->removeFromSuperviewSoon = false;
}

Widget::~Widget()
{
releasePlatformWidget();
delete data;
delete m_data;
}

// FIXME: Should move this to Chrome; bad layering that this knows about Frame.
@@ -268,18 +261,18 @@ static void safeRemoveFromSuperview(NSView *view)
[window _setNeedsToResetDragMargins:NO];
if ([subview superview] != view)
[view addSubview:subview];
data->removeFromSuperviewSoon = false;
m_data->removeFromSuperviewSoon = false;
[window _setNeedsToResetDragMargins:resetDragMargins];

END_BLOCK_OBJC_EXCEPTIONS;
}

void Widget::removeFromSuperview()
{
if (data->mustStayInWindow)
data->removeFromSuperviewSoon = true;
if (m_data->mustStayInWindow)
m_data->removeFromSuperviewSoon = true;
else {
data->removeFromSuperviewSoon = false;
m_data->removeFromSuperviewSoon = false;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
safeRemoveFromSuperview(getOuterView());
END_BLOCK_OBJC_EXCEPTIONS;
@@ -290,8 +283,8 @@ static void safeRemoveFromSuperview(NSView *view)
{
if (widget) {
ASSERT(view == widget->getOuterView());
ASSERT(!widget->data->mustStayInWindow);
widget->data->mustStayInWindow = true;
ASSERT(!widget->m_data->mustStayInWindow);
widget->m_data->mustStayInWindow = true;
}
}

@@ -302,9 +295,9 @@ static void safeRemoveFromSuperview(NSView *view)
safeRemoveFromSuperview(view);
END_BLOCK_OBJC_EXCEPTIONS;
} else {
ASSERT(widget->data->mustStayInWindow);
widget->data->mustStayInWindow = false;
if (widget->data->removeFromSuperviewSoon)
ASSERT(widget->m_data->mustStayInWindow);
widget->m_data->mustStayInWindow = false;
if (widget->m_data->removeFromSuperviewSoon)
widget->removeFromSuperview();
}
}
@@ -53,15 +53,9 @@

namespace WebCore {

Widget::Widget()
{
init();
}

Widget::Widget(QWidget* widget)
{
init();
m_widget = widget;
init(widget);
}

Widget::~Widget()
@@ -38,15 +38,9 @@

namespace WebCore {

Widget::Widget()
{
init();
}

Widget::Widget(PlatformWidget widget)
{
init();
m_widget = widget;
init(widget);
}

Widget::~Widget()
@@ -34,15 +34,9 @@

namespace WebCore {

Widget::Widget()
{
init();
}

Widget::Widget(PlatformWidget widget)
{
init();
m_widget = widget;
init(widget);
}

Widget::~Widget()

0 comments on commit b237c55

Please sign in to comment.