diff options
172 files changed, 9612 insertions, 242 deletions
@@ -19,7 +19,7 @@ deps = { "http://googletest.googlecode.com/svn/trunk@243", "src/third_party/WebKit": - "/trunk/deps/third_party/WebKit@15639", + "/trunk/deps/third_party/WebKit@15738", "src/third_party/icu38": "/trunk/deps/third_party/icu38@13472", diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h index d9e9fe4..f92f097 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.h +++ b/chrome/browser/renderer_host/browser_render_process_host.h @@ -19,7 +19,7 @@ #include "chrome/browser/renderer_host/audio_renderer_host.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/common/notification_observer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCache.h" +#include "webkit/api/public/WebCache.h" class CommandLine; class GURL; diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 395167c..265b8ea 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -38,7 +38,7 @@ #include "chrome/common/url_constants.h" #include "net/base/net_util.h" #include "skia/include/SkBitmap.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" +#include "webkit/api/public/WebFindOptions.h" #include "webkit/glue/autofill_form.h" using base::TimeDelta; diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 34fd03c..1e7bc4f 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -14,7 +14,7 @@ #include "chrome/browser/renderer_host/render_widget_host.h" #include "chrome/common/modal_dialog_event.h" #include "chrome/common/page_zoom.h" -#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" +#include "webkit/api/public/WebConsoleMessage.h" #include "webkit/glue/autofill_form.h" #include "webkit/glue/password_form_dom_manager.h" #include "webkit/glue/window_open_disposition.h" diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index e737606..c0e08e7 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -16,7 +16,7 @@ #include "chrome/common/x11_util.h" #include "chrome/browser/renderer_host/backing_store.h" #include "chrome/browser/renderer_host/render_widget_host.h" -#include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h" +#include "webkit/api/public/gtk/WebInputEventFactory.h" #include "webkit/glue/webcursor_gtk_data.h" using WebKit::WebInputEventFactory; diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 3312ade..b9290d4 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -28,8 +28,8 @@ #include "chrome/common/render_messages.h" #include "grit/webkit_resources.h" #include "skia/ext/skia_utils_win.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" -#include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h" +#include "webkit/api/public/WebInputEvent.h" +#include "webkit/api/public/win/WebInputEventFactory.h" #include "views/focus/focus_util_win.h" // Included for views::kReflectedMessage - TODO(beng): move this to win_util.h! #include "views/widget/widget_win.h" diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 5f3051c..0b86265 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -43,9 +43,9 @@ #endif #if defined(OS_WIN) -#include "third_party/WebKit/WebKit/chromium/public/win/WebScreenInfoFactory.h" +#include "webkit/api/public/win/WebScreenInfoFactory.h" #elif defined(OS_MACOSX) -#include "third_party/WebKit/WebKit/chromium/public/mac/WebScreenInfoFactory.h" +#include "webkit/api/public/mac/WebScreenInfoFactory.h" #endif using WebKit::WebCache; diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index f394745..c28618b 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -23,7 +23,7 @@ #include "chrome/common/modal_dialog_event.h" #include "chrome/common/notification_observer.h" #include "chrome/common/transport_dib.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCache.h" +#include "webkit/api/public/WebCache.h" #if defined(OS_WIN) #include <windows.h> diff --git a/chrome/browser/renderer_host/resource_message_filter_gtk.cc b/chrome/browser/renderer_host/resource_message_filter_gtk.cc index 8328a90..052713c 100644 --- a/chrome/browser/renderer_host/resource_message_filter_gtk.cc +++ b/chrome/browser/renderer_host/resource_message_filter_gtk.cc @@ -10,8 +10,8 @@ #include "chrome/common/render_messages.h" #include "chrome/common/x11_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" -#include "third_party/WebKit/WebKit/chromium/public/x11/WebScreenInfoFactory.h" +#include "webkit/api/public/WebScreenInfo.h" +#include "webkit/api/public/x11/WebScreenInfoFactory.h" using WebKit::WebScreenInfo; using WebKit::WebScreenInfoFactory; diff --git a/chrome/browser/renderer_host/web_cache_manager.h b/chrome/browser/renderer_host/web_cache_manager.h index 1e9b642..70f3560 100644 --- a/chrome/browser/renderer_host/web_cache_manager.h +++ b/chrome/browser/renderer_host/web_cache_manager.h @@ -17,7 +17,7 @@ #include "base/singleton.h" #include "base/task.h" #include "base/time.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCache.h" +#include "webkit/api/public/WebCache.h" class PrefService; diff --git a/chrome/browser/ssl/ssl_manager.h b/chrome/browser/ssl/ssl_manager.h index 0c940a4..57a6d63 100644 --- a/chrome/browser/ssl/ssl_manager.h +++ b/chrome/browser/ssl/ssl_manager.h @@ -21,7 +21,7 @@ #include "net/base/net_errors.h" #include "net/base/ssl_info.h" #include "net/base/x509_certificate.h" -#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" +#include "webkit/api/public/WebConsoleMessage.h" #include "webkit/glue/resource_type.h" class AutomationProvider; diff --git a/chrome/common/native_web_keyboard_event.h b/chrome/common/native_web_keyboard_event.h index 0400b41..8dece32 100644 --- a/chrome/common/native_web_keyboard_event.h +++ b/chrome/common/native_web_keyboard_event.h @@ -6,7 +6,7 @@ #define CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ #include "base/basictypes.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" +#include "webkit/api/public/WebInputEvent.h" #if defined(OS_WIN) #include <windows.h> diff --git a/chrome/common/native_web_keyboard_event_linux.cc b/chrome/common/native_web_keyboard_event_linux.cc index a2e606f..ae3b25a 100644 --- a/chrome/common/native_web_keyboard_event_linux.cc +++ b/chrome/common/native_web_keyboard_event_linux.cc @@ -4,7 +4,7 @@ #include "chrome/common/native_web_keyboard_event.h" -#include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h" +#include "webkit/api/public/gtk/WebInputEventFactory.h" using WebKit::WebInputEventFactory; diff --git a/chrome/common/native_web_keyboard_event_win.cc b/chrome/common/native_web_keyboard_event_win.cc index 184fc72..2fe23f1 100644 --- a/chrome/common/native_web_keyboard_event_win.cc +++ b/chrome/common/native_web_keyboard_event_win.cc @@ -4,7 +4,7 @@ #include "chrome/common/native_web_keyboard_event.h" -#include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h" +#include "webkit/api/public/win/WebInputEventFactory.h" using WebKit::WebInputEventFactory; using WebKit::WebKeyboardEvent; diff --git a/chrome/common/webkit_param_traits.h b/chrome/common/webkit_param_traits.h index 74f311a..b680782 100644 --- a/chrome/common/webkit_param_traits.h +++ b/chrome/common/webkit_param_traits.h @@ -24,11 +24,11 @@ #define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ #include "chrome/common/ipc_message_utils.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCache.h" -#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "webkit/api/public/WebCache.h" +#include "webkit/api/public/WebConsoleMessage.h" +#include "webkit/api/public/WebFindOptions.h" +#include "webkit/api/public/WebInputEvent.h" +#include "webkit/api/public/WebScreenInfo.h" namespace IPC { diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index 597ac40..1a3614f 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -12,7 +12,7 @@ #include "chrome/renderer/js_only_v8_extensions.h" #include "chrome/renderer/render_view.h" #include "grit/renderer_resources.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" +#include "webkit/api/public/WebScriptSource.h" #include "webkit/glue/webframe.h" using WebKit::WebScriptSource; diff --git a/chrome/renderer/media/video_renderer_impl.h b/chrome/renderer/media/video_renderer_impl.h index 9a39933..0453fa0 100644 --- a/chrome/renderer/media/video_renderer_impl.h +++ b/chrome/renderer/media/video_renderer_impl.h @@ -22,7 +22,7 @@ #include "media/base/factory.h" #include "media/base/filters.h" #include "media/filters/video_renderer_base.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayer.h" +#include "webkit/api/public/WebMediaPlayer.h" class VideoRendererImpl : public media::VideoRendererBase { public: diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 11b3cb0..ffdc80a 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -38,9 +38,9 @@ #include "chrome/renderer/renderer_webkitclient_impl.h" #include "chrome/renderer/user_script_slave.h" #include "chrome/renderer/visitedlink_slave.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCache.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "webkit/api/public/WebCache.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebString.h" #include "webkit/extensions/v8/gears_extension.h" #include "webkit/extensions/v8/interval_extension.h" #include "webkit/extensions/v8/playback_extension.h" diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index d0f0c74..5e573fa 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -50,11 +50,11 @@ #include "printing/units.h" #include "skia/ext/bitmap_platform_device.h" #include "skia/ext/image_operations.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "webkit/api/public/WebDragData.h" +#include "webkit/api/public/WebPoint.h" +#include "webkit/api/public/WebRect.h" +#include "webkit/api/public/WebScriptSource.h" +#include "webkit/api/public/WebSize.h" #include "webkit/default_plugin/default_plugin_shared.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/dom_serializer.h" diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 17abcc2..dcd2de1 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -24,7 +24,7 @@ #include "chrome/renderer/render_widget.h" #include "skia/include/SkBitmap.h" #include "testing/gtest/include/gtest/gtest_prod.h" -#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" +#include "webkit/api/public/WebConsoleMessage.h" #include "webkit/glue/dom_serializer_delegate.h" #include "webkit/glue/form_data.h" #include "webkit/glue/password_form_dom_manager.h" diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 7387665..db181bd 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -15,9 +15,9 @@ #include "chrome/renderer/render_process.h" #include "skia/ext/platform_canvas.h" #include "skia/include/SkShader.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "webkit/api/public/WebRect.h" +#include "webkit/api/public/WebScreenInfo.h" +#include "webkit/api/public/WebSize.h" #if defined(OS_POSIX) #include "skia/include/SkPixelRef.h" diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index 660ccbb..d2cdf96 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -18,7 +18,7 @@ #include "skia/ext/platform_canvas.h" #include "skia/include/SkBitmap.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "webkit/api/public/WebRect.h" #include "webkit/glue/webwidget_delegate.h" #include "webkit/glue/webcursor.h" diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index 354e01f..7ccdec4 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -25,9 +25,9 @@ #include "chrome/renderer/render_process.h" #include "chrome/renderer/render_thread.h" #include "googleurl/src/url_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebKitClient.h" +#include "webkit/api/public/WebString.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/glue/webframe.h" #include "webkit/glue/webkit_glue.h" diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc index 78f3c22..5e7d0bb 100644 --- a/chrome/renderer/renderer_webkitclient_impl.cc +++ b/chrome/renderer/renderer_webkitclient_impl.cc @@ -11,8 +11,8 @@ #include "chrome/renderer/net/render_dns_master.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/visitedlink_slave.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webkit_glue.h" diff --git a/chrome/renderer/renderer_webkitclient_impl.h b/chrome/renderer/renderer_webkitclient_impl.h index ef93dee..2e43515 100644 --- a/chrome/renderer/renderer_webkitclient_impl.h +++ b/chrome/renderer/renderer_webkitclient_impl.h @@ -10,7 +10,7 @@ #include "webkit/glue/webkitclient_impl.h" #if defined(OS_WIN) -#include "third_party/WebKit/WebKit/chromium/public/win/WebSandboxSupport.h" +#include "webkit/api/public/win/WebSandboxSupport.h" #endif class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl { diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc index 4f44ef9..fa4eb7d 100644 --- a/chrome/renderer/user_script_slave.cc +++ b/chrome/renderer/user_script_slave.cc @@ -12,7 +12,7 @@ #include "base/shared_memory.h" #include "base/string_util.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" +#include "webkit/api/public/WebScriptSource.h" #include "webkit/glue/webframe.h" #include "grit/renderer_resources.h" diff --git a/chrome/renderer/webmediaplayer_impl.cc b/chrome/renderer/webmediaplayer_impl.cc index a2d220d..9cff367 100644 --- a/chrome/renderer/webmediaplayer_impl.cc +++ b/chrome/renderer/webmediaplayer_impl.cc @@ -16,9 +16,9 @@ #include "media/filters/ffmpeg_demuxer.h" #include "media/filters/ffmpeg_video_decoder.h" #include "media/filters/null_audio_renderer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/api/public/WebRect.h" +#include "webkit/api/public/WebSize.h" +#include "webkit/api/public/WebURL.h" using WebKit::WebRect; using WebKit::WebSize; diff --git a/chrome/renderer/webmediaplayer_impl.h b/chrome/renderer/webmediaplayer_impl.h index e7ee2f2..bce6205 100644 --- a/chrome/renderer/webmediaplayer_impl.h +++ b/chrome/renderer/webmediaplayer_impl.h @@ -50,8 +50,8 @@ #include "base/message_loop.h" #include "media/base/filters.h" #include "media/base/pipeline_impl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerClient.h" +#include "webkit/api/public/WebMediaPlayer.h" +#include "webkit/api/public/WebMediaPlayerClient.h" class AudioRendererImpl; class DataSourceImpl; diff --git a/chrome/renderer/webworker_proxy.cc b/chrome/renderer/webworker_proxy.cc index 60fcebb..d5c5ede 100644 --- a/chrome/renderer/webworker_proxy.cc +++ b/chrome/renderer/webworker_proxy.cc @@ -7,8 +7,8 @@ #include "chrome/common/child_thread.h" #include "chrome/common/render_messages.h" #include "chrome/common/worker_messages.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h" +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebWorkerClient.h" using WebKit::WebString; using WebKit::WebURL; diff --git a/chrome/renderer/webworker_proxy.h b/chrome/renderer/webworker_proxy.h index 7c44ba6..b2b361d 100644 --- a/chrome/renderer/webworker_proxy.h +++ b/chrome/renderer/webworker_proxy.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "chrome/common/ipc_channel.h" -#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h" +#include "webkit/api/public/WebWorker.h" class ChildThread; class GURL; diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index 583fff6..9885334 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -10,8 +10,8 @@ #include "chrome/renderer/extensions/extension_process_bindings.h" #include "chrome/renderer/extensions/renderer_extension_bindings.h" #include "chrome/renderer/js_only_v8_extensions.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebScriptSource.h" #include "webkit/glue/weburlrequest.h" #include "webkit/glue/webview.h" diff --git a/chrome/worker/webworkerclient_proxy.cc b/chrome/worker/webworkerclient_proxy.cc index 4e154e2..2c57dad 100644 --- a/chrome/worker/webworkerclient_proxy.cc +++ b/chrome/worker/webworkerclient_proxy.cc @@ -8,9 +8,9 @@ #include "chrome/common/ipc_logging.h" #include "chrome/common/worker_messages.h" #include "chrome/worker/worker_thread.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebWorker.h" using WebKit::WebString; using WebKit::WebWorker; diff --git a/chrome/worker/webworkerclient_proxy.h b/chrome/worker/webworkerclient_proxy.h index ccf9557..9de4dd9 100644 --- a/chrome/worker/webworkerclient_proxy.h +++ b/chrome/worker/webworkerclient_proxy.h @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "chrome/common/ipc_channel.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h" +#include "webkit/api/public/WebWorkerClient.h" namespace WebKit { class WebWorker; diff --git a/chrome/worker/worker_thread.cc b/chrome/worker/worker_thread.cc index 8ae8fab..8f3aebf 100644 --- a/chrome/worker/worker_thread.cc +++ b/chrome/worker/worker_thread.cc @@ -7,7 +7,7 @@ #include "chrome/common/worker_messages.h" #include "chrome/worker/webworkerclient_proxy.h" #include "chrome/worker/worker_webkitclient_impl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" +#include "webkit/api/public/WebKit.h" WorkerThread::WorkerThread() : ChildThread(base::Thread::Options(MessageLoop::TYPE_DEFAULT, diff --git a/chrome/worker/worker_webkitclient_impl.cc b/chrome/worker/worker_webkitclient_impl.cc index b896a8a..21d715ab 100644 --- a/chrome/worker/worker_webkitclient_impl.cc +++ b/chrome/worker/worker_webkitclient_impl.cc @@ -7,8 +7,8 @@ #include "base/logging.h" #include "chrome/renderer/webworker_proxy.h" #include "chrome/worker/worker_thread.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" WebKit::WebClipboard* WorkerWebKitClientImpl::clipboard() { NOTREACHED(); diff --git a/webkit/api/README b/webkit/api/README new file mode 100644 index 0000000..247bcde --- /dev/null +++ b/webkit/api/README @@ -0,0 +1,48 @@ +This directory contains the Chromium WebKit API. It will eventually be +upstreamed to WebKit/WebKit/chromium in svn.webkit.org. + + +OVERVIEW + + The Chromium WebKit API provides a stable interface to WebCore without + revealing any of the WebCore or WTF types to the consumer. + + The 'public' directory contains the API headers, and the 'src' directory + contains the API implementation. The API is intended to be used either as a + shared or static library. + + +COMPATIBILITY + + No attempt is made to support runtime compatibility in a shared library + build. Instead, the API is intended to support backwards compatibility at + build time. C++ symbols are allowed in other words. + + +CODING STYLE + + The code in this directory should adhere to the WebKit Coding Style + Guidelines: http://webkit.org/coding/coding-style.html + + +DEFINES + + WEBKIT_IMPLEMENTATION is defined when building the 'src' directory. + Consumers should not define this macro. + + WEBKIT_DLL is defined when building as a shared library. This should be + defined when building the 'src' directory, and it should also be defined by + the consumer to ensure proper linkage to the shared library. + + +BASIC TYPES + + Use of STL is prohibited except in cases where it would be allowed in + WebCore. This includes non-allocating uses: algorithms, numeric limits, etc. + WTF container classes should be used in the implementation of this API. + + The API includes some usage of WebCore types when WEBKIT_IMPLEMENTATION is + defined. This is only done for the convenience to the implementation, and + should not be considered part of the Chromium WebKit API. Similarly, STL + types are assumed when WEBKIT_IMPLEMENTATION is not defined, which is done + for the convenience of the consumer. diff --git a/webkit/api/public/WebCString.h b/webkit/api/public/WebCString.h new file mode 100644 index 0000000..7b4cc4e --- /dev/null +++ b/webkit/api/public/WebCString.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCString_h +#define WebCString_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class CString; } +#else +#include <string> +#endif + +namespace WebKit { + + class WebCStringPrivate; + + // A single-byte string container with unspecified encoding. It is + // inexpensive to copy a WebCString object. + // + // WARNING: It is not safe to pass a WebCString across threads!!! + // + class WebCString { + public: + ~WebCString() { reset(); } + + WebCString() : m_private(0) { } + + WebCString(const char* data, size_t len) : m_private(0) + { + assign(data, len); + } + + WebCString(const WebCString& s) : m_private(0) { assign(s); } + + WebCString& operator=(const WebCString& s) + { + assign(s); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebCString&); + WEBKIT_API void assign(const char* data, size_t len); + + WEBKIT_API size_t length() const; + WEBKIT_API const char* data() const; + + bool isEmpty() const { return length() == 0; } + bool isNull() const { return m_private == 0; } + +#if WEBKIT_IMPLEMENTATION + WebCString(const WebCore::CString&); + WebCString& operator=(const WebCore::CString&); + operator WebCore::CString() const; +#else + WebCString(const std::string& s) : m_private(0) + { + assign(s.data(), s.length()); + } + + WebCString& operator=(const std::string& s) + { + assign(s.data(), s.length()); + return *this; + } + + operator std::string() const + { + size_t len = length(); + return len ? std::string(data(), len) : std::string(); + } +#endif + + private: + void assign(WebCStringPrivate*); + WebCStringPrivate* m_private; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebCache.h b/webkit/api/public/WebCache.h new file mode 100644 index 0000000..71b45fd --- /dev/null +++ b/webkit/api/public/WebCache.h @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCache_h +#define WebCache_h + +#include "WebCommon.h" + +namespace WebKit { + + // An interface to query and configure WebKit's resource cache. + class WebCache { + public: + struct UsageStats { + // Capacities. + size_t minDeadCapacity; + size_t maxDeadCapacity; + size_t capacity; + // Utilization. + size_t liveSize; + size_t deadSize; + }; + + // A struct mirroring WebCore::Cache::TypeStatistic. + struct ResourceTypeStat { + size_t count; + size_t size; + size_t liveSize; + size_t decodedSize; + }; + + // A struct mirroring WebCore::Cache::Statistics. + struct ResourceTypeStats { + ResourceTypeStat images; + ResourceTypeStat cssStyleSheets; + ResourceTypeStat scripts; + ResourceTypeStat xslStyleSheets; + ResourceTypeStat fonts; + }; + + // Sets the capacities of the resource cache, evicting objects as necessary. + WEBKIT_API static void setCapacities(size_t minDeadCapacity, + size_t maxDeadCapacity, + size_t capacity); + + // Gets the usage statistics from the resource cache. + WEBKIT_API static void getUsageStats(UsageStats*); + + // Get usage stats about the resource cache. + WEBKIT_API static void getResourceTypeStats(ResourceTypeStats*); + + private: + WebCache(); // Not intended to be instanced. + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebCanvas.h b/webkit/api/public/WebCanvas.h new file mode 100644 index 0000000..1eae3a0 --- /dev/null +++ b/webkit/api/public/WebCanvas.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCanvas_h +#define WebCanvas_h + +#include "WebCommon.h" + +// FIXME: PlatformCanvas should not be a typedef +#if WEBKIT_USING_SKIA +namespace skia { +#if defined(WIN32) + class PlatformCanvasWin; +#elif defined(__linux__) + class PlatformCanvasLinux; +#endif +} +#endif + +namespace WebKit { + +#if WEBKIT_USING_SKIA +#if defined(WIN32) + typedef skia::PlatformCanvasWin WebCanvas; +#elif defined(__linux__) + typedef skia::PlatformCanvasLinux WebCanvas; +#endif +#endif + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebClipboard.h b/webkit/api/public/WebClipboard.h new file mode 100644 index 0000000..6a24012 --- /dev/null +++ b/webkit/api/public/WebClipboard.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebClipboard_h +#define WebClipboard_h + +#include "WebCommon.h" + +namespace WebKit { + class WebImage; + class WebString; + class WebURL; + + class WebClipboard { + public: + enum Format { + FormatHTML, + FormatBookmark, + FormatSmartPaste + }; + + virtual bool isFormatAvailable(Format) = 0; + + virtual WebString readPlainText() = 0; + virtual WebString readHTML(WebURL*) = 0; + + virtual void writeHTML( + const WebString& htmlText, const WebURL&, + const WebString& plainText, bool writeSmartPaste) = 0; + virtual void writeURL( + const WebURL&, const WebString& title) = 0; + virtual void writeImage( + const WebImage&, const WebURL&, const WebString& title) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebColor.h b/webkit/api/public/WebColor.h new file mode 100644 index 0000000..2f77c76 --- /dev/null +++ b/webkit/api/public/WebColor.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebColor_h +#define WebColor_h + +namespace WebKit { + + typedef unsigned WebColor; // RGBA quad + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebCommon.h b/webkit/api/public/WebCommon.h new file mode 100644 index 0000000..64d34cc --- /dev/null +++ b/webkit/api/public/WebCommon.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCommon_h +#define WebCommon_h + +// ----------------------------------------------------------------------------- +// Default configuration + +#if !defined(WEBKIT_IMPLEMENTATION) + #define WEBKIT_IMPLEMENTATION 0 +#endif + +#if !defined(WEBKIT_USING_SKIA) + #if !defined(__APPLE__) + #define WEBKIT_USING_SKIA 1 + #else + #define WEBKIT_USING_SKIA 0 + #endif +#endif + +#if !defined(WEBKIT_USING_CG) + #if defined(__APPLE__) + #define WEBKIT_USING_CG 1 + #else + #define WEBKIT_USING_CG 0 + #endif +#endif + +#if !defined(WEBKIT_USING_V8) + #define WEBKIT_USING_V8 1 +#endif + +#if !defined(WEBKIT_USING_JSC) + #define WEBKIT_USING_JSC 0 +#endif + +// ----------------------------------------------------------------------------- +// Exported symbols need to be annotated with WEBKIT_API + +#if defined(WIN32) && defined(WEBKIT_DLL) + #if defined(WEBKIT_IMPLEMENTATION) + #define WEBKIT_API __declspec(dllexport) + #else + #define WEBKIT_API __declspec(dllimport) + #endif +#else + #define WEBKIT_API +#endif + +// ----------------------------------------------------------------------------- +// Basic types + +#include <stddef.h> // For size_t + +namespace WebKit { + + // UTF-16 character type +#if defined(WIN32) + typedef wchar_t WebUChar; +#else + typedef unsigned short WebUChar; +#endif + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebCompositionCommand.h b/webkit/api/public/WebCompositionCommand.h new file mode 100644 index 0000000..d7acbfd --- /dev/null +++ b/webkit/api/public/WebCompositionCommand.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCompositionCommand_h +#define WebCompositionCommand_h + +#error "This header file is still a work in progress; do not include!" + +namespace WebKit { + + enum WebCompositionCommand { + WebCompositionCommandDiscard, + WebCompositionCommandSet, + WebCompositionCommandConfirm, + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebConsoleMessage.h b/webkit/api/public/WebConsoleMessage.h new file mode 100644 index 0000000..0b328fe0 --- /dev/null +++ b/webkit/api/public/WebConsoleMessage.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebConsoleMessage_h +#define WebConsoleMessage_h + +#include "WebString.h" + +namespace WebKit { + + struct WebConsoleMessage { + enum Level { + LevelTip, + LevelLog, + LevelWarning, + LevelError + }; + + Level level; + WebString text; + + WebConsoleMessage() + : level(LevelLog) { } + WebConsoleMessage(Level level, const WebString& text) + : level(LevelLog) + , text(text) { } + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebCursorInfo.h b/webkit/api/public/WebCursorInfo.h new file mode 100644 index 0000000..c1930de --- /dev/null +++ b/webkit/api/public/WebCursorInfo.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCursorInfo_h +#define WebCursorInfo_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebImage.h" +#include "WebPoint.h" + +#ifdef WIN32 +typedef struct HICON__* HICON; +typedef HICON HCURSOR; +#endif + +namespace WebKit { + + struct WebCursorInfo { + enum Type { + TypePointer, + TypeCross, + TypeHand, + TypeIBeam, + TypeWait, + TypeHelp, + TypeEastResize, + TypeNorthResize, + TypeNorthEastResize, + TypeNorthWestResize, + TypeSouthResize, + TypeSouthEastResize, + TypeSouthWestResize, + TypeWestResize, + TypeNorthSouthResize, + TypeEastWestResize, + TypeNorthEastSouthWestResize, + TypeNorthWestSouthEastResize, + TypeColumnResize, + TypeRowResize, + TypeMiddlePanning, + TypeEastPanning, + TypeNorthPanning, + TypeNorthEastPanning, + TypeNorthWestPanning, + TypeSouthPanning, + TypeSouthEastPanning, + TypeSouthWestPanning, + TypeWestPanning, + TypeMove, + TypeVerticalText, + TypeCell, + TypeContextMenu, + TypeAlias, + TypeProgress, + TypeNoDrop, + TypeCopy, + TypeNone, + TypeNotAllowed, + TypeZoomIn, + TypeZoomOut, + TypeCustom + }; + + Type type; + WebPoint hotSpot; + WebImage customData; + +#ifdef WIN32 + // On Windows, TypeCustom may alternatively reference an externally + // defined HCURSOR. If type is TypeCustom and externalHandle is non- + // null, then customData should be ignored. The WebCursorInfo is not + // responsible for managing the lifetime of this cursor handle. + HCURSOR externalHandle; +#endif + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebData.h b/webkit/api/public/WebData.h new file mode 100644 index 0000000..2666789 --- /dev/null +++ b/webkit/api/public/WebData.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebData_h +#define WebData_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class SharedBuffer; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + + class WebDataPrivate; + + // A container for raw bytes. It is inexpensive to copy a WebData object. + // + // WARNING: It is not safe to pass a WebData across threads!!! + // + class WebData { + public: + ~WebData() { reset(); } + + WebData() : m_private(0) { } + + WebData(const char* data, size_t size) : m_private(0) + { + assign(data, size); + } + + WebData(const WebData& d) : m_private(0) { assign(d); } + + WebData& operator=(const WebData& d) + { + assign(d); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebData&); + WEBKIT_API void assign(const char* data, size_t size); + + WEBKIT_API size_t size() const; + WEBKIT_API const char* data() const; + + bool isEmpty() const { return size() == 0; } + bool isNull() const { return m_private == 0; } + +#if WEBKIT_IMPLEMENTATION + WebData(const WTF::PassRefPtr<WebCore::SharedBuffer>&); + WebData& operator=(const WTF::PassRefPtr<WebCore::SharedBuffer>&); + operator WTF::PassRefPtr<WebCore::SharedBuffer>() const; +#endif + + private: + void assign(WebDataPrivate*); + WebDataPrivate* m_private; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebDataSource.h b/webkit/api/public/WebDataSource.h new file mode 100644 index 0000000..ef96042 --- /dev/null +++ b/webkit/api/public/WebDataSource.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebDataSource_h +#define WebDataSource_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" +#include "WebNavigationType.h" + +namespace WebKit { + class WebURL; + class WebURLRequest; + class WebURLResponse; + template <typename T> class WebVector; + + class WebDataSource { + public: + class ExtraData { + public: + virtual ~ExtraData() { } + }; + + // Returns the original request that resulted in this datasource. + virtual const WebURLRequest& originalRequest() const = 0; + + // Returns the request corresponding to this datasource. It may + // include additional request headers added by WebKit that were not + // present in the original request. This request may also correspond + // to a location specified by a redirect that was followed. + virtual const WebURLRequest& request() const = 0; + + // Returns the response associated to this datasource. + virtual const WebURLResponse& response() const = 0; + + // When this datasource was created as a result of WebFrame::loadData, + // there may be an associated unreachableURL. + virtual bool hasUnreachableURL() const = 0; + virtual WebURL unreachableURL() const = 0; + + // Returns all redirects that occurred (both client and server) before + // at last committing the current page. This will contain one entry + // for each intermediate URL, and one entry for the last URL (so if + // there are no redirects, it will contain exactly the current URL, and + // if there is one redirect, it will contain the source and destination + // URL). + virtual void redirectChain(WebVector<WebURL>&) const = 0; + + // Returns the title for the current page. + virtual WebString pageTitle() const = 0; + + // The type of navigation that triggered the creation of this datasource. + virtual WebNavigationType triggeringActionNavigationType() const = 0; + + // The time in seconds of the event that triggered the creation of this + // datasource. This may be 0 if there was no triggering event. + virtual double triggeringActionEventTime() const = 0; + + // Extra data associated with this datasource. If non-null, the extra + // data pointer will be deleted when the datasource is destroyed. + // Setting the extra data pointer will cause any existing non-null + // extra data pointer to be deleted. + virtual ExtraData* extraData() const = 0; + virtual void SetExtraData(ExtraData*) = 0; + + // FIXME provide alternatives to: + // GetSearchableFormData() + // GetPasswordFormData() + // IsFormSubmit() + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebDragData.h b/webkit/api/public/WebDragData.h new file mode 100644 index 0000000..fe3abab --- /dev/null +++ b/webkit/api/public/WebDragData.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebDragData_h +#define WebDragData_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class ChromiumDataObject; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + class WebData; + class WebDragDataPrivate; + class WebString; + class WebURL; + template <typename T> class WebVector; + + // Holds data that may be exchanged through a drag-n-drop operation. It is + // inexpensive to copy a WebDragData object. + class WebDragData { + public: + ~WebDragData() { reset(); } + + WebDragData() : m_private(0) { } + WebDragData(const WebDragData& d) : m_private(0) { assign(d); } + WebDragData& operator=(const WebDragData& d) { assign(d); return *this; } + + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebDragData&); + + bool isNull() const { return m_private == 0; } + + WEBKIT_API WebURL url() const; + WEBKIT_API void setURL(const WebURL&); + + WEBKIT_API WebString urlTitle() const; + WEBKIT_API void setURLTitle(const WebString&); + + WEBKIT_API WebString fileExtension() const; + WEBKIT_API void setFileExtension(const WebString&); + + WEBKIT_API bool hasFileNames() const; + WEBKIT_API void fileNames(WebVector<WebString>&) const; + WEBKIT_API void setFileNames(const WebVector<WebString>&); + WEBKIT_API void appendToFileNames(const WebString&); + + WEBKIT_API WebString plainText() const; + WEBKIT_API void setPlainText(const WebString&); + + WEBKIT_API WebString htmlText() const; + WEBKIT_API void setHTMLText(const WebString&); + + WEBKIT_API WebURL htmlBaseURL() const; + WEBKIT_API void setHTMLBaseURL(const WebURL&); + + WEBKIT_API WebString fileContentFileName() const; + WEBKIT_API void setFileContentFileName(const WebString&); + + WEBKIT_API WebData fileContent() const; + WEBKIT_API void setFileContent(const WebData&); + +#if WEBKIT_IMPLEMENTATION + WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); + WebDragData& operator=(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); + operator WTF::PassRefPtr<WebCore::ChromiumDataObject>() const; +#endif + + private: + void assign(WebDragDataPrivate*); + WebDragDataPrivate* m_private; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebEditingAction.h b/webkit/api/public/WebEditingAction.h new file mode 100644 index 0000000..de716ca --- /dev/null +++ b/webkit/api/public/WebEditingAction.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebEditingAction_h +#define WebEditingAction_h + +#error "This header file is still a work in progress; do not include!" + +namespace WebKit { + + enum WebEditingAction { + WebEditingActionTyped, + WebEditingActionPasted, + WebEditingActionDropped, + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebEditingClient.h b/webkit/api/public/WebEditingClient.h new file mode 100644 index 0000000..8cc0e01 --- /dev/null +++ b/webkit/api/public/WebEditingClient.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebEditingClient_h +#define WebEditingClient_h + +#error "This header file is still a work in progress; do not include!" + +namespace WebKit { + class WebNode; + class WebRange; + class WebView; + + class WebEditingClient { + public: + // The following methods allow the client to intercept and overrule + // editing operations. + virtual bool shouldBeginEditing(WebView*, const WebRange&) = 0; + virtual bool shouldEndEditing(WebView*, const WebRange&) = 0; + virtual bool shouldInsertNode( + WebView*, const WebNode&, const WebRange&, const WebEditingAction&) = 0; + virtual bool shouldInsertText( + WebView*, const WebString&, const WebRange&, const WebEditingAction&) = 0; + virtual bool shouldChangeSelectedRange( + WebView*, const WebRange& from, const WebRange& to, const WebTextAffinity&, + bool stillSelecting) = 0; + virtual bool shouldDeleteRange(WebView*, const WebRange&) = 0; + virtual bool shouldApplyStyle(WebView*, const WebString& style, const WebRange&) = 0; + + virtual bool isSmartInsertDeleteEnabled(WebView*) = 0; + virtual bool isSelectTrailingWhitespaceEnabled(WebView*) = 0; + virtual void setInputMethodEnabled(WebView*, bool enabled) = 0; + + virtual void didBeginEditing(WebView*) = 0; + virtual void didChangeSelection(WebView*, bool isSelectionEmpty) = 0; + virtual void didChangeContents(WebView*) = 0; + virtual void didExecuteCommand(WebView*, const WebString& commandName) = 0; + virtual void didEndEditing(WebView*) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebFindOptions.h b/webkit/api/public/WebFindOptions.h new file mode 100644 index 0000000..05651b3 --- /dev/null +++ b/webkit/api/public/WebFindOptions.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFindOptions_h +#define WebFindOptions_h + +#include "WebString.h" + +namespace WebKit { + + // Options used when performing a find-in-page query. + struct WebFindOptions { + // Whether to search forward or backward within the page. + bool forward; + + // Whether search should be case-sensitive. + bool matchCase; + + // Whether this operation is the first request or a follow-up. + bool findNext; + + WebFindOptions() + : forward(true) + , matchCase(false) + , findNext(false) { } + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebFrame.h b/webkit/api/public/WebFrame.h new file mode 100644 index 0000000..72ae9bb --- /dev/null +++ b/webkit/api/public/WebFrame.h @@ -0,0 +1,239 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFrame_h +#define WebFrame_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" + +struct NPObject; + +namespace WebKit { + class WebData; + class WebDataSource; + class WebHistoryItem; + class WebString; + class WebURL; + class WebURLRequest; + class WebView; + + class WebFrame { + public: + // Returns the frame that is currently executing script or 0 if there + // is none. + WEBKIT_API static WebFrame* activeFrame(); + + + // Basic properties --------------------------------------------------- + + // The name of this frame. + virtual WebString name() = 0; + + // The url of the document loaded in this frame. This is equivalent to + // dataSource()->request().url(). + virtual WebURL url() = 0; + + // The url of the favicon (if any) specified by the document loaded in + // this frame. + virtual WebURL favIconURL() = 0; + + // The url of the OpenSearch Desription Document (if any) specified by + // the document loaded in this frame. + virtual WebURL openSearchDescriptionURL() = 0; + + // Returns the security origin of the current document. + virtual WebString securityOrigin() = 0; + + + // Geometry ----------------------------------------------------------- + + // NOTE: These routines do not force page layout so their results may + // not be accurate if the page layout is out-of-date. + + // The scroll offset from the top-left corner of the frame in pixels. + virtual WebSize scrollOffset() = 0; + + // The size of the contents area. + virtual WebSize contentsSize() = 0; + + // Returns the minimum preferred width of the content contained in the + // current document. + virtual int contentsPreferredWidth() = 0; + + // Returns true if the contents (minus scrollbars) has non-zero area. + virtual bool hasVisibleContent() = 0; + + + // Hierarchy ---------------------------------------------------------- + + // Returns the containing view. + virtual WebView* view() = 0; + + // Returns the parent frame. + virtual WebFrame* parent() = 0; + + // Returns the top-most frame in the hierarchy containing this frame. + virtual WebFrame* top() = 0; + + // Returns the first/last child frame. + virtual WebFrame* firstChild() = 0; + virtual WebFrame* lastChild() = 0; + + // Returns the next/previous sibling frame. + virtual WebFrame* nextSibling() = 0; + virtual WebFrame* previousSibling() = 0; + + // Returns the next/previous frame in "frame traversal order" + // optionally wrapping around. + virtual WebFrame* traverseNext(bool wrap) = 0; + virtual WebFrame* traversePrevious(bool wrap) = 0; + + // Returns the child frame identified by the given name. + virtual WebFrame* findChildByName(const WebString& name) = 0; + + // Returns the child frame identified by the given xpath expression. + virtual WebFrame* findChildByExpression(const WebString& xpath) = 0; + + + // Scripting ---------------------------------------------------------- + + // Calls window.gc() if it is defined. + virtual void collectGarbage() = 0; + + // Returns a NPObject corresponding to this frame's DOMWindow. + virtual NPObject* windowObject() = 0; + + // Binds a NPObject as a property of this frame's DOMWindow. + virtual void bindToWindowObject(const WebString& name, NPObject*) = 0; + + // Executes script in the context of the current page. + virtual void executeScript(const WebScriptSource&) = 0; + + // Executes script in a new context associated with the frame. The + // script gets its own global scope and its own prototypes for + // intrinsic JS objects (String, Array, and so-on). It shares the + // wrappers for all DOM nodes and DOM constructors. + virtual void executeScriptInNewContext(const WebScriptSource* sources, + unsigned numSources) = 0; + + // Logs to the console associated with this frame. + virtual void addMessageToConsole(const WebConsoleMessage&) = 0; + + + // Styling ------------------------------------------------------------- + + // Insert the given text as a STYLE element at the beginning of the + // document. + virtual bool insertStyleText(const WebString&) = 0; + + + // Navigation ---------------------------------------------------------- + + virtual void loadURL(const WebURLRequest&) = 0; + + virtual void loadData(const WebData& data, + const WebString& mimeType, + const WebString& textEncoding, + const WebURL& baseURL, + const WebURL& unreachableURL, + bool replace) = 0; + + virtual void loadHistorical(const WebHistoryItem&) = 0; + + virtual void reload() = 0; + + virtual bool isLoading() = 0; + + // Stops any pending loads on the frame and its children. + virtual void stopLoading() = 0; + + // Returns the data source that is currently loading. May be null. + virtual WebDataSource* provisionalDataSource() = 0; + + // Returns the data source that is currently loaded. + virtual WebDataSource* dataSource() = 0; + + // Returns the previous history item. Check WebHistoryItem::isNull() + // before using. + virtual const WebHistoryItem& previousHistoryItem() = 0; + + // Returns the current history item. Check WebHistoryItem::isNull() + // before using. + virtual const WebHistoryItem& currentHistoryItem() = 0; + + // View-source rendering mode. Set this before loading an URL to cause + // it to be rendered in view-source mode. + virtual void enableViewSourceMode(bool) = 0; + virtual bool isViewSourceModeEnabled() = 0; + + + // App-cache ----------------------------------------------------------- + + virtual void selectAppCacheWithoutManifest() = 0; + virtual void selectAppCacheWithManifest(const WebURL& manifest) = 0; + + // Will be null if an app cache has not been selected. + virtual WebAppCacheContext* appCacheContext() = 0; + + + // Editing ------------------------------------------------------------- + + // Replaces the selection with the given text. + virtual void replaceSelection(const WebString& text) = 0; + + // See EditorCommand.cpp for the list of supported commands. + virtual void executeCommand(const WebString&) = 0; + virtual void executeCommand(const WebString&, const WebString& value) = 0; + virtual bool isCommandEnabled(const WebString&); + + // Spell-checking support. + virtual void enableContinuousSpellChecking(bool) = 0; + virtual bool isContinuousSpellCheckingEnabled() = 0; + + + // Selection ----------------------------------------------------------- + + virtual void selectAll() = 0; + virtual void selectNone() = 0; + + virtual WebString selectionAsText() = 0; + virtual WebString selectionAsHTML() = 0; + + + // Find-in-page -------------------------------------------------------- + + // FIXME + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebFrameClient.h b/webkit/api/public/WebFrameClient.h new file mode 100644 index 0000000..d03cf12 --- /dev/null +++ b/webkit/api/public/WebFrameClient.h @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFrameClient_h +#define WebFrameClient_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" +#include "WebNavigationGesture.h" + +namespace WebKit { + class WebFrame; + class WebMediaPlayer; + class WebMediaPlayerClient; + class WebString; + class WebURL; + class WebWorker; + class WebWorkerClient; + + class WebFrameClient { + public: + // Factory methods ----------------------------------------------------- + + // May return null. + virtual WebPlugin* createPlugin( + WebFrame*, const WebURL& source, const WebString& mimeType, + const WebString& classID, WebString* actualMimeType) = 0; + + // May return null. + virtual WebWorker* createWorker(WebFrame*, WebWorkerClient*) = 0; + + // May return null. + virtual WebMediaPlayer* createMediaPlayer(WebFrame*, WebMediaPlayerClient*) = 0; + + + // General notifications ----------------------------------------------- + + // This frame is about to be closed. + virtual void willClose(WebFrame*) = 0; + + + // Load commands ------------------------------------------------------- + + // The client should handle the navigation externally. + virtual void loadURLExternally( + WebFrame*, const WebURLRequest&, WebNavigationPolicy) = 0; + + + // Navigational queries ------------------------------------------------ + + // The client may choose to alter the navigation policy. Otherwise, + // defaultPolicy should just be returned. + virtual WebNavigationPolicy decidePolicyForNavigation( + WebFrame*, const WebURLRequest&, WebNavigationType, + WebNavigationPolicy defaultPolicy, bool isRedirect) = 0; + + + // Navigational notifications ------------------------------------------ + + // A client-side redirect will occur. This may correspond to a <META + // refresh> or some script activity. + virtual void willPerformClientRedirect( + WebFrame*, const WebURL&, double interval, double fireTime) = 0; + + // A client-side redirect was cancelled. + virtual void didCancelClientRedirect(WebFrame*) = 0; + + // A client-side redirect completed. + virtual void didCompleteClientRedirect(WebFrame*, const WebURL& fromURL) = 0; + + // A datasource has been created for a new navigation. The given + // datasource will become the provisional datasource for the frame. + virtual void didCreateDataSource(WebFrame*, WebDataSource*) = 0; + + // A new provisional load has been started. + virtual void didStartProvisionalLoad(WebFrame*, WebNavigationGesture) = 0; + + // The provisional load was redirected via a HTTP 3xx response. + virtual void didReceiveServerRedirectForProvisionalLoad(WebFrame*) = 0; + + // The provisional load failed. + virtual void didFailProvisionalLoad(WebFrame*, const WebURLError&) = 0; + + // The provisional datasource is now committed. The first part of the + // response body has been received, and the encoding of the response + // body is known. + virtual void didCommitProvisionalLoad(WebFrame*, bool isNewNavigation) = 0; + + // The window object for the frame has been cleared of any extra + // properties that may have been set by script from the previously + // loaded document. + virtual void didClearWindowObject(WebFrame*) = 0; + + // The document element has been created. + virtual void didCreateDocumentElement(WebFrame*) = 0; + + // The page title is available. + virtual void didReceiveTitle(WebFrame*, const WebString& title) = 0; + + // The frame's document finished loading. + virtual void didFinishDocumentLoad(WebFrame*) = 0; + + // The 'load' event was dispatched. + virtual void didHandleOnloadEvents(WebFrame*) = 0; + + // The frame's document or one of its subresources failed to load. + virtual void didFailLoad(WebFrame*, const WebURLError&) = 0; + + // The frame's document and all of its subresources succeeded to load. + virtual void didFinishLoad(WebFrame*) = 0; + + // The navigation resulted in scrolling the page to a named anchor instead + // of downloading a new document. + virtual void didChangeLocationWithinPage(WebFrame*, bool isNewNavigation) = 0; + + // Called upon update to scroll position, document state, and other + // non-navigational events related to the data held by WebHistoryItem. + // WARNING: This method may be called very frequently. + virtual void didUpdateCurrentHistoryItem(WebFrame*) = 0; + + + // Low-level resource notifications ------------------------------------ + + // An identifier was assigned to the specified request. The client + // should remember this association if interested in subsequent events. + virtual void assignIdentifierToRequest( + WebFrame*, unsigned identifier, const WebURLRequest&) = 0; + + // The request may be modified before it is sent. + virtual void willSendRequest( + WebFrame*, unsigned identifier, WebURLRequest&) = 0; + + // The resource request given by identifier succeeded. + virtual void didFinishLoading( + WebFrame*, unsigned identifier) = 0; + + // The resource request given by identifier failed. + virtual void didFailLoading( + WebFrame*, unsigned identifier, const WebURLError&) = 0; + + // The specified request was satified from WebCore's memory cache. + virtual void didLoadResourceFromMemoryCache( + WebFrame*, const WebURLRequest&, const WebURLResponse&) = 0; + + + // Script notifications ------------------------------------------------ + + // Script in the page tried to allocate too much memory. + virtual void didExhaustMemoryAvailableForScript(WebFrame*) = 0; + + + // Geometry notifications ---------------------------------------------- + + // The size of the content area changed. + virtual void didChangeContentsSize(WebFrame*) = 0; + + + // FIXME need to add: + // find-in-page + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebHTTPBody.h b/webkit/api/public/WebHTTPBody.h new file mode 100644 index 0000000..1a4f49c --- /dev/null +++ b/webkit/api/public/WebHTTPBody.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebHTTPBody_h +#define WebHTTPBody_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebData.h" +#include "WebString.h" +#include "WebVector.h" + +namespace WebKit { + + struct WebHTTPBody { + struct Element { + enum { TypeData, TypeFile } type; + WebData data; + WebString fileName; + }; + WebVector<Element> elements; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebHistoryItem.h b/webkit/api/public/WebHistoryItem.h new file mode 100644 index 0000000..5b2b32d --- /dev/null +++ b/webkit/api/public/WebHistoryItem.h @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebHistoryItem_h +#define WebHistoryItem_h + +#include "WebCommon.h" + +namespace WebKit { + class WebHistoryItemPrivate; + class WebString; + class WebURL; + struct WebPoint; + template <typename T> class WebVector; + + // Represents a frame-level navigation entry in session history. A + // WebHistoryItem is a node in a tree. + // + // Copying a WebHistoryItem is cheap. + // + class WebHistoryItem { + public: + ~WebHistoryItem() { reset(); } + + WebHistoryItem() : m_private(0) { } + WebHistoryItem(const WebHistoryItem& h) : m_private(0) { assign(h); } + WebHistoryItem& operator=(const WebHistoryItem& h) { assign(h); return *this; } + + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebHistoryItem&); + + bool isNull() const { return m_private == 0; } + + WEBKIT_API WebURL url() const; + WEBKIT_API void setURL(const WebURL&); + + WEBKIT_API WebURL originalURL() const; + WEBKIT_API void setOriginalURL(const WebURL&); + + WEBKIT_API WebURL referrerURL() const; + WEBKIT_API void setReferrerURL(const WebURL&); + + WEBKIT_API WebString target() const; + WEBKIT_API void setTarget(const WebString&) const; + + WEBKIT_API WebString parent() const; + WEBKIT_API void setParent(const WebString&); + + WEBKIT_API WebString title() const; + WEBKIT_API void setTitle(const WebString&); + + WEBKIT_API WebString alternateTitle() const; + WEBKIT_API void setAlternateTitle(const WebString&); + + WEBKIT_API double lastVisitedTime() const; + WEBKIT_API void setLastVisitedTime(double); + + WEBKIT_API WebPoint scrollOffset() const; + WEBKIT_API void setScrollOffset(const WebPoint&) const; + + WEBKIT_API bool isTargetItem() const; + WEBKIT_API void setIsTargetItem(bool) const; + + WEBKIT_API int visitCount() const; + WEBKIT_API void setVisitCount(int) const; + + WEBKIT_API void documentState(WebVector<WebString>&) const; + WEBKIT_API void setDocumentState(const WebVector<WebString>&) const; + + WEBKIT_API WebString httpContentType() const; + WEBKIT_API void setHTTPContentType(const WebString&) const; + + WEBKIT_API bool hasHTTPBody() const; + WEBKIT_API void httpBody(WebHTTPBody&) const; + WEBKIT_API void setHTTPBody(const WebHTTPBody&); + WEBKIT_API void appendToHTTPBody(const WebHTTPBody::Element&); + + WEBKIT_API bool hasChildren() const; + WEBKIT_API void children(WebVector<WebHistoryItem>&) const; + WEBKIT_API void setChildren(const WebVector<WebHistoryItem>&); + WEBKIT_API void appendToChildren(const WebHistoryItem&); + + private: + WebHistoryItemPrivate* m_private; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebImage.h b/webkit/api/public/WebImage.h new file mode 100644 index 0000000..5dd4d52 --- /dev/null +++ b/webkit/api/public/WebImage.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebImage_h +#define WebImage_h + +#include "WebCommon.h" +#include "WebSize.h" + +#if WEBKIT_USING_SKIA +class SkBitmap; +#endif + +namespace WebKit { + + class WebImagePixels; + class WebImagePrivate; + + // A container for an ARGB bitmap. + class WebImage { + public: + ~WebImage() { reset(); } + + WebImage() : m_private(0) { } + WebImage(const WebImage& image) : m_private(0) { assign(image); } + + WebImage& operator=(const WebImage& image) + { + assign(image); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API WebSize size() const; + + WebImagePixels pixels() const; + bool isNull() const { return m_private == 0; } + +#if WEBKIT_USING_SKIA + WebImage(const SkBitmap& bitmap) : m_private(0) + { + assign(bitmap); + } + + WebImage& operator=(const SkBitmap& bitmap) + { + assign(bitmap); + return *this; + } + + WEBKIT_API operator SkBitmap() const; +#endif + + private: + friend class WebImagePixels; + + WEBKIT_API void assign(const WebImage&); + WEBKIT_API const void* lockPixels(); + WEBKIT_API void unlockPixels(); + +#if WEBKIT_USING_SKIA + WEBKIT_API void assign(const SkBitmap&); +#endif + + WebImagePrivate* m_private; + }; + + class WebImagePixels { + public: + WebImagePixels(WebImage* image) : m_image(image) + { + m_data = m_image->lockPixels(); + } + + WebImagePixels(const WebImagePixels& other) : m_image(other.m_image) + { + m_data = m_image->lockPixels(); + } + + ~WebImagePixels() { m_image->unlockPixels(); } + + const void* get() const { return m_data; } + operator const void*() const { return m_data; } + + private: + WebImagePixels& operator=(const WebImagePixels&); + + WebImage* m_image; + const void* m_data; + }; + + inline WebImagePixels WebImage::pixels() const + { + return WebImagePixels(const_cast<WebImage*>(this)); + } + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebInputEvent.h b/webkit/api/public/WebInputEvent.h new file mode 100644 index 0000000..93350a5 --- /dev/null +++ b/webkit/api/public/WebInputEvent.h @@ -0,0 +1,225 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebInputEvent_h +#define WebInputEvent_h + +#include <string.h> + +#include "WebCommon.h" + +namespace WebKit { + + // The classes defined in this file are intended to be used with + // WebWidget's handleInputEvent method. These event types are cross- + // platform and correspond closely to WebCore's Platform*Event classes. + // + // WARNING! These classes must remain PODs (plain old data). They are + // intended to be "serializable" by copying their raw bytes, so they must + // not contain any non-bit-copyable member variables! + + // WebInputEvent -------------------------------------------------------------- + + class WebInputEvent { + public: + WebInputEvent() : type(None), modifiers(0) { } + + // There are two schemes used for keyboard input. On Windows (and, + // interestingly enough, on Mac Carbon) there are two events for a + // keypress. One is a raw keydown, which provides the keycode only. + // If the app doesn't handle that, then the system runs key translation + // to create an event containing the generated character and pumps that + // event. In such a scheme, those two events are translated to + // RAW_KEY_DOWN and CHAR events respectively. In Cocoa and Gtk, key + // events contain both the keycode and any translation into actual + // text. In such a case, WebCore will eventually need to split the + // events (see disambiguateKeyDownEvent and its callers) but we don't + // worry about that here. We just use a different type (KEY_DOWN) to + // indicate this. + + enum Type { + None = -1, + + // WebMouseEvent + MouseDown, + MouseUp, + MouseMove, + MouseLeave, + MouseDoubleClick, + MouseTripleClick, + + // WebMouseWheelEvent + MouseWheel, + + // WebKeyboardEvent + RawKeyDown, + KeyDown, + KeyUp, + Char + }; + + enum Modifiers { + // modifiers for all events: + ShiftKey = 1 << 0, + ControlKey = 1 << 1, + AltKey = 1 << 2, + MetaKey = 1 << 3, + + // modifiers for keyboard events: + IsKeyPad = 1 << 4, + IsAutoRepeat = 1 << 5 + }; + + Type type; + int modifiers; + + // Returns true if the WebInputEvent |type| is a keyboard event. + static bool isKeyboardEventType(int type) + { + return type == RawKeyDown + || type == KeyDown + || type == KeyUp + || type == Char; + } + }; + + // WebKeyboardEvent ----------------------------------------------------------- + + class WebKeyboardEvent : public WebInputEvent { + public: + // Caps on string lengths so we can make them static arrays and keep + // them PODs. + static const size_t textLengthCap = 4; + + // http://www.w3.org/TR/DOM-Level-3-Events/keyset.html lists the + // identifiers. The longest is 18 characters, so we round up to the + // next multiple of 4. + static const size_t keyIdentifierLengthCap = 20; + + // |windowsKeyCode| is the Windows key code associated with this key + // event. Sometimes it's direct from the event (i.e. on Windows), + // sometimes it's via a mapping function. If you want a list, see + // webkit/port/platform/chromium/KeyboardCodes* . + int windowsKeyCode; + + // The actual key code genenerated by the platform. The DOM spec runs + // on Windows-equivalent codes (thus |windowsKeyCode| above) but it + // doesn't hurt to have this one around. + int nativeKeyCode; + + // |text| is the text generated by this keystroke. |unmodifiedText| is + // |text|, but unmodified by an concurrently-held modifiers (except + // shift). This is useful for working out shortcut keys. Linux and + // Windows guarantee one character per event. The Mac does not, but in + // reality that's all it ever gives. We're generous, and cap it a bit + // longer. + WebUChar text[textLengthCap]; + WebUChar unmodifiedText[textLengthCap]; + + // This is a string identifying the key pressed. + char keyIdentifier[keyIdentifierLengthCap]; + + // This identifies whether this event was tagged by the system as being + // a "system key" event (see + // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for + // details). Other platforms don't have this concept, but it's just + // easier to leave it always false than ifdef. + bool isSystemKey; + + WebKeyboardEvent() + : windowsKeyCode(0) + , nativeKeyCode(0) + , isSystemKey(false) + { + memset(&text, 0, sizeof(text)); + memset(&unmodifiedText, 0, sizeof(unmodifiedText)); + memset(&keyIdentifier, 0, sizeof(keyIdentifier)); + } + + // Sets keyIdentifier based on the value of windowsKeyCode. This is + // handy for generating synthetic keyboard events. + WEBKIT_API void setKeyIdentifierFromWindowsKeyCode(); + }; + + // WebMouseEvent -------------------------------------------------------------- + + class WebMouseEvent : public WebInputEvent { + public: + // These values defined for WebCore::MouseButton + enum Button { + ButtonNone = -1, + ButtonLeft, + ButtonMiddle, + ButtonRight + }; + + Button button; + int x; + int y; + int globalX; + int globalY; + double timeStampSeconds; // Seconds since epoch. + int layoutTestClickCount; // Only used during layout tests. + + WebMouseEvent() + : button(ButtonNone) + , x(0) + , y(0) + , globalX(0) + , globalY(0) + , timeStampSeconds(0.0) + , layoutTestClickCount(0) + { + } + }; + + // WebMouseWheelEvent --------------------------------------------------------- + + class WebMouseWheelEvent : public WebMouseEvent { + public: + float deltaX; + float deltaY; + float wheelTicksX; + float wheelTicksY; + bool scrollByPage; + + WebMouseWheelEvent() + : deltaX(0.0f) + , deltaY(0.0f) + , wheelTicksX(0.0f) + , wheelTicksY(0.0f) + , scrollByPage(false) + { + } + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebKit.h b/webkit/api/public/WebKit.h new file mode 100644 index 0000000..faf54ce --- /dev/null +++ b/webkit/api/public/WebKit.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebKit_h +#define WebKit_h + +#include "WebCommon.h" + +namespace v8 { + class Extension; +} + +namespace WebKit { + class WebKitClient; + class WebString; + + // Must be called on the thread that will be the main WebKit thread before + // using any other WebKit APIs. The provided WebKitClient must be non-null + // and must remain valid until the current thread calls shutdown. + WEBKIT_API void initialize(WebKitClient*); + + // Once shutdown, the WebKitClient passed to initialize will no longer be + // accessed. No other WebKit objects should be in use when this function + // is called. Any background threads created by WebKit are promised to be + // terminated by the time this function returns. + WEBKIT_API void shutdown(); + + // Returns the WebKitClient instance passed to initialize. + WEBKIT_API WebKitClient* webKitClient(); + + // Alters the rendering of content to conform to a fixed set of rules. + WEBKIT_API void setLayoutTestMode(bool); + WEBKIT_API bool layoutTestMode(); + + // Registers a URL scheme to be treated as a local scheme (i.e., with the + // same security rules as those applied to "file" URLs). This means that + // normal pages cannot link to or access URLs of this scheme. + WEBKIT_API void registerURLSchemeAsLocal(const WebString&); + + // Registers a URL scheme to be treated as a noAccess scheme. This means + // that pages loaded with this URL scheme cannot access pages loaded with + // any other URL scheme. + WEBKIT_API void registerURLSchemeAsNoAccess(const WebString&); + + // Registers a v8 extension to be available on webpages with a particular + // scheme. If the scheme argument is empty, the extension is available on + // all pages. Will only affect v8 contexts initialized after this call. + // Takes ownership of the v8::Extension object passed. + WEBKIT_API void registerExtension(v8::Extension*); + WEBKIT_API void registerExtension(v8::Extension*, + const WebString& schemeRestriction); + + // Enables HTML5 worker support. + WEBKIT_API void enableWebWorkers(); + + // Purge the plugin list cache. + WEBKIT_API void resetPluginCache(); + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebKitClient.h b/webkit/api/public/WebKitClient.h new file mode 100644 index 0000000..112e5ff --- /dev/null +++ b/webkit/api/public/WebKitClient.h @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebKitClient_h +#define WebKitClient_h + +#include "WebCommon.h" + +namespace WebKit { + class WebClipboard; + class WebData; + class WebMimeRegistry; + class WebPluginListBuilder; + class WebSandboxSupport; + class WebString; + class WebThemeEngine; + class WebURL; + struct WebPluginInfo; + template <typename T> class WebVector; + class WebWorker; + class WebWorkerClient; + + class WebKitClient { + public: + // Must return non-null. + virtual WebClipboard* clipboard() = 0; + + // Must return non-null. + virtual WebMimeRegistry* mimeRegistry() = 0; + + // May return null on some platforms. + virtual WebSandboxSupport* sandboxSupport() = 0; + + // May return null on some platforms. + virtual WebThemeEngine* themeEngine() = 0; + + + // History ------------------------------------------------------------- + + // Returns the hash for the given canonicalized URL for use in visited + // link coloring. + virtual unsigned long long visitedLinkHash( + const char* canonicalURL, size_t length) = 0; + + // Returns whether the given link hash is in the user's history. The + // hash must have been generated by calling VisitedLinkHash(). + virtual bool isLinkVisited(unsigned long long linkHash) = 0; + + + // Network ------------------------------------------------------------- + + virtual void setCookies( + const WebURL& url, const WebURL& policyURL, const WebString& cookies) = 0; + virtual WebString cookies(const WebURL& url, const WebURL& policyURL) = 0; + + // A suggestion to prefetch IP information for the given hostname. + virtual void prefetchHostName(const WebString&) = 0; + + + // Plugins ------------------------------------------------------------- + + // If refresh is true, then cached information should not be used to + // satisfy this call. + virtual void getPluginList(bool refresh, WebPluginListBuilder*) = 0; + + + // Profiling ----------------------------------------------------------- + + virtual void decrementStatsCounter(const char* name) = 0; + virtual void incrementStatsCounter(const char* name) = 0; + + // An event is identified by the pair (name, id). The extra parameter + // specifies additional data to log with the event. + virtual void traceEventBegin(const char* name, void* id, const char* extra) = 0; + virtual void traceEventEnd(const char* name, void* id, const char* extra) = 0; + + + // Resources ----------------------------------------------------------- + + // Returns a blob of data corresponding to the named resource. + virtual WebData loadResource(const char* name) = 0; + + + // Sudden Termination -------------------------------------------------- + + // Disable/Enable sudden termination. + virtual void suddenTerminationChanged(bool enabled) = 0; + + + // System -------------------------------------------------------------- + + // Returns a value such as "en-US". + virtual WebString defaultLocale() = 0; + + // Wall clock time in seconds since the epoch. + virtual double currentTime() = 0; + + // Delayed work is driven by a shared timer. + virtual void setSharedTimerFiredFunction(void (*func)()) = 0; + virtual void setSharedTimerFireTime(double fireTime) = 0; + virtual void stopSharedTimer() = 0; + + // Callable from a background WebKit thread. + virtual void callOnMainThread(void (*func)()) = 0; + + + // WebWorkers ---------------------------------------------------------- + + virtual WebWorker* createWorker(WebWorkerClient*) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebMediaPlayer.h b/webkit/api/public/WebMediaPlayer.h new file mode 100644 index 0000000..18d3bbf --- /dev/null +++ b/webkit/api/public/WebMediaPlayer.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebMediaPlayer_h +#define WebMediaPlayer_h + +#include "WebCanvas.h" + +namespace WebKit { + class WebMediaPlayerClient; + class WebURL; + struct WebRect; + struct WebSize; + + class WebMediaPlayer { + public: + enum NetworkState { + Empty, + Idle, + Loading, + Loaded, + FormatError, + NetworkError, + DecodeError, + }; + + enum ReadyState { + HaveNothing, + HaveMetadata, + HaveCurrentData, + HaveFutureData, + HaveEnoughData, + }; + + virtual ~WebMediaPlayer() {} + + virtual void load(const WebURL&) = 0; + virtual void cancelLoad() = 0; + + // Playback controls. + virtual void play() = 0; + virtual void pause() = 0; + virtual void stop() = 0; + virtual void seek(float seconds) = 0; + virtual void setEndTime(float seconds) = 0; + virtual void setRate(float) = 0; + virtual void setVolume(float) = 0; + virtual void setVisible(bool) = 0; + virtual bool setAutoBuffer(bool) = 0; + virtual bool totalBytesKnown() = 0; + virtual float maxTimeBuffered() const = 0; + virtual float maxTimeSeekable() const = 0; + + virtual void setSize(const WebSize&) = 0; + + // TODO(hclam): enable this for mac. +#if WEBKIT_USING_SKIA + virtual void paint(WebCanvas*, const WebRect&) = 0; +#endif + + // True if a video is loaded. + virtual bool hasVideo() const = 0; + + // Dimension of the video. + virtual WebSize naturalSize() const = 0; + + // Getters fo playback state. + virtual bool paused() const = 0; + virtual bool seeking() const = 0; + virtual float duration() const = 0; + virtual float currentTime() const = 0; + + // Get rate of loading the resource. + virtual int dataRate() const = 0; + + // Internal states of loading and network. + virtual NetworkState networkState() const = 0; + virtual ReadyState readyState() const = 0; + + virtual unsigned long long bytesLoaded() const = 0; + virtual unsigned long long totalBytes() const = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebMediaPlayerClient.h b/webkit/api/public/WebMediaPlayerClient.h new file mode 100644 index 0000000..e398149 --- /dev/null +++ b/webkit/api/public/WebMediaPlayerClient.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebMediaPlayerClient_h +#define WebMediaPlayerClient_h + +namespace WebKit { + + class WebRequest; + class WebURL; + + class WebMediaPlayerClient { + public: + virtual void networkStateChanged() = 0; + virtual void readyStateChanged() = 0; + virtual void volumeChanged() = 0; + virtual void timeChanged() = 0; + virtual void repaint() = 0; + virtual void durationChanged() = 0; + virtual void rateChanged() = 0; + virtual void sizeChanged() = 0; + virtual void sawUnsupportedTracks() = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebMimeRegistry.h b/webkit/api/public/WebMimeRegistry.h new file mode 100644 index 0000000..40e5c98 --- /dev/null +++ b/webkit/api/public/WebMimeRegistry.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebMimeRegistry_h +#define WebMimeRegistry_h + +#include "WebCommon.h" + +namespace WebKit { + class WebString; + + class WebMimeRegistry { + public: + virtual bool supportsImageMIMEType(const WebString& mimeType) = 0; + virtual bool supportsJavaScriptMIMEType(const WebString& mimeType) = 0; + virtual bool supportsNonImageMIMEType(const WebString& mimeType) = 0; + + virtual WebString mimeTypeForExtension(const WebString& fileExtension) = 0; + virtual WebString mimeTypeFromFile(const WebString& filePath) = 0; + virtual WebString preferredExtensionForMIMEType(const WebString& mimeType) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebNavigationPolicy.h b/webkit/api/public/WebNavigationPolicy.h new file mode 100644 index 0000000..707f56d --- /dev/null +++ b/webkit/api/public/WebNavigationPolicy.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebNavigationPolicy_h +#define WebNavigationPolicy_h + +#error "This header file is still a work in progress; do not include!" + +namespace WebKit { + + enum WebNavigationPolicy { + WebNavigationPolicyIgnore, + WebNavigationPolicyDownload, + WebNavigationPolicyCurrentTab, + WebNavigationPolicyNewBackgroundTab, + WebNavigationPolicyNewForegroundTab, + WebNavigationPolicyNewForegroundTabInNewWindow, + WebNavigationPolicyNewPopupWindow, + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebNavigationType.h b/webkit/api/public/WebNavigationType.h new file mode 100644 index 0000000..8e57376 --- /dev/null +++ b/webkit/api/public/WebNavigationType.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebNavigationType_h +#define WebNavigationType_h + +#error "This header file is still a work in progress; do not include!" + +namespace WebKit { + + enum WebNavigationType { + WebNavigationTypeLinkClicked, + WebNavigationTypeFormSubmitted, + WebNavigationTypeBackForward, + WebNavigationTypeReload, + WebNavigationTypeFormResubmitted, + WebNavigationTypeOther + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebNode.h b/webkit/api/public/WebNode.h new file mode 100644 index 0000000..16f8d61 --- /dev/null +++ b/webkit/api/public/WebNode.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebNode_h +#define WebNode_h + +#include "WebCommon.h" + +namespace WebKit { + class WebNodePrivate; + + // Provides readonly access to some properties of a DOM node. + class WebNode { + public: + ~WebNode() { reset(); } + + WebNode() : m_private(0) { } + WebNode(const WebNode& n) : m_private(0) { assign(n); } + WebNode& operator=(const WebNode& n) { assign(n); return *this; } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebNode&); + + bool isNull() const { return m_private == 0; } + + WEBKIT_API WebNode parentNode() const; + WEBKIT_API WebString nodeName() const; + + private: + WebNodePrivate* m_private; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebPluginListBuilder.h b/webkit/api/public/WebPluginListBuilder.h new file mode 100644 index 0000000..405b50f --- /dev/null +++ b/webkit/api/public/WebPluginListBuilder.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPluginListBuilder_h +#define WebPluginListBuilder_h + +namespace WebKit { + class WebString; + + // An interface for building a list of known plugins. + class WebPluginListBuilder { + public: + virtual void addPlugin( + const WebString& name, const WebString& description, + const WebString& fileName) = 0; + + virtual void addMediaTypeToLastPlugin( + const WebString& name, const WebString& description) = 0; + + virtual void addFileExtensionToLastMediaType( + const WebString& fileExtension) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebPoint.h b/webkit/api/public/WebPoint.h new file mode 100644 index 0000000..bf73e34 --- /dev/null +++ b/webkit/api/public/WebPoint.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPoint_h +#define WebPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntPoint.h" +#else +#include <base/gfx/rect.h> +#endif + +namespace WebKit { + + struct WebPoint { + int x; + int y; + + WebPoint() + : x(0) + , y(0) + { + } + + WebPoint(int x, int y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebPoint(const WebCore::IntPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const WebCore::IntPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::IntPoint() const + { + return WebCore::IntPoint(x, y); + } +#else + WebPoint(const gfx::Point& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const gfx::Point& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator gfx::Point() const + { + return gfx::Point(x, y); + } +#endif + }; + + inline bool operator==(const WebPoint& a, const WebPoint& b) + { + return a.x == b.x && a.y == b.y; + } + + inline bool operator!=(const WebPoint& a, const WebPoint& b) + { + return !(a == b); + } + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebPopupMenu.h b/webkit/api/public/WebPopupMenu.h new file mode 100644 index 0000000..521ecec --- /dev/null +++ b/webkit/api/public/WebPopupMenu.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPopupMenu_h +#define WebPopupMenu_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" +#include "WebWidget.h" + +namespace WebKit { + + class WebPopupMenu : public WebWidget { + public: + WEBKIT_API static WebPopupMenu* create(WebWidgetClient*); + }; + +} // namespace WebKit diff --git a/webkit/api/public/WebPopupMenuInfo.h b/webkit/api/public/WebPopupMenuInfo.h new file mode 100644 index 0000000..5ce741b --- /dev/null +++ b/webkit/api/public/WebPopupMenuInfo.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPopupMenuInfo_h +#define WebPopupMenuInfo_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" +#include "WebRect.h" +#include "WebVector.h" + +namespace WebKit { + + // Describes the contents of a popup menu. + struct WebPopupMenuInfo { + struct Item { + enum Type { + Option, + Group, + Separator, + }; + WebString label; + Type type; + bool enabled; + }; + + WebRect bounds; + int itemHeight; + int selectedIndex; + WebVector<Item> items; + }; + +} // namespace WebKit diff --git a/webkit/api/public/WebPreferences.h b/webkit/api/public/WebPreferences.h new file mode 100644 index 0000000..1c5056d --- /dev/null +++ b/webkit/api/public/WebPreferences.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPreferences_h +#define WebPreferences_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" + +namespace WebKit { + class WebString; + + class WebPreferences { + public: + enum BooleanKey { + DeveloperExtrasEnabled, + DOMPasteEnabled, + JavaEnabled, + JavaScriptEnabled, + JavaScriptCanOpenWindowsAutomatically, + JavaScriptCanCloseWindowsAutomatically, + LoadsImagesAutomatically, + PluginsEnabled, + ShrinksStandaloneImagesToFit, + TabKeyCyclesThroughElements, + TextAreasAreResizable, + UserStyleSheetEnabled, + UsesPageCache, + UsesUniversalDetector, + }; + + enum IntegerKey { + DefaultFixedFontSize, + DefaultFontSize, + MinimumFontSize, + MinimumLogicalFontSize, + }; + + enum StringKey { + CursiveFontFamily, + DefaultEncoding, + FantasyFontFamily, + FixedFontFamily, + SansSerifFontFamily, + SerifFontFamily, + StandardFontFamily, + }; + + enum URLKey { + UserStyleSheetLocation, + }; + + virtual bool getValue(BooleanKey) const = 0; + virtual void setValue(BooleanKey, bool) = 0; + + virtual int getValue(IntegerKey) const = 0; + virtual void setValue(IntegerKey, int) = 0; + + virtual WebString getValue(StringKey) const = 0; + virtual void setValue(StringKey, const WebString&) = 0; + + virtual WebURL getValue(URLKey) const = 0; + virtual void setValue(URLKey, const WebURL&) = 0; + }; + +} // namespace WebKit diff --git a/webkit/api/public/WebRange.h b/webkit/api/public/WebRange.h new file mode 100644 index 0000000..bd6924c --- /dev/null +++ b/webkit/api/public/WebRange.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebRange_h +#define WebRange_h + +#include "WebCommon.h" + +namespace WebKit { + class WebNode; + class WebRangePrivate; + + // Provides readonly access to some properties of a DOM range. + class WebRange { + public: + ~WebRange() { reset(); } + + WebRange() : m_private(0) { } + WebRange(const WebRange& r) : m_private(0) { assign(r); } + WebRange& operator=(const WebRange& r) { assign(r); return *this; } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebRange&); + + bool isNull() const { return m_private == 0; } + + WEBKIT_API int startOffset() const; + WEBKIT_API int endOffset() const; + WEBKIT_API WebNode startContainer(int& exceptionCode) const; + WEBKIT_API WebNode endContainer(int& exceptionCode) const; + + private: + WebRangePrivate* m_private; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebRect.h b/webkit/api/public/WebRect.h new file mode 100644 index 0000000..b3a6c08 --- /dev/null +++ b/webkit/api/public/WebRect.h @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebRect_h +#define WebRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntRect.h" +#else +#include <base/gfx/rect.h> +#endif + +namespace WebKit { + + struct WebRect { + int x; + int y; + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebRect() + : x(0) + , y(0) + , width(0) + , height(0) + { + } + + WebRect(int x, int y, int width, int height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebRect(const WebCore::IntRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const WebCore::IntRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::IntRect() const + { + return WebCore::IntRect(x, y, width, height); + } +#else + WebRect(const gfx::Rect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const gfx::Rect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator gfx::Rect() const + { + return gfx::Rect(x, y, width, height); + } +#endif + }; + + inline bool operator==(const WebRect& a, const WebRect& b) + { + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; + } + + inline bool operator!=(const WebRect& a, const WebRect& b) + { + return !(a == b); + } + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebScreenInfo.h b/webkit/api/public/WebScreenInfo.h new file mode 100644 index 0000000..da63ea7 --- /dev/null +++ b/webkit/api/public/WebScreenInfo.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScreenInfo_h +#define WebScreenInfo_h + +#include "WebRect.h" + +namespace WebKit { + + struct WebScreenInfo { + // The screen depth in bits per pixel + int depth; + + // The bits per colour component. This assumes that the colours are balanced + // equally. + int depthPerComponent; + + // This can be true for black and white printers + bool isMonochrome; + + // This is set from the rcMonitor member of MONITORINFOEX, to whit: + // "A RECT structure that specifies the display monitor rectangle, + // expressed in virtual-screen coordinates. Note that if the monitor + // is not the primary display monitor, some of the rectangle's + // coordinates may be negative values." + WebRect rect; + + // This is set from the rcWork member of MONITORINFOEX, to whit: + // "A RECT structure that specifies the work area rectangle of the + // display monitor that can be used by applications, expressed in + // virtual-screen coordinates. Windows uses this rectangle to + // maximize an application on the monitor. The rest of the area in + // rcMonitor contains system windows such as the task bar and side + // bars. Note that if the monitor is not the primary display monitor, + // some of the rectangle's coordinates may be negative values". + WebRect availableRect; + + WebScreenInfo() + : depth(0) + , depthPerComponent(0) + , isMonochrome(false) { } + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebScriptSource.h b/webkit/api/public/WebScriptSource.h new file mode 100644 index 0000000..4f53ab7 --- /dev/null +++ b/webkit/api/public/WebScriptSource.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScriptSource_h +#define WebScriptSource_h + +#include "WebString.h" +#include "WebURL.h" + +namespace WebKit { + + struct WebScriptSource { + WebString code; + WebURL url; + int startLine; + + WebScriptSource(const WebString& code) + : code(code), startLine(1) { } + WebScriptSource(const WebString& code, const WebURL& url) + : code(code), url(url), startLine(1) { } + WebScriptSource(const WebString& code, const WebURL& url, int startLine) + : code(code), url(url), startLine(startLine) { } + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebSize.h b/webkit/api/public/WebSize.h new file mode 100644 index 0000000..bc7b012 --- /dev/null +++ b/webkit/api/public/WebSize.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSize_h +#define WebSize_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntSize.h" +#else +#include <base/gfx/rect.h> +#endif + +namespace WebKit { + + struct WebSize { + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebSize() + : width(0) + , height(0) + { + } + + WebSize(int width, int height) + : width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebSize(const WebCore::IntSize& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const WebCore::IntSize& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator WebCore::IntSize() const + { + return WebCore::IntSize(width, height); + } +#else + WebSize(const gfx::Size& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const gfx::Size& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator gfx::Size() const + { + return gfx::Size(width, height); + } +#endif + }; + + inline bool operator==(const WebSize& a, const WebSize& b) + { + return a.width == b.width && a.height == b.height; + } + + inline bool operator!=(const WebSize& a, const WebSize& b) + { + return !(a == b); + } + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebString.h b/webkit/api/public/WebString.h new file mode 100644 index 0000000..b0f8e49 --- /dev/null +++ b/webkit/api/public/WebString.h @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebString_h +#define WebString_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class String; } +#else +#include <base/string16.h> +#endif + +namespace WebKit { + + class WebStringPrivate; + + // A UTF-16 string container. It is inexpensive to copy a WebString + // object. + // + // WARNING: It is not safe to pass a WebString across threads!!! + // + class WebString { + public: + ~WebString() { reset(); } + + WebString() : m_private(0) { } + + WebString(const WebUChar* data, size_t len) : m_private(0) + { + assign(data, len); + } + + WebString(const WebString& s) : m_private(0) { assign(s); } + + WebString& operator=(const WebString& s) + { + assign(s); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebString&); + WEBKIT_API void assign(const WebUChar* data, size_t len); + + WEBKIT_API size_t length() const; + WEBKIT_API const WebUChar* data() const; + + bool isEmpty() const { return length() == 0; } + bool isNull() const { return m_private == 0; } + + WEBKIT_API static WebString fromUTF8(const char* data, size_t length); + WEBKIT_API static WebString fromUTF8(const char* data); + +#if WEBKIT_IMPLEMENTATION + WebString(const WebCore::String&); + WebString& operator=(const WebCore::String&); + operator WebCore::String() const; +#else + WebString(const string16& s) : m_private(0) + { + assign(s.data(), s.length()); + } + + WebString& operator=(const string16& s) + { + assign(s.data(), s.length()); + return *this; + } + + operator string16() const + { + size_t len = length(); + return len ? string16(data(), len) : string16(); + } + + template <class UTF8String> + static WebString fromUTF8(const UTF8String& s) + { + return fromUTF8(s.data(), s.length()); + } +#endif + + private: + void assign(WebStringPrivate*); + WebStringPrivate* m_private; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebTextAffinity.h b/webkit/api/public/WebTextAffinity.h new file mode 100644 index 0000000..3fcea31 --- /dev/null +++ b/webkit/api/public/WebTextAffinity.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebTextAffinity_h +#define WebTextAffinity_h + +#error "This header file is still a work in progress; do not include!" + +namespace WebKit { + + // These constants specify the preferred direction of selection. + enum WebTextAffinity { + WebTextAffinityUpstream, // The selection is moving toward the top of the document. + WebTextAffinityDownstream, // The selection is moving toward the bottom of the document. + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebTextDirection.h b/webkit/api/public/WebTextDirection.h new file mode 100644 index 0000000..8136402 --- /dev/null +++ b/webkit/api/public/WebTextDirection.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebTextDirection_h +#define WebTextDirection_h + +#error "This header file is still a work in progress; do not include!" + +namespace WebKit { + + // Represents text directions (or writing directions) of a DOM node. + enum WebTextDirection { + WebTextDirectionDefault, + WebTextDirectionLeftToRight, + WebTextDirectionRightToLeft, + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebURL.h b/webkit/api/public/WebURL.h new file mode 100644 index 0000000..aad9281 --- /dev/null +++ b/webkit/api/public/WebURL.h @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURL_h +#define WebURL_h + +#include "WebCString.h" +#include <googleurl/src/url_parse.h> + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class KURL; } +#else +#include <googleurl/src/gurl.h> +#endif + +namespace WebKit { + + class WebURL { + public: + ~WebURL() + { + } + + WebURL() : m_isValid(false) + { + } + + WebURL(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid) + : m_spec(spec) + , m_parsed(parsed) + , m_isValid(isValid) + { + } + + WebURL(const WebURL& s) + : m_spec(s.m_spec) + , m_parsed(s.m_parsed) + , m_isValid(s.m_isValid) + { + } + + WebURL& operator=(const WebURL& s) + { + m_spec = s.m_spec; + m_parsed = s.m_parsed; + m_isValid = s.m_isValid; + return *this; + } + + void assign(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid) + { + m_spec = spec; + m_parsed = parsed; + m_isValid = isValid; + } + + const WebCString& spec() const + { + return m_spec; + } + + const url_parse::Parsed& parsed() const + { + return m_parsed; + } + + bool isValid() const + { + return m_isValid; + } + + bool isEmpty() const + { + return m_spec.isEmpty(); + } + + bool isNull() const + { + return m_spec.isEmpty(); + } + +#if WEBKIT_IMPLEMENTATION + WebURL(const WebCore::KURL&); + WebURL& operator=(const WebCore::KURL&); + operator WebCore::KURL() const; +#else + WebURL(const GURL& g) + : m_spec(g.possibly_invalid_spec()) + , m_parsed(g.parsed_for_possibly_invalid_spec()) + , m_isValid(g.is_valid()) + { + } + + WebURL& operator=(const GURL& g) + { + m_spec = g.possibly_invalid_spec(); + m_parsed = g.parsed_for_possibly_invalid_spec(); + m_isValid = g.is_valid(); + return *this; + } + + operator GURL() const + { + return GURL(m_spec.data(), m_spec.length(), m_parsed, m_isValid); + } +#endif + + private: + WebCString m_spec; // UTF-8 encoded + url_parse::Parsed m_parsed; + bool m_isValid; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebURLError.h b/webkit/api/public/WebURLError.h new file mode 100644 index 0000000..6332b5e --- /dev/null +++ b/webkit/api/public/WebURLError.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLError_h +#define WebURLError_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebString.h" +#include "WebURL.h" + +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { class ResourceError; } +#endif + +namespace WebKit { + + struct WebURLError { + // A namespace for "reason" to support various layers generating + // resource errors. WebKit does not care about the value of this + // string as it will just be passed via callbacks to the consumer. + WebString domain; + + // A numeric reason for the error. WebKit does not care about the + // value of this field as it will just be passed via callbacks to the + // consumer. + int reason; + + // The url that failed to load. + WebURL unreachableURL; + + WebURLError() : reason(0) { } + +#if defined(WEBKIT_IMPLEMENTATION) + WebURLError(const WebCore::ResourceError&); + WebURLError& operator=(const WebCore::ResourceError&); + operator WebCore::ResourceError() const; +#endif + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebURLLoader.h b/webkit/api/public/WebURLLoader.h new file mode 100644 index 0000000..721fe60 --- /dev/null +++ b/webkit/api/public/WebURLLoader.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLLoader_h +#define WebURLLoader_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" + +namespace WebKit { + class WebCString; + class WebURLError; + class WebURLLoaderClient; + class WebURLRequest; + class WebURLResponse; + + class WebURLLoader { + public: + virtual ~WebURLLoader() {} + + // Load the request synchronously, returning results directly to the + // caller upon completion. There is no mechanism to interrupt a + // synchronous load!! + virtual void loadSynchronously(const WebURLRequest&, + WebURLResponse&, WebURLError&, WebCString& data) = 0; + + // Load the request asynchronously, sending notifications to the given + // client. The client will receive no further notifications if the + // loader is disposed before it completes its work. + virtual void loadAsynchronously(const WebURLRequest&, + WebURLLoaderClient*) = 0; + + // Cancels an asynchronous load. This will appear as a load error to + // the client. + virtual void cancel() = 0; + + // Suspends/resumes an asynchronous load. + virtual void setDefersLoading(bool) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebURLLoaderClient.h b/webkit/api/public/WebURLLoaderClient.h new file mode 100644 index 0000000..3a0a761 --- /dev/null +++ b/webkit/api/public/WebURLLoaderClient.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLLoaderClient_h +#define WebURLLoaderClient_h + +#error "This header file is still a work in progress; do not include!" + +namespace WebKit { + + class WebURLLoaderClient { + public: + // Called when following a redirect. |newRequest| contains the request + // generated by the redirect. The client may modify |newRequest|. + virtual void willSendRequest( + WebURLRequest& newRequest, const WebURLResponse& redirectResponse) = 0; + + // Called to report upload progress. The bytes reported correspond to + // the HTTP message body. + virtual void didSendData( + unsigned long long bytesSent, unsigned long long totalBytesToBeSent) = 0; + + // Called when response headers are received. + virtual void didReceiveResponse(const WebURLResponse&) = 0; + + // Called when a chunk of response data is received. + virtual void didReceiveData(const char* data, int dataLength, int totalDataLength) = 0; + + // Called when the load completes successfully. + virtual void didFinishLoading() = 0; + + // Called when the load completes with an error. + virtual void didFail(const WebURLError&) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebURLRequest.h b/webkit/api/public/WebURLRequest.h new file mode 100644 index 0000000..5728eb6 --- /dev/null +++ b/webkit/api/public/WebURLRequest.h @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLRequest_h +#define WebURLRequest_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" +#include "WebHTTPBody.h" + +namespace WebKit { + class WebCString; + class WebHTTPBody; + class WebString; + class WebURL; + class WebURLRequestPrivate; + + class WebURLRequest { + public: + enum CachePolicy { + UseProtocolCachePolicy, // normal load + ReloadIgnoringCacheData, // reload + ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data + ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache + }; + + enum TargetType { + TargetIsMainFrame, + TargetIsSubFrame, + TargetIsSubResource, + TargetIsObject, + TargetIsMedia + }; + + ~WebURLRequest() { reset(); } + + WebURLRequest() : m_private(0) { } + WebURLRequest(const WebURLRequest& r) : m_private(0) { assign(r); } + WebURLRequest& operator=(const WebURLRequest& r) { assign(r); return *this; } + + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebURLRequest&); + + bool isNull() const { return m_private == 0; } + + WEBKIT_API WebURL url() const = 0; + WEBKIT_API void setURL(const WebURL&) = 0; + + // Used to implement third-party cookie blocking. + WEBKIT_API WebURL policyBaseURL() const = 0; + WEBKIT_API void setPolicyBaseURL(const WebURL&) = 0; + + WEBKIT_API CachePolicy cachePolicy() const = 0; + WEBKIT_API void setCachePolicy(CachePolicy) = 0; + + WEBKIT_API WebString httpMethod() const = 0; + WEBKIT_API void setHTTPMethod(const WebString&) = 0; + + WEBKIT_API WebString httpHeaderField(const WebString& name) const = 0; + WEBKIT_API void setHTTPHeaderField(const WebString& name, const WebString& value) = 0; + WEBKIT_API void addHTTPHeaderField(const WebString& name, const WebString& value) = 0; + WEBKIT_API void clearHTTPHeaderField(const WebString& name) = 0; + + WEBKIT_API bool hasHTTPBody() const = 0; + WEBKIT_API void httpBody(WebHTTPBody&) const = 0; + WEBKIT_API void setHTTPBody(const WebHTTPBody&) = 0; + WEBKIT_API void appendToHTTPBody(const WebHTTPBody::Element&) = 0; + + // Controls whether upload progress events are generated when a request + // has a body. + WEBKIT_API bool reportUploadProgress() const = 0; + WEBKIT_API void setReportUploadProgress(bool) = 0; + + WEBKIT_API TargetType targetType() const = 0; + WEBKIT_API void setTargetType(const TargetType&) = 0; + + // A consumer controlled value intended to be used to identify the + // requestor. + WEBKIT_API int requestorID() const = 0; + WEBKIT_API void setRequestorID(int) = 0; + + // A consumer controlled value intended to be used to identify the + // process of the requestor. + WEBKIT_API int requestorProcessID() const = 0; + WEBKIT_API void setRequestorProcessID(int) = 0; + + // A consumer controlled value intended to be used to record opaque + // security info related to this request. + // FIXME: This really doesn't belong here! + WEBKIT_API WebCString securityInfo() const = 0; + WEBKIT_API void setSecurityInfo(const WebCString&) = 0; + + private: + WebURLRequestPrivate* m_private; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebURLResponse.h b/webkit/api/public/WebURLResponse.h new file mode 100644 index 0000000..30d2641 --- /dev/null +++ b/webkit/api/public/WebURLResponse.h @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLResponse_h +#define WebURLResponse_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" + +namespace WebKit { + class WebCString; + class WebString; + class WebURL; + class WebURLResponsePrivate; + + class WebURLResponse { + public: + ~WebURLResponse() { reset(); } + + WebURLResponse() : m_private(0) { } + WebURLResponse(const WebURLResponse& r) : m_private(0) { assign(r); } + WebURLResponse& operator=(const WebURLResponse& r) { assign(r); return *this; } + + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebURLResponse&); + + bool isNull() const { return m_private == 0; } + + WEBKIT_API WebURL url() const = 0; + WEBKIT_API void setURL(const WebURL&) = 0; + + WEBKIT_API WebString mimeType() const = 0; + WEBKIT_API void setMIMEType(const WebString&) = 0; + + WEBKIT_API long long expectedContentLength() const = 0; + WEBKIT_API void setExpectedContentLength(long long) = 0; + + WEBKIT_API WebString textEncodingName() const = 0; + WEBKIT_API void setTextEncodingName(const WebString&) = 0; + + WEBKIT_API WebString suggestedFileName() const = 0; + WEBKIT_API void setSuggestedFileName(const WebString&) = 0; + + WEBKIT_API int httpStatusCode() const = 0; + WEBKIT_API void setHTTPStatusCode(int) = 0; + + WEBKIT_API WebString httpStatusText() const = 0; + WEBKIT_API void setHTTPStatusText(const WebString&) = 0; + + WEBKIT_API WebString httpHeaderField(const WebString& name) const = 0; + WEBKIT_API void setHTTPHeaderField(const WebString& name, const WebString& value) = 0; + WEBKIT_API void addHTTPHeaderField(const WebString& name, const WebString& value) = 0; + WEBKIT_API void clearHTTPHeaderField(const WebString& name) = 0; + + WEBKIT_API double expirationDate() const = 0; + WEBKIT_API void setExpirationDate(double) = 0; + + WEBKIT_API double lastModifiedDate() const = 0; + WEBKIT_API void setLastModifiedDate(double) = 0; + + WEBKIT_API bool isContentFiltered() const = 0; + WEBKIT_API void setIsContentFiltered(bool) = 0; + + // A consumer controlled value intended to be used to record opaque + // security info related to this request. + WEBKIT_API WebCString securityInfo() const = 0; + WEBKIT_API void setSecurityInfo(const WebCString&) = 0; + + private: + WebURLResponsePrivate* m_private; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebVector.h b/webkit/api/public/WebVector.h new file mode 100644 index 0000000..2f3cf71 --- /dev/null +++ b/webkit/api/public/WebVector.h @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebVector_h +#define WebVector_h + +#include <utility> + +#include "WebCommon.h" + +namespace WebKit { + + // A simple vector class. + // + // Sample usage: + // + // void Foo(WebVector<int>& result) + // { + // WebVector<int> data(10); + // for (size_t i = 0; i < data.size(); ++i) + // data[i] = ... + // result.swap(data); + // } + // + // It is also possible to assign from other types of random access + // containers: + // + // void Foo(const std::vector<std::string>& input) + // { + // WebVector<WebCString> cstrings = input; + // ... + // } + // + template <typename T> + class WebVector { + public: + typedef T ValueType; + + ~WebVector() + { + destroy(); + } + + explicit WebVector(size_t size = 0) + { + initialize(size); + } + + template <typename C> + WebVector(const C& other) + { + initializeFrom(other.size() ? &other[0] : 0, other.size()); + } + + template <typename C> + WebVector<T>& operator=(const C& other) + { + if (this != reinterpret_cast<const WebVector<T>*>(&other)) + assign(other); + return *this; + } + + template <typename C> + void assign(const C& other) + { + assign(other.size() ? &other[0] : 0, other.size()); + } + + template <typename U> + void assign(const U* values, size_t size) + { + destroy(); + initializeFrom(values, size); + } + + size_t size() const { return m_size; } + + T& operator[](size_t i) { return m_ptr[i]; } + const T& operator[](size_t i) const { return m_ptr[i]; } + + T* data() { return m_ptr; } + const T* data() const { return m_ptr; } + + void swap(WebVector<T>& other) + { + std::swap(m_ptr, other.m_ptr); + std::swap(m_size, other.m_size); + } + + private: + void initialize(size_t size) + { + m_size = size; + if (!m_size) + m_ptr = 0; + else { + m_ptr = static_cast<T*>(::operator new(sizeof(T) * m_size)); + for (size_t i = 0; i < m_size; ++i) + new (&m_ptr[i]) T(); + } + } + + template <typename U> + void initializeFrom(const U* values, size_t size) + { + m_size = size; + if (!m_size) + m_ptr = 0; + else { + m_ptr = static_cast<T*>(::operator new(sizeof(T) * m_size)); + for (size_t i = 0; i < m_size; ++i) + new (&m_ptr[i]) T(values[i]); + } + } + + void destroy() + { + for (size_t i = 0; i < m_size; ++i) + m_ptr[i].~T(); + ::operator delete(m_ptr); + } + + T* m_ptr; + size_t m_size; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebView.h b/webkit/api/public/WebView.h new file mode 100644 index 0000000..ec21703 --- /dev/null +++ b/webkit/api/public/WebView.h @@ -0,0 +1,207 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebView_h +#define WebView_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" +#include "WebWidget.h" + +namespace WebKit { + class WebPreferences; + class WebString; + class WebViewClient; + struct WebPoint; + + class WebView : public WebWidget { + public: + WEBKIT_API WebView* create(WebViewClient*); + + + // Preferences --------------------------------------------------------- + + virtual WebPreferences* preferences() = 0; + + // Corresponds to the encoding of the main frame. Setting the page + // encoding may cause the main frame to reload. + virtual WebString pageEncoding() const = 0; + virtual void setPageEncoding(const WebString&) = 0; + + + // Closing ------------------------------------------------------------- + + // Returns false if any handler suppressed unloading. + virtual bool dispatchBeforeUnloadEvent() = 0; + + virtual void dispatchUnloadEvent() = 0; + + + // Frames -------------------------------------------------------------- + + virtual WebFrame* mainFrame() = 0; + + // Returns the frame identified by the given name. This method + // supports pseudo-names like _self, _top, and _blank. It traverses + // the entire frame tree containing this tree looking for a frame that + // matches the given name. + virtual WebFrame* findFrameByName(const WebString& name) = 0; + + + // Focus --------------------------------------------------------------- + + virtual WebFrame* focusedFrame() = 0; + virtual void setFocusedFrame(WebFrame*) = 0; + + // Restores focus to the previously focused frame and element. This + // method is invoked when the WebView is shown after being hidden, and + // focus is to be restored. When a WebView loses focus, it remembers + // the frame and element that had focus. + virtual void restoreFocus() = 0; + + // Focus the first (last if reverse is true) focusable node. + virtual void setInitialFocus(bool reverse) = 0; + + // Clears the focused node (and selection if a text field is focused) + // to ensure that a text field on the page is not eating keystrokes we + // send it. + virtual void clearFocusedNode() = 0; + + + // Capture ------------------------------------------------------------- + + // Fills the contents of this WebView's frames into the given string. + // If the text is longer than maxCharacters, it will be clipped to that + // length. Warning: this function may be slow depending on the number + // of characters retrieved and page complexity. For a typically sized + // page, expect it to take on the order of milliseconds. + // + // If there is room, subframe text will be recursively appended. Each + // frame will be separated by an empty line. + virtual WebString captureAsText(unsigned maxCharacters) = 0; + + // Paints the contents of this WebView into a bitmapped image. This + // image will not have plugins drawn. Devices are cheap to copy because + // the data is internally ref-counted, so we allocate and return a new + // copy. + // + // Set scrollToZero to force all frames to be scrolled to 0,0 before + // being painted into the image. This will not send DOM events because + // it just draws the contents at a different place, but it does mean + // the scrollbars in the resulting image will appear to be wrong + // (they'll be painted as if the content was scrolled). + virtual WebImage captureAsImage(bool scrollToZero) = 0; + + + // Printing ------------------------------------------------------------ + + // Reformats the WebView for printing. pageSize is the page size in + // pixels. Returns the number of pages that can be printed at the + // given page size. + virtual int printBegin(const WebSize& pageSize); + + // Prints one page, and returns the calculated page shrinking factor + // (usually between 1/1.25 and 1/2). Returns 0 if the page number is + // invalid or not in printing mode. + virtual float printPage(int pageToPrint, const WebCanvas&); + + // Reformats the WebView for screen display. + virtual void printEnd(); + + + // Zoom ---------------------------------------------------------------- + + // Change the text zoom level. It will make the zoom level 20% larger + // or smaller. If textOnly is set, the text size will be changed. + // When unset, the entire page's zoom factor will be changed. + // + // You can only have either text zoom or full page zoom at one time. + // Changing the mode will change things in weird ways. Generally the + // app should only support text zoom or full page zoom, and not both. + // + // zoomDefault will reset both full page and text zoom. + virtual void zoomIn(bool textOnly) = 0; + virtual void zoomOut(bool textOnly) = 0; + virtual void zoomDefault() = 0; + + + // Data exchange ------------------------------------------------------- + + // Copy to the clipboard the image located at a particular point in the + // WebView (if there is such an image) + virtual void copyImageAt(const WebPoint&) = 0; + + // Notifies the WebView that a drag has terminated. + virtual void dragSourceEndedAt(const WebPoint& clientPoint, + const WebPoint& screenPoint) = 0; + + // Notifies the WebView that a drag and drop operation is in progress, with + // dropable items over the view. + virtual void dragSourceMovedTo(const WebPoint& clientPoint, + const WebPoint& screenPoint) = 0; + + // Notfies the WebView that the system drag and drop operation has ended. + virtual void dragSourceSystemDragEnded() = 0; + + // Callback methods when a drag-and-drop operation is trying to drop + // something on the WebView. + virtual bool dragTargetDragEnter(const WebDragData&, int identity, + const WebPoint& clientPoint, + const WebPoint& screenPoint) = 0; + virtual bool dragTargetDragOver(const WebPoint& clientPoint, + const WebPoint& screenPoint) = 0; + virtual void dragTargetDragLeave() = 0; + virtual void dragTargetDrop(const WebPoint& clientPoint, + const WebPoint& screenPoint) = 0; + + virtual int dragIdentity() = 0; + + + // Developer tools ----------------------------------------------------- + + virtual WebDevToolsAgent* devToolsAgent() = 0; + + // Inspect a particular point in the WebView. (x = -1 || y = -1) is a + // special case, meaning inspect the current page and not a specific + // point. + virtual void inspectElementAt(const WebPoint&) = 0; + + + // FIXME what about: + // StoreFocusForFrame + // DownloadImage + // Get/SetDelegate + // InsertText -> should move to WebTextInput + // AutofillSuggestionsForNode + // HideAutofillPopup + }; + +} // namespace WebKit diff --git a/webkit/api/public/WebViewClient.h b/webkit/api/public/WebViewClient.h new file mode 100644 index 0000000..fbb56d0 --- /dev/null +++ b/webkit/api/public/WebViewClient.h @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebViewClient_h +#define WebViewClient_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebWidgetClient.h" + +namespace WebKit { + class WebFileChooserCompletion; + class WebFrame; + class WebPopupMenu; + class WebString; + class WebView; + struct WebConsoleMessage; + struct WebContextMenuInfo; + struct WebPopupMenuInfo; + + class WebViewClient : public WebWidgetClient { + public: + // Factory methods ----------------------------------------------------- + + // Create a new related WebView. + virtual WebView* createView(bool hasUserGesture) = 0; + + // Create a new WebPopupMenu. In the second form, the client is + // responsible for rendering the contents of the popup menu. + virtual WebPopupMenu* createPopupMenu(bool activatable) = 0; + virtual WebPopupMenu* createPopupMenu(bool activatable, const WebPopupMenuInfo&) = 0; + + + // Misc ---------------------------------------------------------------- + + // A new message was added to the console. + virtual void didAddMessageToConsole( + const WebConsoleMessage&, const WebString& sourceName, unsigned sourceLine) = 0; + + // If enabled, sudden termination implies that there are no registered + // unload event handlers that would need to run in order to close the + // WebView. This information allows the embedder to determine if the + // process can be closed without closing the respective WebViews. + virtual void enableSuddenTermination() = 0; + virtual void disableSuddenTermination() = 0; + + // Called when script in the page calls window.print(). + virtual void printPage() = 0; + + + // Navigational -------------------------------------------------------- + + // These notifications bracket any loading that occurs in the WebView. + virtual void didStartLoading() = 0; + virtual void didStopLoading() = 0; + + // A frame (or subframe) was created. The client may return a + // WebFrameClient to be associated with the newly created frame. + virtual WebFrameClient* didCreateFrame(WebFrame* frame) = 0; + + + // Editing ------------------------------------------------------------- + + // May return null. The WebEditingClient is passed additional events + // related to text editing in the page. + virtual WebEditingClient* editingClient() = 0; + + // The client should perform spell-checking on the given word + // synchronously. Return a length of 0 if the word is not misspelled. + virtual void spellCheck( + const WebString& word, int& misspelledOffset, int& misspelledLength) = 0; + + // Request the text on the selection clipboard be sent back to the + // WebView so it can be inserted into the current focus area. This is + // only meaningful on platforms that have a selection clipboard (e.g., + // X-Windows). + virtual void pasteFromSelectionClipboard() = 0; + + + // Dialogs ------------------------------------------------------------- + + // These methods should not return until the dialog has been closed. + virtual void runModalAlertDialog(const WebString& message) = 0; + virtual bool runModalConfirmDialog(const WebString& message) = 0; + virtual bool runModalPromptDialog( + const WebString& message, const WebString& defaultValue, + WebString* actualValue) = 0; + virtual bool runModalBeforeUnloadDialog(const WebString& message) = 0; + + // This method returns immediately after showing the dialog. When the + // dialog is closed, it should call the WebFileChooserCompletion to + // pass the results of the dialog. + virtual void runFileChooser( + bool multiSelect, const WebString& title, + const WebString& initialValue, WebFileChooserCompletion*) = 0; + + + // UI ------------------------------------------------------------------ + + // Called when script modifies window.status + virtual void setStatusText(const WebString&) = 0; + + // Called when hovering over an anchor with the given URL. + virtual void setMouseOverURL(const WebURL&) = 0; + + // Called when a tooltip should be shown at the current cursor position. + virtual void setToolTipText(const WebString&) = 0; + + // Called when a context menu should be shown at the current cursor position. + virtual void showContextMenu(const WebContextMenuInfo&) = 0; + + // Called when a drag-n-drop operation should begin. + virtual void startDragging(WebFrame*, const WebDragData&) = 0; + + // Take focus away from the WebView by focusing an adjacent UI element + // in the containing window. + virtual void focusNext() = 0; + virtual void focusPrevious() = 0; + + + // Session History ----------------------------------------------------- + + // Returns the history item at the given index. + virtual WebHistoryItem historyItemAtIndex(int index) = 0; + + // Returns the number of history items before/after the current + // history item. + virtual int historyBackListCount() = 0; + virtual int historyForwardListCount() = 0; + + // Called to notify the embedder when a new history item is added. + virtual void didAddHistoryItem() = 0; + + + // Developer Tools ----------------------------------------------------- + + virtual void didOpenInspector(int numResources) = 0; + + + // FIXME need to something for: + // OnPasswordFormsSeen + // OnAutofillFormSubmitted + // QueryFormFieldAutofill + // RemoveStoredAutofillEntry + // ShowModalHTMLDialog <-- we should be able to kill this + // GetWebDevToolsAgentDelegate + // WasOpenedByUserGesture + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebWidget.h b/webkit/api/public/WebWidget.h new file mode 100644 index 0000000..30f0601 --- /dev/null +++ b/webkit/api/public/WebWidget.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebWidget_h +#define WebWidget_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" +#include "WebTextDirection.h" + +namespace WebKit { + + class WebWidget { + public: + // This method closes and deletes the WebWidget. + virtual void close() = 0; + + // Returns the current size of the WebWidget. + virtual WebSize size() = 0; + + // Called to resize the WebWidget. + virtual void resize(const WebSize&) = 0; + + // Called to layout the WebWidget. This MUST be called before Paint, + // and it may result in calls to WebWidgetClient::didInvalidateRect. + virtual void layout() = 0; + + // Called to paint the specified region of the WebWidget onto the given + // canvas. You MUST call Layout before calling this method. It is + // okay to call paint multiple times once layout has been called, + // assuming no other changes are made to the WebWidget (e.g., once + // events are processed, it should be assumed that another call to + // layout is warranted before painting again). + virtual void paint(WebCanvas*, const WebRect&) = 0; + + // Called to inform the WebWidget of an input event. Returns true if + // the event has been processed, false otherwise. + virtual void handleInputEvent(const WebInputEvent&) = 0; + + // Called to inform the WebWidget that mouse capture was lost. + virtual void mouseCaptureLost() = 0; + + // Called to inform the WebWidget that it has gained or lost keyboard focus. + virtual void setFocus(bool) = 0; + + // Called to inform the WebWidget of a composition event. + virtual bool handleCompositionEvent(WebCompositionCommand command, + int cursorPosition, + int targetStart, + int targetEnd, + const WebString& text) = 0; + + // Retrieve the status of this WebWidget required by IME APIs. Upon + // success enabled and caretBounds are set. + virtual bool queryCompositionStatus(bool* enabled, WebRect* caretBounds) = 0; + + // Changes the text direction of the selected input node. + virtual void setTextDirection(WebTextDirection) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebWidgetClient.h b/webkit/api/public/WebWidgetClient.h new file mode 100644 index 0000000..02815e7 --- /dev/null +++ b/webkit/api/public/WebWidgetClient.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebWidgetClient_h +#define WebWidgetClient_h + +#error "This header file is still a work in progress; do not include!" + +#include "WebCommon.h" +#include "WebNavigationPolicy.h" + +namespace WebKit { + class WebWidget; + struct WebCursorInfo; + struct WebPluginGeometry; + struct WebRect; + struct WebScreenInfo; + + class WebWidgetClient { + public: + // Called when a region of the WebWidget needs to be re-painted. + virtual void didInvalidateRect(WebWidget*, const WebRect&) = 0; + + // Called when a region of the WebWidget, given by clipRect, should be + // scrolled by the specified dx and dy amounts. + virtual void didScrollRect(WebWidget*, int dx, int dy, const WebRect& clipRect) = 0; + + // Called when a plugin is moved relative to its containing window. + // This typically happens as a result of scrolling the page. + virtual void didMovePlugin(WebWidget*, const WebPluginGeometry&) = 0; + + // Called when the widget acquires or loses focus, respectively. + virtual void didFocus(WebWidget*) = 0; + virtual void didBlur(WebWidget*) = 0; + + // Called when the cursor for the widget changes. + virtual void didChangeCursor(WebWidget*, const WebCursorInfo&) = 0; + + // Called when the widget should be closed. WebWidget::close() should + // be called asynchronously as a result of this notification. + virtual void closeWidgetSoon(WebWidget*) = 0; + + // Called to show the widget according to the given policy. + virtual void show(WebWidget*, WebNavigationPolicy) = 0; + + // Called to block execution of the current thread until the widget is + // closed. + virtual void runModal(WebWidget*) = 0; + + // Called to get/set the position of the widget in screen coordinates. + virtual WebRect windowRect(WebWidget*) = 0; + virtual void setWindowRect(WebWidget*, const WebRect&) = 0; + + // Called to get the position of the resizer rect in window coordinates. + virtual WebRect windowResizerRect(WebWidget*) = 0; + + // Called to get the position of the root window containing the widget + // in screen coordinates. + virtual WebRect rootWindowRect(WebWidget*) = 0; + + // Called to query information about the screen where this widget is + // displayed. + virtual WebScreenInfo screenInfo(WebWidget*) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebWorker.h b/webkit/api/public/WebWorker.h new file mode 100644 index 0000000..908993e --- /dev/null +++ b/webkit/api/public/WebWorker.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebWorker_h +#define WebWorker_h + +#include "WebCommon.h" + +namespace WebKit { + class WebString; + class WebURL; + class WebWorkerClient; + + // Provides an interface to the script execution context for a worker. + class WebWorker { + public: + // Instantiates a built-in WebWorker. + WEBKIT_API static WebWorker* create(WebWorkerClient*); + + virtual ~WebWorker() { } + virtual void startWorkerContext(const WebURL& scriptURL, + const WebString& userAgent, + const WebString& sourceCode) = 0; + virtual void terminateWorkerContext() = 0; + virtual void postMessageToWorkerContext(const WebString&) = 0; + virtual void workerObjectDestroyed() = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/WebWorkerClient.h b/webkit/api/public/WebWorkerClient.h new file mode 100644 index 0000000..dd46de2 --- /dev/null +++ b/webkit/api/public/WebWorkerClient.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebWorkerClient_h +#define WebWorkerClient_h + +#include "WebCommon.h" + +namespace WebKit { + class WebString; + + // Provides an interface back to the in-page script object for a worker. + class WebWorkerClient { + public: + virtual void postMessageToWorkerObject(const WebString&) = 0; + + virtual void postExceptionToWorkerObject( + const WebString& errorString, int lineNumber, + const WebString& sourceURL) = 0; + + virtual void postConsoleMessageToWorkerObject( + int destinationIdentifier, + int sourceIdentifier, + int messageLevel, + const WebString& message, + int lineNumber, + const WebString& sourceURL) = 0; + + virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0; + virtual void reportPendingActivity(bool hasPendingActivity) = 0; + + virtual void workerContextDestroyed() = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/gtk/WebInputEventFactory.h b/webkit/api/public/gtk/WebInputEventFactory.h new file mode 100644 index 0000000..7caf629 --- /dev/null +++ b/webkit/api/public/gtk/WebInputEventFactory.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebInputEventFactory_h +#define WebInputEventFactory_h + +#include "../WebCommon.h" + +typedef struct _GdkEventButton GdkEventButton; +typedef struct _GdkEventMotion GdkEventMotion; +typedef struct _GdkEventScroll GdkEventScroll; +typedef struct _GdkEventKey GdkEventKey; + +namespace WebKit { + + class WebKeyboardEvent; + class WebMouseEvent; + class WebMouseWheelEvent; + + class WebInputEventFactory { + public: + WEBKIT_API static WebKeyboardEvent keyboardEvent(const GdkEventKey*); + WEBKIT_API static WebMouseEvent mouseEvent(const GdkEventButton*); + WEBKIT_API static WebMouseEvent mouseEvent(const GdkEventMotion*); + WEBKIT_API static WebMouseWheelEvent mouseWheelEvent(const GdkEventScroll*); + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/gtk/WebScreenInfoFactory.h b/webkit/api/public/gtk/WebScreenInfoFactory.h new file mode 100644 index 0000000..28ec161 --- /dev/null +++ b/webkit/api/public/gtk/WebScreenInfoFactory.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScreenInfoFactory_h +#define WebScreenInfoFactory_h + +#include "../WebCommon.h" + +typedef struct _GtkWidget GtkWidget; + +namespace WebKit { + struct WebScreenInfo; + + class WebScreenInfoFactory { + public: + WEBKIT_API static WebScreenInfo screenInfo(GtkWidget*); + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/mac/WebInputEventFactory.h b/webkit/api/public/mac/WebInputEventFactory.h new file mode 100644 index 0000000..5b55613c --- /dev/null +++ b/webkit/api/public/mac/WebInputEventFactory.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebInputEventFactory_h +#define WebInputEventFactory_h + +#include "../WebCommon.h" + +#ifdef __OBJC__ +@class NSEvent; +@class NSView; +#else +class NSEvent; +class NSView; +#endif + +namespace WebKit { + + class WebKeyboardEvent; + class WebMouseEvent; + class WebMouseWheelEvent; + + class WebInputEventFactory { + public: + WEBKIT_API static WebKeyboardEvent keyboardEvent(NSEvent*); + WEBKIT_API static WebMouseEvent mouseEvent(NSEvent*, NSView*); + WEBKIT_API static WebMouseWheelEvent mouseWheelEvent(NSEvent*, NSView*); + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/mac/WebScreenInfoFactory.h b/webkit/api/public/mac/WebScreenInfoFactory.h new file mode 100644 index 0000000..e3d8006 --- /dev/null +++ b/webkit/api/public/mac/WebScreenInfoFactory.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScreenInfoFactory_h +#define WebScreenInfoFactory_h + +#include "../WebCommon.h" + +#ifdef __OBJC__ +@class NSView; +#else +class NSView; +#endif + +namespace WebKit { + struct WebScreenInfo; + + class WebScreenInfoFactory { + public: + WEBKIT_API static WebScreenInfo screenInfo(NSView*); + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/win/WebInputEventFactory.h b/webkit/api/public/win/WebInputEventFactory.h new file mode 100644 index 0000000..c353ed4 --- /dev/null +++ b/webkit/api/public/win/WebInputEventFactory.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebInputEventFactory_h +#define WebInputEventFactory_h + +#include <windows.h> + +#include "../WebCommon.h" + +namespace WebKit { + + class WebKeyboardEvent; + class WebMouseEvent; + class WebMouseWheelEvent; + + class WebInputEventFactory { + public: + WEBKIT_API static WebKeyboardEvent keyboardEvent(HWND, UINT, WPARAM, LPARAM); + WEBKIT_API static WebMouseEvent mouseEvent(HWND, UINT, WPARAM, LPARAM); + WEBKIT_API static WebMouseWheelEvent mouseWheelEvent(HWND, UINT, WPARAM, LPARAM); + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/win/WebSandboxSupport.h b/webkit/api/public/win/WebSandboxSupport.h new file mode 100644 index 0000000..9adb8fe --- /dev/null +++ b/webkit/api/public/win/WebSandboxSupport.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +typedef struct HFONT__* HFONT; + +namespace WebKit { + + // Put methods here that are required due to sandbox restrictions. + class WebSandboxSupport { + public: + // Sometimes a Win32 API call will fail because a font is not loaded, + // and due to sandbox restrictions, the current process may be unable + // to access the filesystem to load the font. So, this call serves as + // a failover to ask the embedder to try some other way to load the + // font (usually by delegating to an empowered process to have it load + // the font). Returns true if the font was successfully loaded. + virtual bool ensureFontLoaded(HFONT) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/win/WebScreenInfoFactory.h b/webkit/api/public/win/WebScreenInfoFactory.h new file mode 100644 index 0000000..b809dc7 --- /dev/null +++ b/webkit/api/public/win/WebScreenInfoFactory.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScreenInfoFactory_h +#define WebScreenInfoFactory_h + +#include "../WebCommon.h" + +typedef struct HWND__* HWND; + +namespace WebKit { + struct WebScreenInfo; + + class WebScreenInfoFactory { + public: + WEBKIT_API static WebScreenInfo screenInfo(HWND); + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/win/WebThemeEngine.h b/webkit/api/public/win/WebThemeEngine.h new file mode 100644 index 0000000..0631950 --- /dev/null +++ b/webkit/api/public/win/WebThemeEngine.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" +#include "../WebColor.h" + +namespace WebKit { + struct WebRect; + + // The part and state parameters correspond to values defined by the + // Windows Theme API. The classicState parameter corresponds to the uState + // parameter of the Windows DrawFrameRect function. + class WebThemeEngine { + public: + virtual void paintButton( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintMenuList( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintScrollbarArrow( + WebCanvas*, int state, int classicState, + const WebRect&) = 0; + + virtual void paintScrollbarThumb( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintScrollbarTrack( + WebCanvas*, int part, int state, int classicState, + const WebRect&, const WebRect& alignRect) = 0; + + virtual void paintTextField( + WebCanvas*, int part, int state, int classicState, + const WebRect&, WebColor, bool fillContentArea, bool drawEdges) = 0; + + virtual void paintTrackbar( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/public/x11/WebScreenInfoFactory.h b/webkit/api/public/x11/WebScreenInfoFactory.h new file mode 100644 index 0000000..5267fd5 --- /dev/null +++ b/webkit/api/public/x11/WebScreenInfoFactory.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebScreenInfoFactory_h +#define WebScreenInfoFactory_h + +#include "../WebCommon.h" + +typedef struct _XDisplay Display; + +namespace WebKit { + struct WebScreenInfo; + + class WebScreenInfoFactory { + public: + WEBKIT_API static WebScreenInfo screenInfo(Display*, int screenNumber); + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/src/ChromiumBridge.cpp b/webkit/api/src/ChromiumBridge.cpp new file mode 100644 index 0000000..38e2d3a --- /dev/null +++ b/webkit/api/src/ChromiumBridge.cpp @@ -0,0 +1,392 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ChromiumBridge.h" + +#include <googleurl/src/url_util.h> + +#include "WebClipboard.h" +#include "WebData.h" +#include "WebImage.h" +#include "WebKit.h" +#include "WebKitClient.h" +#include "WebMimeRegistry.h" +#include "WebPluginListBuilderImpl.h" +#include "WebString.h" +#include "WebURL.h" + +#if PLATFORM(WIN_OS) +#include "WebRect.h" +#include "WebSandboxSupport.h" +#include "WebThemeEngine.h" +#endif + +#include "BitmapImage.h" +#include "GraphicsContext.h" +#include "KURL.h" +#include "NativeImageSkia.h" +#include "NotImplemented.h" +#include "PlatformContextSkia.h" +#include "PluginData.h" +#include <wtf/Assertions.h> + +// We are part of the WebKit implementation. +using namespace WebKit; + +namespace WebCore { + +// Clipboard ------------------------------------------------------------------ + +COMPILE_ASSERT( + int(PasteboardPrivate::HTMLFormat) == int(WebClipboard::FormatHTML), + FormatHTML); +COMPILE_ASSERT( + int(PasteboardPrivate::BookmarkFormat) == int(WebClipboard::FormatBookmark), + FormatBookmark); +COMPILE_ASSERT( + int(PasteboardPrivate::WebSmartPasteFormat) == int(WebClipboard::FormatSmartPaste), + FormatSmartPaste); + +bool ChromiumBridge::clipboardIsFormatAvailable( + PasteboardPrivate::ClipboardFormat format) +{ + return webKitClient()->clipboard()->isFormatAvailable( + static_cast<WebClipboard::Format>(format)); +} + +String ChromiumBridge::clipboardReadPlainText() +{ + return webKitClient()->clipboard()->readPlainText(); +} + +void ChromiumBridge::clipboardReadHTML(String* htmlText, KURL* sourceURL) +{ + WebURL url; + *htmlText = webKitClient()->clipboard()->readHTML(&url); + *sourceURL = url; +} + +void ChromiumBridge::clipboardWriteSelection(const String& htmlText, + const KURL& sourceURL, + const String& plainText, + bool writeSmartPaste) +{ + webKitClient()->clipboard()->writeHTML( + htmlText, sourceURL, plainText, writeSmartPaste); +} + +void ChromiumBridge::clipboardWriteURL(const KURL& url, const String& title) +{ + webKitClient()->clipboard()->writeURL(url, title); +} + +void ChromiumBridge::clipboardWriteImage(const NativeImageSkia* image, + const KURL& sourceURL, + const String& title) +{ +#if WEBKIT_USING_SKIA + webKitClient()->clipboard()->writeImage( + WebImage(*image), sourceURL, title); +#else + // FIXME clipboardWriteImage probably shouldn't take a NativeImageSkia + notImplemented(); +#endif +} + +// Cookies -------------------------------------------------------------------- + +void ChromiumBridge::setCookies(const KURL& url, const KURL& policyURL, + const String& cookie) +{ + webKitClient()->setCookies(url, policyURL, cookie); +} + +String ChromiumBridge::cookies(const KURL& url, const KURL& policyURL) +{ + return webKitClient()->cookies(url, policyURL); +} + +// DNS ------------------------------------------------------------------------ + +void ChromiumBridge::prefetchDNS(const String& hostname) +{ + webKitClient()->prefetchHostName(hostname); +} + +// Font ----------------------------------------------------------------------- + +#if defined(OS_WIN) +bool ChromiumBridge::ensureFontLoaded(HFONT font) +{ + return webKitClient()->sandboxSupport()->ensureFontLoaded(font); +} +#endif + +// Language ------------------------------------------------------------------- + +String ChromiumBridge::computedDefaultLanguage() +{ + return webKitClient()->defaultLocale(); +} + +// LayoutTestMode ------------------------------------------------------------- + +bool ChromiumBridge::layoutTestMode() +{ + return WebKit::layoutTestMode(); +} + +// MimeType ------------------------------------------------------------------- + +bool ChromiumBridge::isSupportedImageMIMEType(const String& mimeType) +{ + return webKitClient()->mimeRegistry()->supportsImageMIMEType(mimeType); +} + +bool ChromiumBridge::isSupportedJavaScriptMIMEType(const String& mimeType) +{ + return webKitClient()->mimeRegistry()->supportsJavaScriptMIMEType(mimeType); +} + +bool ChromiumBridge::isSupportedNonImageMIMEType(const String& mimeType) +{ + return webKitClient()->mimeRegistry()->supportsNonImageMIMEType(mimeType); +} + +String ChromiumBridge::mimeTypeForExtension(const String& extension) +{ + return webKitClient()->mimeRegistry()->mimeTypeForExtension(extension); +} + +String ChromiumBridge::mimeTypeFromFile(const String& path) +{ + return webKitClient()->mimeRegistry()->mimeTypeFromFile(path); +} + +String ChromiumBridge::preferredExtensionForMIMEType(const String& mimeType) +{ + return webKitClient()->mimeRegistry()->preferredExtensionForMIMEType(mimeType); +} + +// Plugin --------------------------------------------------------------------- + +bool ChromiumBridge::plugins(bool refresh, Vector<PluginInfo*>* results) +{ + WebPluginListBuilderImpl builder(results); + webKitClient()->getPluginList(refresh, &builder); + return true; // FIXME: There is no need for this function to return a value. +} + +// Resources ------------------------------------------------------------------ + +PassRefPtr<Image> ChromiumBridge::loadPlatformImageResource(const char* name) +{ + const WebData& resource = webKitClient()->loadResource(name); + if (resource.isEmpty()) + return Image::nullImage(); + + RefPtr<Image> image = BitmapImage::create(); + image->setData(resource, true); + return image; +} + +// SharedTimers --------------------------------------------------------------- + +void ChromiumBridge::setSharedTimerFiredFunction(void (*func)()) +{ + webKitClient()->setSharedTimerFiredFunction(func); +} + +void ChromiumBridge::setSharedTimerFireTime(double fireTime) +{ + webKitClient()->setSharedTimerFireTime(fireTime); +} + +void ChromiumBridge::stopSharedTimer() +{ + webKitClient()->stopSharedTimer(); +} + +// StatsCounters -------------------------------------------------------------- + +void ChromiumBridge::decrementStatsCounter(const char* name) +{ + webKitClient()->decrementStatsCounter(name); +} + +void ChromiumBridge::incrementStatsCounter(const char* name) +{ + webKitClient()->incrementStatsCounter(name); +} + +// Sudden Termination --------------------------------------------------------- + +void ChromiumBridge::suddenTerminationChanged(bool enabled) +{ + webKitClient()->suddenTerminationChanged(enabled); +} + +// SystemTime ----------------------------------------------------------------- + +double ChromiumBridge::currentTime() +{ + return webKitClient()->currentTime(); +} + +// Theming -------------------------------------------------------------------- + +#if PLATFORM(WIN_OS) + +void ChromiumBridge::paintButton( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintButton( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + +void ChromiumBridge::paintMenuList( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintMenuList( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + +void ChromiumBridge::paintScrollbarArrow( + GraphicsContext* gc, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintScrollbarArrow( + gc->platformContext()->canvas(), state, classicState, rect); +} + +void ChromiumBridge::paintScrollbarThumb( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintScrollbarThumb( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + +void ChromiumBridge::paintScrollbarTrack( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect, const IntRect& alignRect) +{ + webKitClient()->themeEngine()->paintScrollbarTrack( + gc->platformContext()->canvas(), part, state, classicState, rect, + alignRect); +} + +void ChromiumBridge::paintTextField( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect, const Color& color, bool fillContentArea, + bool drawEdges) +{ + webKitClient()->themeEngine()->paintTextField( + gc->platformContext()->canvas(), part, state, classicState, rect, + color.rgb(), fillContentArea, drawEdges); +} + +void ChromiumBridge::paintTrackbar( + GraphicsContext* gc, int part, int state, int classicState, + const IntRect& rect) +{ + webKitClient()->themeEngine()->paintTrackbar( + gc->platformContext()->canvas(), part, state, classicState, rect); +} + +#endif + +// Trace Event ---------------------------------------------------------------- + +void ChromiumBridge::traceEventBegin(const char* name, void* id, const char* extra) +{ + webKitClient()->traceEventBegin(name, id, extra); +} + +void ChromiumBridge::traceEventEnd(const char* name, void* id, const char* extra) +{ + webKitClient()->traceEventEnd(name, id, extra); +} + +// Visited Links -------------------------------------------------------------- + +WebCore::LinkHash ChromiumBridge::visitedLinkHash(const UChar* url, + unsigned length) +{ + url_canon::RawCanonOutput<2048> buffer; + url_parse::Parsed parsed; + if (!url_util::Canonicalize(url, length, NULL, &buffer, &parsed)) + return 0; // Invalid URLs are unvisited. + return webKitClient()->visitedLinkHash(buffer.data(), buffer.length()); +} + +WebCore::LinkHash ChromiumBridge::visitedLinkHash(const WebCore::KURL& base, + const WebCore::AtomicString& attributeURL) +{ + // Resolve the relative URL using googleurl and pass the absolute URL up to + // the embedder. We could create a GURL object from the base and resolve + // the relative URL that way, but calling the lower-level functions + // directly saves us the string allocation in most cases. + url_canon::RawCanonOutput<2048> buffer; + url_parse::Parsed parsed; + +#if USE(GOOGLEURL) + const WebCore::CString& cstr = base.utf8String(); + const char* data = cstr.data(); + int length = cstr.length(); + const url_parse::Parsed& srcParsed = base.parsed(); +#else + // When we're not using GoogleURL, first canonicalize it so we can resolve it + // below. + url_canon::RawCanonOutput<2048> srcCanon; + url_parse::Parsed srcParsed; + WebCore::String str = base.string(); + if (!url_util::Canonicalize(str.characters(), str.length(), NULL, &srcCanon, &srcParsed)) + return 0; + const char* data = srcCanon.data(); + int length = srcCanon.length(); +#endif + + if (!url_util::ResolveRelative(data, length, srcParsed, attributeURL.characters(), + attributeURL.length(), NULL, &buffer, &parsed)) + return 0; // Invalid resolved URL. + + return webKitClient()->visitedLinkHash(buffer.data(), buffer.length()); +} + +bool ChromiumBridge::isLinkVisited(WebCore::LinkHash visitedLinkHash) +{ + return webKitClient()->isLinkVisited(visitedLinkHash); +} + +} // namespace WebCore diff --git a/webkit/api/src/ChromiumCurrentTime.cpp b/webkit/api/src/ChromiumCurrentTime.cpp new file mode 100644 index 0000000..1eccc41 --- /dev/null +++ b/webkit/api/src/ChromiumCurrentTime.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include <wtf/CurrentTime.h> + +#include "WebKit.h" +#include "WebKitClient.h" + +namespace WTF { + +double currentTime() +{ + return WebKit::webKitClient()->currentTime(); +} + +} // namespace WTF diff --git a/webkit/api/src/ChromiumThreading.cpp b/webkit/api/src/ChromiumThreading.cpp new file mode 100644 index 0000000..902a433 --- /dev/null +++ b/webkit/api/src/ChromiumThreading.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include <wtf/chromium/ChromiumThreading.h> + +#include "WebKit.h" +#include "WebKitClient.h" + +#include <wtf/MainThread.h> + +namespace WTF { + +void ChromiumThreading::initializeMainThread() +{ +} + +void ChromiumThreading::scheduleDispatchFunctionsOnMainThread() +{ + WebKit::webKitClient()->callOnMainThread(&WTF::dispatchFunctionsFromMainThread); +} + +} // namespace WTF diff --git a/webkit/api/src/WebCString.cpp b/webkit/api/src/WebCString.cpp new file mode 100644 index 0000000..a387a72 --- /dev/null +++ b/webkit/api/src/WebCString.cpp @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebCString.h" + +#include "CString.h" + +namespace WebKit { + +class WebCStringPrivate : public WebCore::CStringBuffer { +}; + +void WebCString::reset() +{ + if (m_private) { + m_private->deref(); + m_private = 0; + } +} + +void WebCString::assign(const WebCString& other) +{ + assign(const_cast<WebCStringPrivate*>(other.m_private)); +} + +void WebCString::assign(const char* data, size_t length) +{ + char* newData; + RefPtr<WebCore::CStringBuffer> buffer = + WebCore::CString::newUninitialized(length, newData).buffer(); + memcpy(newData, data, length); + assign(static_cast<WebCStringPrivate*>(buffer.get())); +} + +size_t WebCString::length() const +{ + if (!m_private) + return 0; + // NOTE: The buffer's length includes the null byte. + return const_cast<WebCStringPrivate*>(m_private)->length() - 1; +} + +const char* WebCString::data() const +{ + if (!m_private) + return 0; + return const_cast<WebCStringPrivate*>(m_private)->data(); +} + +WebCString::WebCString(const WebCore::CString& s) + : m_private(static_cast<WebCStringPrivate*>(s.buffer())) +{ + if (m_private) + m_private->ref(); +} + +WebCString& WebCString::operator=(const WebCore::CString& s) +{ + assign(static_cast<WebCStringPrivate*>(s.buffer())); + return *this; +} + +WebCString::operator WebCore::CString() const +{ + return m_private; +} + +void WebCString::assign(WebCStringPrivate* p) +{ + // Take care to handle the case where m_private == p + if (p) + p->ref(); + if (m_private) + m_private->deref(); + m_private = p; +} + +} // namespace WebKit diff --git a/webkit/api/src/WebCache.cpp b/webkit/api/src/WebCache.cpp new file mode 100644 index 0000000..7d8164e --- /dev/null +++ b/webkit/api/src/WebCache.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebCache.h" + +// Instead of providing accessors, we make all members of Cache public. +// This will make it easier to track WebCore changes to the Cache class. +// FIXME: We should introduce public getters on the Cache class. +#define private public +#include "Cache.h" +#undef private + +using namespace WebCore; + +namespace WebKit { + +// A helper method for coverting a Cache::TypeStatistic to a +// WebCache::ResourceTypeStat. +static void ToResourceTypeStat(const Cache::TypeStatistic& from, + WebCache::ResourceTypeStat& to) +{ + to.count = static_cast<size_t>(from.count); + to.size = static_cast<size_t>(from.size); + to.liveSize = static_cast<size_t>(from.liveSize); + to.decodedSize = static_cast<size_t>(from.decodedSize); +} + +void WebCache::setCapacities( + size_t minDeadCapacity, size_t maxDeadCapacity, size_t capacity) +{ + Cache* cache = WebCore::cache(); + if (cache) + cache->setCapacities(static_cast<unsigned int>(minDeadCapacity), + static_cast<unsigned int>(maxDeadCapacity), + static_cast<unsigned int>(capacity)); +} + +void WebCache::getUsageStats(UsageStats* result) +{ + ASSERT(result); + + Cache* cache = WebCore::cache(); + if (cache) { + result->minDeadCapacity = cache->m_minDeadCapacity; + result->maxDeadCapacity = cache->m_maxDeadCapacity; + result->capacity = cache->m_capacity; + result->liveSize = cache->m_liveSize; + result->deadSize = cache->m_deadSize; + } else + memset(result, 0, sizeof(UsageStats)); +} + +void WebCache::getResourceTypeStats(ResourceTypeStats* result) +{ + Cache* cache = WebCore::cache(); + if (cache) { + Cache::Statistics stats = cache->getStatistics(); + ToResourceTypeStat(stats.images, result->images); + ToResourceTypeStat(stats.cssStyleSheets, result->cssStyleSheets); + ToResourceTypeStat(stats.scripts, result->scripts); +#if ENABLE(XSLT) + ToResourceTypeStat(stats.xslStyleSheets, result->xslStyleSheets); +#else + memset(&result->xslStyleSheets, 0, sizeof(result->xslStyleSheets)); +#endif + ToResourceTypeStat(stats.fonts, result->fonts); + } else + memset(result, 0, sizeof(WebCache::ResourceTypeStats)); +} + +} // namespace WebKit diff --git a/webkit/api/src/WebData.cpp b/webkit/api/src/WebData.cpp new file mode 100644 index 0000000..f4ec81a --- /dev/null +++ b/webkit/api/src/WebData.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebData.h" + +#include "SharedBuffer.h" + +using namespace WebCore; + +namespace WebKit { + +class WebDataPrivate : public SharedBuffer { +}; + +void WebData::reset() +{ + if (m_private) { + m_private->deref(); + m_private = 0; + } +} + +void WebData::assign(const WebData& other) +{ + WebDataPrivate* p = const_cast<WebDataPrivate*>(other.m_private); + p->ref(); + assign(p); +} + +void WebData::assign(const char* data, size_t size) +{ + assign(static_cast<WebDataPrivate*>( + SharedBuffer::create(data, size).releaseRef())); +} + +size_t WebData::size() const +{ + if (!m_private) + return 0; + return const_cast<WebDataPrivate*>(m_private)->size(); +} + +const char* WebData::data() const +{ + if (!m_private) + return 0; + return const_cast<WebDataPrivate*>(m_private)->data(); +} + +WebData::WebData(const PassRefPtr<SharedBuffer>& buffer) + : m_private(static_cast<WebDataPrivate*>(buffer.releaseRef())) +{ +} + +WebData& WebData::operator=(const PassRefPtr<SharedBuffer>& buffer) +{ + assign(static_cast<WebDataPrivate*>(buffer.releaseRef())); + return *this; +} + +WebData::operator PassRefPtr<SharedBuffer>() const +{ + return PassRefPtr<SharedBuffer>(const_cast<WebDataPrivate*>(m_private)); +} + +void WebData::assign(WebDataPrivate* p) +{ + // p is already ref'd for us by the caller + if (m_private) + m_private->deref(); + m_private = p; +} + +} // namespace WebKit diff --git a/webkit/api/src/WebDragData.cpp b/webkit/api/src/WebDragData.cpp new file mode 100644 index 0000000..426ceea --- /dev/null +++ b/webkit/api/src/WebDragData.cpp @@ -0,0 +1,214 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebDragData.h" + +#include "WebData.h" +#include "WebString.h" +#include "WebURL.h" +#include "WebVector.h" + +#include "ChromiumDataObject.h" +#include <wtf/PassRefPtr.h> + +using namespace WebCore; + +namespace WebKit { + +class WebDragDataPrivate : public ChromiumDataObject { +}; + +void WebDragData::initialize() +{ + assign(static_cast<WebDragDataPrivate*>(ChromiumDataObject::create().releaseRef())); +} + +void WebDragData::reset() +{ + if (m_private) { + m_private->deref(); + m_private = 0; + } +} + +void WebDragData::assign(const WebDragData& other) +{ + WebDragDataPrivate* p = const_cast<WebDragDataPrivate*>(other.m_private); + p->ref(); + assign(p); +} + +WebURL WebDragData::url() const +{ + ASSERT(!isNull()); + return m_private->url; +} + +void WebDragData::setURL(const WebURL& url) +{ + ASSERT(!isNull()); + m_private->url = url; +} + +WebString WebDragData::urlTitle() const +{ + ASSERT(!isNull()); + return m_private->urlTitle; +} + +void WebDragData::setURLTitle(const WebString& urlTitle) +{ + ASSERT(!isNull()); + m_private->urlTitle = urlTitle; +} + +WebString WebDragData::fileExtension() const +{ + ASSERT(!isNull()); + return m_private->fileExtension; +} + +void WebDragData::setFileExtension(const WebString& fileExtension) +{ + ASSERT(!isNull()); + m_private->fileExtension = fileExtension; +} + +bool WebDragData::hasFileNames() const +{ + ASSERT(!isNull()); + return !m_private->filenames.isEmpty(); +} + +void WebDragData::fileNames(WebVector<WebString>& fileNames) const +{ + ASSERT(!isNull()); + fileNames = m_private->filenames; +} + +void WebDragData::setFileNames(const WebVector<WebString>& fileNames) +{ + ASSERT(!isNull()); + m_private->filenames.clear(); + m_private->filenames.append(fileNames.data(), fileNames.size()); +} + +void WebDragData::appendToFileNames(const WebString& fileName) +{ + ASSERT(!isNull()); + m_private->filenames.append(fileName); +} + +WebString WebDragData::plainText() const +{ + ASSERT(!isNull()); + return m_private->plainText; +} + +void WebDragData::setPlainText(const WebString& plainText) +{ + ASSERT(!isNull()); + m_private->plainText = plainText; +} + +WebString WebDragData::htmlText() const +{ + ASSERT(!isNull()); + return m_private->textHtml; +} + +void WebDragData::setHTMLText(const WebString& htmlText) +{ + ASSERT(!isNull()); + m_private->textHtml = htmlText; +} + +WebURL WebDragData::htmlBaseURL() const +{ + ASSERT(!isNull()); + return m_private->htmlBaseUrl; +} + +void WebDragData::setHTMLBaseURL(const WebURL& htmlBaseURL) +{ + ASSERT(!isNull()); + m_private->htmlBaseUrl = htmlBaseURL; +} + +WebString WebDragData::fileContentFileName() const +{ + ASSERT(!isNull()); + return m_private->fileContentFilename; +} + +void WebDragData::setFileContentFileName(const WebString& fileName) +{ + ASSERT(!isNull()); + m_private->fileContentFilename = fileName; +} + +WebData WebDragData::fileContent() const +{ + ASSERT(!isNull()); + return WebData(m_private->fileContent); +} + +void WebDragData::setFileContent(const WebData& fileContent) +{ + ASSERT(!isNull()); + m_private->fileContent = fileContent; +} + +WebDragData::WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>& data) + : m_private(static_cast<WebDragDataPrivate*>(data.releaseRef())) +{ +} + +WebDragData& WebDragData::operator=(const WTF::PassRefPtr<WebCore::ChromiumDataObject>& data) +{ + assign(static_cast<WebDragDataPrivate*>(data.releaseRef())); + return *this; +} + +WebDragData::operator WTF::PassRefPtr<WebCore::ChromiumDataObject>() const +{ + return PassRefPtr<ChromiumDataObject>(const_cast<WebDragDataPrivate*>(m_private)); +} + +void WebDragData::assign(WebDragDataPrivate* p) +{ + // p is already ref'd for us by the caller + if (m_private) + m_private->deref(); + m_private = p; +} + +} // namespace WebKit diff --git a/webkit/api/src/WebImageSkia.cpp b/webkit/api/src/WebImageSkia.cpp new file mode 100644 index 0000000..12c8d178 --- /dev/null +++ b/webkit/api/src/WebImageSkia.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebImage.h" + +#include <SkBitmap.h> + +namespace WebKit { + +class WebImagePrivate : public SkBitmap { +public: + WebImagePrivate(const SkBitmap& bitmap) : SkBitmap(bitmap) { } +}; + +void WebImage::reset() +{ + delete m_private; + m_private = 0; +} + +WebSize WebImage::size() const +{ + if (!m_private) + return WebSize(); + + return WebSize(m_private->width(), m_private->height()); +} + +void WebImage::assign(const WebImage& image) +{ + if (m_private) + delete m_private; + + if (image.m_private) + m_private = new WebImagePrivate(*image.m_private); + else + m_private = 0; +} + +WebImage::operator SkBitmap() const +{ + if (!m_private) + return SkBitmap(); + + return *m_private; +} + +void WebImage::assign(const SkBitmap& bitmap) +{ + if (m_private) + delete m_private; + + m_private = new WebImagePrivate(bitmap); +} + +const void* WebImage::lockPixels() +{ + m_private->lockPixels(); + return static_cast<void*>(m_private->getPixels()); +} + +void WebImage::unlockPixels() +{ + m_private->unlockPixels(); +} + +} // namespace WebKit diff --git a/webkit/api/src/WebInputEvent.cpp b/webkit/api/src/WebInputEvent.cpp new file mode 100644 index 0000000..9ad4e34 --- /dev/null +++ b/webkit/api/src/WebInputEvent.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebInputEvent.h" + +#include <ctype.h> +#include <stdio.h> + +#include "KeyboardCodes.h" +#include <wtf/Assertions.h> +#include <wtf/StringExtras.h> + +using namespace WebCore; + +namespace WebKit { + +static const char* staticKeyIdentifiers(unsigned short keyCode) +{ + switch (keyCode) { + case VKEY_MENU: + return "Alt"; + case VKEY_CONTROL: + return "Control"; + case VKEY_SHIFT: + return "Shift"; + case VKEY_CAPITAL: + return "CapsLock"; + case VKEY_LWIN: + case VKEY_RWIN: + return "Win"; + case VKEY_CLEAR: + return "Clear"; + case VKEY_DOWN: + return "Down"; + case VKEY_END: + return "End"; + case VKEY_RETURN: + return "Enter"; + case VKEY_EXECUTE: + return "Execute"; + case VKEY_F1: + return "F1"; + case VKEY_F2: + return "F2"; + case VKEY_F3: + return "F3"; + case VKEY_F4: + return "F4"; + case VKEY_F5: + return "F5"; + case VKEY_F6: + return "F6"; + case VKEY_F7: + return "F7"; + case VKEY_F8: + return "F8"; + case VKEY_F9: + return "F9"; + case VKEY_F10: + return "F11"; + case VKEY_F12: + return "F12"; + case VKEY_F13: + return "F13"; + case VKEY_F14: + return "F14"; + case VKEY_F15: + return "F15"; + case VKEY_F16: + return "F16"; + case VKEY_F17: + return "F17"; + case VKEY_F18: + return "F18"; + case VKEY_F19: + return "F19"; + case VKEY_F20: + return "F20"; + case VKEY_F21: + return "F21"; + case VKEY_F22: + return "F22"; + case VKEY_F23: + return "F23"; + case VKEY_F24: + return "F24"; + case VKEY_HELP: + return "Help"; + case VKEY_HOME: + return "Home"; + case VKEY_INSERT: + return "Insert"; + case VKEY_LEFT: + return "Left"; + case VKEY_NEXT: + return "PageDown"; + case VKEY_PRIOR: + return "PageUp"; + case VKEY_PAUSE: + return "Pause"; + case VKEY_SNAPSHOT: + return "PrintScreen"; + case VKEY_RIGHT: + return "Right"; + case VKEY_SCROLL: + return "Scroll"; + case VKEY_SELECT: + return "Select"; + case VKEY_UP: + return "Up"; + case VKEY_DELETE: + return "U+007F"; // Standard says that DEL becomes U+007F. + default: + return 0; + } +} + +void WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode() +{ + const char* id = staticKeyIdentifiers(windowsKeyCode); + if (id) { + strncpy(keyIdentifier, id, sizeof(keyIdentifier) - 1); + keyIdentifier[sizeof(keyIdentifier) - 1] = '\0'; + } else + snprintf(keyIdentifier, sizeof(keyIdentifier), "U+%04X", toupper(windowsKeyCode)); +} + +} // namespace WebKit diff --git a/webkit/api/src/WebKit.cpp b/webkit/api/src/WebKit.cpp new file mode 100644 index 0000000..5523eba --- /dev/null +++ b/webkit/api/src/WebKit.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKit.h" + +#include "WebString.h" + +#include "AtomicString.h" +#include "DOMTimer.h" +#include "FrameLoader.h" +#include "Page.h" +#include "V8Proxy.h" +#include "WorkerContextExecutionProxy.h" +#include <wtf/Assertions.h> +#include <wtf/Threading.h> + +namespace WebKit { + +static WebKitClient* s_webKitClient = 0; +static bool s_layoutTestMode = false; + +void initialize(WebKitClient* webKitClient) +{ + ASSERT(webKitClient); + ASSERT(!s_webKitClient); + s_webKitClient = webKitClient; + + WTF::initializeThreading(); + WebCore::AtomicString::init(); + + // Chromium sets the minimum interval timeout to 4ms, overriding the + // default of 10ms. We'd like to go lower, however there are poorly + // coded websites out there which do create CPU-spinning loops. Using + // 4ms prevents the CPU from spinning too busily and provides a balance + // between CPU spinning and the smallest possible interval timer. + WebCore::DOMTimer::setMinTimerInterval(0.004); +} + +void shutdown() +{ + s_webKitClient = 0; +} + +WebKitClient* webKitClient() +{ + return s_webKitClient; +} + +void setLayoutTestMode(bool value) +{ + s_layoutTestMode = value; +} + +bool layoutTestMode() +{ + return s_layoutTestMode; +} + +void registerURLSchemeAsLocal(const WebString& scheme) +{ + WebCore::FrameLoader::registerURLSchemeAsLocal(scheme); +} + +void registerURLSchemeAsNoAccess(const WebString& scheme) +{ + WebCore::FrameLoader::registerURLSchemeAsNoAccess(scheme); +} + +void registerExtension(v8::Extension* extension) +{ + WebCore::V8Proxy::RegisterExtension(extension, WebString()); +} + +void registerExtension(v8::Extension* extension, + const WebString& schemeRestriction) +{ + WebCore::V8Proxy::RegisterExtension(extension, schemeRestriction); +} + +void enableWebWorkers() +{ +#if ENABLE(WORKERS) + WebCore::WorkerContextExecutionProxy::setIsWebWorkersEnabled(true); +#endif +} + +void resetPluginCache() +{ + WebCore::Page::refreshPlugins(false); +} + +} // namespace WebKit diff --git a/webkit/api/src/WebPluginListBuilderImpl.cpp b/webkit/api/src/WebPluginListBuilderImpl.cpp new file mode 100644 index 0000000..1971911 --- /dev/null +++ b/webkit/api/src/WebPluginListBuilderImpl.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebPluginListBuilderImpl.h" + +#include "WebString.h" + +#include "PluginData.h" +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace WebKit { + +void WebPluginListBuilderImpl::addPlugin(const WebString& name, const WebString& description, const WebString& fileName) +{ + PluginInfo* info = new PluginInfo(); + info->name = name; + info->desc = description; + info->file = fileName; + m_results->append(info); +} + +void WebPluginListBuilderImpl::addMediaTypeToLastPlugin(const WebString& name, const WebString& description) +{ + MimeClassInfo* info = new MimeClassInfo(); + info->type = name; + info->desc = description; + m_results->last()->mimes.append(info); +} + +void WebPluginListBuilderImpl::addFileExtensionToLastMediaType(const WebString& extension) +{ + MimeClassInfo* info = m_results->last()->mimes.last(); + if (!info->suffixes.isEmpty()) + info->suffixes.append(','); + info->suffixes.append(extension); +} + +} // namespace WebKit diff --git a/webkit/api/src/WebPluginListBuilderImpl.h b/webkit/api/src/WebPluginListBuilderImpl.h new file mode 100644 index 0000000..7d7ad7b --- /dev/null +++ b/webkit/api/src/WebPluginListBuilderImpl.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPluginListBuilderImpl_h +#define WebPluginListBuilderImpl_h + +#include "WebPluginListBuilder.h" + +#include "PluginData.h" +#include <wtf/Vector.h> + +namespace WebKit { + + class WebPluginListBuilderImpl : public WebPluginListBuilder { + public: + WebPluginListBuilderImpl(Vector<WebCore::PluginInfo*>* results) : m_results(results) { } + + // WebPluginListBuilder methods: + virtual void addPlugin(const WebString& name, const WebString& description, const WebString& fileName); + virtual void addMediaTypeToLastPlugin(const WebString& name, const WebString& description); + virtual void addFileExtensionToLastMediaType(const WebString& extension); + + private: + Vector<WebCore::PluginInfo*>* m_results; + }; + +} // namespace WebKit + +#endif diff --git a/webkit/api/src/WebString.cpp b/webkit/api/src/WebString.cpp new file mode 100644 index 0000000..08da985 --- /dev/null +++ b/webkit/api/src/WebString.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebString.h" + +#include "PlatformString.h" + +namespace WebKit { + +class WebStringPrivate : public WebCore::StringImpl { +}; + +void WebString::reset() +{ + if (m_private) { + m_private->deref(); + m_private = 0; + } +} + +void WebString::assign(const WebString& other) +{ + assign(const_cast<WebStringPrivate*>(other.m_private)); +} + +void WebString::assign(const WebUChar* data, size_t length) +{ + assign(static_cast<WebStringPrivate*>( + WebCore::StringImpl::create(data, length).get())); +} + +size_t WebString::length() const +{ + return m_private ? const_cast<WebStringPrivate*>(m_private)->length() : 0; +} + +const WebUChar* WebString::data() const +{ + return m_private ? const_cast<WebStringPrivate*>(m_private)->characters() : 0; +} + +WebString WebString::fromUTF8(const char* data, size_t length) +{ + return WebCore::String::fromUTF8(data, length); +} + +WebString WebString::fromUTF8(const char* data) +{ + return WebCore::String::fromUTF8(data); +} + +WebString::WebString(const WebCore::String& s) + : m_private(static_cast<WebStringPrivate*>(s.impl())) +{ + if (m_private) + m_private->ref(); +} + +WebString& WebString::operator=(const WebCore::String& s) +{ + assign(static_cast<WebStringPrivate*>(s.impl())); + return *this; +} + +WebString::operator WebCore::String() const +{ + return m_private; +} + +void WebString::assign(WebStringPrivate* p) +{ + // Take care to handle the case where m_private == p + if (p) + p->ref(); + if (m_private) + m_private->deref(); + m_private = p; +} + +} // namespace WebKit diff --git a/webkit/api/src/WebURL.cpp b/webkit/api/src/WebURL.cpp new file mode 100644 index 0000000..feb92c1 --- /dev/null +++ b/webkit/api/src/WebURL.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebURL.h" + +#include "KURL.h" + +namespace WebKit { + +WebURL::WebURL(const WebCore::KURL& url) + : m_spec(url.utf8String()) + , m_parsed(url.parsed()) + , m_isValid(url.isValid()) +{ +} + +WebURL& WebURL::operator=(const WebCore::KURL& url) +{ + m_spec = url.utf8String(); + m_parsed = url.parsed(); + m_isValid = url.isValid(); + return *this; +} + +WebURL::operator WebCore::KURL() const +{ + return WebCore::KURL(m_spec, m_parsed, m_isValid); +} + +} // namespace WebKit diff --git a/webkit/api/src/gtk/WebInputEventFactory.cpp b/webkit/api/src/gtk/WebInputEventFactory.cpp new file mode 100644 index 0000000..7c784d1 --- /dev/null +++ b/webkit/api/src/gtk/WebInputEventFactory.cpp @@ -0,0 +1,239 @@ +/* + * Copyright (C) 2006-2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebInputEventFactory.h" + +#include <gdk/gdk.h> +#include <gdk/gdkkeysyms.h> +#include <gtk/gtkversion.h> + +#include "WebInputEvent.h" + +#include "KeyboardCodes.h" +#include "KeyCodeConversion.h" +#include <wtf/Assertions.h> + +namespace WebKit { + +static double gdkEventTimeToWebEventTime(guint32 time) +{ + // Convert from time in ms to time in sec. + return time / 1000.0; +} + +static int gdkStateToWebEventModifiers(guint state) +{ + int modifiers = 0; + if (state & GDK_SHIFT_MASK) + modifiers |= WebInputEvent::ShiftKey; + if (state & GDK_CONTROL_MASK) + modifiers |= WebInputEvent::ControlKey; + if (state & GDK_MOD1_MASK) + modifiers |= WebInputEvent::AltKey; +#if GTK_CHECK_VERSION(2,10,0) + if (state & GDK_META_MASK) + modifiers |= WebInputEvent::MetaKey; +#endif + return modifiers; +} + +// WebKeyboardEvent ----------------------------------------------------------- + +WebKeyboardEvent WebInputEventFactory::keyboardEvent(const GdkEventKey* event) +{ + WebKeyboardEvent result; + + result.modifiers = gdkStateToWebEventModifiers(event->state); + + switch (event->type) { + case GDK_KEY_RELEASE: + result.type = WebInputEvent::KeyUp; + break; + case GDK_KEY_PRESS: + result.type = WebInputEvent::KeyDown; + break; + default: + ASSERT_NOT_REACHED(); + } + + // The key code tells us which physical key was pressed (for example, the + // A key went down or up). It does not determine whether A should be lower + // or upper case. This is what text does, which should be the keyval. + result.windowsKeyCode = WebCore::windowsKeyCodeForKeyEvent(event->keyval); + result.nativeKeyCode = event->hardware_keycode; + + switch (event->keyval) { + // We need to treat the enter key as a key press of character \r. This + // is apparently just how webkit handles it and what it expects. + case GDK_ISO_Enter: + case GDK_KP_Enter: + case GDK_Return: + result.unmodifiedText[0] = result.text[0] = static_cast<WebUChar>('\r'); + break; + default: + // This should set text to 0 when it's not a real character. + // FIXME: fix for non BMP chars + result.unmodifiedText[0] = result.text[0] = + static_cast<WebUChar>(gdk_keyval_to_unicode(event->keyval)); + } + + result.setKeyIdentifierFromWindowsKeyCode(); + + // FIXME: Do we need to set IsAutoRepeat or IsKeyPad? + + return result; +} + +// WebMouseEvent -------------------------------------------------------------- + +WebMouseEvent WebInputEventFactory::mouseEvent(const GdkEventButton* event) +{ + WebMouseEvent result; + + result.timeStampSeconds = gdkEventTimeToWebEventTime(event->time); + + result.modifiers = gdkStateToWebEventModifiers(event->state); + result.x = static_cast<int>(event->x); + result.y = static_cast<int>(event->y); + result.globalX = static_cast<int>(event->x_root); + result.globalY = static_cast<int>(event->y_root); + result.layoutTestClickCount = 0; + + switch (event->type) { + case GDK_BUTTON_PRESS: + result.type = WebInputEvent::MouseDown; + break; + case GDK_2BUTTON_PRESS: + result.type = WebInputEvent::MouseDoubleClick; + break; + case GDK_3BUTTON_PRESS: + result.type = WebInputEvent::MouseTripleClick; + break; + case GDK_BUTTON_RELEASE: + result.type = WebInputEvent::MouseUp; + break; + + default: + ASSERT_NOT_REACHED(); + }; + + result.button = WebMouseEvent::ButtonNone; + if (event->button == 1) + result.button = WebMouseEvent::ButtonLeft; + else if (event->button == 2) + result.button = WebMouseEvent::ButtonMiddle; + else if (event->button == 3) + result.button = WebMouseEvent::ButtonRight; + + return result; +} + +WebMouseEvent WebInputEventFactory::mouseEvent(const GdkEventMotion* event) +{ + WebMouseEvent result; + + result.timeStampSeconds = gdkEventTimeToWebEventTime(event->time); + result.modifiers = gdkStateToWebEventModifiers(event->state); + result.x = static_cast<int>(event->x); + result.y = static_cast<int>(event->y); + result.globalX = static_cast<int>(event->x_root); + result.globalY = static_cast<int>(event->y_root); + + switch (event->type) { + case GDK_MOTION_NOTIFY: + result.type = WebInputEvent::MouseMove; + break; + default: + ASSERT_NOT_REACHED(); + } + + result.button = WebMouseEvent::ButtonNone; + if (event->state & GDK_BUTTON1_MASK) + result.button = WebMouseEvent::ButtonLeft; + else if (event->state & GDK_BUTTON2_MASK) + result.button = WebMouseEvent::ButtonMiddle; + else if (event->state & GDK_BUTTON3_MASK) + result.button = WebMouseEvent::ButtonRight; + + return result; +} + +// WebMouseWheelEvent --------------------------------------------------------- + +WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(const GdkEventScroll* event) +{ + WebMouseWheelEvent result; + + result.type = WebInputEvent::MouseWheel; + result.button = WebMouseEvent::ButtonNone; + + result.timeStampSeconds = gdkEventTimeToWebEventTime(event->time); + result.modifiers = gdkStateToWebEventModifiers(event->state); + result.x = static_cast<int>(event->x); + result.y = static_cast<int>(event->y); + result.globalX = static_cast<int>(event->x_root); + result.globalY = static_cast<int>(event->y_root); + + // How much should we scroll per mouse wheel event? + // - Windows uses 3 lines by default and obeys a system setting. + // - Mozilla has a pref that lets you either use the "system" number of lines + // to scroll, or lets the user override it. + // For the "system" number of lines, it appears they've hardcoded 3. + // See case NS_MOUSE_SCROLL in content/events/src/nsEventStateManager.cpp + // and InitMouseScrollEvent in widget/src/gtk2/nsCommonWidget.cpp . + // - Gtk makes the scroll amount a function of the size of the scroll bar, + // which is not available to us here. + // Instead, we pick a number that empirically matches Firefox's behavior. + static const float scrollbarPixelsPerTick = 160.0f / 3.0f; + + switch (event->direction) { + case GDK_SCROLL_UP: + result.deltaY = scrollbarPixelsPerTick; + result.wheelTicksY = 1; + break; + case GDK_SCROLL_DOWN: + result.deltaY = -scrollbarPixelsPerTick; + result.wheelTicksY = -1; + break; + case GDK_SCROLL_LEFT: + result.deltaX = scrollbarPixelsPerTick; + result.wheelTicksX = -1; // Match Windows positive/negative orientation + break; + case GDK_SCROLL_RIGHT: + result.deltaX = -scrollbarPixelsPerTick; + result.wheelTicksX = 1; + break; + } + + return result; +} + +} // namespace WebKit diff --git a/webkit/api/src/gtk/WebScreenInfoFactory.cpp b/webkit/api/src/gtk/WebScreenInfoFactory.cpp new file mode 100644 index 0000000..6ac1a65 --- /dev/null +++ b/webkit/api/src/gtk/WebScreenInfoFactory.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebScreenInfoFactory.h" + +#include <gtk/gtk.h> + +#include "WebScreenInfo.h" + +namespace WebKit { + +WebScreenInfo WebScreenInfoFactory::screenInfo(GtkWidget* widget) +{ + WebScreenInfo results; + results.depth = 32; + results.depthPerComponent = 8; + results.isMonochrome = false; + + if (!widget) + return results; + + GdkScreen* screen = gtk_widget_get_screen(widget); + + results.rect = WebRect( + 0, 0, gdk_screen_get_width(screen), gdk_screen_get_height(screen)); + + // I don't know of a way to query the "maximize" size of the window (e.g. + // screen size less sidebars etc) since this is something which only the + // window manager knows. + results.availableRect = results.rect; + + return results; +} + +} // namespace WebKit diff --git a/webkit/api/src/mac/WebInputEventFactory.mm b/webkit/api/src/mac/WebInputEventFactory.mm new file mode 100644 index 0000000..c0afa04 --- /dev/null +++ b/webkit/api/src/mac/WebInputEventFactory.mm @@ -0,0 +1,1129 @@ +/* + * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006-2009 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebInputEventFactory.h" + +#include <ApplicationServices/ApplicationServices.h> +#import <Cocoa/Cocoa.h> + +#include "WebInputEvent.h" +#include <wtf/ASCIICType.h> + +namespace WebKit { + +// WebKeyboardEvent ----------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// Begin Apple code, copied from KeyEventMac.mm +// +// We can share some of this code if we factored it out of KeyEventMac, but +// the main problem is that it relies on the NSString ctor on String for +// conversions, and since we're building without PLATFORM(MAC), we don't have +// that. As a result we have to use NSString here exclusively and thus tweak +// the code so it's not re-usable as-is. One possiblity would be to make the +// upstream code only use NSString, but I'm not certain how far that change +// would propagate. + +static inline bool isKeyUpEvent(NSEvent* event) +{ + if ([event type] != NSFlagsChanged) + return [event type] == NSKeyUp; + // FIXME: This logic fails if the user presses both Shift keys at once, for example: + // we treat releasing one of them as keyDown. + switch ([event keyCode]) { + case 54: // Right Command + case 55: // Left Command + return ([event modifierFlags] & NSCommandKeyMask) == 0; + + case 57: // Capslock + return ([event modifierFlags] & NSAlphaShiftKeyMask) == 0; + + case 56: // Left Shift + case 60: // Right Shift + return ([event modifierFlags] & NSShiftKeyMask) == 0; + + case 58: // Left Alt + case 61: // Right Alt + return ([event modifierFlags] & NSAlternateKeyMask) == 0; + + case 59: // Left Ctrl + case 62: // Right Ctrl + return ([event modifierFlags] & NSControlKeyMask) == 0; + + case 63: // Function + return ([event modifierFlags] & NSFunctionKeyMask) == 0; + } + return false; +} + +static bool isKeypadEvent(NSEvent* event) +{ + // Check that this is the type of event that has a keyCode. + switch ([event type]) { + case NSKeyDown: + case NSKeyUp: + case NSFlagsChanged: + break; + default: + return false; + } + + switch ([event keyCode]) { + case 71: // Clear + case 81: // = + case 75: // / + case 67: // * + case 78: // - + case 69: // + + case 76: // Enter + case 65: // . + case 82: // 0 + case 83: // 1 + case 84: // 2 + case 85: // 3 + case 86: // 4 + case 87: // 5 + case 88: // 6 + case 89: // 7 + case 91: // 8 + case 92: // 9 + return true; + } + + return false; +} + +static int windowsKeyCodeForKeyEvent(NSEvent* event) +{ + switch ([event keyCode]) { + // VK_TAB (09) TAB key + case 48: + return 0x09; + + // VK_APPS (5D) Right windows/meta key + case 54: // Right Command + return 0x5D; + + // VK_LWIN (5B) Left windows/meta key + case 55: // Left Command + return 0x5B; + + // VK_CAPITAL (14) caps locks key + case 57: // Capslock + return 0x14; + + // VK_SHIFT (10) either shift key + case 56: // Left Shift + case 60: // Right Shift + return 0x10; + + // VK_MENU (12) either alt key + case 58: // Left Alt + case 61: // Right Alt + return 0x12; + + // VK_CONTROL (11) either ctrl key + case 59: // Left Ctrl + case 62: // Right Ctrl + return 0x11; + + // VK_CLEAR (0C) CLEAR key + case 71: return 0x0C; + + // VK_NUMPAD0 (60) Numeric keypad 0 key + case 82: return 0x60; + // VK_NUMPAD1 (61) Numeric keypad 1 key + case 83: return 0x61; + // VK_NUMPAD2 (62) Numeric keypad 2 key + case 84: return 0x62; + // VK_NUMPAD3 (63) Numeric keypad 3 key + case 85: return 0x63; + // VK_NUMPAD4 (64) Numeric keypad 4 key + case 86: return 0x64; + // VK_NUMPAD5 (65) Numeric keypad 5 key + case 87: return 0x65; + // VK_NUMPAD6 (66) Numeric keypad 6 key + case 88: return 0x66; + // VK_NUMPAD7 (67) Numeric keypad 7 key + case 89: return 0x67; + // VK_NUMPAD8 (68) Numeric keypad 8 key + case 91: return 0x68; + // VK_NUMPAD9 (69) Numeric keypad 9 key + case 92: return 0x69; + // VK_MULTIPLY (6A) Multiply key + case 67: return 0x6A; + // VK_ADD (6B) Add key + case 69: return 0x6B; + + // VK_SUBTRACT (6D) Subtract key + case 78: return 0x6D; + // VK_DECIMAL (6E) Decimal key + case 65: return 0x6E; + // VK_DIVIDE (6F) Divide key + case 75: return 0x6F; + } + + NSString* s = [event charactersIgnoringModifiers]; + if ([s length] != 1) + return 0; + + switch ([s characterAtIndex:0]) { + // VK_LBUTTON (01) Left mouse button + // VK_RBUTTON (02) Right mouse button + // VK_CANCEL (03) Control-break processing + // VK_MBUTTON (04) Middle mouse button (three-button mouse) + // VK_XBUTTON1 (05) + // VK_XBUTTON2 (06) + + // VK_BACK (08) BACKSPACE key + case 8: case 0x7F: return 0x08; + // VK_TAB (09) TAB key + case 9: return 0x09; + + // VK_CLEAR (0C) CLEAR key + // handled by key code above + + // VK_RETURN (0D) + case 0xD: case 3: return 0x0D; + + // VK_SHIFT (10) SHIFT key + // VK_CONTROL (11) CTRL key + // VK_MENU (12) ALT key + + // VK_PAUSE (13) PAUSE key + case NSPauseFunctionKey: return 0x13; + + // VK_CAPITAL (14) CAPS LOCK key + // VK_KANA (15) Input Method Editor (IME) Kana mode + // VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL) + // VK_HANGUL (15) IME Hangul mode + // VK_JUNJA (17) IME Junja mode + // VK_FINAL (18) IME final mode + // VK_HANJA (19) IME Hanja mode + // VK_KANJI (19) IME Kanji mode + + // VK_ESCAPE (1B) ESC key + case 0x1B: return 0x1B; + + // VK_CONVERT (1C) IME convert + // VK_NONCONVERT (1D) IME nonconvert + // VK_ACCEPT (1E) IME accept + // VK_MODECHANGE (1F) IME mode change request + + // VK_SPACE (20) SPACEBAR + case ' ': return 0x20; + // VK_PRIOR (21) PAGE UP key + case NSPageUpFunctionKey: return 0x21; + // VK_NEXT (22) PAGE DOWN key + case NSPageDownFunctionKey: return 0x22; + // VK_END (23) END key + case NSEndFunctionKey: return 0x23; + // VK_HOME (24) HOME key + case NSHomeFunctionKey: return 0x24; + // VK_LEFT (25) LEFT ARROW key + case NSLeftArrowFunctionKey: return 0x25; + // VK_UP (26) UP ARROW key + case NSUpArrowFunctionKey: return 0x26; + // VK_RIGHT (27) RIGHT ARROW key + case NSRightArrowFunctionKey: return 0x27; + // VK_DOWN (28) DOWN ARROW key + case NSDownArrowFunctionKey: return 0x28; + // VK_SELECT (29) SELECT key + case NSSelectFunctionKey: return 0x29; + // VK_PRINT (2A) PRINT key + case NSPrintFunctionKey: return 0x2A; + // VK_EXECUTE (2B) EXECUTE key + case NSExecuteFunctionKey: return 0x2B; + // VK_SNAPSHOT (2C) PRINT SCREEN key + case NSPrintScreenFunctionKey: return 0x2C; + // VK_INSERT (2D) INS key + case NSInsertFunctionKey: case NSHelpFunctionKey: return 0x2D; + // VK_DELETE (2E) DEL key + case NSDeleteFunctionKey: return 0x2E; + + // VK_HELP (2F) HELP key + + // (30) 0 key + case '0': case ')': return 0x30; + // (31) 1 key + case '1': case '!': return 0x31; + // (32) 2 key + case '2': case '@': return 0x32; + // (33) 3 key + case '3': case '#': return 0x33; + // (34) 4 key + case '4': case '$': return 0x34; + // (35) 5 key + case '5': case '%': return 0x35; + // (36) 6 key + case '6': case '^': return 0x36; + // (37) 7 key + case '7': case '&': return 0x37; + // (38) 8 key + case '8': case '*': return 0x38; + // (39) 9 key + case '9': case '(': return 0x39; + // (41) A key + case 'a': case 'A': return 0x41; + // (42) B key + case 'b': case 'B': return 0x42; + // (43) C key + case 'c': case 'C': return 0x43; + // (44) D key + case 'd': case 'D': return 0x44; + // (45) E key + case 'e': case 'E': return 0x45; + // (46) F key + case 'f': case 'F': return 0x46; + // (47) G key + case 'g': case 'G': return 0x47; + // (48) H key + case 'h': case 'H': return 0x48; + // (49) I key + case 'i': case 'I': return 0x49; + // (4A) J key + case 'j': case 'J': return 0x4A; + // (4B) K key + case 'k': case 'K': return 0x4B; + // (4C) L key + case 'l': case 'L': return 0x4C; + // (4D) M key + case 'm': case 'M': return 0x4D; + // (4E) N key + case 'n': case 'N': return 0x4E; + // (4F) O key + case 'o': case 'O': return 0x4F; + // (50) P key + case 'p': case 'P': return 0x50; + // (51) Q key + case 'q': case 'Q': return 0x51; + // (52) R key + case 'r': case 'R': return 0x52; + // (53) S key + case 's': case 'S': return 0x53; + // (54) T key + case 't': case 'T': return 0x54; + // (55) U key + case 'u': case 'U': return 0x55; + // (56) V key + case 'v': case 'V': return 0x56; + // (57) W key + case 'w': case 'W': return 0x57; + // (58) X key + case 'x': case 'X': return 0x58; + // (59) Y key + case 'y': case 'Y': return 0x59; + // (5A) Z key + case 'z': case 'Z': return 0x5A; + + // VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard) + // VK_RWIN (5C) Right Windows key (Natural keyboard) + // VK_APPS (5D) Applications key (Natural keyboard) + // VK_SLEEP (5F) Computer Sleep key + + // VK_NUMPAD0 (60) Numeric keypad 0 key + // VK_NUMPAD1 (61) Numeric keypad 1 key + // VK_NUMPAD2 (62) Numeric keypad 2 key + // VK_NUMPAD3 (63) Numeric keypad 3 key + // VK_NUMPAD4 (64) Numeric keypad 4 key + // VK_NUMPAD5 (65) Numeric keypad 5 key + // VK_NUMPAD6 (66) Numeric keypad 6 key + // VK_NUMPAD7 (67) Numeric keypad 7 key + // VK_NUMPAD8 (68) Numeric keypad 8 key + // VK_NUMPAD9 (69) Numeric keypad 9 key + // VK_MULTIPLY (6A) Multiply key + // VK_ADD (6B) Add key + // handled by key code above + + // VK_SEPARATOR (6C) Separator key + + // VK_SUBTRACT (6D) Subtract key + // VK_DECIMAL (6E) Decimal key + // VK_DIVIDE (6F) Divide key + // handled by key code above + + // VK_F1 (70) F1 key + case NSF1FunctionKey: return 0x70; + // VK_F2 (71) F2 key + case NSF2FunctionKey: return 0x71; + // VK_F3 (72) F3 key + case NSF3FunctionKey: return 0x72; + // VK_F4 (73) F4 key + case NSF4FunctionKey: return 0x73; + // VK_F5 (74) F5 key + case NSF5FunctionKey: return 0x74; + // VK_F6 (75) F6 key + case NSF6FunctionKey: return 0x75; + // VK_F7 (76) F7 key + case NSF7FunctionKey: return 0x76; + // VK_F8 (77) F8 key + case NSF8FunctionKey: return 0x77; + // VK_F9 (78) F9 key + case NSF9FunctionKey: return 0x78; + // VK_F10 (79) F10 key + case NSF10FunctionKey: return 0x79; + // VK_F11 (7A) F11 key + case NSF11FunctionKey: return 0x7A; + // VK_F12 (7B) F12 key + case NSF12FunctionKey: return 0x7B; + // VK_F13 (7C) F13 key + case NSF13FunctionKey: return 0x7C; + // VK_F14 (7D) F14 key + case NSF14FunctionKey: return 0x7D; + // VK_F15 (7E) F15 key + case NSF15FunctionKey: return 0x7E; + // VK_F16 (7F) F16 key + case NSF16FunctionKey: return 0x7F; + // VK_F17 (80H) F17 key + case NSF17FunctionKey: return 0x80; + // VK_F18 (81H) F18 key + case NSF18FunctionKey: return 0x81; + // VK_F19 (82H) F19 key + case NSF19FunctionKey: return 0x82; + // VK_F20 (83H) F20 key + case NSF20FunctionKey: return 0x83; + // VK_F21 (84H) F21 key + case NSF21FunctionKey: return 0x84; + // VK_F22 (85H) F22 key + case NSF22FunctionKey: return 0x85; + // VK_F23 (86H) F23 key + case NSF23FunctionKey: return 0x86; + // VK_F24 (87H) F24 key + case NSF24FunctionKey: return 0x87; + + // VK_NUMLOCK (90) NUM LOCK key + + // VK_SCROLL (91) SCROLL LOCK key + case NSScrollLockFunctionKey: return 0x91; + + // VK_LSHIFT (A0) Left SHIFT key + // VK_RSHIFT (A1) Right SHIFT key + // VK_LCONTROL (A2) Left CONTROL key + // VK_RCONTROL (A3) Right CONTROL key + // VK_LMENU (A4) Left MENU key + // VK_RMENU (A5) Right MENU key + // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key + // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key + // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key + // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key + // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key + // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key + // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key + // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key + // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key + // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key + // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key + // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key + // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key + // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key + // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key + // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key + // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key + // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key + + // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key + case ';': case ':': return 0xBA; + // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key + case '=': case '+': return 0xBB; + // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key + case ',': case '<': return 0xBC; + // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key + case '-': case '_': return 0xBD; + // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key + case '.': case '>': return 0xBE; + // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key + case '/': case '?': return 0xBF; + // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key + case '`': case '~': return 0xC0; + // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key + case '[': case '{': return 0xDB; + // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key + case '\\': case '|': return 0xDC; + // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key + case ']': case '}': return 0xDD; + // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key + case '\'': case '"': return 0xDE; + + // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. + // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard + // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key + // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP + // VK_ATTN (F6) Attn key + // VK_CRSEL (F7) CrSel key + // VK_EXSEL (F8) ExSel key + // VK_EREOF (F9) Erase EOF key + // VK_PLAY (FA) Play key + // VK_ZOOM (FB) Zoom key + // VK_NONAME (FC) Reserved for future use + // VK_PA1 (FD) PA1 key + // VK_OEM_CLEAR (FE) Clear key + } + + return 0; +} + +static inline NSString* textFromEvent(NSEvent* event) +{ + if ([event type] == NSFlagsChanged) + return @""; + return [event characters]; +} + +static inline NSString* unmodifiedTextFromEvent(NSEvent* event) +{ + if ([event type] == NSFlagsChanged) + return @""; + return [event charactersIgnoringModifiers]; +} + +static NSString* keyIdentifierForKeyEvent(NSEvent* event) +{ + if ([event type] == NSFlagsChanged) { + switch ([event keyCode]) { + case 54: // Right Command + case 55: // Left Command + return @"Meta"; + + case 57: // Capslock + return @"CapsLock"; + + case 56: // Left Shift + case 60: // Right Shift + return @"Shift"; + + case 58: // Left Alt + case 61: // Right Alt + return @"Alt"; + + case 59: // Left Ctrl + case 62: // Right Ctrl + return @"Control"; + + default: + ASSERT_NOT_REACHED(); + return @""; + } + } + + NSString* s = [event charactersIgnoringModifiers]; + if ([s length] != 1) + return @"Unidentified"; + + unichar c = [s characterAtIndex:0]; + switch (c) { + // Each identifier listed in the DOM spec is listed here. + // Many are simply commented out since they do not appear on standard Macintosh keyboards + // or are on a key that doesn't have a corresponding character. + + // "Accept" + // "AllCandidates" + + // "Alt" + case NSMenuFunctionKey: + return @"Alt"; + + // "Apps" + // "BrowserBack" + // "BrowserForward" + // "BrowserHome" + // "BrowserRefresh" + // "BrowserSearch" + // "BrowserStop" + // "CapsLock" + + // "Clear" + case NSClearLineFunctionKey: + return @"Clear"; + + // "CodeInput" + // "Compose" + // "Control" + // "Crsel" + // "Convert" + // "Copy" + // "Cut" + + // "Down" + case NSDownArrowFunctionKey: + return @"Down"; + // "End" + case NSEndFunctionKey: + return @"End"; + // "Enter" + case 0x3: case 0xA: case 0xD: // Macintosh calls the one on the main keyboard Return, but Windows calls it Enter, so we'll do the same for the DOM + return @"Enter"; + + // "EraseEof" + + // "Execute" + case NSExecuteFunctionKey: + return @"Execute"; + + // "Exsel" + + // "F1" + case NSF1FunctionKey: + return @"F1"; + // "F2" + case NSF2FunctionKey: + return @"F2"; + // "F3" + case NSF3FunctionKey: + return @"F3"; + // "F4" + case NSF4FunctionKey: + return @"F4"; + // "F5" + case NSF5FunctionKey: + return @"F5"; + // "F6" + case NSF6FunctionKey: + return @"F6"; + // "F7" + case NSF7FunctionKey: + return @"F7"; + // "F8" + case NSF8FunctionKey: + return @"F8"; + // "F9" + case NSF9FunctionKey: + return @"F9"; + // "F10" + case NSF10FunctionKey: + return @"F10"; + // "F11" + case NSF11FunctionKey: + return @"F11"; + // "F12" + case NSF12FunctionKey: + return @"F12"; + // "F13" + case NSF13FunctionKey: + return @"F13"; + // "F14" + case NSF14FunctionKey: + return @"F14"; + // "F15" + case NSF15FunctionKey: + return @"F15"; + // "F16" + case NSF16FunctionKey: + return @"F16"; + // "F17" + case NSF17FunctionKey: + return @"F17"; + // "F18" + case NSF18FunctionKey: + return @"F18"; + // "F19" + case NSF19FunctionKey: + return @"F19"; + // "F20" + case NSF20FunctionKey: + return @"F20"; + // "F21" + case NSF21FunctionKey: + return @"F21"; + // "F22" + case NSF22FunctionKey: + return @"F22"; + // "F23" + case NSF23FunctionKey: + return @"F23"; + // "F24" + case NSF24FunctionKey: + return @"F24"; + + // "FinalMode" + + // "Find" + case NSFindFunctionKey: + return @"Find"; + + // "FullWidth" + // "HalfWidth" + // "HangulMode" + // "HanjaMode" + + // "Help" + case NSHelpFunctionKey: + return @"Help"; + + // "Hiragana" + + // "Home" + case NSHomeFunctionKey: + return @"Home"; + // "Insert" + case NSInsertFunctionKey: + return @"Insert"; + + // "JapaneseHiragana" + // "JapaneseKatakana" + // "JapaneseRomaji" + // "JunjaMode" + // "KanaMode" + // "KanjiMode" + // "Katakana" + // "LaunchApplication1" + // "LaunchApplication2" + // "LaunchMail" + + // "Left" + case NSLeftArrowFunctionKey: + return @"Left"; + + // "Meta" + // "MediaNextTrack" + // "MediaPlayPause" + // "MediaPreviousTrack" + // "MediaStop" + + // "ModeChange" + case NSModeSwitchFunctionKey: + return @"ModeChange"; + + // "Nonconvert" + // "NumLock" + + // "PageDown" + case NSPageDownFunctionKey: + return @"PageDown"; + // "PageUp" + case NSPageUpFunctionKey: + return @"PageUp"; + + // "Paste" + + // "Pause" + case NSPauseFunctionKey: + return @"Pause"; + + // "Play" + // "PreviousCandidate" + + // "PrintScreen" + case NSPrintScreenFunctionKey: + return @"PrintScreen"; + + // "Process" + // "Props" + + // "Right" + case NSRightArrowFunctionKey: + return @"Right"; + + // "RomanCharacters" + + // "Scroll" + case NSScrollLockFunctionKey: + return @"Scroll"; + // "Select" + case NSSelectFunctionKey: + return @"Select"; + + // "SelectMedia" + // "Shift" + + // "Stop" + case NSStopFunctionKey: + return @"Stop"; + // "Up" + case NSUpArrowFunctionKey: + return @"Up"; + // "Undo" + case NSUndoFunctionKey: + return @"Undo"; + + // "VolumeDown" + // "VolumeMute" + // "VolumeUp" + // "Win" + // "Zoom" + + // More function keys, not in the key identifier specification. + case NSF25FunctionKey: + return @"F25"; + case NSF26FunctionKey: + return @"F26"; + case NSF27FunctionKey: + return @"F27"; + case NSF28FunctionKey: + return @"F28"; + case NSF29FunctionKey: + return @"F29"; + case NSF30FunctionKey: + return @"F30"; + case NSF31FunctionKey: + return @"F31"; + case NSF32FunctionKey: + return @"F32"; + case NSF33FunctionKey: + return @"F33"; + case NSF34FunctionKey: + return @"F34"; + case NSF35FunctionKey: + return @"F35"; + + // Turn 0x7F into 0x08, because backspace needs to always be 0x08. + case 0x7F: + return @"U+0008"; + // Standard says that DEL becomes U+007F. + case NSDeleteFunctionKey: + return @"U+007F"; + + // Always use 0x09 for tab instead of AppKit's backtab character. + case NSBackTabCharacter: + return @"U+0009"; + + case NSBeginFunctionKey: + case NSBreakFunctionKey: + case NSClearDisplayFunctionKey: + case NSDeleteCharFunctionKey: + case NSDeleteLineFunctionKey: + case NSInsertCharFunctionKey: + case NSInsertLineFunctionKey: + case NSNextFunctionKey: + case NSPrevFunctionKey: + case NSPrintFunctionKey: + case NSRedoFunctionKey: + case NSResetFunctionKey: + case NSSysReqFunctionKey: + case NSSystemFunctionKey: + case NSUserFunctionKey: + // FIXME: We should use something other than the vendor-area Unicode values for the above keys. + // For now, just fall through to the default. + default: + return [NSString stringWithFormat:@"U+%04X", WTF::toASCIIUpper(c)]; + } +} + +// End Apple code. +// ---------------------------------------------------------------------------- + +static inline int modifiersFromEvent(NSEvent* event) { + int modifiers = 0; + + if ([event modifierFlags] & NSControlKeyMask) + modifiers |= WebInputEvent::ControlKey; + if ([event modifierFlags] & NSShiftKeyMask) + modifiers |= WebInputEvent::ShiftKey; + if ([event modifierFlags] & NSAlternateKeyMask) + modifiers |= WebInputEvent::AltKey; + if ([event modifierFlags] & NSCommandKeyMask) + modifiers |= WebInputEvent::MetaKey; + + return modifiers; +} + +WebKeyboardEvent WebInputEventFactory::keyboardEvent(NSEvent* event) +{ + WebKeyboardEvent result; + + result.type = + isKeyUpEvent(event) ? WebInputEvent::KeyUp : WebInputEvent::KeyDown; + + result.modifiers = modifiersFromEvent(event); + + if (isKeypadEvent(event)) + result.modifiers |= WebInputEvent::IsKeyPad; + + if (([event type] != NSFlagsChanged) && [event isARepeat]) + result.modifiers |= WebInputEvent::IsAutoRepeat; + + result.windowsKeyCode = windowsKeyCodeForKeyEvent(event); + result.nativeKeyCode = [event keyCode]; + + NSString* textStr = textFromEvent(event); + NSString* unmodifiedStr = unmodifiedTextFromEvent(event); + NSString* identifierStr = keyIdentifierForKeyEvent(event); + + // Begin Apple code, copied from KeyEventMac.mm + + // Always use 13 for Enter/Return -- we don't want to use AppKit's + // different character for Enter. + if (result.windowsKeyCode == '\r') { + textStr = @"\r"; + unmodifiedStr = @"\r"; + } + + // The adjustments below are only needed in backward compatibility mode, + // but we cannot tell what mode we are in from here. + + // Turn 0x7F into 8, because backspace needs to always be 8. + if ([textStr isEqualToString:@"\x7F"]) + textStr = @"\x8"; + if ([unmodifiedStr isEqualToString:@"\x7F"]) + unmodifiedStr = @"\x8"; + // Always use 9 for tab -- we don't want to use AppKit's different character + // for shift-tab. + if (result.windowsKeyCode == 9) { + textStr = @"\x9"; + unmodifiedStr = @"\x9"; + } + + // End Apple code. + + if ([textStr length] < WebKeyboardEvent::textLengthCap && + [unmodifiedStr length] < WebKeyboardEvent::textLengthCap) { + [textStr getCharacters:&result.text[0]]; + [unmodifiedStr getCharacters:&result.unmodifiedText[0]]; + } else + ASSERT_NOT_REACHED(); + + [identifierStr getCString:&result.keyIdentifier[0] + maxLength:sizeof(result.keyIdentifier) + encoding:NSASCIIStringEncoding]; + + return result; +} + +// WebMouseEvent -------------------------------------------------------------- + +WebMouseEvent WebInputEventFactory::mouseEvent(NSEvent* event, NSView* view) +{ + WebMouseEvent result; + + switch ([event type]) { + case NSMouseExited: + result.type = WebInputEvent::MouseLeave; + result.button = WebMouseEvent::ButtonNone; + break; + case NSLeftMouseDown: + result.type = [event clickCount] == 2 ? WebInputEvent::MouseDoubleClick + : WebInputEvent::MouseDown; + result.button = WebMouseEvent::ButtonLeft; + break; + case NSOtherMouseDown: + result.type = [event clickCount] == 2 ? WebInputEvent::MouseDoubleClick + : WebInputEvent::MouseDown; + result.button = WebMouseEvent::ButtonMiddle; + break; + case NSRightMouseDown: + result.type = [event clickCount] == 2 ? WebInputEvent::MouseDoubleClick + : WebInputEvent::MouseDown; + result.button = WebMouseEvent::ButtonRight; + break; + case NSLeftMouseUp: + result.type = WebInputEvent::MouseUp; + result.button = WebMouseEvent::ButtonLeft; + break; + case NSOtherMouseUp: + result.type = WebInputEvent::MouseUp; + result.button = WebMouseEvent::ButtonMiddle; + break; + case NSRightMouseUp: + result.type = WebInputEvent::MouseUp; + result.button = WebMouseEvent::ButtonRight; + break; + case NSMouseMoved: + case NSMouseEntered: + result.type = WebInputEvent::MouseMove; + break; + case NSLeftMouseDragged: + result.type = WebInputEvent::MouseMove; + result.button = WebMouseEvent::ButtonLeft; + break; + case NSOtherMouseDragged: + result.type = WebInputEvent::MouseMove; + result.button = WebMouseEvent::ButtonMiddle; + break; + case NSRightMouseDragged: + result.type = WebInputEvent::MouseMove; + result.button = WebMouseEvent::ButtonRight; + break; + default: + ASSERT_NOT_REACHED(); + } + + NSPoint location = [NSEvent mouseLocation]; // global coordinates + result.globalX = location.x; + result.globalY = location.y; + + NSPoint windowLocal = [event locationInWindow]; + location = [view convertPoint:windowLocal fromView:nil]; + result.y = [view frame].size.height - location.y; // flip y + result.x = location.x; + + result.modifiers = modifiersFromEvent(event); + + result.timeStampSeconds = [event timestamp]; + + return result; +} + +// WebMouseWheelEvent --------------------------------------------------------- + +WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(NSEvent* event, NSView* view) +{ + WebMouseWheelEvent result; + + result.type = WebInputEvent::MouseWheel; + result.button = WebMouseEvent::ButtonNone; + + result.modifiers = modifiersFromEvent(event); + + // Set coordinates by translating event coordinates from screen to client. + NSPoint location = [NSEvent mouseLocation]; // global coordinates + result.globalX = location.x; + result.globalY = location.y; + NSPoint windowLocal = [event locationInWindow]; + location = [view convertPoint:windowLocal fromView:nil]; + result.x = location.x; + result.y = [view frame].size.height - location.y; // flip y + + // Of Mice and Men + // --------------- + // + // There are three types of scroll data available on a scroll wheel CGEvent. + // Apple's documentation ([1]) is rather vague in their differences, and not + // terribly helpful in deciding which to use. This is what's really going on. + // + // First, these events behave very differently depending on whether a standard + // wheel mouse is used (one that scrolls in discrete units) or a + // trackpad/Mighty Mouse is used (which both provide continuous scrolling). + // You must check to see which was used for the event by testing the + // kCGScrollWheelEventIsContinuous field. + // + // Second, these events refer to "axes". Axis 1 is the y-axis, and axis 2 is + // the x-axis. + // + // Third, there is a concept of mouse acceleration. Scrolling the same amount + // of physical distance will give you different results logically depending on + // whether you scrolled a little at a time or in one continuous motion. Some + // fields account for this while others do not. + // + // Fourth, for trackpads there is a concept of chunkiness. When scrolling + // continuously, events can be delivered in chunks. That is to say, lots of + // scroll events with delta 0 will be delivered, and every so often an event + // with a non-zero delta will be delivered, containing the accumulated deltas + // from all the intermediate moves. [2] + // + // For notchy wheel mice (kCGScrollWheelEventIsContinuous == 0) + // ------------------------------------------------------------ + // + // kCGScrollWheelEventDeltaAxis* + // This is the rawest of raw events. For each mouse notch you get a value of + // +1/-1. This does not take acceleration into account and thus is less + // useful for building UIs. + // + // kCGScrollWheelEventPointDeltaAxis* + // This is smarter. In general, for each mouse notch you get a value of + // +1/-1, but this _does_ take acceleration into account, so you will get + // larger values on longer scrolls. This field would be ideal for building + // UIs except for one nasty bug: when the shift key is pressed, this set of + // fields fails to move the value into the axis2 field (the other two types + // of data do). This wouldn't be so bad except for the fact that while the + // number of axes is used in the creation of a CGScrollWheelEvent, there is + // no way to get that information out of the event once created. + // + // kCGScrollWheelEventFixedPtDeltaAxis* + // This is a fixed value, and for each mouse notch you get a value of + // +0.1/-0.1 (but, like above, scaled appropriately for acceleration). This + // value takes acceleration into account, and in fact is identical to the + // results you get from -[NSEvent delta*]. (That is, if you linked on Tiger + // or greater; see [2] for details.) + // + // A note about continuous devices + // ------------------------------- + // + // There are two devices that provide continuous scrolling events (trackpads + // and Mighty Mouses) and they behave rather differently. The Mighty Mouse + // behaves a lot like a regular mouse. There is no chunking, and the + // FixedPtDelta values are the PointDelta values multiplied by 0.1. With the + // trackpad, though, there is chunking. While the FixedPtDelta values are + // reasonable (they occur about every fifth event but have values five times + // larger than usual) the Delta values are unreasonable. They don't appear to + // accumulate properly. + // + // For continuous devices (kCGScrollWheelEventIsContinuous != 0) + // ------------------------------------------------------------- + // + // kCGScrollWheelEventDeltaAxis* + // This provides values with no acceleration. With a trackpad, these values + // are chunked but each non-zero value does not appear to be cumulative. + // This seems to be a bug. + // + // kCGScrollWheelEventPointDeltaAxis* + // This provides values with acceleration. With a trackpad, these values are + // not chunked and are highly accurate. + // + // kCGScrollWheelEventFixedPtDeltaAxis* + // This provides values with acceleration. With a trackpad, these values are + // chunked but unlike Delta events are properly cumulative. + // + // Summary + // ------- + // + // In general the best approach to take is: determine if the event is + // continuous. If it is not, then use the FixedPtDelta events (or just stick + // with Cocoa events). They provide both acceleration and proper horizontal + // scrolling. If the event is continuous, then doing pixel scrolling with the + // PointDelta is the way to go. In general, avoid the Delta events. They're + // the oldest (dating back to 10.4, before CGEvents were public) but they lack + // acceleration and precision, making them useful only in specific edge cases. + // + // References + // ---------- + // + // [1] <http://developer.apple.com/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html> + // [2] <http://developer.apple.com/releasenotes/Cocoa/AppKitOlderNotes.html> + // Scroll to the section headed "NSScrollWheel events". + // + // P.S. The "smooth scrolling" option in the system preferences is utterly + // unrelated to any of this. + + CGEventRef cgEvent = [event CGEvent]; + ASSERT(cgEvent); + + // Wheel ticks are supposed to be raw, unaccelerated values, one per physical + // mouse wheel notch. The delta event is perfect for this (being a good + // "specific edge case" as mentioned above). For trackpads, unfortunately, we + // don't have anything better. + + result.wheelTicksY = + CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventDeltaAxis1); + result.wheelTicksX = + CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventDeltaAxis2); + + if (CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventIsContinuous)) { + result.deltaY = + CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis1); + result.deltaX = + CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis2); + } else { + // Convert wheel delta amount to a number of pixels to scroll. + static const double scrollbarPixelsPerCocoaTick = 40.0; + + result.deltaX = [event deltaX] * scrollbarPixelsPerCocoaTick; + result.deltaY = [event deltaY] * scrollbarPixelsPerCocoaTick; + } + + return result; +} + +} // namespace WebKit diff --git a/webkit/api/src/mac/WebScreenInfoFactory.mm b/webkit/api/src/mac/WebScreenInfoFactory.mm new file mode 100644 index 0000000..2805f7a --- /dev/null +++ b/webkit/api/src/mac/WebScreenInfoFactory.mm @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebScreenInfoFactory.h" + +#import <AppKit/AppKit.h> + +#include "WebScreenInfo.h" + +namespace WebKit { + +static NSScreen* screenForWindow(NSWindow* window) +{ + NSScreen* screen = [window screen]; // nil if the window is off-screen + if (screen) + return screen; + + NSArray* screens = [NSScreen screens]; + if ([screens count] > 0) + return [screens objectAtIndex:0]; // screen containing the menubar + + return nil; +} + +static WebRect toUserSpace(const NSRect& rect, NSWindow* destination) +{ + CGRect userRect = NSRectToCGRect(rect); + + userRect.origin.y = + NSMaxY([screenForWindow(destination) frame]) - (userRect.origin.y + userRect.size.height); // flip + + if (destination) { + CGFloat scale = 1 / [destination userSpaceScaleFactor]; // scale down + userRect.origin.x *= scale; + userRect.origin.y *= scale; + userRect.size.width *= scale; + userRect.size.height *= scale; + } + + return WebRect(userRect.origin.x, + userRect.origin.y, + userRect.size.width, + userRect.size.height); +} + +WebScreenInfo WebScreenInfoFactory::screenInfo(NSView* view) +{ + NSString *colorSpace = NSColorSpaceFromDepth([[NSScreen deepestScreen] depth]); + + WebScreenInfo results; + results.depth = + NSBitsPerPixelFromDepth([[NSScreen deepestScreen] depth]); + results.depthPerComponent = + NSBitsPerSampleFromDepth([[NSScreen deepestScreen] depth]); + results.isMonochrome = colorSpace == NSCalibratedWhiteColorSpace + || colorSpace == NSCalibratedBlackColorSpace + || colorSpace == NSDeviceWhiteColorSpace + || colorSpace == NSDeviceBlackColorSpace; + results.rect = + toUserSpace([screenForWindow([view window]) frame], [view window]); + results.availableRect = + toUserSpace([screenForWindow([view window]) visibleFrame], [view window]); + return results; +} + +} // namespace WebKit diff --git a/webkit/api/src/win/WebInputEventFactory.cpp b/webkit/api/src/win/WebInputEventFactory.cpp new file mode 100644 index 0000000..e5bc34c --- /dev/null +++ b/webkit/api/src/win/WebInputEventFactory.cpp @@ -0,0 +1,369 @@ +/* + * Copyright (C) 2006-2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebInputEventFactory.h" + +#include "WebInputEvent.h" + +#include <wtf/Assertions.h> + +namespace WebKit { + +static const unsigned long defaultScrollLinesPerWheelDelta = 3; +static const unsigned long defaultScrollCharsPerWheelDelta = 1; + +// WebKeyboardEvent ----------------------------------------------------------- + +static bool isKeyPad(WPARAM wparam, LPARAM lparam) +{ + bool keypad = false; + switch (wparam) { + case VK_RETURN: + keypad = (lparam >> 16) & KF_EXTENDED; + break; + case VK_INSERT: + case VK_DELETE: + case VK_HOME: + case VK_END: + case VK_PRIOR: + case VK_NEXT: + case VK_UP: + case VK_DOWN: + case VK_LEFT: + case VK_RIGHT: + keypad = !((lparam >> 16) & KF_EXTENDED); + break; + case VK_NUMLOCK: + case VK_NUMPAD0: + case VK_NUMPAD1: + case VK_NUMPAD2: + case VK_NUMPAD3: + case VK_NUMPAD4: + case VK_NUMPAD5: + case VK_NUMPAD6: + case VK_NUMPAD7: + case VK_NUMPAD8: + case VK_NUMPAD9: + case VK_DIVIDE: + case VK_MULTIPLY: + case VK_SUBTRACT: + case VK_ADD: + case VK_DECIMAL: + case VK_CLEAR: + keypad = true; + break; + default: + keypad = false; + } + return keypad; +} + +WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message, + WPARAM wparam, LPARAM lparam) +{ + WebKeyboardEvent result; + + result.windowsKeyCode = result.nativeKeyCode = static_cast<int>(wparam); + + switch (message) { + case WM_SYSKEYDOWN: + result.isSystemKey = true; + case WM_KEYDOWN: + result.type = WebInputEvent::RawKeyDown; + break; + case WM_SYSKEYUP: + result.isSystemKey = true; + case WM_KEYUP: + result.type = WebInputEvent::KeyUp; + break; + case WM_IME_CHAR: + result.type = WebInputEvent::Char; + break; + case WM_SYSCHAR: + result.isSystemKey = true; + result.type = WebInputEvent::Char; + case WM_CHAR: + result.type = WebInputEvent::Char; + break; + default: + ASSERT_NOT_REACHED(); + } + + if (result.type == WebInputEvent::Char || result.type == WebInputEvent::RawKeyDown) { + result.text[0] = result.windowsKeyCode; + result.unmodifiedText[0] = result.windowsKeyCode; + } + if (result.type != WebInputEvent::Char) + result.setKeyIdentifierFromWindowsKeyCode(); + + if (GetKeyState(VK_SHIFT) & 0x8000) + result.modifiers |= WebInputEvent::ShiftKey; + if (GetKeyState(VK_CONTROL) & 0x8000) + result.modifiers |= WebInputEvent::ControlKey; + if (GetKeyState(VK_MENU) & 0x8000) + result.modifiers |= (WebInputEvent::AltKey | WebInputEvent::MetaKey); + + if (LOWORD(lparam) > 1) + result.modifiers |= WebInputEvent::IsAutoRepeat; + if (isKeyPad(wparam, lparam)) + result.modifiers |= WebInputEvent::IsKeyPad; + + return result; +} + +// WebMouseEvent -------------------------------------------------------------- + +static LPARAM GetRelativeCursorPos(HWND hwnd) +{ + POINT pos = {-1, -1}; + GetCursorPos(&pos); + ScreenToClient(hwnd, &pos); + return MAKELPARAM(pos.x, pos.y); +} + +WebMouseEvent WebInputEventFactory::mouseEvent(HWND hwnd, UINT message, + WPARAM wparam, LPARAM lparam) +{ + WebMouseEvent result; //(WebInputEvent::Uninitialized()); + + switch (message) { + case WM_MOUSEMOVE: + result.type = WebInputEvent::MouseMove; + if (wparam & MK_LBUTTON) + result.button = WebMouseEvent::ButtonLeft; + else if (wparam & MK_MBUTTON) + result.button = WebMouseEvent::ButtonMiddle; + else if (wparam & MK_RBUTTON) + result.button = WebMouseEvent::ButtonMiddle; + else + result.button = WebMouseEvent::ButtonNone; + break; + case WM_MOUSELEAVE: + result.type = WebInputEvent::MouseLeave; + result.button = WebMouseEvent::ButtonNone; + // set the current mouse position (relative to the client area of the + // current window) since none is specified for this event + lparam = GetRelativeCursorPos(hwnd); + break; + case WM_LBUTTONDOWN: + result.type = WebInputEvent::MouseDown; + result.button = WebMouseEvent::ButtonLeft; + break; + case WM_MBUTTONDOWN: + result.type = WebInputEvent::MouseDown; + result.button = WebMouseEvent::ButtonMiddle; + break; + case WM_RBUTTONDOWN: + result.type = WebInputEvent::MouseDown; + result.button = WebMouseEvent::ButtonRight; + break; + case WM_LBUTTONUP: + result.type = WebInputEvent::MouseUp; + result.button = WebMouseEvent::ButtonLeft; + break; + case WM_MBUTTONUP: + result.type = WebInputEvent::MouseUp; + result.button = WebMouseEvent::ButtonMiddle; + break; + case WM_RBUTTONUP: + result.type = WebInputEvent::MouseUp; + result.button = WebMouseEvent::ButtonRight; + break; + case WM_LBUTTONDBLCLK: + result.type = WebInputEvent::MouseDoubleClick; + result.button = WebMouseEvent::ButtonLeft; + break; + case WM_MBUTTONDBLCLK: + result.type = WebInputEvent::MouseDoubleClick; + result.button = WebMouseEvent::ButtonMiddle; + break; + case WM_RBUTTONDBLCLK: + result.type = WebInputEvent::MouseDoubleClick; + result.button = WebMouseEvent::ButtonRight; + break; + default: + ASSERT_NOT_REACHED(); + } + + // set position fields: + + result.x = static_cast<short>(LOWORD(lparam)); + result.y = static_cast<short>(HIWORD(lparam)); + + POINT globalPoint = { result.x, result.y }; + ClientToScreen(hwnd, &globalPoint); + + result.globalX = globalPoint.x; + result.globalY = globalPoint.y; + + // set modifiers: + + if (wparam & MK_CONTROL) + result.modifiers |= WebInputEvent::ControlKey; + if (wparam & MK_SHIFT) + result.modifiers |= WebInputEvent::ShiftKey; + if (GetKeyState(VK_MENU) & 0x8000) + result.modifiers |= (WebInputEvent::AltKey | WebInputEvent::MetaKey); // FIXME: set META properly + + // TODO(pkasting): http://b/1117926 Instead of using GetTickCount() here, we + // should use GetMessageTime() on the original Windows message in the browser + // process, and pass that in the WebMouseEvent. + result.timeStampSeconds = GetTickCount() / 1000.0; + + return result; +} + +// WebMouseWheelEvent --------------------------------------------------------- + +WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(HWND hwnd, UINT message, + WPARAM wparam, LPARAM lparam) +{ + WebMouseWheelEvent result; //(WebInputEvent::Uninitialized()); + + result.type = WebInputEvent::MouseWheel; + result.button = WebMouseEvent::ButtonNone; + + // Get key state, coordinates, and wheel delta from event. + typedef SHORT (WINAPI *GetKeyStateFunction)(int key); + GetKeyStateFunction getKeyState; + UINT keyState; + float wheelDelta; + bool horizontalScroll = false; + if ((message == WM_VSCROLL) || (message == WM_HSCROLL)) { + // Synthesize mousewheel event from a scroll event. This is needed to + // simulate middle mouse scrolling in some laptops. Use GetAsyncKeyState + // for key state since we are synthesizing the input event. + getKeyState = GetAsyncKeyState; + keyState = 0; + if (getKeyState(VK_SHIFT)) + keyState |= MK_SHIFT; + if (getKeyState(VK_CONTROL)) + keyState |= MK_CONTROL; + + POINT cursorPosition = {0}; + GetCursorPos(&cursorPosition); + result.globalX = cursorPosition.x; + result.globalY = cursorPosition.y; + + switch (LOWORD(wparam)) { + case SB_LINEUP: // == SB_LINELEFT + wheelDelta = WHEEL_DELTA; + break; + case SB_LINEDOWN: // == SB_LINERIGHT + wheelDelta = -WHEEL_DELTA; + break; + case SB_PAGEUP: + wheelDelta = 1; + result.scrollByPage = true; + break; + case SB_PAGEDOWN: + wheelDelta = -1; + result.scrollByPage = true; + break; + default: // We don't supoprt SB_THUMBPOSITION or SB_THUMBTRACK here. + wheelDelta = 0; + break; + } + + if (message == WM_HSCROLL) + horizontalScroll = true; + } else { + // Non-synthesized event; we can just read data off the event. + getKeyState = GetKeyState; + keyState = GET_KEYSTATE_WPARAM(wparam); + + result.globalX = static_cast<short>(LOWORD(lparam)); + result.globalY = static_cast<short>(HIWORD(lparam)); + + wheelDelta = static_cast<float>(GET_WHEEL_DELTA_WPARAM(wparam)); + if (message == WM_MOUSEHWHEEL) { + horizontalScroll = true; + wheelDelta = -wheelDelta; // Windows is <- -/+ ->, WebKit <- +/- ->. + } + } + if (keyState & MK_SHIFT) + horizontalScroll = true; + + // Set modifiers based on key state. + if (keyState & MK_SHIFT) + result.modifiers |= WebInputEvent::ShiftKey; + if (keyState & MK_CONTROL) + result.modifiers |= WebInputEvent::ControlKey; + if (getKeyState(VK_MENU) & 0x8000) + result.modifiers |= (WebInputEvent::AltKey | WebInputEvent::MetaKey); + + // Set coordinates by translating event coordinates from screen to client. + POINT clientPoint = { result.globalX, result.globalY }; + MapWindowPoints(NULL, hwnd, &clientPoint, 1); + result.x = clientPoint.x; + result.y = clientPoint.y; + + // Convert wheel delta amount to a number of pixels to scroll. + // + // How many pixels should we scroll per line? Gecko uses the height of the + // current line, which means scroll distance changes as you go through the + // page or go to different pages. IE 7 is ~50 px/line, although the value + // seems to vary slightly by page and zoom level. Since IE 7 has a smoothing + // algorithm on scrolling, it can get away with slightly larger scroll values + // without feeling jerky. Here we use 100 px per three lines (the default + // scroll amount is three lines per wheel tick). + static const float scrollbarPixelsPerLine = 100.0f / 3.0f; + wheelDelta /= WHEEL_DELTA; + float scrollDelta = wheelDelta; + if (horizontalScroll) { + unsigned long scrollChars = defaultScrollCharsPerWheelDelta; + SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &scrollChars, 0); + // TODO(pkasting): Should probably have a different multiplier + // scrollbarPixelsPerChar here. + scrollDelta *= static_cast<float>(scrollChars) * scrollbarPixelsPerLine; + } else { + unsigned long scrollLines = defaultScrollLinesPerWheelDelta; + SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0); + if (scrollLines == WHEEL_PAGESCROLL) + result.scrollByPage = true; + if (!result.scrollByPage) + scrollDelta *= static_cast<float>(scrollLines) * scrollbarPixelsPerLine; + } + + // Set scroll amount based on above calculations. WebKit expects positive + // deltaY to mean "scroll up" and positive deltaX to mean "scroll left". + if (horizontalScroll) { + result.deltaX = scrollDelta; + result.wheelTicksX = wheelDelta; + } else { + result.deltaY = scrollDelta; + result.wheelTicksY = wheelDelta; + } + + return result; +} + +} // namespace WebKit diff --git a/webkit/api/src/win/WebScreenInfoFactory.cpp b/webkit/api/src/win/WebScreenInfoFactory.cpp new file mode 100644 index 0000000..43cb447 --- /dev/null +++ b/webkit/api/src/win/WebScreenInfoFactory.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebScreenInfoFactory.h" + +#include <windows.h> + +#include "WebScreenInfo.h" + +namespace WebKit { + +static WebRect toWebRect(const RECT& input) +{ + WebRect output; + output.x = input.left; + output.y = input.top; + output.width = input.right - input.left; + output.height = input.bottom - input.top; + return output; +} + +WebScreenInfo WebScreenInfoFactory::screenInfo(HWND window) +{ + HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY); + + MONITORINFOEX monitorInfo; + monitorInfo.cbSize = sizeof(MONITORINFOEX); + GetMonitorInfo(monitor, &monitorInfo); + + DEVMODE devMode; + devMode.dmSize = sizeof(devMode); + devMode.dmDriverExtra = 0; + EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &devMode); + + WebScreenInfo results; + results.depth = devMode.dmBitsPerPel; + results.depthPerComponent = devMode.dmBitsPerPel / 3; // Assumes RGB + results.isMonochrome = devMode.dmColor == DMCOLOR_MONOCHROME; + results.rect = toWebRect(monitorInfo.rcMonitor); + results.availableRect = toWebRect(monitorInfo.rcWork); + return results; +} + +} // namespace WebKit diff --git a/webkit/api/src/x11/WebScreenInfoFactory.cpp b/webkit/api/src/x11/WebScreenInfoFactory.cpp new file mode 100644 index 0000000..35af6fa --- /dev/null +++ b/webkit/api/src/x11/WebScreenInfoFactory.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebScreenInfoFactory.h" + +#include <X11/Xlib.h> + +#include "WebScreenInfo.h" + +namespace WebKit { + +WebScreenInfo WebScreenInfoFactory::screenInfo(Display* display, int screenNumber) +{ + WebScreenInfo results; + // FIXME: not all screens with use 8bpp. + results.depthPerComponent = 8; + + int displayWidth = XDisplayWidth(display, screenNumber); + int displayHeight = XDisplayHeight(display, screenNumber); + results.depth = XDisplayPlanes(display, screenNumber); + results.isMonochrome = results.depth == 1; + + results.rect = WebRect(0, 0, displayWidth, displayHeight); + + // I don't know of a way to query the "maximize" size of the window (e.g. + // screen size less sidebars etc) since this is something which only the + // window manager knows. + results.availableRect = results.rect; + + return results; +} + +} // namespace WebKit diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index e410805..b235d35 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -32,8 +32,8 @@ MSVC_POP_WARNING(); #include "base/logging.h" #include "base/gfx/rect.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" +#include "webkit/api/public/WebInputEvent.h" +#include "webkit/api/public/WebKit.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webdevtoolsagent_impl.h" #include "webkit/glue/webframe_impl.h" diff --git a/webkit/glue/chromium_bridge_impl.cc b/webkit/glue/chromium_bridge_impl.cc index 471a342..b5a4a97 100644 --- a/webkit/glue/chromium_bridge_impl.cc +++ b/webkit/glue/chromium_bridge_impl.cc @@ -31,7 +31,7 @@ #include "build/build_config.h" #include "googleurl/src/url_util.h" #include "skia/ext/skia_utils_win.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "webkit/api/public/WebScreenInfo.h" #include "webkit/glue/chrome_client_impl.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/plugins/plugin_instance.h" diff --git a/webkit/glue/dragclient_impl.cc b/webkit/glue/dragclient_impl.cc index 6547e27..6199fed 100644 --- a/webkit/glue/dragclient_impl.cc +++ b/webkit/glue/dragclient_impl.cc @@ -20,7 +20,7 @@ MSVC_POP_WARNING(); #include "base/logging.h" #include "base/string_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" +#include "webkit/api/public/WebDragData.h" #include "webkit/glue/context_menu.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webdropdata.h" diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index 6f952b6..c64a3cf 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -26,7 +26,7 @@ #undef LOG #include "base/message_loop.h" #include "base/string_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" +#include "webkit/api/public/WebKit.h" #include "webkit/glue/autofill_form.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/editor_client_impl.h" diff --git a/webkit/glue/event_conversion.cc b/webkit/glue/event_conversion.cc index 229df85..6014107 100644 --- a/webkit/glue/event_conversion.cc +++ b/webkit/glue/event_conversion.cc @@ -15,8 +15,8 @@ #undef LOG #include "base/gfx/point.h" #include "base/logging.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" +#include "webkit/api/public/WebInputEvent.h" +#include "webkit/api/public/WebKit.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webkit_glue.h" diff --git a/webkit/glue/glue_util.cc b/webkit/glue/glue_util.cc index 1ab7b16..5f7228f 100644 --- a/webkit/glue/glue_util.cc +++ b/webkit/glue/glue_util.cc @@ -3,11 +3,11 @@ // found in the LICENSE file. // TODO(darin): This file will be deleted once we complete the move to -// third_party/WebKit/WebKit/chromium +// webkit/api // In this file, we pretend to be part of the WebKit implementation. // This is just a temporary hack while glue is still being moved into -// third_party/WebKit/WebKit/chromium. +// webkit/api. #define WEBKIT_IMPLEMENTATION 1 #include "config.h" @@ -29,12 +29,12 @@ #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/api/public/WebDragData.h" +#include "webkit/api/public/WebPoint.h" +#include "webkit/api/public/WebRect.h" +#include "webkit/api/public/WebSize.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" namespace webkit_glue { diff --git a/webkit/glue/inspector_client_impl.cc b/webkit/glue/inspector_client_impl.cc index 1ddae85..6fd7b88 100644 --- a/webkit/glue/inspector_client_impl.cc +++ b/webkit/glue/inspector_client_impl.cc @@ -17,7 +17,7 @@ MSVC_POP_WARNING(); #undef LOG #include "base/logging.h" #include "base/gfx/rect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "webkit/api/public/WebRect.h" #include "webkit/glue/inspector_client_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/weburlrequest.h" diff --git a/webkit/glue/simple_webmimeregistry_impl.cc b/webkit/glue/simple_webmimeregistry_impl.cc index 4a2fd8c..d678c1b 100644 --- a/webkit/glue/simple_webmimeregistry_impl.cc +++ b/webkit/glue/simple_webmimeregistry_impl.cc @@ -7,7 +7,7 @@ #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "net/base/mime_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "webkit/api/public/WebString.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webkit_glue.h" diff --git a/webkit/glue/simple_webmimeregistry_impl.h b/webkit/glue/simple_webmimeregistry_impl.h index 4857c8f..7d5140b 100644 --- a/webkit/glue/simple_webmimeregistry_impl.h +++ b/webkit/glue/simple_webmimeregistry_impl.h @@ -5,7 +5,7 @@ #ifndef WEBMIMEREGISTRY_IMPL_H_ #define WEBMIMEREGISTRY_IMPL_H_ -#include "third_party/WebKit/WebKit/chromium/public/WebMimeRegistry.h" +#include "webkit/api/public/WebMimeRegistry.h" namespace webkit_glue { diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc index a95f7e8..dd96dca 100644 --- a/webkit/glue/webclipboard_impl.cc +++ b/webkit/glue/webclipboard_impl.cc @@ -9,9 +9,9 @@ #include "base/string_util.h" #include "googleurl/src/gurl.h" #include "net/base/escape.h" -#include "third_party/WebKit/WebKit/chromium/public/WebImage.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/api/public/WebImage.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/glue/webkit_glue.h" diff --git a/webkit/glue/webclipboard_impl.h b/webkit/glue/webclipboard_impl.h index f5b7b50..0813d1d 100644 --- a/webkit/glue/webclipboard_impl.h +++ b/webkit/glue/webclipboard_impl.h @@ -5,7 +5,7 @@ #ifndef WEBCLIPBOARD_IMPL_H_ #define WEBCLIPBOARD_IMPL_H_ -#include "third_party/WebKit/WebKit/chromium/public/WebClipboard.h" +#include "webkit/api/public/WebClipboard.h" #include <string> diff --git a/webkit/glue/webdevtoolsclient_impl.cc b/webkit/glue/webdevtoolsclient_impl.cc index f9d4052..d887022 100644 --- a/webkit/glue/webdevtoolsclient_impl.cc +++ b/webkit/glue/webdevtoolsclient_impl.cc @@ -24,7 +24,7 @@ #include "v8_utility.h" #include "base/string_util.h" #include "base/values.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" +#include "webkit/api/public/WebScriptSource.h" #include "webkit/glue/devtools/debugger_agent.h" #include "webkit/glue/devtools/devtools_rpc_js.h" #include "webkit/glue/devtools/dom_agent.h" diff --git a/webkit/glue/webdropdata.cc b/webkit/glue/webdropdata.cc index b48c04c..8314477 100644 --- a/webkit/glue/webdropdata.cc +++ b/webkit/glue/webdropdata.cc @@ -4,11 +4,11 @@ #include "webkit/glue/webdropdata.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "webkit/api/public/WebData.h" +#include "webkit/api/public/WebDragData.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebVector.h" using WebKit::WebData; using WebKit::WebDragData; diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index a56f43f..466fe5f 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -136,11 +136,11 @@ MSVC_POP_WARNING(); #include "net/base/net_errors.h" #include "skia/ext/bitmap_platform_device.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "webkit/api/public/WebConsoleMessage.h" +#include "webkit/api/public/WebFindOptions.h" +#include "webkit/api/public/WebRect.h" +#include "webkit/api/public/WebScriptSource.h" +#include "webkit/api/public/WebSize.h" #include "webkit/glue/alt_error_page_resource_fetcher.h" #include "webkit/glue/chrome_client_impl.h" #include "webkit/glue/dom_operations.h" diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 2553716..5a6ca45 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -35,7 +35,7 @@ #include "base/sys_info.h" #include "base/sys_string_conversions.h" #include "skia/include/SkBitmap.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "webkit/api/public/WebString.h" #include "webkit/glue/event_conversion.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/weburlrequest_impl.h" diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc index cdf4191..7833fa2 100644 --- a/webkit/glue/webkitclient_impl.cc +++ b/webkit/glue/webkitclient_impl.cc @@ -9,9 +9,9 @@ #include "base/string_util.h" #include "base/trace_event.h" #include "grit/webkit_resources.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPluginListBuilder.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "webkit/api/public/WebData.h" +#include "webkit/api/public/WebPluginListBuilder.h" +#include "webkit/api/public/WebString.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webplugininfo.h" diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h index 1fb7c8e..d820ee8 100644 --- a/webkit/glue/webkitclient_impl.h +++ b/webkit/glue/webkitclient_impl.h @@ -6,7 +6,7 @@ #define WEBKIT_CLIENT_IMPL_H_ #include "base/timer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" +#include "webkit/api/public/WebKitClient.h" #if defined(OS_WIN) #include "webkit/glue/webthemeengine_impl_win.h" #endif diff --git a/webkit/glue/webmediaplayerclient_impl.cc b/webkit/glue/webmediaplayerclient_impl.cc index 8fec5f4..78d7f58 100644 --- a/webkit/glue/webmediaplayerclient_impl.cc +++ b/webkit/glue/webmediaplayerclient_impl.cc @@ -7,15 +7,15 @@ #if ENABLE(VIDEO) -#include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayer.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/api/public/WebCanvas.h" +#include "webkit/api/public/WebCString.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebKitClient.h" +#include "webkit/api/public/WebMediaPlayer.h" +#include "webkit/api/public/WebRect.h" +#include "webkit/api/public/WebSize.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webframe_impl.h" #include "webkit/glue/webview.h" diff --git a/webkit/glue/webmediaplayerclient_impl.h b/webkit/glue/webmediaplayerclient_impl.h index 5bbe9a3..0081955 100644 --- a/webkit/glue/webmediaplayerclient_impl.h +++ b/webkit/glue/webmediaplayerclient_impl.h @@ -7,7 +7,7 @@ #if ENABLE(VIDEO) -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerClient.h" +#include "webkit/api/public/WebMediaPlayerClient.h" #include "MediaPlayerPrivate.h" diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index 0ed9188..f3511f6 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -47,10 +47,10 @@ #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "net/base/escape.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebKitClient.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" #include "webkit/glue/chrome_client_impl.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/multipart_response_delegate.h" diff --git a/webkit/glue/webthemeengine_impl_win.cc b/webkit/glue/webthemeengine_impl_win.cc index dd775b0..85de8cb 100644 --- a/webkit/glue/webthemeengine_impl_win.cc +++ b/webkit/glue/webthemeengine_impl_win.cc @@ -7,7 +7,7 @@ #include "base/gfx/native_theme.h" #include "skia/ext/platform_canvas.h" #include "skia/ext/skia_utils_win.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "webkit/api/public/WebRect.h" using WebKit::WebCanvas; using WebKit::WebColor; diff --git a/webkit/glue/webthemeengine_impl_win.h b/webkit/glue/webthemeengine_impl_win.h index 866e7b8..9d24def 100644 --- a/webkit/glue/webthemeengine_impl_win.h +++ b/webkit/glue/webthemeengine_impl_win.h @@ -5,7 +5,7 @@ #ifndef WEBTHEMEENGINE_IMPL_WIN_H_ #define WEBTHEMEENGINE_IMPL_WIN_H_ -#include "third_party/WebKit/WebKit/chromium/public/win/WebThemeEngine.h" +#include "webkit/api/public/win/WebThemeEngine.h" namespace webkit_glue { diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index a5f4835..06a6b7e 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -84,9 +84,9 @@ MSVC_POP_WARNING(); #include "base/logging.h" #include "base/message_loop.h" #include "base/string_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" +#include "webkit/api/public/WebDragData.h" +#include "webkit/api/public/WebInputEvent.h" +#include "webkit/api/public/WebPoint.h" #include "webkit/glue/chrome_client_impl.h" #include "webkit/glue/context_menu_client_impl.h" #include "webkit/glue/dom_operations.h" diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 15915b0..ae26890 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -10,8 +10,8 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "webkit/api/public/WebPoint.h" +#include "webkit/api/public/WebSize.h" #include "webkit/glue/back_forward_list_client_impl.h" #include "webkit/glue/webframe_impl.h" #include "webkit/glue/webpreferences.h" diff --git a/webkit/glue/webwidget_impl.cc b/webkit/glue/webwidget_impl.cc index cb3ea2c..3fd60c5 100644 --- a/webkit/glue/webwidget_impl.cc +++ b/webkit/glue/webwidget_impl.cc @@ -21,7 +21,7 @@ MSVC_POP_WARNING(); #undef LOG #include "base/logging.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" +#include "webkit/api/public/WebInputEvent.h" #include "webkit/glue/event_conversion.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webwidget_delegate.h" diff --git a/webkit/glue/webwidget_impl.h b/webkit/glue/webwidget_impl.h index 1047673..0ff7b2f 100644 --- a/webkit/glue/webwidget_impl.h +++ b/webkit/glue/webwidget_impl.h @@ -9,9 +9,9 @@ #include "base/compiler_specific.h" #include "base/ref_counted.h" #include "base/gfx/native_widget_types.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "webkit/api/public/WebPoint.h" +#include "webkit/api/public/WebRect.h" +#include "webkit/api/public/WebSize.h" #include "webkit/glue/webwidget.h" #include "FramelessScrollViewClient.h" diff --git a/webkit/glue/webworker_impl.cc b/webkit/glue/webworker_impl.cc index ba78c7d..a4977dc 100644 --- a/webkit/glue/webworker_impl.cc +++ b/webkit/glue/webworker_impl.cc @@ -18,11 +18,11 @@ #undef LOG #include "base/logging.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" +#include "webkit/api/public/WebWorkerClient.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webworker_impl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" -#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h" using WebKit::WebWorker; using WebKit::WebWorkerClient; diff --git a/webkit/glue/webworker_impl.h b/webkit/glue/webworker_impl.h index bfdd26a..f1c6910 100644 --- a/webkit/glue/webworker_impl.h +++ b/webkit/glue/webworker_impl.h @@ -5,7 +5,7 @@ #ifndef WEBKIT_GLUE_WEBWORKER_IMPL_H_ #define WEBKIT_GLUE_WEBWORKER_IMPL_H_ -#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h" +#include "webkit/api/public/WebWorker.h" #if ENABLE(WORKERS) diff --git a/webkit/glue/webworkerclient_impl.cc b/webkit/glue/webworkerclient_impl.cc index aed714d..cc751d9 100644 --- a/webkit/glue/webworkerclient_impl.cc +++ b/webkit/glue/webworkerclient_impl.cc @@ -21,20 +21,16 @@ #include "webkit/glue/webworkerclient_impl.h" #include "base/command_line.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebKitClient.h" +#include "webkit/api/public/WebWorker.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/webframeloaderclient_impl.h" #include "webkit/glue/webframe_impl.h" #include "webkit/glue/webview_delegate.h" #include "webkit/glue/webview_impl.h" #include "webkit/glue/webworker_impl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" -#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h" -using WebKit::WebConsoleMessage; -using WebKit::WebScriptSource; using WebKit::WebString; using WebKit::WebWorker; using WebKit::WebWorkerClient; diff --git a/webkit/glue/webworkerclient_impl.h b/webkit/glue/webworkerclient_impl.h index 4e3f4ae..685eac9 100644 --- a/webkit/glue/webworkerclient_impl.h +++ b/webkit/glue/webworkerclient_impl.h @@ -7,7 +7,7 @@ #if ENABLE(WORKERS) -#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h" +#include "webkit/api/public/WebWorkerClient.h" #include "WorkerContextProxy.h" #include <wtf/RefPtr.h> diff --git a/webkit/tools/test_shell/drag_delegate.cc b/webkit/tools/test_shell/drag_delegate.cc index 1759a68..f3532ad 100644 --- a/webkit/tools/test_shell/drag_delegate.cc +++ b/webkit/tools/test_shell/drag_delegate.cc @@ -6,7 +6,7 @@ #include <atltypes.h> -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" +#include "webkit/api/public/WebPoint.h" #include "webkit/glue/webview.h" using WebKit::WebPoint; diff --git a/webkit/tools/test_shell/drop_delegate.cc b/webkit/tools/test_shell/drop_delegate.cc index fed2514..41b4767 100644 --- a/webkit/tools/test_shell/drop_delegate.cc +++ b/webkit/tools/test_shell/drop_delegate.cc @@ -4,8 +4,8 @@ #include "webkit/tools/test_shell/drop_delegate.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" +#include "webkit/api/public/WebDragData.h" +#include "webkit/api/public/WebPoint.h" #include "webkit/glue/webdropdata.h" #include "webkit/glue/webview.h" diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc index 0fce5e1..9e88f88 100644 --- a/webkit/tools/test_shell/event_sending_controller.cc +++ b/webkit/tools/test_shell/event_sending_controller.cc @@ -28,13 +28,13 @@ #include "base/message_loop.h" #include "base/string_util.h" #include "base/time.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" +#include "webkit/api/public/WebDragData.h" +#include "webkit/api/public/WebPoint.h" #include "webkit/glue/webview.h" #include "webkit/tools/test_shell/test_shell.h" #if defined(OS_WIN) -#include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h" +#include "webkit/api/public/win/WebInputEventFactory.h" using WebKit::WebInputEventFactory; #endif diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h index 1571c68..353c411 100644 --- a/webkit/tools/test_shell/event_sending_controller.h +++ b/webkit/tools/test_shell/event_sending_controller.h @@ -19,7 +19,7 @@ #include "build/build_config.h" #include "base/gfx/point.h" #include "base/task.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" +#include "webkit/api/public/WebInputEvent.h" #include "webkit/glue/cpp_bound_class.h" class TestShell; diff --git a/webkit/tools/test_shell/keyboard_unittest.cc b/webkit/tools/test_shell/keyboard_unittest.cc index 713739b..10f9e741 100644 --- a/webkit/tools/test_shell/keyboard_unittest.cc +++ b/webkit/tools/test_shell/keyboard_unittest.cc @@ -18,7 +18,7 @@ MSVC_POP_WARNING(); #include "webkit/glue/editor_client_impl.h" #include "webkit/glue/event_conversion.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" +#include "webkit/api/public/WebInputEvent.h" using WebCore::PlatformKeyboardEvent; using WebCore::KeyboardEvent; diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 77192d5..f82f187 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -14,7 +14,7 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "base/string_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" +#include "webkit/api/public/WebScriptSource.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/webframe.h" #include "webkit/glue/webpreferences.h" diff --git a/webkit/tools/test_shell/mock_webclipboard_impl.cc b/webkit/tools/test_shell/mock_webclipboard_impl.cc index 305eabf..5f372f9 100644 --- a/webkit/tools/test_shell/mock_webclipboard_impl.cc +++ b/webkit/tools/test_shell/mock_webclipboard_impl.cc @@ -8,15 +8,15 @@ #include "base/logging.h" #include "base/string_util.h" #include "net/base/escape.h" -#include "third_party/WebKit/WebKit/chromium/public/WebImage.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/api/public/WebImage.h" +#include "webkit/api/public/WebURL.h" #include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webkit_glue.h" using WebKit::WebString; using WebKit::WebURL; -bool MockWebClipboardImpl::isFormatAvailable(Format format) { +bool MockWebClipboardImpl::isFormatAvailable(Format format) { switch (format) { case FormatHTML: return !m_htmlText.isEmpty(); diff --git a/webkit/tools/test_shell/mock_webclipboard_impl.h b/webkit/tools/test_shell/mock_webclipboard_impl.h index 6420244..dd47835 100644 --- a/webkit/tools/test_shell/mock_webclipboard_impl.h +++ b/webkit/tools/test_shell/mock_webclipboard_impl.h @@ -10,8 +10,8 @@ #ifndef WEBKIT_TOOLS_TEST_SHELL_MOCK_WEBCLIPBOARD_IMPL_H_ #define WEBKIT_TOOLS_TEST_SHELL_MOCK_WEBCLIPBOARD_IMPL_H_ -#include "third_party/WebKit/WebKit/chromium/public/WebClipboard.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "webkit/api/public/WebClipboard.h" +#include "webkit/api/public/WebString.h" class MockWebClipboardImpl : public WebKit::WebClipboard { public: diff --git a/webkit/tools/test_shell/plugin_tests.cc b/webkit/tools/test_shell/plugin_tests.cc index 1fa32d4..3b12df6 100644 --- a/webkit/tools/test_shell/plugin_tests.cc +++ b/webkit/tools/test_shell/plugin_tests.cc @@ -10,8 +10,8 @@ #include "base/string_util.h" #include "net/base/escape.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" +#include "webkit/api/public/WebScriptSource.h" +#include "webkit/api/public/WebInputEvent.h" #include "webkit/glue/webframe.h" #include "webkit/glue/webview.h" #include "webkit/tools/test_shell/test_shell.h" diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 6e8a385..6dc5c2b 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -25,7 +25,7 @@ #include "net/http/http_cache.h" #include "net/base/ssl_test_util.h" #include "net/url_request/url_request_context.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" +#include "webkit/api/public/WebKit.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/window_open_disposition.h" #include "webkit/extensions/v8/gc_extension.h" diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h index 40ffdca..fe00c3d 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.h +++ b/webkit/tools/test_shell/test_shell_webkit_init.h @@ -7,10 +7,10 @@ #include "base/stats_counters.h" #include "base/string_util.h" -#include "third_party/WebKit/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/api/public/WebData.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebURL.h" #include "webkit/glue/simple_webmimeregistry_impl.h" #include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webkit_glue.h" diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 93d498c..092b2a56 100755 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -17,10 +17,10 @@ #include "base/string_util.h" #include "base/trace_event.h" #include "net/base/net_errors.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "webkit/api/public/WebDragData.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebScreenInfo.h" +#include "webkit/api/public/WebString.h" #include "webkit/glue/webdatasource.h" #include "webkit/glue/webdropdata.h" #include "webkit/glue/weberror.h" diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc index 5062c7c..f8822bd 100755 --- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc +++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc @@ -14,7 +14,7 @@ #include "base/string_util.h" #include "net/base/net_errors.h" #include "chrome/common/page_transition_types.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "webkit/api/public/WebRect.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/webdatasource.h" #include "webkit/glue/webdropdata.h" diff --git a/webkit/tools/test_shell/test_webview_delegate_win.cc b/webkit/tools/test_shell/test_webview_delegate_win.cc index f16c766..cb98dbf 100755 --- a/webkit/tools/test_shell/test_webview_delegate_win.cc +++ b/webkit/tools/test_shell/test_webview_delegate_win.cc @@ -19,7 +19,7 @@ #include "base/string_util.h" #include "base/trace_event.h" #include "net/base/net_errors.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" +#include "webkit/api/public/WebRect.h" #include "webkit/glue/webdatasource.h" #include "webkit/glue/webdropdata.h" #include "webkit/glue/weberror.h" diff --git a/webkit/tools/test_shell/test_webworker_helper.cc b/webkit/tools/test_shell/test_webworker_helper.cc index 20a8d4e..9620c1e 100644 --- a/webkit/tools/test_shell/test_webworker_helper.cc +++ b/webkit/tools/test_shell/test_webworker_helper.cc @@ -18,8 +18,8 @@ #include "base/logging.h" #include "base/file_util.h" #include "base/path_service.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebKitClient.h" using WebKit::WebWorker; using WebKit::WebWorkerClient; diff --git a/webkit/tools/test_shell/test_webworker_helper.h b/webkit/tools/test_shell/test_webworker_helper.h index 951950b..62a9efa 100644 --- a/webkit/tools/test_shell/test_webworker_helper.h +++ b/webkit/tools/test_shell/test_webworker_helper.h @@ -12,7 +12,7 @@ #include "base/basictypes.h" #include "base/port.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "webkit/api/public/WebString.h" #include <wtf/MainThread.h> diff --git a/webkit/tools/test_shell/test_worker/test_webworker.h b/webkit/tools/test_shell/test_worker/test_webworker.h index a7e8030..1071775 100644 --- a/webkit/tools/test_shell/test_worker/test_webworker.h +++ b/webkit/tools/test_shell/test_worker/test_webworker.h @@ -11,9 +11,9 @@ #include "base/basictypes.h" #include "base/ref_counted.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h" -#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h" +#include "webkit/api/public/WebString.h" +#include "webkit/api/public/WebWorker.h" +#include "webkit/api/public/WebWorkerClient.h" class GURL; class TestWebWorkerHelper; diff --git a/webkit/tools/test_shell/test_worker/test_worker_main.cc b/webkit/tools/test_shell/test_worker/test_worker_main.cc index 9273d35..50185b9 100644 --- a/webkit/tools/test_shell/test_worker/test_worker_main.cc +++ b/webkit/tools/test_shell/test_worker/test_worker_main.cc @@ -11,8 +11,8 @@ #include "base/scoped_ptr.h" #include "base/string_util.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "webkit/api/public/WebKit.h" +#include "webkit/api/public/WebString.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkitclient_impl.h" diff --git a/webkit/tools/test_shell/webwidget_host_gtk.cc b/webkit/tools/test_shell/webwidget_host_gtk.cc index 3bba172..4b66004 100644 --- a/webkit/tools/test_shell/webwidget_host_gtk.cc +++ b/webkit/tools/test_shell/webwidget_host_gtk.cc @@ -12,11 +12,11 @@ #include "skia/ext/bitmap_platform_device_linux.h" #include "skia/ext/platform_canvas_linux.h" #include "skia/ext/platform_device_linux.h" -#include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h" -#include "third_party/WebKit/WebKit/chromium/public/x11/WebScreenInfoFactory.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "webkit/api/public/gtk/WebInputEventFactory.h" +#include "webkit/api/public/x11/WebScreenInfoFactory.h" +#include "webkit/api/public/WebInputEvent.h" +#include "webkit/api/public/WebScreenInfo.h" +#include "webkit/api/public/WebSize.h" #include "webkit/glue/webwidget.h" #include "webkit/tools/test_shell/test_shell.h" #include "webkit/tools/test_shell/test_shell_x11.h" diff --git a/webkit/tools/test_shell/webwidget_host_win.cc b/webkit/tools/test_shell/webwidget_host_win.cc index c5464ef..9deca4c 100644 --- a/webkit/tools/test_shell/webwidget_host_win.cc +++ b/webkit/tools/test_shell/webwidget_host_win.cc @@ -9,11 +9,11 @@ #include "base/win_util.h" #include "skia/ext/platform_canvas.h" #include "skia/ext/platform_canvas_win.h" -#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" -#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" -#include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h" -#include "third_party/WebKit/WebKit/chromium/public/win/WebScreenInfoFactory.h" +#include "webkit/api/public/WebInputEvent.h" +#include "webkit/api/public/WebScreenInfo.h" +#include "webkit/api/public/WebSize.h" +#include "webkit/api/public/win/WebInputEventFactory.h" +#include "webkit/api/public/win/WebScreenInfoFactory.h" #include "webkit/glue/webwidget.h" #include "webkit/tools/test_shell/test_shell.h" diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index f91b4fd..f32c3a7 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -4150,67 +4150,67 @@ 'webcore', ], 'include_dirs': [ - '../third_party/WebKit/WebKit/chromium/public', - '../third_party/WebKit/WebKit/chromium/src', + 'api/public', + 'api/src', ], 'defines': [ 'WEBKIT_IMPLEMENTATION', ], 'sources': [ - '../third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h', - '../third_party/WebKit/WebKit/chromium/public/x11/WebScreenInfoFactory.h', - '../third_party/WebKit/WebKit/chromium/public/mac/WebInputEventFactory.h', - '../third_party/WebKit/WebKit/chromium/public/mac/WebScreenInfoFactory.h', - '../third_party/WebKit/WebKit/chromium/public/WebCache.h', - '../third_party/WebKit/WebKit/chromium/public/WebCanvas.h', - '../third_party/WebKit/WebKit/chromium/public/WebClipboard.h', - '../third_party/WebKit/WebKit/chromium/public/WebColor.h', - '../third_party/WebKit/WebKit/chromium/public/WebCommon.h', - '../third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h', - '../third_party/WebKit/WebKit/chromium/public/WebCString.h', - '../third_party/WebKit/WebKit/chromium/public/WebData.h', - '../third_party/WebKit/WebKit/chromium/public/WebDragData.h', - '../third_party/WebKit/WebKit/chromium/public/WebFindOptions.h', - '../third_party/WebKit/WebKit/chromium/public/WebImage.h', - '../third_party/WebKit/WebKit/chromium/public/WebInputEvent.h', - '../third_party/WebKit/WebKit/chromium/public/WebKit.h', - '../third_party/WebKit/WebKit/chromium/public/WebKitClient.h', - '../third_party/WebKit/WebKit/chromium/public/WebMediaPlayer.h', - '../third_party/WebKit/WebKit/chromium/public/WebMediaPlayerClient.h', - '../third_party/WebKit/WebKit/chromium/public/WebMimeRegistry.h', - '../third_party/WebKit/WebKit/chromium/public/WebPluginListBuilder.h', - '../third_party/WebKit/WebKit/chromium/public/WebPoint.h', - '../third_party/WebKit/WebKit/chromium/public/WebRect.h', - '../third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h', - '../third_party/WebKit/WebKit/chromium/public/WebScriptSource.h', - '../third_party/WebKit/WebKit/chromium/public/WebSize.h', - '../third_party/WebKit/WebKit/chromium/public/WebString.h', - '../third_party/WebKit/WebKit/chromium/public/WebURL.h', - '../third_party/WebKit/WebKit/chromium/public/WebVector.h', - '../third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h', - '../third_party/WebKit/WebKit/chromium/public/win/WebSandboxSupport.h', - '../third_party/WebKit/WebKit/chromium/public/win/WebScreenInfoFactory.h', - '../third_party/WebKit/WebKit/chromium/public/win/WebScreenInfoFactory.h', - '../third_party/WebKit/WebKit/chromium/src/ChromiumBridge.cpp', - '../third_party/WebKit/WebKit/chromium/src/ChromiumCurrentTime.cpp', - '../third_party/WebKit/WebKit/chromium/src/ChromiumThreading.cpp', - '../third_party/WebKit/WebKit/chromium/src/gtk/WebInputEventFactory.cpp', - '../third_party/WebKit/WebKit/chromium/src/x11/WebScreenInfoFactory.cpp', - '../third_party/WebKit/WebKit/chromium/src/mac/WebInputEventFactory.mm', - '../third_party/WebKit/WebKit/chromium/src/mac/WebScreenInfoFactory.mm', - '../third_party/WebKit/WebKit/chromium/src/WebCache.cpp', - '../third_party/WebKit/WebKit/chromium/src/WebCString.cpp', - '../third_party/WebKit/WebKit/chromium/src/WebData.cpp', - '../third_party/WebKit/WebKit/chromium/src/WebDragData.cpp', - '../third_party/WebKit/WebKit/chromium/src/WebImageSkia.cpp', - '../third_party/WebKit/WebKit/chromium/src/WebInputEvent.cpp', - '../third_party/WebKit/WebKit/chromium/src/WebKit.cpp', - '../third_party/WebKit/WebKit/chromium/src/WebPluginListBuilderImpl.cpp', - '../third_party/WebKit/WebKit/chromium/src/WebPluginListBuilderImpl.h', - '../third_party/WebKit/WebKit/chromium/src/WebString.cpp', - '../third_party/WebKit/WebKit/chromium/src/WebURL.cpp', - '../third_party/WebKit/WebKit/chromium/src/win/WebInputEventFactory.cpp', - '../third_party/WebKit/WebKit/chromium/src/win/WebScreenInfoFactory.cpp', + 'api/public/gtk/WebInputEventFactory.h', + 'api/public/x11/WebScreenInfoFactory.h', + 'api/public/mac/WebInputEventFactory.h', + 'api/public/mac/WebScreenInfoFactory.h', + 'api/public/WebCache.h', + 'api/public/WebCanvas.h', + 'api/public/WebClipboard.h', + 'api/public/WebColor.h', + 'api/public/WebCommon.h', + 'api/public/WebConsoleMessage.h', + 'api/public/WebCString.h', + 'api/public/WebData.h', + 'api/public/WebDragData.h', + 'api/public/WebFindOptions.h', + 'api/public/WebImage.h', + 'api/public/WebInputEvent.h', + 'api/public/WebKit.h', + 'api/public/WebKitClient.h', + 'api/public/WebMediaPlayer.h', + 'api/public/WebMediaPlayerClient.h', + 'api/public/WebMimeRegistry.h', + 'api/public/WebPluginListBuilder.h', + 'api/public/WebPoint.h', + 'api/public/WebRect.h', + 'api/public/WebScreenInfo.h', + 'api/public/WebScriptSource.h', + 'api/public/WebSize.h', + 'api/public/WebString.h', + 'api/public/WebURL.h', + 'api/public/WebVector.h', + 'api/public/win/WebInputEventFactory.h', + 'api/public/win/WebSandboxSupport.h', + 'api/public/win/WebScreenInfoFactory.h', + 'api/public/win/WebScreenInfoFactory.h', + 'api/src/ChromiumBridge.cpp', + 'api/src/ChromiumCurrentTime.cpp', + 'api/src/ChromiumThreading.cpp', + 'api/src/gtk/WebInputEventFactory.cpp', + 'api/src/x11/WebScreenInfoFactory.cpp', + 'api/src/mac/WebInputEventFactory.mm', + 'api/src/mac/WebScreenInfoFactory.mm', + 'api/src/WebCache.cpp', + 'api/src/WebCString.cpp', + 'api/src/WebData.cpp', + 'api/src/WebDragData.cpp', + 'api/src/WebImageSkia.cpp', + 'api/src/WebInputEvent.cpp', + 'api/src/WebKit.cpp', + 'api/src/WebPluginListBuilderImpl.cpp', + 'api/src/WebPluginListBuilderImpl.h', + 'api/src/WebString.cpp', + 'api/src/WebURL.cpp', + 'api/src/win/WebInputEventFactory.cpp', + 'api/src/win/WebScreenInfoFactory.cpp', ], 'conditions': [ ['OS=="linux"', { @@ -4219,8 +4219,8 @@ '../build/linux/system.gyp:gtk', ], 'include_dirs': [ - '../third_party/WebKit/WebKit/chromium/public/x11', - '../third_party/WebKit/WebKit/chromium/public/gtk', + 'api/public/x11', + 'api/public/gtk', ], }, { # else: OS!="linux" 'sources/': [ @@ -4230,17 +4230,17 @@ }], ['OS=="mac"', { 'include_dirs': [ - '../third_party/WebKit/WebKit/chromium/public/mac', + 'api/public/mac', ], 'sources!': [ - '../third_party/WebKit/WebKit/chromium/src/WebImageSkia.cpp', + 'api/src/WebImageSkia.cpp', ], }, { # else: OS!="mac" 'sources/': [['exclude', '/mac/']], }], ['OS=="win"', { 'include_dirs': [ - '../third_party/WebKit/WebKit/chromium/public/win', + 'api/public/win', ], }, { # else: OS!="win" 'sources/': [['exclude', '/win/']], |