Home | History | Annotate | Download | only in rendering
      1 /*
      2  * Copyright (C) 1999 Lars Knoll (knoll (at) kde.org)
      3  * Copyright (C) 2004, 2005, 2006, 2009, 2010 Apple Inc. All rights reserved.
      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 RenderWidget_h
     23 #define RenderWidget_h
     24 
     25 #include "core/rendering/RenderReplaced.h"
     26 #include "platform/Widget.h"
     27 
     28 namespace WebCore {
     29 
     30 class RenderWidget : public RenderReplaced {
     31 public:
     32     virtual ~RenderWidget();
     33 
     34     Widget* widget() const;
     35 
     36     void updateOnWidgetChange();
     37     void updateWidgetPosition();
     38     void widgetPositionsUpdated();
     39 
     40     void setIsOverlapped(bool);
     41 
     42     void ref() { ++m_refCount; }
     43     void deref();
     44 
     45     virtual bool isWidget() const OVERRIDE FINAL { return true; }
     46     bool updateWidgetGeometry();
     47 
     48 protected:
     49     explicit RenderWidget(Element*);
     50 
     51     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE FINAL;
     52     virtual void layout() OVERRIDE;
     53     virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
     54     virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const OVERRIDE FINAL;
     55     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
     56 
     57     virtual void paintContents(PaintInfo&, const LayoutPoint&);
     58 
     59 private:
     60     virtual void willBeDestroyed() OVERRIDE FINAL;
     61     virtual void destroy() OVERRIDE FINAL;
     62 
     63     bool setWidgetGeometry(const LayoutRect&);
     64 
     65     int m_refCount;
     66 };
     67 
     68 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderWidget, isWidget());
     69 
     70 } // namespace WebCore
     71 
     72 #endif // RenderWidget_h
     73