| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Collabora Ltd. All rights reserved. | 3 * Copyright (C) 2008 Collabora Ltd. All rights reserved. |
| 4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #define FrameViewBase_h | 29 #define FrameViewBase_h |
| 30 | 30 |
| 31 #include "platform/PlatformExport.h" | 31 #include "platform/PlatformExport.h" |
| 32 #include "platform/geometry/FloatPoint.h" | 32 #include "platform/geometry/FloatPoint.h" |
| 33 #include "platform/geometry/IntRect.h" | 33 #include "platform/geometry/IntRect.h" |
| 34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
| 35 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class CullRect; | |
| 40 class Event; | 39 class Event; |
| 41 class GraphicsContext; | |
| 42 | 40 |
| 43 // The FrameViewBase class serves as a base class for FrameView, Scrollbar, and | 41 // The FrameViewBase class serves as a base class for FrameView, Scrollbar, and |
| 44 // PluginView. | 42 // PluginView. |
| 45 // | 43 // |
| 46 // FrameViewBases are connected in a hierarchy, with the restriction that | 44 // FrameViewBases are connected in a hierarchy, with the restriction that |
| 47 // plugins and scrollbars are always leaves of the tree. Only FrameView can have | 45 // plugins and scrollbars are always leaves of the tree. Only FrameView can have |
| 48 // children (and therefore the FrameViewBase class has no concept of children). | 46 // children (and therefore the FrameViewBase class has no concept of children). |
| 49 class PLATFORM_EXPORT FrameViewBase | 47 class PLATFORM_EXPORT FrameViewBase |
| 50 : public GarbageCollectedFinalized<FrameViewBase> { | 48 : public GarbageCollectedFinalized<FrameViewBase> { |
| 51 public: | 49 public: |
| 52 FrameViewBase(); | 50 FrameViewBase(); |
| 53 virtual ~FrameViewBase(); | 51 virtual ~FrameViewBase(); |
| 54 | 52 |
| 55 int X() const { return FrameRect().X(); } | 53 int X() const { return FrameRect().X(); } |
| 56 int Y() const { return FrameRect().Y(); } | 54 int Y() const { return FrameRect().Y(); } |
| 57 int Width() const { return FrameRect().Width(); } | 55 int Width() const { return FrameRect().Width(); } |
| 58 int Height() const { return FrameRect().Height(); } | 56 int Height() const { return FrameRect().Height(); } |
| 59 IntSize Size() const { return FrameRect().Size(); } | 57 IntSize Size() const { return FrameRect().Size(); } |
| 60 IntPoint Location() const { return FrameRect().Location(); } | 58 IntPoint Location() const { return FrameRect().Location(); } |
| 61 | 59 |
| 62 virtual void SetFrameRect(const IntRect& frame_rect) { | 60 virtual void SetFrameRect(const IntRect& frame_rect) { |
| 63 frame_rect_ = frame_rect; | 61 frame_rect_ = frame_rect; |
| 64 } | 62 } |
| 65 const IntRect& FrameRect() const { return frame_rect_; } | 63 const IntRect& FrameRect() const { return frame_rect_; } |
| 66 IntRect BoundsRect() const { return IntRect(0, 0, Width(), Height()); } | |
| 67 | 64 |
| 68 void Resize(int w, int h) { SetFrameRect(IntRect(X(), Y(), w, h)); } | 65 void Resize(int w, int h) { SetFrameRect(IntRect(X(), Y(), w, h)); } |
| 69 void Resize(const IntSize& s) { SetFrameRect(IntRect(Location(), s)); } | 66 void Resize(const IntSize& s) { SetFrameRect(IntRect(Location(), s)); } |
| 70 | 67 |
| 71 virtual void Paint(GraphicsContext&, const CullRect&) const {} | |
| 72 void Invalidate() { InvalidateRect(BoundsRect()); } | |
| 73 virtual void InvalidateRect(const IntRect&) = 0; | |
| 74 | |
| 75 virtual void Show() {} | |
| 76 virtual void Hide() {} | |
| 77 bool IsSelfVisible() const { | 68 bool IsSelfVisible() const { |
| 78 return self_visible_; | 69 return self_visible_; |
| 79 } // Whether or not we have been explicitly marked as visible or not. | 70 } // Whether or not we have been explicitly marked as visible or not. |
| 80 bool IsParentVisible() const { | 71 bool IsParentVisible() const { |
| 81 return parent_visible_; | 72 return parent_visible_; |
| 82 } // Whether or not our parent is visible. | 73 } // Whether or not our parent is visible. |
| 83 bool IsVisible() const { | 74 bool IsVisible() const { |
| 84 return self_visible_ && parent_visible_; | 75 return self_visible_ && parent_visible_; |
| 85 } // Whether or not we are actually visible. | 76 } // Whether or not we are actually visible. |
| 86 virtual void SetParentVisible(bool visible) { parent_visible_ = visible; } | 77 virtual void SetParentVisible(bool visible) { parent_visible_ = visible; } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 private: | 120 private: |
| 130 Member<FrameViewBase> parent_; | 121 Member<FrameViewBase> parent_; |
| 131 IntRect frame_rect_; | 122 IntRect frame_rect_; |
| 132 bool self_visible_; | 123 bool self_visible_; |
| 133 bool parent_visible_; | 124 bool parent_visible_; |
| 134 }; | 125 }; |
| 135 | 126 |
| 136 } // namespace blink | 127 } // namespace blink |
| 137 | 128 |
| 138 #endif // FrameViewBase_h | 129 #endif // FrameViewBase_h |
| OLD | NEW |