diff options
author | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 18:33:11 +0000 |
---|---|---|
committer | avi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 18:33:11 +0000 |
commit | e0751dc32e9a2f42267df6583d6feea0815a9a1a (patch) | |
tree | 438c39a7f782c729b44b9b9cb538f802e270ce4d | |
parent | 27e64ed028a384c7c605dc3a68b1d4b87bf6a9a9 (diff) | |
download | chromium_src-e0751dc32e9a2f42267df6583d6feea0815a9a1a.zip chromium_src-e0751dc32e9a2f42267df6583d6feea0815a9a1a.tar.gz chromium_src-e0751dc32e9a2f42267df6583d6feea0815a9a1a.tar.bz2 |
Bulk fixes to get Mac Test Shell more compile-happy.
Review URL: http://codereview.chromium.org/1818
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1909 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/time.h | 5 | ||||
-rw-r--r-- | webkit/tools/test_shell/event_sending_controller.cc | 54 | ||||
-rw-r--r-- | webkit/tools/test_shell/event_sending_controller.h | 11 | ||||
-rw-r--r-- | webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj | 86 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 37 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 33 | ||||
-rw-r--r-- | webkit/tools/test_shell/webview_host.cc | 9 | ||||
-rw-r--r-- | webkit/tools/test_shell/webview_host.h | 21 | ||||
-rw-r--r-- | webkit/tools/test_shell/webwidget_host.cc | 47 | ||||
-rw-r--r-- | webkit/tools/test_shell/webwidget_host.h | 51 |
10 files changed, 231 insertions, 123 deletions
diff --git a/base/time.h b/base/time.h index cc66eda..427289d 100644 --- a/base/time.h +++ b/base/time.h @@ -375,6 +375,11 @@ class TimeTicks { return ticks_ == 0; } + // Returns the internal numeric value of the TimeTicks object. + int64 ToInternalValue() const { + return ticks_; + } + TimeTicks& operator=(TimeTicks other) { ticks_ = other.ticks_; return *this; diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc index 448c0b5..9314f8d 100644 --- a/webkit/tools/test_shell/event_sending_controller.cc +++ b/webkit/tools/test_shell/event_sending_controller.cc @@ -16,11 +16,14 @@ #include "webkit/tools/test_shell/event_sending_controller.h" +#if defined(OS_WIN) #include <objidl.h> +#endif #include <queue> #include "base/ref_counted.h" #include "base/string_util.h" +#include "base/time.h" #include "webkit/glue/webview.h" #include "webkit/tools/test_shell/test_shell.h" @@ -34,7 +37,12 @@ WebMouseEvent::Button EventSendingController::pressed_button_ = namespace { +#if defined(OS_WIN) static scoped_refptr<IDataObject> drag_data_object; +#elif defined(OS_MACOSX) +// Throughout this file, drag support is #ifdef-ed out. TODO(port): Add it in +// for the Mac. +#endif static bool replaying_saved_events = false; static std::queue<WebMouseEvent> mouse_event_queue; @@ -59,7 +67,9 @@ inline bool outside_multiclick_radius(const gfx::Point &a, const gfx::Point &b) static uint32 time_offset_ms = 0; double GetCurrentEventTimeSec() { - return (GetTickCount() + time_offset_ms) / 1000.0; + return (TimeTicks::Now().ToInternalValue() + / Time::kMicrosecondsPerMillisecond + + time_offset_ms) / 1000.0; } void AdvanceEventTime(int32 delta_ms) { @@ -90,7 +100,9 @@ void ApplyKeyModifiers(const CppVariant* arg, WebKeyboardEvent* event) { event->modifiers |= WebInputEvent::SHIFT_KEY; } else if (!wcscmp(arg_string, L"altKey")) { event->modifiers |= WebInputEvent::ALT_KEY; +#if defined(OS_WIN) event->system_key = true; +#endif } else if (!wcscmp(arg_string, L"metaKey")) { event->modifiers |= WebInputEvent::META_KEY; } @@ -129,8 +141,10 @@ EventSendingController::EventSendingController(TestShell* shell) { void EventSendingController::Reset() { // The test should have finished a drag and the mouse button state. +#if defined(OS_WIN) DCHECK(!drag_data_object); drag_data_object = NULL; +#endif pressed_button_ = WebMouseEvent::BUTTON_NONE; dragMode.Set(true); last_click_time_sec = 0; @@ -141,6 +155,7 @@ void EventSendingController::Reset() { return shell_->webView(); } +#if defined(OS_WIN) /* static */ void EventSendingController::DoDragDrop(IDataObject* data_obj) { drag_data_object = data_obj; @@ -153,6 +168,7 @@ void EventSendingController::Reset() { // Finish processing events. ReplaySavedEvents(); } +#endif // static WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( @@ -219,6 +235,7 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( webview()->HandleInputEvent(&e); pressed_button_ = WebMouseEvent::BUTTON_NONE; +#if defined(OS_WIN) // If we're in a drag operation, complete it. if (drag_data_object) { TestWebViewDelegate* delegate = shell_->delegate(); @@ -240,6 +257,7 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( } drag_data_object = NULL; } +#endif } void EventSendingController::mouseMoveTo( @@ -266,6 +284,7 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( /* static */ void EventSendingController::DoMouseMove(const WebMouseEvent& e) { webview()->HandleInputEvent(&e); +#if defined(OS_WIN) if (pressed_button_ != WebMouseEvent::BUTTON_NONE && drag_data_object) { TestWebViewDelegate* delegate = shell_->delegate(); // Get screen mouse position. @@ -280,6 +299,7 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( delegate->drag_delegate()->GiveFeedback(effect); } +#endif } void EventSendingController::keyDown( @@ -292,8 +312,10 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( static const int kLeftParenthesesVirtualKeyCode = 0x28; static const int kRightParenthesesVirtualKeyCode = 0x29; +#if defined(OS_WIN) static const int kLeftCurlyBracketVirtualKeyCode = 0x7B; static const int kRightCurlyBracketVirtualKeyCode = 0x7D; +#endif bool generate_char = false; @@ -307,6 +329,7 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( // Windows uses \r for "Enter". wchar_t code; bool needs_shift_key_modifier = false; +#if defined(OS_WIN) if (L"\n" == code_str) { generate_char = true; code = VK_RETURN; @@ -320,7 +343,30 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( code = VK_UP; } else if (L"delete" == code_str) { code = VK_BACK; - } else { + } +#elif defined(OS_MACOSX) + // I don't quite understand this code enough to change the way it works. As + // for the keycodes, they were documented once in Inside Macintosh and + // haven't been documented since, either on paper or in a header. The + // reference I'm going by is http://www.meandmark.com/keycodes.html . + // TODO(avi): Find someone who knows keyboard handling in WebCore and have + // them take a look at this. + if (L"\n" == code_str) { + generate_char = true; + code = 0x24; + } else if (L"rightArrow" == code_str) { + code = 0x7C; + } else if (L"downArrow" == code_str) { + code = 0x7D; + } else if (L"leftArrow" == code_str) { + code = 0x7B; + } else if (L"upArrow" == code_str) { + code = 0x7E; + } else if (L"delete" == code_str) { + code = 0x33; + } +#endif + else { DCHECK(code_str.length() == 1); code = code_str[0]; needs_shift_key_modifier = NeedsShiftModifer(code); @@ -378,6 +424,7 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( event_char.key_code = kRightParenthesesVirtualKeyCode; event_char.key_data = kRightParenthesesVirtualKeyCode; break; +#if defined(OS_WIN) // '[{' for US case VK_OEM_4: event_char.key_code = kLeftCurlyBracketVirtualKeyCode; @@ -388,6 +435,7 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( event_char.key_code = kRightCurlyBracketVirtualKeyCode; event_char.key_data = kRightCurlyBracketVirtualKeyCode; break; +#endif default: break; } @@ -404,7 +452,7 @@ WebMouseEvent::Button EventSendingController::GetButtonTypeFromSingleArg( // If code is an uppercase letter, assign a SHIFT key to // event_down.modifier, this logic comes from // WebKit/WebKitTools/DumpRenderTree/Win/EventSender.cpp - if ((LOBYTE(key_code)) >= 'A' && (LOBYTE(key_code)) <= 'Z') + if ((key_code & 0xFF) >= 'A' && (key_code & 0xFF) <= 'Z') return true; return false; } diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h index 4edb60e..d910bd7 100644 --- a/webkit/tools/test_shell/event_sending_controller.h +++ b/webkit/tools/test_shell/event_sending_controller.h @@ -13,15 +13,18 @@ WebKit/WebKitTools/DumpRenderTree/EventSendingController.m */ -#ifndef WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H__ -#define WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H__ +#ifndef WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H_ +#define WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H_ +#include "build/build_config.h" #include "base/gfx/point.h" #include "webkit/glue/cpp_bound_class.h" #include "webkit/glue/webinputevent.h" +#if defined(OS_WIN) struct IDataObject; struct IDropSource; +#endif class TestShell; class WebView; @@ -34,8 +37,10 @@ class EventSendingController : public CppBoundClass { // Resets some static variable state. void Reset(); +#if defined(OS_WIN) // Simulate Windows' drag&drop system call. static void DoDragDrop(IDataObject* drag_data); +#endif // JS callback methods. void mouseDown(const CppArgumentList& args, CppVariant* result); @@ -84,5 +89,5 @@ class EventSendingController : public CppBoundClass { static WebMouseEvent::Button pressed_button_; }; -#endif // WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H__ +#endif // WEBKIT_TOOLS_TEST_SHELL_EVENT_SENDING_CONTROLLER_H_ diff --git a/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj b/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj index d8b5c75..397befb 100644 --- a/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj +++ b/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj @@ -20,7 +20,6 @@ 7BFDF89E0E37B26400F1D7D8 /* libicutu.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BFDF5F60E37ADE100F1D7D8 /* libicutu.a */; }; 7BFDF8A00E37B26400F1D7D8 /* libbase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BFDF6130E37ADE800F1D7D8 /* libbase.a */; }; 7BFDF8A10E37B26400F1D7D8 /* libbase_gfx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BFDF6150E37ADE800F1D7D8 /* libbase_gfx.a */; }; - 7BFDF8A20E37B26400F1D7D8 /* libgoogleurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BFDF61F0E37ADF400F1D7D8 /* libgoogleurl.a */; }; 7BFDF8A30E37B26400F1D7D8 /* libpng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BFDF6240E37ADFC00F1D7D8 /* libpng.a */; }; 7BFDF8A40E37B26400F1D7D8 /* libjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BFDF66A0E37AE2100F1D7D8 /* libjpeg.a */; }; 7BFDF8A50E37B26400F1D7D8 /* libzlib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BFDF6720E37AE2F00F1D7D8 /* libzlib.a */; }; @@ -66,7 +65,7 @@ E456290F0E26B4FE005E4685 /* webview_host.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8A785E0DC553EE005C27B8 /* webview_host.mm */; }; E45629100E26B4FE005E4685 /* webwidget_host.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABD16F380DC6A73B0013D3AA /* webwidget_host.mm */; }; E45629150E26B4FE005E4685 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.mm */; }; - E45629160E26B4FE005E4685 /* event_sending_controller.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8A78520DC553A8005C27B8 /* event_sending_controller.mm */; }; + E45629160E26B4FE005E4685 /* event_sending_controller.cc in Sources */ = {isa = PBXBuildFile; fileRef = AB8A78520DC553A8005C27B8 /* event_sending_controller.cc */; }; E45629170E26B4FE005E4685 /* layout_test_controller.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8A77FD0DC54DD6005C27B8 /* layout_test_controller.mm */; }; E45629180E26B4FE005E4685 /* navigation_controller_base.cc in Sources */ = {isa = PBXBuildFile; fileRef = AB351E5B0DC7B3A5002F427A /* navigation_controller_base.cc */; }; E45629190E26B4FE005E4685 /* test_navigation_controller.cc in Sources */ = {isa = PBXBuildFile; fileRef = AB351E2E0DC7B290002F427A /* test_navigation_controller.cc */; }; @@ -233,13 +232,6 @@ remoteGlobalIDString = 825403B10D92D2E50006B936; remoteInfo = base_gfx; }; - 7BFDF61E0E37ADF400F1D7D8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = AB8665450DC78A5A002CE06A /* googleurl.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = D2AAC046055464E500DB518D; - remoteInfo = googleurl; - }; 7BFDF6230E37ADFC00F1D7D8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = ABC8C3EE0DC7F72600B59C21 /* libpng.xcodeproj */; @@ -345,13 +337,6 @@ remoteGlobalIDString = 825404020D92D3340006B936; remoteInfo = All; }; - 7BFDF8590E37B00600F1D7D8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = AB8665450DC78A5A002CE06A /* googleurl.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = D2AAC045055464E500DB518D; - remoteInfo = googleurl; - }; 7BFDF85B0E37B00800F1D7D8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = ABC8C3EE0DC7F72600B59C21 /* libpng.xcodeproj */; @@ -422,6 +407,20 @@ remoteGlobalIDString = E4BA04540E25613300BE02C6; remoteInfo = bzip2; }; + 82DB3BB30E71881D007B146B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AB8665450DC78A5A002CE06A /* googleurl.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 7BA018360E5A28DB00044150; + remoteInfo = googleurl; + }; + 82DB3BB50E71881D007B146B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AB8665450DC78A5A002CE06A /* googleurl.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 7BA018E20E5A2AFF00044150; + remoteInfo = googleurl_unittests; + }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ @@ -481,11 +480,11 @@ AB351E2F0DC7B290002F427A /* test_navigation_controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test_navigation_controller.h; sourceTree = "<group>"; }; AB351E5B0DC7B3A5002F427A /* navigation_controller_base.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = navigation_controller_base.cc; sourceTree = "<group>"; }; AB351E5C0DC7B3A5002F427A /* navigation_controller_base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = navigation_controller_base.h; sourceTree = "<group>"; }; - AB8665450DC78A5A002CE06A /* googleurl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = googleurl.xcodeproj; path = ../../../../googleurl/build/googleurl.xcodeproj; sourceTree = SOURCE_ROOT; }; + AB8665450DC78A5A002CE06A /* googleurl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = googleurl.xcodeproj; path = ../../../../build/googleurl.xcodeproj; sourceTree = SOURCE_ROOT; }; AB8A77FD0DC54DD6005C27B8 /* layout_test_controller.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = layout_test_controller.mm; sourceTree = "<group>"; }; AB8A77FE0DC54DD6005C27B8 /* layout_test_controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = layout_test_controller.h; sourceTree = "<group>"; }; AB8A78510DC553A8005C27B8 /* event_sending_controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = event_sending_controller.h; sourceTree = "<group>"; }; - AB8A78520DC553A8005C27B8 /* event_sending_controller.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = event_sending_controller.mm; sourceTree = "<group>"; }; + AB8A78520DC553A8005C27B8 /* event_sending_controller.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = event_sending_controller.cc; sourceTree = "<group>"; }; AB8A78540DC553BC005C27B8 /* node_leak_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_leak_test.cc; sourceTree = "<group>"; }; AB8A78560DC553C7005C27B8 /* test_shell_test.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = test_shell_test.mm; sourceTree = "<group>"; }; AB8A78580DC553D7005C27B8 /* test_webview_delegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = test_webview_delegate.mm; sourceTree = "<group>"; }; @@ -534,7 +533,6 @@ 7BFDF8A00E37B26400F1D7D8 /* libbase.a in Frameworks */, 7BFDF8A10E37B26400F1D7D8 /* libbase_gfx.a in Frameworks */, 7BFDF8950E37B26400F1D7D8 /* libGlue_v8_chrome.a in Frameworks */, - 7BFDF8A20E37B26400F1D7D8 /* libgoogleurl.a in Frameworks */, 7BFDF89D0E37B26400F1D7D8 /* libicui18n.a in Frameworks */, 7BFDF89E0E37B26400F1D7D8 /* libicutu.a in Frameworks */, 7BFDF89C0E37B26400F1D7D8 /* libicuuc.a in Frameworks */, @@ -748,14 +746,6 @@ name = Products; sourceTree = "<group>"; }; - 7BFDF61B0E37ADF400F1D7D8 /* Products */ = { - isa = PBXGroup; - children = ( - 7BFDF61F0E37ADF400F1D7D8 /* libgoogleurl.a */, - ); - name = Products; - sourceTree = "<group>"; - }; 7BFDF6200E37ADFC00F1D7D8 /* Products */ = { isa = PBXGroup; children = ( @@ -805,13 +795,22 @@ name = Products; sourceTree = "<group>"; }; + 82DB3BAE0E71881D007B146B /* Products */ = { + isa = PBXGroup; + children = ( + 82DB3BB40E71881D007B146B /* libgoogleurl.a */, + 82DB3BB60E71881D007B146B /* googleurl_unittests */, + ); + name = Products; + sourceTree = "<group>"; + }; AB1E8EFA0DB7B95C00742926 /* test_shell */ = { isa = PBXGroup; children = ( 7BFDF4FD0E37AB4200F1D7D8 /* mac */, AB351E580DC7B399002F427A /* temp */, AB8A78510DC553A8005C27B8 /* event_sending_controller.h */, - AB8A78520DC553A8005C27B8 /* event_sending_controller.mm */, + AB8A78520DC553A8005C27B8 /* event_sending_controller.cc */, AB8A77FD0DC54DD6005C27B8 /* layout_test_controller.mm */, AB8A77FE0DC54DD6005C27B8 /* layout_test_controller.h */, AB8A78540DC553BC005C27B8 /* node_leak_test.cc */, @@ -888,7 +887,6 @@ 7BFDF8540E37AFFF00F1D7D8 /* PBXTargetDependency */, 7BFDF8560E37B00200F1D7D8 /* PBXTargetDependency */, 7BFDF8580E37B00300F1D7D8 /* PBXTargetDependency */, - 7BFDF85A0E37B00600F1D7D8 /* PBXTargetDependency */, 7BFDF85C0E37B00800F1D7D8 /* PBXTargetDependency */, 7BFDF85E0E37B00B00F1D7D8 /* PBXTargetDependency */, 7BFDF8600E37B00D00F1D7D8 /* PBXTargetDependency */, @@ -921,7 +919,7 @@ ProjectRef = E456295B0E26B5F8005E4685 /* bzip2.xcodeproj */; }, { - ProductGroup = 7BFDF61B0E37ADF400F1D7D8 /* Products */; + ProductGroup = 82DB3BAE0E71881D007B146B /* Products */; ProjectRef = AB8665450DC78A5A002CE06A /* googleurl.xcodeproj */; }, { @@ -1112,13 +1110,6 @@ remoteRef = 7BFDF6140E37ADE800F1D7D8 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 7BFDF61F0E37ADF400F1D7D8 /* libgoogleurl.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libgoogleurl.a; - remoteRef = 7BFDF61E0E37ADF400F1D7D8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 7BFDF6240E37ADFC00F1D7D8 /* libpng.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1175,6 +1166,20 @@ remoteRef = 82DB396C0E6F17B0007B146B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 82DB3BB40E71881D007B146B /* libgoogleurl.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgoogleurl.a; + remoteRef = 82DB3BB30E71881D007B146B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 82DB3BB60E71881D007B146B /* googleurl_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = googleurl_unittests; + remoteRef = 82DB3BB50E71881D007B146B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -1231,7 +1236,7 @@ E456290F0E26B4FE005E4685 /* webview_host.mm in Sources */, E45629100E26B4FE005E4685 /* webwidget_host.mm in Sources */, E45629150E26B4FE005E4685 /* main.mm in Sources */, - E45629160E26B4FE005E4685 /* event_sending_controller.mm in Sources */, + E45629160E26B4FE005E4685 /* event_sending_controller.cc in Sources */, E45629170E26B4FE005E4685 /* layout_test_controller.mm in Sources */, E45629180E26B4FE005E4685 /* navigation_controller_base.cc in Sources */, E45629190E26B4FE005E4685 /* test_navigation_controller.cc in Sources */, @@ -1309,11 +1314,6 @@ name = All; targetProxy = 7BFDF8570E37B00300F1D7D8 /* PBXContainerItemProxy */; }; - 7BFDF85A0E37B00600F1D7D8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = googleurl; - targetProxy = 7BFDF8590E37B00600F1D7D8 /* PBXContainerItemProxy */; - }; 7BFDF85C0E37B00800F1D7D8 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = libpng; diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index b6cf9ec..07fdc92 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -23,14 +23,16 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H__ -#define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H__ +#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ +#define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ #pragma once #include <string> #include <list> +#include "base/basictypes.h" +#include "base/gfx/native_widget_types.h" #include "base/ref_counted.h" #include "webkit/tools/test_shell/event_sending_controller.h" #include "webkit/tools/test_shell/layout_test_controller.h" @@ -40,7 +42,7 @@ #include "webkit/tools/test_shell/webview_host.h" #include "webkit/tools/test_shell/webwidget_host.h" -typedef std::list<HWND> WindowList; +typedef std::list<gfx::WindowHandle> WindowList; struct WebPreferences; class TestNavigationEntry; @@ -144,10 +146,10 @@ public: void DumpDocumentText(); void DumpRenderTree(); - HWND mainWnd() const { return m_mainWnd; } - HWND webViewWnd() const { return m_webViewHost->window_handle(); } - HWND editWnd() const { return m_editWnd; } - HWND popupWnd() const { return m_popupHost->window_handle(); } + gfx::WindowHandle mainWnd() const { return m_mainWnd; } + gfx::ViewHandle webViewWnd() const { return m_webViewHost->window_handle(); } + gfx::EditViewHandle editWnd() const { return m_editWnd; } + gfx::ViewHandle popupWnd() const { return m_popupHost->window_handle(); } static WindowList* windowList() { return window_list_; } @@ -161,7 +163,9 @@ public: WebWidget* CreatePopupWidget(WebView* webview); void ClosePopup(); +#if defined(OS_WIN) static ATOM RegisterWindowClass(); +#endif // Called by the WebView delegate WindowObjectCleared() method, this // binds the layout_test_controller_ and other C++ controller classes to @@ -197,9 +201,11 @@ public: // Get the timeout for running a test. static int GetFileTestTimeout() { return file_test_timeout_ms_; } +#if defined(OS_WIN) // Access to the finished event. Used by the static WatchDog // thread. HANDLE finished_event() { return finished_event_; } +#endif // Have the shell print the StatsTable to stdout on teardown. void DumpStatsTableOnExit() { dump_stats_table_on_exit_ = true; } @@ -215,15 +221,19 @@ protected: void SizeTo(int width, int height); void ResizeSubViews(); +#if defined(OS_WIN) static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); static LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM); +#endif protected: - HWND m_mainWnd; - HWND m_editWnd; + gfx::WindowHandle m_mainWnd; + gfx::EditViewHandle m_editWnd; scoped_ptr<WebViewHost> m_webViewHost; WebWidgetHost* m_popupHost; +#if defined(OS_WIN) WNDPROC default_edit_wnd_proc_; +#endif // Primitive focus controller for layout test mode. WebWidgetHost* m_focusedWidgetHost; @@ -231,8 +241,13 @@ protected: private: // A set of all our windows. static WindowList* window_list_; +#if defined(OS_MACOSX) + static std::map<gfx::WindowHandle, TestShell *> window_map_; +#endif +#if defined(OS_WIN) static HINSTANCE instance_handle_; +#endif // False when the app is being run using the --layout-tests switch. static bool interactive_; @@ -262,11 +277,13 @@ private: // The preferences for the test shell. static WebPreferences* web_prefs_; +#if defined(OS_WIN) // Used by the watchdog to know when it's finished. HANDLE finished_event_; +#endif // Dump the stats table counters on exit. bool dump_stats_table_on_exit_; }; -#endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H__ +#endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index c42567a..56d3906 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -6,18 +6,24 @@ // This class implements the WebViewDelegate methods for the test shell. One // instance is owned by each TestShell. -#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H__ -#define WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H__ +#ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ +#define WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ +#include "build/build_config.h" + +#if defined(OS_WIN) #include <windows.h> +#endif #include <map> #include "base/basictypes.h" #include "base/ref_counted.h" #include "webkit/glue/webview_delegate.h" #include "webkit/glue/webwidget_delegate.h" +#if defined(OS_WIN) #include "webkit/tools/test_shell/drag_delegate.h" #include "webkit/tools/test_shell/drop_delegate.h" +#endif struct WebPreferences; class GURL; @@ -25,7 +31,8 @@ class TestShell; class WebDataSource; class WebWidgetHost; -class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, public WebViewDelegate { +class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, + public WebViewDelegate { public: struct CapturedContextMenuEvent { CapturedContextMenuEvent(ContextNode::Type in_type, @@ -49,8 +56,11 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, public page_id_(-1), last_page_id_updated_(-1), page_is_loading_(false), - is_custom_policy_delegate_(false), - custom_cursor_(NULL) { + is_custom_policy_delegate_(false) +#if defined(OS_WIN) + , custom_cursor_(NULL) +#endif + { } virtual ~TestWebViewDelegate(); @@ -182,7 +192,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, public virtual int GetHistoryForwardListCount(); // WebWidgetDelegate - virtual HWND GetContainingWindow(WebWidget* webwidget); + virtual gfx::ViewHandle GetContainingWindow(WebWidget* webwidget); virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, const gfx::Rect& clip_rect); @@ -198,16 +208,18 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, public virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); virtual void RunModal(WebWidget* webwidget); virtual void AddRef() { - RefCounted<TestWebViewDelegate>::AddRef(); + base::RefCounted<TestWebViewDelegate>::AddRef(); } virtual void Release() { - RefCounted<TestWebViewDelegate>::Release(); + base::RefCounted<TestWebViewDelegate>::Release(); } // Additional accessors WebFrame* top_loading_frame() { return top_loading_frame_; } +#if defined(OS_WIN) IDropTarget* drop_delegate() { return drop_delegate_.get(); } IDropSource* drag_delegate() { return drag_delegate_.get(); } +#endif const CapturedContextMenuEvents& captured_context_menu_events() const { return captured_context_menu_events_; } @@ -266,16 +278,17 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, public ResourceMap resource_identifier_map_; std::string GetResourceDescription(uint32 identifier); +#if defined(OS_WIN) HCURSOR custom_cursor_; // Classes needed by drag and drop. scoped_refptr<TestDragDelegate> drag_delegate_; scoped_refptr<TestDropDelegate> drop_delegate_; +#endif CapturedContextMenuEvents captured_context_menu_events_; DISALLOW_EVIL_CONSTRUCTORS(TestWebViewDelegate); }; -#endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H__ - +#endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ diff --git a/webkit/tools/test_shell/webview_host.cc b/webkit/tools/test_shell/webview_host.cc index 4e87d1f..3713b3f 100644 --- a/webkit/tools/test_shell/webview_host.cc +++ b/webkit/tools/test_shell/webview_host.cc @@ -4,7 +4,7 @@ #include "webkit/tools/test_shell/webview_host.h" -#include "base/gfx/platform_canvas_win.h" +#include "base/gfx/platform_canvas.h" #include "base/gfx/rect.h" #include "base/gfx/size.h" #include "base/win_util.h" @@ -14,7 +14,8 @@ static const wchar_t kWindowClassName[] = L"WebViewHost"; /*static*/ -WebViewHost* WebViewHost::Create(HWND parent_window, WebViewDelegate* delegate, +WebViewHost* WebViewHost::Create(gfx::WindowHandle parent_window, + WebViewDelegate* delegate, const WebPreferences& prefs) { WebViewHost* host = new WebViewHost(); @@ -31,11 +32,11 @@ WebViewHost* WebViewHost::Create(HWND parent_window, WebViewDelegate* delegate, registered_class = true; } - host->hwnd_ = CreateWindow(kWindowClassName, NULL, + host->view_ = CreateWindow(kWindowClassName, NULL, WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, 0, 0, 0, 0, parent_window, NULL, GetModuleHandle(NULL), NULL); - win_util::SetWindowUserData(host->hwnd_, host); + win_util::SetWindowUserData(host->view_, host); host->webwidget_ = WebView::Create(delegate, prefs); diff --git a/webkit/tools/test_shell/webview_host.h b/webkit/tools/test_shell/webview_host.h index 146f6ab..9a1e719 100644 --- a/webkit/tools/test_shell/webview_host.h +++ b/webkit/tools/test_shell/webview_host.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H__ -#define WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H__ - -#include <windows.h> +#ifndef WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ +#define WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ +#include "base/basictypes.h" +#include "base/gfx/native_widget_types.h" #include "base/gfx/rect.h" #include "base/scoped_ptr.h" #include "webkit/tools/test_shell/webwidget_host.h" @@ -15,23 +15,24 @@ struct WebPreferences; class WebView; class WebViewDelegate; -// This class is a simple HWND-based host for a WebView +// This class is a simple ViewHandle-based host for a WebView class WebViewHost : public WebWidgetHost { public: - // The new instance is deleted once the associated HWND is destroyed. The - // newly created window should be resized after it is created, using the + // The new instance is deleted once the associated ViewHandle is destroyed. + // The newly created window should be resized after it is created, using the // MoveWindow (or equivalent) function. - static WebViewHost* Create(HWND parent_window, + static WebViewHost* Create(gfx::WindowHandle parent_window, WebViewDelegate* delegate, const WebPreferences& prefs); WebView* webview() const; protected: +#if defined(OS_WIN) virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam) { return false; } +#endif }; -#endif // WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H__ - +#endif // WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_ diff --git a/webkit/tools/test_shell/webwidget_host.cc b/webkit/tools/test_shell/webwidget_host.cc index 30e20c9..ca0289e 100644 --- a/webkit/tools/test_shell/webwidget_host.cc +++ b/webkit/tools/test_shell/webwidget_host.cc @@ -4,6 +4,7 @@ #include "webkit/tools/test_shell/webwidget_host.h" +#include "base/gfx/platform_canvas.h" #include "base/gfx/platform_canvas_win.h" #include "base/gfx/rect.h" #include "base/logging.h" @@ -14,7 +15,8 @@ static const wchar_t kWindowClassName[] = L"WebWidgetHost"; /*static*/ -WebWidgetHost* WebWidgetHost::Create(HWND parent_window, WebWidgetDelegate* delegate) { +WebWidgetHost* WebWidgetHost::Create(gfx::WindowHandle parent_window, + WebWidgetDelegate* delegate) { WebWidgetHost* host = new WebWidgetHost(); static bool registered_class = false; @@ -30,12 +32,12 @@ WebWidgetHost* WebWidgetHost::Create(HWND parent_window, WebWidgetDelegate* dele registered_class = true; } - host->hwnd_ = CreateWindowEx(WS_EX_TOOLWINDOW, + host->view_ = CreateWindowEx(WS_EX_TOOLWINDOW, kWindowClassName, kWindowClassName, WS_POPUP, 0, 0, 0, 0, parent_window, NULL, GetModuleHandle(NULL), NULL); - win_util::SetWindowUserData(host->hwnd_, host); + win_util::SetWindowUserData(host->view_, host); host->webwidget_ = WebWidget::Create(delegate); @@ -43,7 +45,7 @@ WebWidgetHost* WebWidgetHost::Create(HWND parent_window, WebWidgetDelegate* dele } /*static*/ -WebWidgetHost* WebWidgetHost::FromWindow(HWND hwnd) { +WebWidgetHost* WebWidgetHost::FromWindow(gfx::WindowHandle hwnd) { return reinterpret_cast<WebWidgetHost*>(win_util::GetWindowUserData(hwnd)); } @@ -129,7 +131,7 @@ void WebWidgetHost::DidInvalidateRect(const gfx::Rect& damaged_rect) { paint_rect_ = paint_rect_.Union(damaged_rect); RECT r = damaged_rect.ToRECT(); - InvalidateRect(hwnd_, &r, FALSE); + InvalidateRect(view_, &r, FALSE); } void WebWidgetHost::DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect) { @@ -149,11 +151,11 @@ void WebWidgetHost::DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect) { scroll_dy_ = dy; RECT r = clip_rect.ToRECT(); - InvalidateRect(hwnd_, &r, FALSE); + InvalidateRect(view_, &r, FALSE); } void WebWidgetHost::SetCursor(HCURSOR cursor) { - SetClassLong(hwnd_, GCL_HCURSOR, + SetClassLong(view_, GCL_HCURSOR, static_cast<LONG>(reinterpret_cast<LONG_PTR>(cursor))); ::SetCursor(cursor); } @@ -163,7 +165,7 @@ void WebWidgetHost::DiscardBackingStore() { } WebWidgetHost::WebWidgetHost() - : hwnd_(NULL), + : view_(NULL), webwidget_(NULL), track_mouse_leave_(false), scroll_dx_(0), @@ -172,7 +174,7 @@ WebWidgetHost::WebWidgetHost() } WebWidgetHost::~WebWidgetHost() { - win_util::SetWindowUserData(hwnd_, 0); + win_util::SetWindowUserData(view_, 0); TrackMouseLeave(false); @@ -184,7 +186,7 @@ bool WebWidgetHost::WndProc(UINT message, WPARAM wparam, LPARAM lparam) { switch (message) { case WM_ACTIVATE: if (wparam == WA_INACTIVE) { - PostMessage(hwnd_, WM_CLOSE, 0, 0); + PostMessage(view_, WM_CLOSE, 0, 0); return true; } break; @@ -195,14 +197,14 @@ bool WebWidgetHost::WndProc(UINT message, WPARAM wparam, LPARAM lparam) { void WebWidgetHost::Paint() { RECT r; - GetClientRect(hwnd_, &r); + GetClientRect(view_, &r); gfx::Rect client_rect(r); // Allocate a canvas if necessary if (!canvas_.get()) { ResetScrollRect(); paint_rect_ = client_rect; - canvas_.reset(new gfx::PlatformCanvasWin( + canvas_.reset(new gfx::PlatformCanvas( paint_rect_.width(), paint_rect_.height(), true)); } @@ -238,15 +240,15 @@ void WebWidgetHost::Paint() { // Paint to the screen PAINTSTRUCT ps; - BeginPaint(hwnd_, &ps); + BeginPaint(view_, &ps); canvas_->getTopPlatformDevice().drawToHDC(ps.hdc, ps.rcPaint.left, ps.rcPaint.top, &ps.rcPaint); - EndPaint(hwnd_, &ps); + EndPaint(view_, &ps); // Draw children - UpdateWindow(hwnd_); + UpdateWindow(view_); } void WebWidgetHost::Resize(LPARAM lparam) { @@ -257,7 +259,7 @@ void WebWidgetHost::Resize(LPARAM lparam) { } void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) { - WebMouseEvent event(hwnd_, message, wparam, lparam); + WebMouseEvent event(view_, message, wparam, lparam); switch (event.type) { case WebInputEvent::MOUSE_MOVE: TrackMouseLeave(true); @@ -266,10 +268,10 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) { TrackMouseLeave(false); break; case WebInputEvent::MOUSE_DOWN: - SetCapture(hwnd_); + SetCapture(view_); break; case WebInputEvent::MOUSE_UP: - if (GetCapture() == hwnd_) + if (GetCapture() == view_) ReleaseCapture(); break; } @@ -277,12 +279,12 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) { } void WebWidgetHost::WheelEvent(WPARAM wparam, LPARAM lparam) { - WebMouseWheelEvent event(hwnd_, WM_MOUSEWHEEL, wparam, lparam); + WebMouseWheelEvent event(view_, WM_MOUSEWHEEL, wparam, lparam); webwidget_->HandleInputEvent(&event); } void WebWidgetHost::KeyEvent(UINT message, WPARAM wparam, LPARAM lparam) { - WebKeyboardEvent event(hwnd_, message, wparam, lparam); + WebKeyboardEvent event(view_, message, wparam, lparam); webwidget_->HandleInputEvent(&event); } @@ -299,14 +301,14 @@ void WebWidgetHost::TrackMouseLeave(bool track) { return; track_mouse_leave_ = track; - DCHECK(hwnd_); + DCHECK(view_); TRACKMOUSEEVENT tme; tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_LEAVE; if (!track_mouse_leave_) tme.dwFlags |= TME_CANCEL; - tme.hwndTrack = hwnd_; + tme.hwndTrack = view_; TrackMouseEvent(&tme); } @@ -327,4 +329,3 @@ void WebWidgetHost::PaintRect(const gfx::Rect& rect) { webwidget_->Paint(canvas_.get(), rect); set_painting(false); } - diff --git a/webkit/tools/test_shell/webwidget_host.h b/webkit/tools/test_shell/webwidget_host.h index b7a5945..c318c18 100644 --- a/webkit/tools/test_shell/webwidget_host.h +++ b/webkit/tools/test_shell/webwidget_host.h @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__ -#define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__ - -#include <windows.h> +#ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ +#define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ +#include "base/basictypes.h" +#include "base/gfx/native_widget_types.h" +#include "base/gfx/platform_canvas.h" #include "base/gfx/rect.h" #include "base/scoped_ptr.h" @@ -14,26 +15,31 @@ class WebWidget; class WebWidgetDelegate; namespace gfx { -class PlatformCanvasWin; class Size; } -// This class is a simple HWND-based host for a WebWidget +// This class is a simple ViewHandle-based host for a WebWidget class WebWidgetHost { public: - // The new instance is deleted once the associated HWND is destroyed. The - // newly created window should be resized after it is created, using the + // The new instance is deleted once the associated ViewHandle is destroyed. + // The newly created window should be resized after it is created, using the // MoveWindow (or equivalent) function. - static WebWidgetHost* Create(HWND parent_window, WebWidgetDelegate* delegate); + static WebWidgetHost* Create(gfx::WindowHandle parent_window, + WebWidgetDelegate* delegate); - static WebWidgetHost* FromWindow(HWND hwnd); + static WebWidgetHost* FromWindow(gfx::WindowHandle view); +#if defined(OS_MACOSX) + static void HandleEvent(gfx::WindowHandle window, NSEvent *event); +#endif - HWND window_handle() const { return hwnd_; } + gfx::ViewHandle window_handle() const { return view_; } WebWidget* webwidget() const { return webwidget_; } void DidInvalidateRect(const gfx::Rect& rect); void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect); +#if defined(OS_WIN) void SetCursor(HCURSOR cursor); +#endif void DiscardBackingStore(); @@ -41,6 +47,7 @@ class WebWidgetHost { WebWidgetHost(); ~WebWidgetHost(); +#if defined(OS_WIN) // Per-class wndproc. Returns true if the event should be swallowed. virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam); @@ -52,6 +59,19 @@ class WebWidgetHost { void CaptureLostEvent(); void SetFocus(bool enable); + static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +#elif defined(OS_MACOSX) + // These need to be called from a non-subclass, so they need to be public. + public: + void Paint(); + void Resize(const gfx::Rect& rect); + void MouseEvent(NSEvent *); + void WheelEvent(NSEvent *); + void KeyEvent(NSEvent *); + void SetFocus(bool enable); + protected: +#endif + void TrackMouseLeave(bool enable); void ResetScrollRect(); void PaintRect(const gfx::Rect& rect); @@ -62,11 +82,9 @@ class WebWidgetHost { #endif } - static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); - - HWND hwnd_; + gfx::ViewHandle view_; WebWidget* webwidget_; - scoped_ptr<gfx::PlatformCanvasWin> canvas_; + scoped_ptr<gfx::PlatformCanvas> canvas_; // specifies the portion of the webwidget that needs painting gfx::Rect paint_rect_; @@ -83,5 +101,4 @@ class WebWidgetHost { #endif }; -#endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__ - +#endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ |