Changeset 36647 in webkit


Ignore:
Timestamp:
Sep 18, 2008 8:16:26 PM (16 years ago)
Author:
hyatt@apple.com
Message:

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):
Location:
trunk/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r36645 r36647  
     12008-09-18  David Hyatt  <hyatt@apple.com>
     2
     3        Move to only one constructor for Widgets.  Rename data to m_data and make
     4        it have an #ifdef only for platforms that have platform-specific data (Mac
     5        and Gtk).
     6
     7        Reviewed by Sam Weinig
     8
     9        * WebCore.base.exp:
     10        * platform/Widget.cpp:
     11        (WebCore::Widget::init):
     12        * platform/Widget.h:
     13        * platform/gtk/WidgetGtk.cpp:
     14        (WebCore::Widget::Widget):
     15        (WebCore::Widget::~Widget):
     16        (WebCore::Widget::cursor):
     17        (WebCore::Widget::setCursor):
     18        * platform/mac/WidgetMac.mm:
     19        (WebCore::Widget::Widget):
     20        (WebCore::Widget::~Widget):
     21        (WebCore::Widget::addToSuperview):
     22        (WebCore::Widget::removeFromSuperview):
     23        (WebCore::Widget::beforeMouseDown):
     24        (WebCore::Widget::afterMouseDown):
     25        * platform/qt/WidgetQt.cpp:
     26        (WebCore::Widget::Widget):
     27        * platform/win/WidgetWin.cpp:
     28        (WebCore::Widget::Widget):
     29        * platform/wx/WidgetWx.cpp:
     30        (WebCore::Widget::Widget):
     31
    1322008-09-18  David Hyatt  <hyatt@apple.com>
    233
  • trunk/WebCore/WebCore.base.exp

    r36620 r36647  
    543543__ZN7WebCore6Widget8setFocusEv
    544544__ZN7WebCore6WidgetC1EP6NSView
    545 __ZN7WebCore6WidgetC1Ev
    546545__ZN7WebCore6WidgetC2EP6NSView
    547546__ZN7WebCore6WidgetD2Ev
  • trunk/WebCore/platform/Widget.cpp

    r36646 r36647  
    3434namespace WebCore {
    3535
    36 void Widget::init()
     36void Widget::init(PlatformWidget widget)
    3737{
    3838    m_parent = 0;
    39     m_widget = 0;
    4039    m_selfVisible = false;
    4140    m_parentVisible = false;
    4241    m_containingWindow = 0;
     42    m_widget = widget;
     43    if (m_widget)
     44        retainPlatformWidget();
    4345}
    4446
  • trunk/WebCore/platform/Widget.h

    r36645 r36647  
    103103class Widget {
    104104public:
    105     Widget();
    106     Widget(PlatformWidget);
     105    Widget(PlatformWidget = 0);
    107106    virtual ~Widget();
    108107   
     
    188187
    189188private:
    190     void init(); // Must be called by all Widget constructors to initialize cross-platform data.
     189    void init(PlatformWidget); // Must be called by all Widget constructors to initialize cross-platform data.
    191190
    192191    void releasePlatformWidget();
     
    203202
    204203#if PLATFORM(MAC) || PLATFORM(GTK)
    205     WidgetPrivate* data;
     204    WidgetPrivate* m_data;
    206205#endif
    207206};
  • trunk/WebCore/platform/gtk/WidgetGtk.cpp

    r36643 r36647  
    4646};
    4747
    48 Widget::Widget()
    49     : data(new WidgetPrivate)
     48Widget::Widget(PlatformWidget widget)
     49    : m_data(new WidgetPrivate)
    5050{
    51     init();
    52     data->cursor = 0;
    53 }
    54 
    55 Widget::Widget(PlatformWidget widget)
    56     : data(new WidgetPrivate)
    57 {
    58     init();
    59     m_widget = widget;
    60     data->cursor = 0;
     51    init(widget);
     52    m_data->cursor = 0;
    6153}
    6254
     
    6456{
    6557    ASSERT(!parent());
    66     delete data;
     58    delete m_data;
    6759}
    6860
     
    7971Cursor Widget::cursor()
    8072{
    81     return Cursor(data->cursor);
     73    return Cursor(m_data->cursor);
    8274}
    8375
     
    9789    // expensive operation, so avoid it if possible.
    9890
    99     if (pcur == data->cursor)
     91    if (pcur == m_data->cursor)
    10092        return;
    10193
    10294    gdk_window_set_cursor(gdkDrawable(platformWidget()) ? GDK_WINDOW(gdkDrawable(platformWidget())) : GTK_WIDGET(containingWindow())->window, pcur);
    103     data->cursor = pcur;
     95    m_data->cursor = pcur;
    10496}
    10597
  • trunk/WebCore/platform/mac/WidgetMac.mm

    r36642 r36647  
    7676}
    7777
    78 Widget::Widget() : data(new WidgetPrivate)
    79 {
    80     init();
    81     data->mustStayInWindow = false;
    82     data->removeFromSuperviewSoon = false;
    83 }
    84 
    85 Widget::Widget(NSView* view) : data(new WidgetPrivate)
    86 {
    87     init();
    88     setPlatformWidget(view);
    89     data->mustStayInWindow = false;
    90     data->removeFromSuperviewSoon = false;
     78Widget::Widget(NSView* view)
     79    : m_data(new WidgetPrivate)
     80{
     81    init(view);
     82    m_data->mustStayInWindow = false;
     83    m_data->removeFromSuperviewSoon = false;
    9184}
    9285
     
    9487{
    9588    releasePlatformWidget();
    96     delete data;
     89    delete m_data;
    9790}
    9891
     
    269262    if ([subview superview] != view)
    270263        [view addSubview:subview];
    271     data->removeFromSuperviewSoon = false;
     264    m_data->removeFromSuperviewSoon = false;
    272265    [window _setNeedsToResetDragMargins:resetDragMargins];
    273266
     
    277270void Widget::removeFromSuperview()
    278271{
    279     if (data->mustStayInWindow)
    280         data->removeFromSuperviewSoon = true;
     272    if (m_data->mustStayInWindow)
     273        m_data->removeFromSuperviewSoon = true;
    281274    else {
    282         data->removeFromSuperviewSoon = false;
     275        m_data->removeFromSuperviewSoon = false;
    283276        BEGIN_BLOCK_OBJC_EXCEPTIONS;
    284277        safeRemoveFromSuperview(getOuterView());
     
    291284    if (widget) {
    292285        ASSERT(view == widget->getOuterView());
    293         ASSERT(!widget->data->mustStayInWindow);
    294         widget->data->mustStayInWindow = true;
     286        ASSERT(!widget->m_data->mustStayInWindow);
     287        widget->m_data->mustStayInWindow = true;
    295288    }
    296289}
     
    303296        END_BLOCK_OBJC_EXCEPTIONS;
    304297    } else {
    305         ASSERT(widget->data->mustStayInWindow);
    306         widget->data->mustStayInWindow = false;
    307         if (widget->data->removeFromSuperviewSoon)
     298        ASSERT(widget->m_data->mustStayInWindow);
     299        widget->m_data->mustStayInWindow = false;
     300        if (widget->m_data->removeFromSuperviewSoon)
    308301            widget->removeFromSuperview();
    309302    }
  • trunk/WebCore/platform/qt/WidgetQt.cpp

    r36645 r36647  
    5454namespace WebCore {
    5555
    56 Widget::Widget()
    57 {
    58     init();
    59 }
    60 
    6156Widget::Widget(QWidget* widget)
    6257{
    63     init();
    64     m_widget = widget;
     58    init(widget);
    6559}
    6660
  • trunk/WebCore/platform/win/WidgetWin.cpp

    r36645 r36647  
    3939namespace WebCore {
    4040
    41 Widget::Widget()
    42 {
    43     init();
    44 }
    45 
    4641Widget::Widget(PlatformWidget widget)
    4742{
    48     init();
    49     m_widget = widget;
     43    init(widget);
    5044}
    5145
  • trunk/WebCore/platform/wx/WidgetWx.cpp

    r36645 r36647  
    3535namespace WebCore {
    3636
    37 Widget::Widget()
    38 {
    39     init();
    40 }
    41 
    4237Widget::Widget(PlatformWidget widget)
    4338{
    44     init();
    45     m_widget = widget;
     39    init(widget);
    4640}
    4741
Note: See TracChangeset for help on using the changeset viewer.