Changeset 57521 in webkit
- Timestamp:
- Apr 13, 2010 10:20:44 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r57520 r57521 1 2010-04-13 Stephan Aßmus <superstippi@gmx.de> 2 3 Reviewed by David Levin. 4 5 [Haiku] Fix bridging Widget to native top-level BView. 6 https://bugs.webkit.org/show_bug.cgi?id=37419 7 8 In the Haiku port, there is no mapping between native widgets 9 and WebCore Widget instances. There is only a top-level BView 10 which renders a web page into a bitmap. For certain WebCore widget 11 functionality, we need to access this BView, like for setting the 12 current cursor or forcing focus. On the other hand, setting a 13 platform widget pointer on Widget results into completely different 14 behavior, like ScrollView tries to forward everything instead of 15 handling stuff itself. To make this work, the pointer to a "top-level" 16 BView is stored in every Widget for the Haiku port. 17 18 No new tests needed. 19 20 * platform/Widget.h: 21 - Added the m_topLevelPlatformWidget member for the Haiku platform. 22 (WebCore::Widget::setPlatformWidget): 23 (WebCore::Widget::topLevelPlatformWidget): 24 (WebCore::Widget::setTopLevelPlatformWidget): 25 * platform/haiku/WidgetHaiku.cpp: 26 (WebCore::AutoPlatformWidgetLocker::AutoPlatformWidgetLocker): 27 (WebCore::AutoPlatformWidgetLocker::~AutoPlatformWidgetLocker): 28 (WebCore::AutoPlatformWidgetLocker::isLocked): 29 - helper class for locking the BView looper thread with a timeout 30 (WebCore::Widget::Widget): 31 (WebCore::Widget::setFocus): 32 - Make sure the top-level view receives keyboard input. 33 (WebCore::Widget::setCursor): 34 - Set the cursor on the top-level view. 35 (WebCore::Widget::show): 36 (WebCore::Widget::hide): 37 - Don't show/hide the top-level view, but make the code correct 38 for whenever we would map an individual BView per Widget. 39 - Use setSelfVisible() and isParentVisible() like in other ports. 40 1 41 2010-04-13 Jeremy Moskovich <jeremy@chromium.org> 2 42 -
trunk/WebCore/platform/Widget.h
r55633 r57521 22 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 25 */ 26 26 … … 118 118 PlatformWidget platformWidget() const { return m_widget; } 119 119 void setPlatformWidget(PlatformWidget widget) 120 { 120 { 121 121 if (widget != m_widget) { 122 122 releasePlatformWidget(); … … 125 125 } 126 126 } 127 #if PLATFORM(HAIKU) 128 PlatformWidget topLevelPlatformWidget() const { return m_topLevelPlatformWidget; } 129 void setTopLevelPlatformWidget(PlatformWidget widget) 130 { 131 m_topLevelPlatformWidget = widget; 132 } 133 #endif 127 134 128 135 int x() const { return frameRect().x(); } … … 162 169 virtual bool isFrameView() const { return false; } 163 170 virtual bool isPluginView() const { return false; } 164 // FIXME: The Mac plug-in code should inherit from PluginView. When this happens PluginWidget and PluginView can become one class. 171 // FIXME: The Mac plug-in code should inherit from PluginView. When this happens PluginWidget and PluginView can become one class. 165 172 virtual bool isPluginWidget() const { return false; } 166 173 virtual bool isScrollbar() const { return false; } … … 179 186 IntRect convertToContainingWindow(const IntRect&) const; 180 187 IntRect convertFromContainingWindow(const IntRect&) const; 181 188 182 189 IntPoint convertToContainingWindow(const IntPoint&) const; 183 190 IntPoint convertFromContainingWindow(const IntPoint&) const; … … 190 197 #if PLATFORM(MAC) 191 198 NSView* getOuterView() const; 192 199 193 200 static void beforeMouseDown(NSView*, Widget*); 194 201 static void afterMouseDown(NSView*, Widget*); … … 208 215 void releasePlatformWidget(); 209 216 void retainPlatformWidget(); 210 217 211 218 // These methods are used to convert from the root widget to the containing window, 212 219 // which has behavior that may differ between platforms (e.g. Mac uses flipped window coordinates). 213 220 static IntRect convertFromRootToContainingWindow(const Widget* rootWidget, const IntRect&); 214 221 static IntRect convertFromContainingWindowToRoot(const Widget* rootWidget, const IntRect&); 215 222 216 223 static IntPoint convertFromRootToContainingWindow(const Widget* rootWidget, const IntPoint&); 217 224 static IntPoint convertFromContainingWindowToRoot(const Widget* rootWidget, const IntPoint&); … … 222 229 bool m_selfVisible; 223 230 bool m_parentVisible; 224 231 225 232 IntRect m_frame; // Not used when a native widget exists. 226 233 … … 228 235 WidgetPrivate* m_data; 229 236 #endif 237 #if PLATFORM(HAIKU) 238 PlatformWidget m_topLevelPlatformWidget; 239 #endif 230 240 }; 231 241 -
trunk/WebCore/platform/haiku/WidgetHaiku.cpp
r46923 r57521 1 1 /* 2 2 * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> 3 * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de> 3 4 * 4 5 * All rights reserved. … … 30 31 31 32 #include "Cursor.h" 32 #include "GraphicsContext.h"33 33 #include "IntRect.h" 34 34 #include "NotImplemented.h" 35 #include <Control.h>36 35 #include <View.h> 37 38 36 39 37 namespace WebCore { 40 38 39 class AutoPlatformWidgetLocker { 40 public: 41 AutoPlatformWidgetLocker(PlatformWidget widget) 42 : m_widget(widget) 43 { 44 if (!m_widget || m_widget->LockLooperWithTimeout(5000) != B_OK) 45 m_widget = 0; 46 } 47 48 ~AutoPlatformWidgetLocker() 49 { 50 if (m_widget) 51 m_widget->UnlockLooper(); 52 } 53 54 bool isLocked() const 55 { 56 return m_widget; 57 } 58 59 private: 60 PlatformWidget m_widget; 61 }; 62 41 63 Widget::Widget(PlatformWidget widget) 64 : m_topLevelPlatformWidget(0) 42 65 { 43 66 init(widget); … … 60 83 void Widget::setFocus() 61 84 { 62 if (platformWidget()) 63 platformWidget()->MakeFocus(); 85 AutoPlatformWidgetLocker locker(topLevelPlatformWidget()); 86 if (locker.isLocked()) 87 topLevelPlatformWidget()->MakeFocus(); 64 88 } 65 89 66 90 void Widget::setCursor(const Cursor& cursor) 67 91 { 68 if (platformWidget()) 69 platformWidget()->SetViewCursor(cursor.impl()); 92 AutoPlatformWidgetLocker locker(topLevelPlatformWidget()); 93 if (locker.isLocked()) 94 topLevelPlatformWidget()->SetViewCursor(cursor.impl()); 70 95 } 71 96 72 97 void Widget::show() 73 98 { 74 if (platformWidget()) 99 setSelfVisible(true); 100 if (!isParentVisible()) 101 return; 102 103 AutoPlatformWidgetLocker locker(platformWidget()); 104 if (locker.isLocked() && platformWidget()->IsHidden()) 75 105 platformWidget()->Show(); 76 106 } … … 78 108 void Widget::hide() 79 109 { 80 if (platformWidget()) 110 setSelfVisible(false); 111 if (!isParentVisible()) 112 return; 113 114 AutoPlatformWidgetLocker locker(platformWidget()); 115 if (locker.isLocked() && !platformWidget()->IsHidden()) 81 116 platformWidget()->Hide(); 82 117 } 83 118 84 void Widget::paint(GraphicsContext* p, IntRect const& r)119 void Widget::paint(GraphicsContext*, IntRect const&) 85 120 { 86 121 notImplemented();
Note: See TracChangeset
for help on using the changeset viewer.