Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: Source/core/platform/Widget.h

Issue 26936002: Remove Widget's dependency upon its own inheritor aka ScrollView. This was nasty from an OO design… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Fix for clang compile error Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/platform/Scrollbar.cpp ('k') | Source/core/platform/Widget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 27
28 #ifndef Widget_h 28 #ifndef Widget_h
29 #define Widget_h 29 #define Widget_h
30 30
31 #include "platform/geometry/IntRect.h" 31 #include "platform/geometry/IntRect.h"
32 #include "wtf/Forward.h" 32 #include "wtf/Forward.h"
33 #include "wtf/RefCounted.h" 33 #include "wtf/RefCounted.h"
34 34
35 namespace WebCore { 35 namespace WebCore {
36 36
37 class AXObjectCache;
38 class Cursor; 37 class Cursor;
39 class Event; 38 class Event;
40 class GraphicsContext; 39 class GraphicsContext;
41 class ScrollView; 40 class HostWindow;
42 41
43 // The Widget class serves as a base class for three kinds of objects: 42 // The Widget class serves as a base class for three kinds of objects:
44 // (1) Scrollable areas (ScrollView) 43 // (1) Scrollable areas (ScrollView)
45 // (2) Scrollbars (Scrollbar) 44 // (2) Scrollbars (Scrollbar)
46 // (3) Plugins (PluginView) 45 // (3) Plugins (PluginView)
47 // 46 //
48 // Widgets are connected in a hierarchy, with the restriction that plugins and s crollbars are always leaves of the 47 // Widgets are connected in a hierarchy, with the restriction that plugins and
49 // tree. Only ScrollViews can have children (and therefore the Widget class has no concept of children). 48 // scrollbars are always leaves of the tree. Only ScrollViews can have children
49 // (and therefore the Widget class has no concept of children).
50 class Widget : public RefCounted<Widget> { 50 class Widget : public RefCounted<Widget> {
51 public: 51 public:
52 Widget(); 52 Widget();
53 virtual ~Widget(); 53 virtual ~Widget();
54 54
55 int x() const { return frameRect().x(); } 55 int x() const { return frameRect().x(); }
56 int y() const { return frameRect().y(); } 56 int y() const { return frameRect().y(); }
57 int width() const { return frameRect().width(); } 57 int width() const { return frameRect().width(); }
58 int height() const { return frameRect().height(); } 58 int height() const { return frameRect().height(); }
59 IntSize size() const { return frameRect().size(); } 59 IntSize size() const { return frameRect().size(); }
(...skipping 23 matching lines...) Expand all
83 bool isVisible() const { return m_selfVisible && m_parentVisible; } // Wheth er or not we are actually visible. 83 bool isVisible() const { return m_selfVisible && m_parentVisible; } // Wheth er or not we are actually visible.
84 virtual void setParentVisible(bool visible) { m_parentVisible = visible; } 84 virtual void setParentVisible(bool visible) { m_parentVisible = visible; }
85 void setSelfVisible(bool v) { m_selfVisible = v; } 85 void setSelfVisible(bool v) { m_selfVisible = v; }
86 86
87 virtual bool isFrameView() const { return false; } 87 virtual bool isFrameView() const { return false; }
88 virtual bool isPluginView() const { return false; } 88 virtual bool isPluginView() const { return false; }
89 virtual bool isPluginContainer() const { return false; } 89 virtual bool isPluginContainer() const { return false; }
90 virtual bool isScrollbar() const { return false; } 90 virtual bool isScrollbar() const { return false; }
91 virtual bool isScrollView() const { return false; } 91 virtual bool isScrollView() const { return false; }
92 92
93 void removeFromParent(); 93 virtual HostWindow* hostWindow() const;
94 virtual void setParent(ScrollView* view); 94 virtual void setParent(Widget*);
95 ScrollView* parent() const { return m_parent; } 95 Widget* parent() const { return m_parent; }
96 ScrollView* root() const; 96 Widget* root() const;
97 97
98 virtual void handleEvent(Event*) { } 98 virtual void handleEvent(Event*) { }
99 99
100 IntRect convertToRootView(const IntRect&) const; 100 IntRect convertToRootView(const IntRect&) const;
101 IntRect convertFromRootView(const IntRect&) const; 101 IntRect convertFromRootView(const IntRect&) const;
102 102
103 IntPoint convertToRootView(const IntPoint&) const; 103 IntPoint convertToRootView(const IntPoint&) const;
104 IntPoint convertFromRootView(const IntPoint&) const; 104 IntPoint convertFromRootView(const IntPoint&) const;
105 105
106 // It is important for cross-platform code to realize that Mac has flipped c oordinates. Therefore any code 106 // It is important for cross-platform code to realize that Mac has flipped c oordinates. Therefore any code
(...skipping 13 matching lines...) Expand all
120 120
121 // Notifies this widget that its clip rect changed. 121 // Notifies this widget that its clip rect changed.
122 virtual void clipRectChanged() { } 122 virtual void clipRectChanged() { }
123 123
124 // Virtual methods to convert points to/from the containing ScrollView 124 // Virtual methods to convert points to/from the containing ScrollView
125 virtual IntRect convertToContainingView(const IntRect&) const; 125 virtual IntRect convertToContainingView(const IntRect&) const;
126 virtual IntRect convertFromContainingView(const IntRect&) const; 126 virtual IntRect convertFromContainingView(const IntRect&) const;
127 virtual IntPoint convertToContainingView(const IntPoint&) const; 127 virtual IntPoint convertToContainingView(const IntPoint&) const;
128 virtual IntPoint convertFromContainingView(const IntPoint&) const; 128 virtual IntPoint convertFromContainingView(const IntPoint&) const;
129 129
130 // A means to access the AX cache when this object can get a pointer to it. 130 // Virtual methods to convert points to/from child widgets
131 virtual AXObjectCache* axObjectCache() const { return 0; } 131 virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
132 virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
132 133
133 // Notifies this widget that it will no longer be receiving events. 134 // Notifies this widget that it will no longer be receiving events.
134 virtual void eventListenersRemoved() { } 135 virtual void eventListenersRemoved() { }
135 136
136 private: 137 private:
137 ScrollView* m_parent; 138 Widget* m_parent;
138 IntRect m_frame; 139 IntRect m_frame;
139 bool m_selfVisible; 140 bool m_selfVisible;
140 bool m_parentVisible; 141 bool m_parentVisible;
141 }; 142 };
142 143
143 } // namespace WebCore 144 } // namespace WebCore
144 145
145 #endif // Widget_h 146 #endif // Widget_h
OLDNEW
« no previous file with comments | « Source/core/platform/Scrollbar.cpp ('k') | Source/core/platform/Widget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698