diff -Naur WebKit-r41128/autotools/webkit.m4 WebKit-r41137-nx/autotools/webkit.m4 --- WebKit-r41128/autotools/webkit.m4 2009-02-15 03:48:56.000000000 -0500 +++ WebKit-r41137-nx/autotools/webkit.m4 2009-02-23 16:01:26.000000000 -0500 @@ -120,17 +120,17 @@ dnl determine the Unicode backend AC_MSG_CHECKING([which Unicode backend to use]) AC_ARG_WITH(unicode_backend, - AC_HELP_STRING([--with-unicode-backend=@<:@icu@:>@], + AC_HELP_STRING([--with-unicode-backend=@<:@icu/glib@:>@], [Select Unicode backend [default=icu]]), - [],[unicode_backend="icu"]) + [],[with_unicode_backend="icu"]) -case "$unicode_backend" in - icu) ;; - *) AC_MSG_ERROR([Invalid Unicode backend: must be icu.]) ;; +case "$with_unicode_backend" in + icu|glib) ;; + *) AC_MSG_ERROR([Invalid Unicode backend: must be icu or glib.]) ;; esac -AC_MSG_RESULT([$unicode_backend]) - -if test "$unicode_backend" = "icu"; then +AC_MSG_RESULT([$with_unicode_backend]) + +if test "$with_unicode_backend" = "icu"; then if test "$os_darwin" = "yes"; then UNICODE_CFLAGS="-I\$(srcdir)/JavaScriptCore/icu -I\$(srcdir)/WebCore/icu" UNICODE_LIBS="-licucore" @@ -150,6 +150,19 @@ UNICODE_LIBS=`$icu_config --ldflags` fi fi + +if test "$with_unicode_backend" = "glib"; then + PKG_CHECK_MODULES([UNICODE], [glib-2.0 pango >= 1.16.0]) + AC_MSG_CHECKING([for libidn]) + AC_CHECK_HEADER(idna.h, + AC_CHECK_LIB(idn, stringprep_check_version, + [libidn=yes UNICODE_LIBS="${UNICODE_LIBS} -lidn"], libidn=no), + libidn=no) + if test "$libidn" = "no" ; then + AC_MSG_ERROR([Libidn not found, needed for GLib unicode backend.]) + fi +fi + AC_SUBST([UNICODE_CFLAGS]) AC_SUBST([UNICODE_LIBS]) ]) diff -Naur WebKit-r41128/autotoolsconfig.h.in WebKit-r41137-nx/autotoolsconfig.h.in --- WebKit-r41128/autotoolsconfig.h.in 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/autotoolsconfig.h.in 2009-07-25 12:13:35.219054384 -0400 @@ -0,0 +1,113 @@ +/* autotoolsconfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define to enable JIT */ +#undef ENABLE_JIT + +/* Define to enable optimized arithmetic */ +#undef ENABLE_JIT_OPTIMIZE_ARITHMETIC + +/* Define to enable optimizing calls */ +#undef ENABLE_JIT_OPTIMIZE_CALL + +/* Define to enable optimized property access */ +#undef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS + +/* Define to enable WREC */ +#undef ENABLE_WREC + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to disable debugging features */ +#undef NDEBUG + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define if target is DirectFB */ +#undef WTF_PLATFORM_DIRECTFB + +/* Define if target is X11 */ +#undef WTF_PLATFORM_X11 + +/* Use stub va_list */ +#undef WTF_USE_JIT_STUB_ARGUMENT_VA_LIST + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +#undef volatile diff -Naur WebKit-r41128/build.py WebKit-r41137-nx/build.py --- WebKit-r41128/build.py 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/build.py 2009-06-23 19:32:02.272477885 -0400 @@ -0,0 +1,37 @@ +#!/usr/bin/env python +import os, sys, re +import subprocess +import shutil + +def uname_matches(n): return bool(re.match(os.uname()[0], n)) +platform = None +if not hasattr(os, 'uname') or uname_matches('CYGWIN'): + platform = 'win32' +elif uname_matches('Darwin'): + platform = 'osx' +elif uname_matches('Linux'): + platform = 'linux' + +print "Build Webkit_Titanium (%s).." % platform +try: + if platform is 'linux': + os.system("./configure") + os.system("make") + elif platform is 'osx': + # TODO: add logic for 10.4/10.5 build + # Ported over from the webkit nightly build script, although some parts not included... + # They probably should be, but I don't understand what they do yet, --BTH + build_flags_common = 'DEBUG_INFORMATION_FORMAT=dwarf-with-dsym STRIP_INSTALLED_PRODUCT=YES DEPLOYMENT_POSTPROCESSING=YES' + build_flags_10_4 = 'GCC_VERSION=4.0 SDKROOT=/Developer/SDKs/MacOSX10.4u.sdk MACOSX_DEPLOYMENT_TARGET=10.4 WEBKIT_SYSTEM_INTERFACE_LIBRARY=WebKitSystemInterfaceTiger MAC_OS_X_VERSION_MAJOR=1040 MAC_OS_X_VERSION_ACTUAL=1049' + build_flags_10_5 = 'SDKROOT=/Developer/SDKs/MacOSX10.5.sdk MACOSX_DEPLOYMENT_TARGET=10.5 WEBKIT_SYSTEM_INTERFACE_LIBRARY=WebKitSystemInterfaceLeopard' + os.system("./WebKitTools/Scripts/build-webkit --universal --release " + build_flags_common + " " + build_flags_10_5) + elif platform is 'win32': + cygwin_dir = 'C:\\cygwin' + bash_exe = os.path.join(cygwin_dir, 'bin', 'bash.exe') + cygpath_exe = os.path.join(cygwin_dir, 'bin', 'cygpath.exe') + workspace_dir = os.environ["WORKSPACE"] + workspace_cyg_dir = subprocess.Popen([cygpath_exe, "-u", workspace_dir], stdout=subprocess.PIPE).communicate()[0] + subprocess.call([bash_exe, '-l', '-c', "%s/WebKitTools/Scripts/build-webkit" % workspace_cyg_dir, "--release", "--cairo-win32"]) + +except OSError, e: + print "Error building: " + str(e) diff -Naur WebKit-r41128/configure.ac WebKit-r41137-nx/configure.ac --- WebKit-r41128/configure.ac 2009-02-19 01:12:25.000000000 -0500 +++ WebKit-r41137-nx/configure.ac 2009-02-23 16:01:26.000000000 -0500 @@ -27,7 +27,7 @@ LIBWEBKITGTK_VERSION=1:0:0 AC_SUBST([LIBWEBKITGTK_VERSION]) -AM_INIT_AUTOMAKE([foreign subdir-objects tar-ustar]) +AM_INIT_AUTOMAKE([foreign subdir-objects]) # host checking - inspired by the GTK+ configure.in # TODO: move these to webkit.m4? @@ -607,6 +607,10 @@ AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_target" = "quartz"]) AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_target" = "directfb"]) +# Unicode backend conditionals +AM_CONDITIONAL([USE_ICU_UNICODE], [test "$with_unicode_backend" = "icu"]) +AM_CONDITIONAL([USE_GLIB_UNICODE], [test "$with_unicode_backend" = "glib"]) + # HTTP backend conditionals AM_CONDITIONAL([USE_CURL], [test "$with_http_backend" = "curl"]) AM_CONDITIONAL([USE_SOUP], [test "$with_http_backend" = "soup"]) @@ -656,7 +660,7 @@ Enable debugging (slow) : $enable_debug Enable GCC build optimization : $enable_optimizations Code coverage support : $enable_coverage - Unicode backend : $unicode_backend + Unicode backend : $with_unicode_backend HTTP backend : $with_http_backend Font backend : $with_font_backend Optimized memory allocator : $enable_fast_malloc diff -Naur WebKit-r41128/copy-libs-to-kroll.cmd WebKit-r41137-nx/copy-libs-to-kroll.cmd --- WebKit-r41128/copy-libs-to-kroll.cmd 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/copy-libs-to-kroll.cmd 2009-06-23 19:32:02.288659283 -0400 @@ -0,0 +1,3 @@ +cp ../../source/WebKitBuild/bin/WebKit.dll ../titanium/kroll/thirdparty/win32/webkit/bin/WebKit.dll +cp ../../source/WebKitBuild/lib/WebKit.lib ../titanium/kroll/thirdparty/win32/webkit/lib/WebKit.lib + diff -Naur WebKit-r41128/copy-libs-to-kroll.sh WebKit-r41137-nx/copy-libs-to-kroll.sh --- WebKit-r41128/copy-libs-to-kroll.sh 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/copy-libs-to-kroll.sh 2009-06-23 19:32:02.288659283 -0400 @@ -0,0 +1,8 @@ +if [ `uname -m` = "x86_64" ] +then + ARCH="linux64" +else + ARCH="linux" +fi +cp .libs/libwebkit-1.0.so.1.0.0 ../titanium/kroll/thirdparty/$ARCH/webkit/lib +cp libwebkit-1.0.la ../titanium/kroll/thirdparty/$ARCH/webkit/lib diff -Naur WebKit-r41128/debian/changelog WebKit-r41137-nx/debian/changelog --- WebKit-r41128/debian/changelog 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/debian/changelog 2009-07-25 12:11:13.388491532 -0400 @@ -0,0 +1,165 @@ +webkit (1.0-svn41137-13) unstable; urgency=high + + * Popup menu population enchancements. + + -- Bundyo Tue, 25 Jul 2009 19:30:00 +0200 + +webkit (1.0-svn41137-12) unstable; urgency=high + + * Applied Adam Dingle's GTK+ DOM bindings patch. + + -- Bundyo Tue, 19 Jul 2009 00:12:00 +0200 + +webkit (1.0-svn41137-11) unstable; urgency=high + + * Enabled AppCache. + * Removed vfp and softfp optimization switches. + + -- Bundyo Tue, 01 Jul 2009 02:20:00 +0200 + +webkit (1.0-svn41137-10) unstable; urgency=high + + * Applied Titanium patches. + * Fixed the maxlength less by two chars issue. + + -- Bundyo Tue, 01 Jul 2009 02:20:00 +0200 + +webkit (1.0-svn41137-9) unstable; urgency=high + + * Applied upstream patch to enable local storage. + + -- Bundyo Tue, 26 May 2009 02:20:00 +0200 + +webkit (1.0-svn41137-8) unstable; urgency=high + + * Fix for slow loading resources after a while (cookies). + + -- Bundyo Tue, 05 May 2009 02:20:00 +0200 + +webkit (1.0-svn41137-7) unstable; urgency=high + + * Fix for zoom_step. + + -- Bundyo Tue, 25 Apr 2009 16:40:00 +0200 + +webkit (1.0-svn41137-6) unstable; urgency=high + + * Applied patch for user agent change support. + + -- Bundyo Tue, 21 Apr 2009 01:35:00 +0200 + +webkit (1.0-svn41137-5) unstable; urgency=high + + * Removed resource request checks for testing. + * Added XSLT support on request. + + -- Bundyo Tue, 08 Apr 2009 01:00:00 +0200 + +webkit (1.0-svn41137-4) unstable; urgency=high + + * Changed the place where the resource request checks are done. + + -- Bundyo Tue, 31 Mar 2009 09:00:00 +0200 + +webkit (1.0-svn41137-3) unstable; urgency=high + + * Fixed the badly applied 3rd hns' patch (The GMail crash). + + -- Bundyo Tue, 30 Mar 2009 02:00:00 +0200 + +webkit (1.0-svn41137-2) unstable; urgency=high + + * No optimizations. 770 compatible. + + -- Bundyo Tue, 25 Mar 2009 21:00:00 +0200 + +webkit (1.0-svn41137-1) unstable; urgency=high + + * Update from upstream. + * Built with Nokia 770 optimizations. + + -- Bundyo Tue, 25 Mar 2009 02:00:00 +0200 + +webkit (1.0-svn41128-2) unstable; urgency=high + + * Menu popup hack removed. + + -- Bundyo Tue, 25 Mar 2009 02:00:00 +0200 + +webkit (1.0-svn41128-1~hns-2) unstable; urgency=low + + * Fix input method issues with hildon on-screen keyboard + + -- Hannes Wallnoefer Tue, 24 Mar 2009 15:08:11 +0100 + +webkit (1.0-svn41128-1) unstable; urgency=high + + * Update from upstream. + * Menu popup hack. + + -- Bundyo Tue, 23 Feb 2009 02:00:00 +0200 + +webkit (1.0-svn41071-1) unstable; urgency=high + + * Update from upstream. + + -- Bundyo Tue, 20 Feb 2009 02:00:00 +0200 + +webkit (1.0-svn40663-1) unstable; urgency=high + + * Update from upstream. + + -- Bundyo Tue, 06 Feb 2009 02:00:00 +0200 + +webkit (1.0-svn40419-1) unstable; urgency=high + + * Handling text/plain MIME types as downloads - like Mozilla does. + * Different way to get the Content-Length - CURL doesn't seem to do it. + + -- Bundyo Tue, 31 Jan 2009 22:00:00 +0200 + +webkit (1.0-svn40239-3) unstable; urgency=high + + * Changed some dependencies to allow installation on Chinook. + + -- Bundyo Tue, 28 Jan 2009 23:30:00 +0200 + +webkit (1.0-svn40239-2) unstable; urgency=high + + * Switched on some optimizations. + + -- Bundyo Tue, 27 Jan 2009 03:00:00 +0200 + +webkit (1.0-svn40239-1) unstable; urgency=high + + * Updated to 40239. + + -- Bundyo Tue, 27 Jan 2009 01:00:00 +0200 + +webkit (1.0-svn40080-1) unstable; urgency=high + + * Updated to 40080. + + -- Bundyo Tue, 22 Jan 2009 01:00:00 +0200 + +webkit (1.0-svn39682-1) unstable; urgency=high + + * Updated to 39682. + + -- Bundyo Tue, 09 Jan 2009 23:00:00 +0200 + +webkit (1.0-svn39572-1) unstable; urgency=high + + * Patch for unicode handling with GLib. + * Patch for download support. + * Patch for inspect support. + * Maemo PASSWORD input field support with INVISIBLE input mode. + * Web inspector files included in package. + + -- Bundyo Tue, 04 Jan 2009 20:00:00 +0200 + +webkit (1.0-svn39572) unstable; urgency=high + + * Packaged for Maemo. No changes from SVN 39572. + + -- Bundyo Tue, 03 Jan 2009 20:57:48 +0200 diff -Naur WebKit-r41128/debian/compat WebKit-r41137-nx/debian/compat --- WebKit-r41128/debian/compat 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/debian/compat 2009-02-23 16:01:26.000000000 -0500 @@ -0,0 +1 @@ +4 diff -Naur WebKit-r41128/debian/control WebKit-r41137-nx/debian/control --- WebKit-r41128/debian/control 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/debian/control 2009-02-23 16:01:26.000000000 -0500 @@ -0,0 +1,53 @@ +Source: webkit +Priority: optional +Section: user/other +Uploaders: Bundyo +Build-Depends: debhelper (>= 5.0), libgtk2.0-dev (>= 2.10), libpango1.0-dev (>= 1.16), libxslt-dev, libcurl3-dev, libsqlite3-dev, bison, flex, libjpeg62-dev, libpng12-dev, autoconf, automake, libtool, libxt-dev +Standards-Version: 3.8.0.1 +Homepage: http://webkit.org/ + +Package: libwebkit-1.0-1 +Section: user/other +Architecture: any +Depends: ${shlibs:Depends} +Description: Web content engine library for Gtk+ + WebKit is a web content engine, derived from KHTML and KJS from KDE, and + used primarily in Apple's Safari browser. It is made to be embedded in + other applications, such as mail readers, or web browsers. + . + It is able to display content such as HTML, SVG, XML, and others. It also + supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and more. + . + This is the library for embedding in Gtk+ applications. + +Package: libwebkit-dev +Section: libdevel +Priority: extra +Architecture: all +Depends: libwebkit-1.0-1 (>= ${source:Upstream-Version}), libgtk2.0-dev +Conflicts: libwebkitgdk-dev +Description: Web content engine library for Gtk+ - Development files + WebKit is a web content engine, derived from KHTML and KJS from KDE, and + used primarily in Apple's Safari browser. It is made to be embedded in + other applications, such as mail readers, or web browsers. + . + It is able to display content such as HTML, SVG, XML, and others. It also + supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and more. + . + This package provides development files required to create Gtk+ applications + embedding WebKit. + +Package: libwebkit-1.0-1-dbg +Section: libdevel +Priority: extra +Architecture: any +Depends: libwebkit-1.0-1 (= ${binary:Version}) +Description: Web content engine library for Gtk+ - Debugging symbols + WebKit is a web content engine, derived from KHTML and KJS from KDE, and + used primarily in Apple's Safari browser. It is made to be embedded in + other applications, such as mail readers, or web browsers. + . + It is able to display content such as HTML, SVG, XML, and others. It also + supports DOM, XMLHttpRequest, XSLT, CSS, Javascript/ECMAscript and more. + . + This package provides the debugging symbols for the Webkit library for Gtk+. diff -Naur WebKit-r41128/debian/copyright WebKit-r41137-nx/debian/copyright --- WebKit-r41128/debian/copyright 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/debian/copyright 2009-02-23 16:01:26.000000000 -0500 @@ -0,0 +1,1082 @@ +Original source may be found at http://people.freedesktop.org/~alp/webkit/gtk/ + +Files: debian/* +Copyright: © 2007 Mike Hommey +License: LGPL-2+ (/usr/share/common-licenses/LGPL-2) + +Files: JavaScriptCore/API/*, + JavaScriptCore/profiler/Profile.*, + JavaScriptCore/wtf/Assertions.*, + JavaScriptCore/wtf/HashIterators.h, + JavaScriptCore/wtf/MathExtras.h, + JavaScriptCore/wtf/OwnPtrWin.cpp, + JavaScriptCore/wtf/Platform.h, + JavaScriptCore/wtf/StringExtras.h, + JavaScriptCore/wtf/unicode/UTF8.*, + WebCore/WebCorePrefix.cpp, + WebCore/bindings/js/JSAudioConstructor.*, + WebCore/bindings/js/JSConsoleCustom.cpp, + WebCore/bindings/js/JSCSSRuleCustom.cpp, + WebCore/bindings/js/JSCSSStyleDeclarationCustom.*, + WebCore/bindings/js/JSCSSValueCustom.cpp, + WebCore/bindings/js/JSCustomXPathNSResolver.*, + WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp, + WebCore/bindings/js/JSEventTargetBase.*, + WebCore/bindings/js/JSEventTargetNode.*, + WebCore/bindings/js/JSHTMLAllCollection.h, + WebCore/bindings/js/JSHTMLAppletElementCustom.*, + WebCore/bindings/js/JSHTMLDocumentCustom.cpp, + WebCore/bindings/js/JSHTMLElementCustom.cpp, + WebCore/bindings/js/JSHTMLEmbedElementCustom.*, + WebCore/bindings/js/JSHTMLFormElementCustom.cpp, + WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp, + WebCore/bindings/js/JSHTMLObjectElementCustom.*, + WebCore/bindings/js/JSHistoryCustom.h, + WebCore/bindings/js/JSInspectedObjectWrapper.*, + WebCore/bindings/js/JSInspectorCallbackWrapper.*, + WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp, + WebCore/bindings/js/JSLocationCustom.h, + WebCore/bindings/js/JSNamedNodeMapCustom.cpp, + WebCore/bindings/js/JSNamedNodesCollection.*, + WebCore/bindings/js/JSNodeCustom.cpp, + WebCore/bindings/js/JSNodeFilterCustom.cpp, + WebCore/bindings/js/JSNodeListCustom.cpp, + WebCore/bindings/js/JSQuarantinedObjectWrapper.*, + WebCore/bindings/js/JSSVGPODTypeWrapper.h, + WebCore/bindings/js/JSStorageCustom.*, + WebCore/bindings/js/JSStyleSheetCustom.cpp, + WebCore/bindings/js/JSStyleSheetListCustom.cpp, + WebCore/bindings/js/JSTextCustom.cpp, + WebCore/bindings/js/JSXSLTProcessorConstructor.*, + WebCore/bindings/js/GCController.*, + WebCore/bindings/objc/*, + WebCore/bridge/*, + WebCore/css/CSSCanvasValue.*, + WebCore/css/CSSFontFace.*, + WebCore/css/CSSFontFaceSource.*, + WebCore/css/CSSFontFaceSrcValue.*, + WebCore/css/CSSFontSelector.*, + WebCore/css/CSSGradientValue.*, + WebCore/css/CSSImageGeneratorValue.*, + WebCore/css/CSSPrimitiveValueMappings.h, + WebCore/css/CSSReflectValue.*, + WebCore/css/CSSReflectionDirection.h, + WebCore/css/CSSRuleList.idl, + WebCore/css/CSSSegmentedFontFace.*, + WebCore/css/CSSTimingFunctionValue.*, + WebCore/css/CSSTransformValue.*, + WebCore/css/CSSUnicodeRangeValue.*, + WebCore/css/CSSValueList.idl, + WebCore/css/MediaList.idl, + WebCore/css/MediaQuery*, + WebCore/css/view-source.css, + WebCore/css/svg.css, + WebCore/dom/BeforeTextInsertedEvent.*, + WebCore/dom/Clipboard.cpp, + WebCore/dom/ClipboardAccessPolicy.h, + WebCore/dom/EventTarget.cpp, + WebCore/dom/EventTarget.h, + WebCore/dom/ExceptionCode.cpp, + WebCore/dom/MessageEvent.*, + WebCore/dom/NodeWithIndex.h, + WebCore/dom/OverflowEvent.*, + WebCore/dom/Position*, + WebCore/dom/ProgressEvent.*, + WebCore/dom/RangeBoundaryPoint.h, + WebCore/dom/TextEvent.*, + WebCore/editing/*, + WebCore/history/*, + WebCore/html/Canvas*, + WebCore/html/HTMLAudioElement.*, + WebCore/html/HTMLCanvasElement.*, + WebCore/html/HTMLMediaElement.*, + WebCore/html/HTMLParserErrorCodes.*, + WebCore/html/HTMLSourceElement.*, + WebCore/html/HTMLTextFieldInnerElement.*, + WebCore/html/HTMLVideoElement.*, + WebCore/html/HTMLViewSourceDocument.*, + WebCore/html/MediaError.h, + WebCore/html/PreloadScanner.*, + WebCore/html/TimeRanges.*, + WebCore/html/VoidCallback.h, + WebCore/loader/CachePolicy.h, + WebCore/loader/CachedFont.*, + WebCore/loader/ImageDocument.*, + WebCore/loader/PluginDocument.*, + WebCore/loader/ProgressTracker.*, + WebCore/loader/SubstituteData.h, + WebCore/loader/SubstituteResource.h, + WebCore/loader/TextDocument.*, + WebCore/loader/FTPDirectoryDocument.*, + WebCore/loader/*/*, + WebCore/page/*, + WebCore/page/inspector/Breakpoint.js, + WebCore/page/inspector/BreakpointsSidebarPane.js, + WebCore/page/inspector/CallStackSidebarPane.js, + WebCore/page/inspector/DataGrid.js, + WebCore/page/inspector/DatabaseQueryView.js, + WebCore/page/inspector/DatabaseTableView.js, + WebCore/page/inspector/Object.js, + WebCore/page/inspector/ObjectPropertiesSection.js, + WebCore/page/inspector/Placard.js, + WebCore/page/inspector/ProfileView.js, + WebCore/page/inspector/ProfilesPanel.js, + WebCore/page/inspector/ScopeChainSidebarPane.js, + WebCore/page/inspector/Script.js, + WebCore/page/inspector/ScriptsPanel.js, + WebCore/page/inspector/ScriptView.js, + WebCore/page/inspector/SidebarTreeElement.js, + WebCore/page/inspector/SourceFrame.js, + WebCore/page/inspector/View.js, + WebCore/page/win/AXObjectCacheWin.cpp, + WebCore/page/win/AccessibilityObjectWrapperWin.h, + WebCore/platform/*, + WebCore/platform/graphics/svg/filters/cg/WK*, + WebCore/plugins/gtk/PluginDatabaseGtk.cpp, + WebCore/plugins/gtk/PluginPackageGtk.cpp, + WebCore/plugins/gtk/PluginViewGtk.cpp, + WebCore/plugins/npapi.cpp, + WebCore/plugins/npfunctions.h, + WebCore/plugins/PluginDatabase.*, + WebCore/plugins/PluginDebug.h, + WebCore/plugins/PluginInfoStore.*, + WebCore/plugins/PluginStream.*, + WebCore/plugins/PluginPackage.*, + WebCore/plugins/PluginView.*, + WebCore/plugins/PluginQuirkSet.h, + WebCore/plugins/qt/PluginDatabaseQt.cpp, + WebCore/plugins/qt/PluginPackageQt.cpp, + WebCore/plugins/qt/PluginViewQt.cpp, + WebCore/plugins/win/PluginMessageThrottlerWin.*, + WebCore/plugins/win/PluginDatabaseWin.cpp, + WebCore/plugins/win/PluginViewWin.cpp, + WebCore/plugins/win/PluginPackageWin.cpp, + WebCore/plugins/wx/PluginDataWx.cpp, + WebCore/plugins/wx/PluginDatabaseWx.cpp, + WebCore/plugins/wx/PluginPackageWx.cpp, + WebCore/plugins/wx/PluginViewWx.cpp, + WebCore/rendering/LayoutState.*, + WebCore/rendering/RenderHTMLCanvas.*, + WebCore/rendering/RenderImageGeneratedContent.*, + WebCore/rendering/RenderMedia.*, + WebCore/rendering/RenderTreeAsText.*, + WebCore/rendering/RenderWordBreak.*, + WebCore/rendering/SVGRenderTreeAsText.*, + WebCore/rendering/RenderVideo.*, + WebCore/storage/LocalStorage.*, + WebCore/storage/LocalStorageArea.*, + WebCore/storage/LocalStorageTask.*, + WebCore/storage/LocalStorageThread.*, + WebCore/storage/SessionStorage.*, + WebCore/storage/SessionStorageArea.*, + WebCore/storage/Storage.*, + WebCore/storage/StorageArea.*, + WebCore/storage/StorageEvent.*, + WebCore/storage/StorageMap.*, + WebCore/svg/ElementTimeControl.h, + WebCore/svg/*.idl, + WebCore/svg/animation/*, + WebCore/svg/graphics/SVGImage.*, + WebCore/svg/graphics/SVGImageEmptyClients.h, + WebCore/svg/graphics/SVGPaintServer*, + WebCore/svg/graphics/SVGResource*, + WebCore/svg/graphics/cg/CgSupport.*, + WebCore/svg/graphics/cg/RenderPathCg.cpp, + WebCore/svg/graphics/cg/SVGResourceClipperCg.cpp, + WebCore/svg/graphics/cg/SVGResourceFilterCg.cpp, + WebCore/svg/graphics/cg/SVGResourceMaskerCg.cpp, + WebCore/svg/graphics/filters/cg/WK*, + WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.h, + WebCore/xml/*, + WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.*, + WebKit/gtk/WebCoreSupport/EditorClientGtk.*, + WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.*, + WebKitTools/DumpRenderTree/cg/ImageDiffCG.cpp, + WebKitTools/DumpRenderTree/mac/ObjCPlugin.*, + WebKitTools/DumpRenderTree/mac/ObjCPluginFunction.*, + WebKitTools/GtkLauncher/main.c, + WebKitTools/Scripts/run-sunspider, + WebKitTools/Scripts/update-sources-list.py, + WebKitTools/wx/build-wxwebkit, + WebKitTools/wx/browser/browser.cpp, + WebKitTools/WinLauncher/stdafx.*, + WebKitTools/WinLauncher/WinLauncher.*, + WebKit/mac/History/WebHistoryInternal.h + WebKit/mac/Misc/WebIconFetcher.*, + WebKit/mac/Misc/WebIconFetcherInternal.h, + WebKit/mac/Plugins/WebNetscapePluginEventHandler.*, + WebKit/mac/Plugins/WebNetscapePluginEventHandlerCarbon.*, + WebKit/mac/Plugins/WebNetscapePluginEventHandlerCocoa.*, + WebKit/mac/Plugins/nptextinput.h, + WebKit/mac/WebCoreSupport/WebDragClient.h, + WebKit/mac/WebCoreSupport/WebPasteboardHelper.h, + WebKit/win/*, + WebKit/wx/*, + WebKitLibraries/win/tools/scripts/auto-version.sh +Copyright: © 2002, 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. + © 2005, 2006, 2007 Alexey Proskuryakov (ap@nypop.com) + © 2006, 2007 Trolltech ASA + © 2006, 2007 Nikolas Zimmermann + © 2006 Samuel Weinig + © 2006 James G. Speth (speth@end.com) + © 2006 Jonas Witt + © 2005 Frerich Raabe + © 2005 Maksim Orlovich + © 2001, 2002 Thomas Broyer, Charlie Bozeman and Daniel Veillard + © 2005, 2006 Alexander Kellett + © 2005, 2006 Kimmo Kinnunen + © 2005, 2006 Michael Emmel mike.emmel@gmail.com + © 2005 Ben La Monica + © 2005 Google Inc. + © 2005, 2006 Nokia Corporation + © 2005, 2006 Oliver Hunt + © 2006, 2007 Eric Seidel + © 2006 Allan Sandfeld Jensen + © 2006 Charles Samuels + © 2006 Dave MacLachlan (dmaclach@mac.com) + © 2006 David Smith (catfish.man@gmail.com) + © 2006 Dirk Mueller + © 2006 Don Gibson + © 2006 Friedemann Kleint + © 2006 George Staikos + © 2006 Justin Haygood + © 2006, 2007, 2008 Kevin Ollivier + © 2006 Lars Knoll + © 2006 Nefaur Khandker + © 2006, 2007 Rob Buis + © 2006 Simon Hausmann + © 2006 Zack Rusin + © 2007 Alp Toker + © 2007 Holger Hans Peter Freyther + © 2007 Robin Dunn + © 2007 Staikos Computing Services Inc. + © 2007 Henry Mason (hmason@mac.com) + © 2007 Hiroyuki Ikezoe + © 2007 Kouhei Sutou + © 2007 Vaclav Slavik + © 2008 Xan Lopez + © 2008 Collabora, Ltd. + © 2008 Julien Chaffraix + © 2008 The Mozilla Foundation +License: BSD-2 + 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. + +Files: JavaScriptCore/API/JSRetainPtr.h, + JavaScriptCore/API/JSStringRefBSTR.*, + JavaScriptCore/DerivedSources.make, + JavaScriptCore/VM/*, + JavaScriptCore/kjs/CallData.h, + JavaScriptCore/kjs/CollectorHeapIntrospector.*, + JavaScriptCore/kjs/ConstructData.h, + JavaScriptCore/kjs/DebuggerCallFrame.*, + JavaScriptCore/kjs/InitializeThreading.*, + JavaScriptCore/kjs/JSActivation.*, + JavaScriptCore/kjs/JSGlobalData.*, + JavaScriptCore/kjs/JSGlobalObject.cpp, + JavaScriptCore/kjs/JSNotAnObject.*, + JavaScriptCore/kjs/JSVariableObject.*, + JavaScriptCore/kjs/SourceProvider.h, + JavaScriptCore/kjs/SourceRange.h, + JavaScriptCore/kjs/SymbolTable.h, + JavaScriptCore/profiler/*, + JavaScriptCore/wtf/ASCIICType.h, + JavaScriptCore/wtf/AVLTree.h, + JavaScriptCore/wtf/Deque.h, + JavaScriptCore/wtf/DisallowCType.h, + JavaScriptCore/wtf/Locker.h, + JavaScriptCore/wtf/MainThread.*, + JavaScriptCore/wtf/MallocZoneSupport.h, + JavaScriptCore/wtf/MessageQueue.h, + JavaScriptCore/wtf/Threading.h, + JavaScriptCore/wtf/ThreadingGtk.cpp, + JavaScriptCore/wtf/ThreadingNone.cpp, + JavaScriptCore/wtf/ThreadingPthreads.cpp, + JavaScriptCore/wtf/ThreadingQt.cpp, + JavaScriptCore/wtf/ThreadingWin.cpp, + JavaScriptCore/wtf/ThreadSpecific.h, + JavaScriptCore/wtf/mac/MainThreadMac.mm, + JavaScriptCore/wtf/gtk/MainThreadGtk.cpp, + JavaScriptCore/wtf/qt/MainThreadQt.cpp, + JavaScriptCore/wtf/unicode/Collator.h, + JavaScriptCore/wtf/unicode/CollatorDefault.cpp + JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp, + JavaScriptCore/wtf/win/MainThreadWin.cpp, + JavaScriptCore/wtf/wx/MainThreadWx.cpp, + JavaScriptGlue/*, + WebCore/DerivedSources.make, + WebCore/WebCore.vcproj/migrate-idls.sh, + WebCore/bindings/js/JSAttrCustom.cpp, + WebCore/bindings/js/JSCanvasPixelArrayCustom.cpp, + WebCore/bindings/js/JSClipboardCustom.cpp, + WebCore/bindings/js/JSCustomSQL*, + WebCore/bindings/js/JSCustomVoidCallback.*, + WebCore/bindings/js/JSDatabaseCustom.cpp, + WebCore/bindings/js/JSHistoryCustom.cpp, + WebCore/bindings/js/JSEventCustom.cpp, + WebCore/bindings/js/JSHTMLFrameElementCustom.cpp, + WebCore/bindings/js/JSHTMLIFrameElementCustom.cpp, + WebCore/bindings/js/JSHTMLSelectElementCustom.h, + WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp, + WebCore/bindings/js/JSSQLTransactionCustom.cpp, + WebCore/bindings/js/JSXMLHttpRequestCustom.cpp, + WebCore/bindings/js/JSXSLTProcessorCustom.cpp, + WebCore/bindings/js/StringSourceProvider.h, + WebCore/bindings/objc/DOMAbstractView.mm, + WebCore/bindings/objc/DOMAbstractViewFrame.h, + WebCore/bridge/npruntime.h, + WebCore/dom/ClassNodeList.*, + WebCore/dom/Clipboard.idl, + WebCore/dom/DOMCoreException.idl, + WebCore/dom/DOMCoreException.h, + WebCore/dom/EventException.idl, + WebCore/dom/EventException.h, + WebCore/dom/ExceptionBase.*, + WebCore/dom/SelectorNodeList.*, + WebCore/dom/StaticNodeList.*, + WebCore/dom/make_names.pl, + WebCore/editing/SmartReplace*, + WebCore/history/CachedPagePlatformData.h, + WebCore/html/CanvasPixelArray.*, + WebCore/html/HTMLTableRowsCollection.*, + WebCore/html/ImageData.*, + WebCore/loader/archive/*, + WebCore/loader/DocumentLoader.*, + WebCore/loader/FormState.*, + WebCore/loader/FrameLoader*, + WebCore/loader/MainResourceLoader.*, + WebCore/loader/NavigationAction.*, + WebCore/loader/NetscapePlugInStreamLoader.*, + WebCore/loader/ResourceLoader.*, + WebCore/loader/SubresourceLoader*, + WebCore/loader/icon/IconDatabaseClient.h, + WebCore/loader/icon/IconRecord.*, + WebCore/loader/icon/PageURLRecord.*, + WebCore/loader/mac/*, + WebCore/page/AccessibilityObject.*, + WebCore/page/AccessibilityListBox.*, + WebCore/page/AccessibilityListBoxOption.*, + WebCore/page/AccessibilityRenderObject.*, + WebCore/page/AnimationController.*, + WebCore/page/AXObjectCache.cpp, + WebCore/page/BarInfo.*, + WebCore/page/Console.*, + WebCore/page/DOMSelection.*, + WebCore/page/InspectorController.*, + WebCore/page/JavaScriptDebugListener.h, + WebCore/page/JavaScriptDebugServer.*, + WebCore/page/Location.*, + WebCore/page/Screen.*, + WebCore/page/WindowFeatures.h, + WebCore/page/inspector/*, + WebCore/page/mac/AccessibilityObjectWrapper.*, + WebCore/page/mac/PageMac.cpp, + WebCore/platform/AutodrainedPool.h, + WebCore/platform/FileChooser.*, + WebCore/platform/FileSystem.h, + WebCore/platform/FloatConversion.h, + WebCore/platform/SecurityOrigin.*, + WebCore/platform/SecurityOriginHash.h, + WebCore/platform/cf/FileSystemCF.cpp, + WebCore/platform/cf/SchedulePair.*, + WebCore/platform/cf/SharedBufferCF.cpp, + WebCore/platform/graphics/FontCache.*, + WebCore/platform/graphics/FontFallbackList.cpp, + WebCore/platform/graphics/FontDescription.cpp, + WebCore/platform/graphics/Glyph*, + WebCore/platform/graphics/SimpleFontData.cpp, + WebCore/platform/graphics/StringTruncator.*, + WebCore/platform/graphics/gtk/FontDataGtk.cpp, + WebCore/platform/graphics/gtk/FontCacheGtk.cpp, + WebCore/platform/graphics/gtk/GlyphPageTreeNodeGtk.cpp, + WebCore/platform/graphics/gtk/GlyphPageTreeNodePango.cpp, + WebCore/platform/graphics/gtk/IconGtk.cpp, + WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp, + WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp, + WebCore/platform/graphics/mac/ColorMac.h, + WebCore/platform/graphics/mac/FontCacheMac.mm, + WebCore/platform/graphics/mac/FontDataMac.mm, + WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp, + WebCore/platform/graphics/mac/SimpleFontDataMac.mm, + WebCore/platform/graphics/win/ColorSafari.cpp, + WebCore/platform/graphics/win/FontCacheWin.cpp, + WebCore/platform/graphics/win/FontDataWin.cpp, + WebCore/platform/graphics/win/FontDatabase.*, + WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp, + WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp, + WebCore/platform/graphics/win/SimpleFontDataWin.cpp, + WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp, + WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp, + WebCore/platform/graphics/win/UniscribeController.*, + WebCore/platform/graphics/wx/FontCacheWx.cpp, + WebCore/platform/graphics/wx/FontDataWx.cpp, + WebCore/platform/graphics/wx/FontPlatformData.h, + WebCore/platform/graphics/wx/GlyphMapWx.cpp, + WebCore/platform/graphics/wx/SimpleFontDataWx.cpp, + WebCore/platform/gtk/ContextMenuGtk.cpp, + WebCore/platform/gtk/ContextMenuItemGtk.cpp, + WebCore/platform/gtk/PasteboardGtk.cpp, + WebCore/platform/gtk/SearchPopupMenuGtk.cpp, + WebCore/platform/mac/AutodrainedPool.mm, + WebCore/platform/mac/FileChooserMac.mm, + WebCore/platform/mac/SchedulePairMac.mm, + WebCore/platform/mac/SoftLinking.h, + WebCore/platform/mac/Threading.mm, + WebCore/platform/mac/WebCoreNSStringExtras.*, + WebCore/platform/mac/WebCoreObjCExtras.*, + WebCore/platform/mac/WebFontCache.mm, + WebCore/platform/network/HTTPParsers.*, + WebCore/platform/network/cf/FormDataStreamCFNet.*, + WebCore/platform/network/mac/FormDataStreamMac.*, + WebCore/platform/network/mac/WebCoreURLResponse.*, + WebCore/platform/posix/FileSystemPOSIX.cpp, + WebCore/platform/qt/FileSystemQt.cpp + WebCore/platform/qt/PlatformScreenQt.cpp, + WebCore/platform/qt/ThreadingQt.cpp, + WebCore/platform/sql/SQLValue.*, + WebCore/platform/sql/SQLiteAuthorizer.*, + WebCore/platform/text/StringBuffer.h, + WebCore/platform/text/StringBuilder.*, + WebCore/platform/text/mac/make-charset-table.pl, + WebCore/platform/win/FileSystemWin.cpp, + WebCore/platform/win/GDIObjectCounter.*, + WebCore/platform/win/MutexWin.cpp, + WebCore/platform/win/SharedBufferWin.cpp, + WebCore/platform/win/SoftLinking.h, + WebCore/platform/win/WindowMessageBroadcaster.*, + WebCore/platform/win/WindowMessageListener.h, + WebCore/platform/wx/ThreadingWx.cpp, + WebCore/rendering/MediaControlElements.*, + WebCore/rendering/RenderListBox.*, + WebCore/rendering/RenderReplica.*, + WebCore/storage/*, + WebCore/xml/XMLHttpRequest.idl, + WebCore/xml/XMLHttpRequestException.h, + WebCore/xml/XMLHttpRequestException.idl, + WebCore/xml/XPathException.h, + WebCore/xml/XPathException.idl, + WebCore/xml/XSLTUnicodeSort.*, + WebKit/qt/WebCoreSupport/InspectorClientQt.*, + WebKitTools/BuildSlaveSupport/*, + WebKitTools/CodeCoverage/*, + WebKitTools/DumpRenderTree/*, + WebKitTools/Scripts/*, + WebKitTools/WebKitLauncher/*, + WebKitTools/FindSafari/*, + WebKitTools/wx/browser/browser.bkl, + WebKitTools/wx/install-unix-extras, + WebKit/*, + WebKit/gtk/*, + WebKit/win/DOMCreateInstance.*, + WebKit/win/ForEachCoClass.h, + WebKit/win/GEN_DOMObject.*, + WebKit/win/WebDatabaseManager.*, + WebKit/win/WebDragClient.h, + WebKit/win/WebInspector.*, + WebKit/win/WebInspectorClient.*, + WebKit/win/WebKit.vcproj/FixMIDLHeaders.pl, + WebKit/win/WebKit.vcproj/build-generated-files.sh, + WebKit/win/WebKitLogging.*, + WebKit/win/WebKitPrefix.*, + WebKit/win/WebKitStatistics*, + WebKit/win/WebKitSystemBits.*, + WebKit/win/WebPreferenceKeysPrivate.h, + WebKit/win/WebScriptCallFrame.*, + WebKit/win/WebTextRenderer.*, + WebKit/win/WebNodeHighlight.*, + WebKit/win/Interfaces/IWebIconFetcher.idl, + WebKit/win/Interfaces/IWebMutableURLRequestPrivate.idl, + WebKit/win/Interfaces/IWebSecurityOrigin.idl, + WebKit/win/WebCoreSupport/FormValuesPropertyBag.*, + WebKit/win/WebCoreSupport/WebFrameLoaderClient.*, + WebKit/win/WebCoreSupport/WebInspectorDelegate.cpp, + WebKit/wx/WebViewPrivate.h +Copyright: © 2003, 2005, 2006, 2007, 2008 Apple Inc. + © 2006, 2007 Holger Hans Peter Freyther + © 2004, Apple Computer, Inc. and The Mozilla Foundation + © 2006 Samuel Weinig + © 2006, 2007 Trolltech ASA + © 2006 Alexey Proskuryakov (ap@nypop.com) + © 2007 Matt Lilek (pewtermoose@gmail.com) + © 2006 Michael Emmel mike.emmel@gmail.com + © 2007, 2008 Alp Toker + © 2006, 2007 Kevin Ollivier + © 2006 Mark Rowe + © 2004, 2005, 2006 Nathaniel Smith + © 2006, 2007 David Smith (catfish.man@gmail.com) + © 2006, 2007 Vladimir Olexa (vladimir.olexa@gmail.com) + © 2006 Nikolas Zimmermann + © 2006 Jonas Witt + © 2006 Eric Seidel (eric@webkit.org) + © 2006 Graham Dennis + © 2007 Staikos Computing Services, Inc. + © 2007 Brent Fulgham + © 2007 Justin Haygood (jhaygood@reaktix.com) + © 2008 Cameron Zwarich (cwzwarich@uwaterloo.ca) + © 2008 Tony Chang +License: BSD-3 + 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. + 3. Neither the name of Apple, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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. + +Files: WebCore/bridge/qt/*, + WebCore/page/Chrome.*, + WebCore/page/ChromeClient.h, + WebCore/page/Frame.*, + WebCore/page/FramePrivate.h, + WebCore/page/FrameTree.*, + WebCore/page/FrameView.*, + WebCore/page/MouseEventWithHitTestResults.*, + WebCore/page/Navigator.*, + WebCore/page/Page.*, + WebCore/page/Plugin.h, + WebCore/page/PrintContext.*, + WebCore/page/WindowFeatures.cpp, + WebCore/page/gtk/AXObjectCacheAtk.cpp, + WebCore/page/gtk/AccessibilityObjectWrapperAtk.*, + WebCore/page/mac/ChromeMac.mm, + WebCore/platform/PopupMenuClient.h, + WebCore/platform/PopupMenu.h, + WebCore/platform/SearchPopupMenu.h, + WebCore/platform/Shared.h, + WebCore/platform/StaticConstructors.h, + WebCore/platform/TreeShared.h, + WebCore/platform/graphics/FloatPoint3D.*, + WebCore/platform/graphics/Font.cpp, + WebCore/platform/graphics/Font.h, + WebCore/platform/graphics/FontDescription.h, + WebCore/platform/graphics/FontFallbackList.h, + WebCore/platform/graphics/Icon.h, + WebCore/platform/graphics/IntSizeHash.h, + WebCore/platform/graphics/PathTraversalState.cpp, + WebCore/platform/graphics/SimpleFontData.h, + WebCore/platform/graphics/cairo/CairoPath.h, + WebCore/platform/graphics/cairo/PathCairo.cpp, + WebCore/platform/graphics/gtk/FontPlatformData.h, + WebCore/platform/graphics/gtk/FontPlatformDataGtk.cpp, + WebCore/platform/graphics/gtk/FontPlatformDataPango.cpp, + WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.*, + WebCore/platform/graphics/gtk/PopupMenuGtk.cpp, + WebCore/platform/graphics/gtk/RenderThemeGtk.*, + WebCore/platform/graphics/gtk/VideoSinkGStreamer.*, + WebCore/platform/graphics/mac/FontCustomPlatformData.*, + WebCore/platform/graphics/mac/FontMac.mm, + WebCore/platform/graphics/mac/FontPlatformData.h, + WebCore/platform/graphics/mac/FontPlatformDataMac.mm, + WebCore/platform/graphics/mac/IconMac.mm, + WebCore/platform/graphics/qt/FontCacheQt.cpp, + WebCore/platform/graphics/qt/FontCustomPlatformData.*, + WebCore/platform/graphics/qt/FontDataQt.cpp, + WebCore/platform/graphics/qt/FontPlatformData.h, + WebCore/platform/graphics/qt/FontQt.cpp, + WebCore/platform/graphics/qt/GlyphPageTreeNodeQt.cpp, + WebCore/platform/graphics/qt/IconQt.cpp, + WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.*, + WebCore/platform/graphics/qt/SimpleFontDataQt.cpp, + WebCore/platform/graphics/win/FontCustomPlatformData.*, + WebCore/platform/graphics/win/FontCustomPlatformDataCairo.*, + WebCore/platform/graphics/win/FontPlatformData.h, + WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp, + WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp, + WebCore/platform/graphics/win/IconWin.cpp, + WebCore/platform/gtk/CursorGtk.h, + WebCore/platform/gtk/EventLoopGtk.cpp, + WebCore/platform/gtk/PasteboardHelper.h, + WebCore/platform/mac/LocalCurrentGraphicsContext.*, + WebCore/platform/mac/PopupMenuMac.mm, + WebCore/platform/mac/SearchPopupMenuMac.mm, + WebCore/platform/network/FormData.*, + WebCore/platform/network/curl/CookieJarCurl.cpp, + WebCore/platform/network/soup/CookieJarSoup.cpp, + WebCore/platform/network/qt/QNetworkReplyHandler.*, + WebCore/platform/network/qt/ResourceRequestQt.cpp, + WebCore/platform/network/soup/ResourceHandleSoup.cpp, + WebCore/platform/qt/EventLoopQt.cpp, + WebCore/platform/qt/FileChooserQt.cpp, + WebCore/platform/qt/KURLQt.cpp, + WebCore/platform/qt/LoggingQt.cpp, + WebCore/platform/qt/MenuEventProxy.h, + WebCore/platform/qt/PopupMenuQt.cpp, + WebCore/platform/qt/QWebPopup.*, + WebCore/platform/qt/RenderThemeQt.*, + WebCore/platform/qt/SearchPopupMenuQt.cpp, + WebCore/platform/qt/WheelEventQt.cpp, + WebCore/platform/qt/html4-adjustments-qt.css, + WebCore/platform/text/AtomicString.*, + WebCore/platform/text/AtomicStringImpl.h, + WebCore/platform/text/Base64.cpp, + WebCore/platform/text/BidiContext.*, + WebCore/platform/text/BidiResolver.h, + WebCore/platform/text/ParserUtilities.h, + WebCore/platform/text/PlatformString.h, + WebCore/platform/text/String.cpp, + WebCore/platform/text/SegmentedString.*, + WebCore/platform/text/StringHash.h, + WebCore/platform/text/StringImpl.*, + WebCore/platform/text/TextBreakIterator.h, + WebCore/platform/text/TextBreakIteratorICU.cpp, + WebCore/platform/text/TextBreakIteratorInternalICU.h, + WebCore/platform/text/cf/StringCF.cpp, + WebCore/platform/text/cf/StringImplCF.cpp, + WebCore/platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp, + WebCore/platform/text/mac/StringImplMac.mm, + WebCore/platform/text/mac/StringMac.mm, + WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm, + WebCore/platform/text/qt/TextBreakIteratorQt.cpp, + WebCore/platform/text/win/TextBreakIteratorInternalICUWin.cpp, + WebCore/platform/win/PopupMenuWin.cpp, + WebCore/platform/win/SearchPopupMenuWin.cpp, + WebCore/platform/wx/PopupMenuWx.cpp, + WebCore/svg/SVGAngle.idl, + WebCore/svg/SVGColor.idl, + WebCore/svg/SVGDocument.idl, + WebCore/svg/SVGElement.idl, + WebCore/svg/SVGException.idl, + WebCore/svg/SVGFontData.*, + WebCore/svg/SVGHKernElement.idl, + WebCore/svg/SVGLength.idl, + WebCore/svg/SVGMatrix.idl, + WebCore/svg/SVGMetadataElement.idl, + WebCore/svg/SVGNumber.idl, + WebCore/svg/SVGPoint.idl, + WebCore/svg/SVGRect.idl, + WebCore/svg/SVGSVGElement.idl, + WebCore/svg/SVGTransform.idl, + WebCore/svg/graphics/SVGResourceFilter.*, + WebCore/svg/graphics/cg/SVGPaintServerCg.cpp, + WebCore/svg/graphics/cg/SVGPaintServerGradientCg.cpp, + WebCore/svg/graphics/cg/SVGPaintServerPatternCg.cpp, + WebCore/svg/graphics/cg/SVGPaintServerSolidCg.cpp, + WebCore/svg/graphics/filters/*, + WebCore/svg/graphics/filters/cg/SVG*, + WebCore/svg/graphics/qt/*, + WebCore/xml/DOMParser.*, + WebCore/xml/XMLSerializer.*, + WebCore/xml/XPathEvaluator.idl, + WebCore/xml/XPathExpression.idl, + WebCore/xml/XPathNSResolver.idl, + WebCore/xml/XPathResult.idl, + WebCore/xml/XSL*, + WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.*, + WebKit/gtk/webkit/*, + WebKit/qt, + * +Copyright: © 2002, 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. + © 1991, 1999 Free Software Foundation, Inc. + © 1997 Martin Jones (mjones@kde.org) + © 1998, 1999 Torben Weis + © 1998-2003, 2006 Lars Knoll (knoll@kde.org) + © 1999-2004 Harri Porten (porten@kde.org) + © 1999, 2001 Antti Koivisto (koivisto@kde.org) + © 1999, 2002 Waldo Bastian (bastian@kde.org) + © 2000-2001 Dawit Alemayehu + © 2000 Daniel Molkentin (molkentin@kde.org) + © 2000-2003 Dirk Mueller (mueller@kde.org) + © 2000 Frederik Holljen (frederik.holljen@hig.no) + © 2000, 2001, 2003 Peter Kelly (pmk@post.com) + © 2000 Malte Starostik + © 2000 Simon Hausmann + © 2000 Stefan Schimanski (schimmi@kde.org) + © 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) + © 2001 Tim Copperfield + © 2002, 2003 The Karbon Developers + © 2002 Cyrus Patel + © 2004, 2005, 2006, 2007 Nikolas Zimmermann + © 2004, 2005, 2006, 2007 Rob Buis + © 2004, 2005 Allan Sandfeld Jensen (kde@carewolf.com) + © 2004, 2006 Zack Rusin + © 2004 Michal Zalewski + © 2005, 2006 Alexander Kellett + © 2005, 2006, 2007 Alexey Proskuryakov + © 2005, 2006 Oliver Hunt + © 2006, 2007 Eric Seidel (eric@webkit.org) + © 2006, 2007 Samuel Weinig + © 2006 Anders Carlsson + © 2006 Andrew Wellington (proton@wiretapped.net) + © 2006 Bjoern Graf (bjoern.graf@gmail.com) + © 2006 Enrico Ros + © 2006 George Staikos + © 2006 Graham Dennis (graham.dennis@gmail.com) + © 2006 James G. Speth (speth@end.com) + © 2006 Jon Shier (jshier@iastate.edu) + © 2006, 2007 Maks Orlovich + © 2006 Michael Emmel + © 2006, 2008 Trolltech ASA + © 2007, 2008 Alp Toker + © 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) + © 2007 Holger Hans Peter Freyther + © 2007 Krzysztof Kowalczyk + © 2007 Staikos Computing Services Inc. + © 2007 David Smith (catfish.man@gmail.com) + © 2007, 2008 Collabora, Ltd. + © 2007 OpenedHand + © 2007 Christian Dywan + © 2007 Luca Bruno + © 2008 Xan Lopez + © 2008 Nuanti Ltd + © 2007 Christian Dywan +License: LGPL-2+ (/usr/share/common-licenses/LGPL-2) + +Files: WebCore/bridge/npruntime_internal.h +Copyright: © 2007 Collabora, Ltd. +License: LGPL-2.1+ (/usr/share/common-licenses/LGPL-2) + +Files: JavaScriptCore/kjs/DateMath.*, + WebCore/bridge/npapi.h, + WebCore/html/HTMLDocument.cpp, + WebCore/platform/Arena.*, + WebCore/platform/gtk/gtk2drawing.c, + WebCore/platform/gtk/gtkdrawing.h, + WebCore/platform/image-decoders/gif/GIFImageReader.*, + WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp, + WebCore/platform/image-decoders/png/PNGImageDecoder.cpp, + WebCore/platform/image-decoders/zlib/mozzconf.h, + WebCore/platform/text/UnicodeRange.*, + WebCore/plugins/gtk/gtk2xtbin.*, + WebCore/plugins/gtk/xembed.h, + WebCore/rendering/RenderArena.*, + WebCore/rendering/RenderLayer.* +Copyright: © 1998, 2001-2006 mozilla.org + © 1999, 2000 Harri Porten (porten@kde.org) + © 2003, 2004, 2005, 2006, 2007 Apple Inc. + © 1998-2000, 2002 Netscape Communications Corporation. + © 1999 Lars Knoll (knoll@kde.org) + © 1999 Antti Koivisto (koivisto@kde.org) + © 2004 IBM Corporation + © 2002 Sun Microsystems, Inc. +License: LGPL-2.1+ (/usr/share/common-licenses/LGPL-2) | GPL-2+ (/usr/share/common-licenses/GPL-2) | MPL-1.1 + Other contributors for this code include: + - Boris Zbarsky + - Brian Ryner + - Chris Saari + - Christian Biesinger + - David Baron + - Jeff Hostetler + - Josh Soref + - Michael Ventnor + - Nick Blievers + - Pierre Chanial + - Raffaele Sena + - Randall Jesup + - Robert O'Callahan + - Roland Mainz + - Stuart Parmenter + - Tom Rini + +Files: JavaScriptCore/pcre/* +Copyright: © 1997-2005 University of Cambridge + © 2002, 2004, 2005, 2006, 2007 Apple Inc. +License: BSD-3 + 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 the University of Cambridge 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. + +Files: JavaScriptCore/kjs/dtoa.cpp +Copyright: © 1991, 2000, 2001 Lucent Technologies +License: other + Permission to use, copy, modify, and distribute this software for any + purpose without fee is hereby granted, provided that this entire notice + is included in all copies of any software which is or includes a copy + or modification of this software and in all copies of the supporting + documentation for such software. + . + THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY + REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + +Files: JavaScriptCore/wtf/FastMalloc.cpp, + JavaScriptCore/wtf/TC* +Copyright: © 2005, 2007 Google Inc. +License: BSD-3 + 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. + +Files: WebCore/platform/text/symbian/StringImplSymbian.* +Copyright: © 2006 Nokia Corporation +License: BSD-3 + 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 the Nokia Corporation 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. + +Files: JavaScriptCore/icu/*, + JavaScriptGlue/icu/*, + WebCore/icu/*, + WebKit/mac/icu/*, +Copyright: © 1995-2006 International Business Machines Corporation and others +License: other + Permission is hereby granted, free of charge, to any person obtaining a copy of this + software and associated documentation files (the "Software"), to deal in the Software + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, and/or sell copies of the Software, and to permit persons + to whom the Software is furnished to do so, provided that the above copyright notice(s) + and this permission notice appear in all copies of the Software and that both the above + copyright notice(s) and this permission notice appear in supporting documentation. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER + OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR + CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + . + Except as contained in this notice, the name of a copyright holder shall not be used in + advertising or otherwise to promote the sale, use or other dealings in this Software + without prior written authorization of the copyright holder. + +Files: WebCore/platform/image-decoders/zlib/* +Copyright: © 1995-2005 Mark Adler + © 1995-2005 Jean-loup Gailly +License: other + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + . + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + . + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + +Files: WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c, + WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp, + WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp, + WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h, + WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.cpp, + WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/TestObject.h, + WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp +Copyright: © Apple Inc. +License: other + IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in + consideration of your agreement to the following terms, and your use, installation, + modification or redistribution of this Apple software constitutes acceptance of these + terms. If you do not agree with these terms, please do not use, install, modify or + redistribute this Apple software. + . + In consideration of your agreement to abide by the following terms, and subject to these + terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in + this original Apple software (the "Apple Software"), to use, reproduce, modify and + redistribute the Apple Software, with or without modifications, in source and/or binary + forms; provided that if you redistribute the Apple Software in its entirety and without + modifications, you must retain this notice and the following text and disclaimers in all + such redistributions of the Apple Software. Neither the name, trademarks, service marks + or logos of Apple Computer, Inc. may be used to endorse or promote products derived from + the Apple Software without specific prior written permission from Apple. Except as expressly + stated in this notice, no other rights or licenses, express or implied, are granted by Apple + herein, including but not limited to any patent rights that may be infringed by your + derivative works or by other works in which the Apple Software may be incorporated. + . + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, + EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS + USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. + . + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, + REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND + WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR + OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Files: WebKitTools/iExploder/* +Copyright: © 2005 Thomas Stromberg +License: other + This software is provided 'as-is', without any express or implied warranty. + In no event will the authors be held liable for any damages arising from the + use of this software. + . + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + . + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software in a + product, an acknowledgment in the product documentation would be appreciated + but is not required. + . + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + . + 3. This notice may not be removed or altered from any source distribution. + +Files: WebKitTools/Scripts/prepare-ChangeLog +Copyright: © 2000, 2001 Eazel, Inc. + © 2002, 2003, 2004, 2005, 2006, 2007 Apple Inc. +License: GPL-2+ (/usr/share/common-licenses/GPL-2) + +Files: WebCore/bindings/scripts/XMLTiny.pm +Copyright: © 2007 David Cantrell +License: other + This program is free software; you can redistribute it and/or modify + it under the terms of either: + . + a) the GNU General Public License as published by the Free + Software Foundation; either version 1, or (at your option) any + later version, or + b) the "Artistic License" which comes with this Kit. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either + the GNU General Public License or the Artistic License for more details. + . + You should have received a copy of the Artistic License with this + Kit, in the file named "Artistic". If not, I'll be glad to provide one. + . + You should also have received a copy of the GNU General Public License + along with this program in the file named "Copying". If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307, USA or visit their web page on the internet at + http://www.gnu.org/copyleft/gpl.html. + . + For those of you that choose to use the GNU General Public License, + my interpretation of the GNU General Public License is that no Perl + script falls under the terms of the GPL unless you explicitly put + said script under the terms of the GPL yourself. Furthermore, any + object code linked with perl does not automatically fall under the + terms of the GPL, provided such object code only adds definitions + of subroutines and variables, and does not otherwise impair the + resulting interpreter from executing any standard Perl script. I + consider linking in C subroutines in this manner to be the moral + equivalent of defining subroutines in the Perl language itself. You + may sell such an object file as proprietary provided that you provide + or offer to provide the Perl source, as specified by the GNU General + Public License. (This is merely an alternate way of specifying input + to the program.) You may also sell a binary produced by the dumping of + a running Perl script that belongs to you, provided that you provide or + offer to provide the Perl source as specified by the GPL. (The + fact that a Perl interpreter and your code are in the same binary file + is, in this case, a form of mere aggregation.) This is my interpretation + of the GPL. If you still have concerns or difficulties understanding + my intent, feel free to contact me. Of course, the Artistic License + spells all this out for your protection, so you may prefer to use that. + +Files: WebKitLibraries/WebCoreSQLite3 +Copyright: © 2001, 2006 +License: other + The author disclaims copyright to this source code. In place of + a legal notice, here is a blessing: + . + May you do good and not evil. + May you find forgiveness for yourself and forgive others. + May you share freely, never taking more than you give. + +Files: acinclude.m4 +Copyright: © 2007, 2008 Josh Triplett +License: other + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. diff -Naur WebKit-r41128/debian/files WebKit-r41137-nx/debian/files --- WebKit-r41128/debian/files 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/debian/files 2009-07-26 07:42:26.595074568 -0400 @@ -0,0 +1,3 @@ +libwebkit-dev_1.0-svn41137-13_all.deb libdevel extra +libwebkit-1.0-1_1.0-svn41137-13_armel.deb user/other optional +libwebkit-1.0-1-dbg_1.0-svn41137-13_armel.deb libdevel extra diff -Naur WebKit-r41128/debian/libwebkit-1.0-1.install WebKit-r41137-nx/debian/libwebkit-1.0-1.install --- WebKit-r41128/debian/libwebkit-1.0-1.install 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/debian/libwebkit-1.0-1.install 2009-02-23 16:01:26.000000000 -0500 @@ -0,0 +1,4 @@ +usr/lib/libwebkit-1.0.so.* +usr/lib/webkit-1.0/libexec/GtkLauncher +usr/lib/webkit-1.0/libexec/DumpRenderTree +usr/share/webkit-1.0/* diff -Naur WebKit-r41128/debian/libwebkit-dev.install WebKit-r41137-nx/debian/libwebkit-dev.install --- WebKit-r41128/debian/libwebkit-dev.install 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/debian/libwebkit-dev.install 2009-02-23 16:01:26.000000000 -0500 @@ -0,0 +1,3 @@ +usr/lib/libwebkit-1.0.so +usr/include/webkit-1.0 +usr/lib/pkgconfig/webkit-1.0.pc diff -Naur WebKit-r41128/debian/rules WebKit-r41137-nx/debian/rules --- WebKit-r41128/debian/rules 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/debian/rules 2009-07-13 04:22:30.954953328 -0400 @@ -0,0 +1,103 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export LC_ALL=en_US + +CFLAGS = -g -Wall + +ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O2 +#-mfpu=vfp -mfloat-abi=softfp +else + CFLAGS += -O0 +endif + +ifeq ($(DEB_BUILD_ARCH),alpha) + CFLAGS += -Wl,--no-relax +endif + +clean: + dh_testdir + dh_testroot + + rm -f build-stamp install-stamp + # comment out next line for fast rebuilds + rm -rf build + + rm -f GNUmakefile.in INSTALL README aclocal.m4 aconfig.h.in compile config.guess config.sub configure depcomp install-sh ltmain.sh missing + rm -rf autom4te.cache + + dh_clean + +build: build-stamp + +build-stamp: + dh_testdir + +# CPPFLAGS="-DMOBILE=1" + [ ! -d build ] && mkdir build || true + cd build && \ + CFLAGS="$(CFLAGS)" \ + CXXFLAGS="$(CFLAGS)" \ + CC="gcc -Wl,--as-needed" \ + CXX="g++ -Wl,--as-needed" \ + ../autogen.sh --prefix=/usr --with-hildon --with-unicode-backend=glib --disable-dashboard-support --enable-optimizations --enable-workers --with-http-backend=curl --enable-video --enable-offline-web-applications + + $(MAKE) -j5 -C build + + touch $@ + +install: install-stamp + +install-stamp: build-stamp + dh_testdir + dh_testroot + + dh_clean -k + + $(MAKE) -j5 -C build install DESTDIR="$(CURDIR)"/debian/tmp + [ ! -d debian/tmp/usr/lib/webkit-1.0/libexec ] && install -d -m 755 debian/tmp/usr/lib/webkit-1.0/libexec || true + build/libtool --mode=install install -m 755 build/Programs/DumpRenderTree "$(CURDIR)"/debian/tmp/usr/lib/webkit-1.0/libexec/DumpRenderTree + build/libtool --mode=install install -m 755 build/Programs/GtkLauncher "$(CURDIR)"/debian/tmp/usr/lib/webkit-1.0/libexec/GtkLauncher + + touch $@ + +# Build architecture-independent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_installdocs -i + dh_installchangelogs -i + dh_install -i --sourcedir=debian/tmp + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs -a + dh_installchangelogs -a + dh_install -a --sourcedir=debian/tmp + dh_link -a + # dh_strip -a --dbg-package=libwebkit-1.0-1 + dh_strip -a + dh_compress -a + dh_fixperms -a + dh_makeshlibs -a -V 'libwebkit-1.0-1 (>= 1.0)' -- -c4 + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-indep binary-arch + +.PHONY: build clean install binary binary-indep binary-arch diff -Naur WebKit-r41128/debian/shlibs.local WebKit-r41137-nx/debian/shlibs.local --- WebKit-r41128/debian/shlibs.local 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/debian/shlibs.local 2009-03-25 03:31:31.000000000 -0400 @@ -0,0 +1 @@ +libfreetype 6 libfreetype6 (>= 2.2) diff -Naur WebKit-r41128/GNUmakefile.am WebKit-r41137-nx/GNUmakefile.am --- WebKit-r41128/GNUmakefile.am 2009-02-20 22:38:12.000000000 -0500 +++ WebKit-r41137-nx/GNUmakefile.am 2009-07-19 14:54:17.471045791 -0400 @@ -31,6 +31,7 @@ # Directory for autogenerated sources GENSOURCES := $(top_builddir)/DerivedSources +GENSOURCESGOBJECT := $(top_builddir)/DerivedSources/webkit GENPROGRAMS := $(top_builddir)/Programs # Script for creating hash tables @@ -50,8 +51,15 @@ # Global flags to CPP global_cppflags := +if USE_ICU_UNICODE global_cppflags += \ -DWTF_USE_ICU_UNICODE=1 +endif + +if USE_GLIB_UNICODE +global_cppflags += \ + -DWTF_USE_GLIB_UNICODE=1 +endif # Default compiler flags global_cflags := \ @@ -103,7 +111,8 @@ -I$(srcdir)/JavaScriptCore/ForwardingHeaders \ -I$(srcdir)/JavaScriptCore/parser \ -I$(srcdir)/JavaScriptCore/wtf \ - -I$(top_builddir)/DerivedSources + -I$(top_builddir)/DerivedSources \ + -I$(srcdir)/WebCore/bindings/webkit # The variables above are already included below so no need to touch # these variables unless you really have to @@ -150,6 +159,11 @@ webcoregtk_cppflags := webcoregtk_sources := +webcoregtk_cppflags += \ + -I$(top_builddir)/DerivedSources/webkit \ + -I$(srcdir)/WebCore/bindings \ + -I$(srcdir)/WebCore/bindings/gobject + nodist_EXTRA_libWebCore_la_SOURCES = \ $(webcore_built_nosources) @@ -194,6 +208,7 @@ libWebCore_la_LIBADD = \ libJavaScriptCore.la \ libWebCoreJS.la \ + libgobject.la \ $(webcore_libadd) \ $(GLIB_LIBS) \ $(LIBXML_LIBS) \ @@ -214,6 +229,10 @@ $(GEOCLUE_LIBS) \ -lpthread +libgobject_ladir = $(prefix)/include/webkit-1.0/webkit +libgobject_la_HEADERS = \ + $(libgobject_h_api) + # WebKit webkitgtk_h_api := webkitgtk_sources := @@ -310,10 +329,13 @@ WebKit/gtk/webkit/webkitwebframe.h \ WebKit/gtk/webkit/webkitwebhistoryitem.h \ WebKit/gtk/webkit/webkitwebinspector.h \ + WebKit/gtk/webkit/webkitwebscriptevaluator.h \ + WebKit/gtk/webkit/webkitwebscriptelement.h \ WebKit/gtk/webkit/webkitwebnavigationaction.h \ WebKit/gtk/webkit/webkitwebpolicydecision.h \ WebKit/gtk/webkit/webkitwebsettings.h \ WebKit/gtk/webkit/webkitwebwindowfeatures.h \ + WebKit/gtk/webkit/webkitwebdownload.h \ WebKit/gtk/webkit/webkitwebview.h webkitgtk_built_sources += \ @@ -345,9 +367,11 @@ WebKit/gtk/webkit/webkitwebframe.cpp \ WebKit/gtk/webkit/webkitwebhistoryitem.cpp \ WebKit/gtk/webkit/webkitwebinspector.cpp \ + WebKit/gtk/webkit/webkitwebscriptelement.cpp \ WebKit/gtk/webkit/webkitwebnavigationaction.cpp \ WebKit/gtk/webkit/webkitwebpolicydecision.cpp \ WebKit/gtk/webkit/webkitwebsettings.cpp \ + WebKit/gtk/webkit/webkitwebdownload.cpp \ WebKit/gtk/webkit/webkitwebview.cpp \ WebKit/gtk/webkit/webkitwebwindowfeatures.cpp @@ -356,12 +380,14 @@ -I$(srcdir)/WebKit/gtk \ -I$(srcdir)/WebKit/gtk/WebCoreSupport \ -I$(srcdir)/WebKit/gtk/webkit \ - -I$(top_builddir)/WebKit/gtk/webkit + -I$(top_builddir)/WebKit/gtk/webkit \ + -I$(top_builddir)/DerivedSources webkitgtk_cleanfiles += \ $(top_builddir)/Programs/GtkLauncher \ $(top_builddir)/WebKit/gtk/webkit-1.0.pc \ - $(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h + $(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h \ + $(top_builddir)/libgobject.la pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc @@ -448,6 +474,52 @@ && cp xgen-gtc $@ \ && rm -f xgen-gtc +WebKit/gtk/webkit/gdomenumtypes.h: stamp-gdomenumtypes.h + @true +stamp-gdomenumtypes.h: $(libgdom_h_api) GNUmakefile + (cd $(srcdir) \ + && glib-mkenums \ + --fhead "#ifndef GDOM_ENUM_TYPES_H\n" \ + --fhead "#define GDOM_ENUM_TYPES_H\n\n" \ + --fhead "#include \n\n" \ + --fhead "G_BEGIN_DECLS\n\n" \ + --ftail "G_END_DECLS\n\n" \ + --ftail "#endif\n" \ + --fprod "#include <@filename@>\n\n" \ + --eprod "#define GDOM_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \ + --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \ + $(libgdom_h_api) | \ + sed 's,WebKit/gtk/,,' | \ + sed 's,web_kit,gdom,' | \ + sed 's,GDOM_TYPE_KIT,GDOM_TYPE,' \ + ) > xgen-cgth \ + && (cmp -s xgen-cgth WebKit/gtk/webkit/gdomenumtypes.h || cp xgen-cgth WebKit/gtk/webkit/gdomenumtypes.h) \ + && rm -f xgen-cgth \ + && echo timestamp > $(@F) + +DerivedSources/gdomenumtypes.cpp: $(libgdom_h_api) GNUmakefile + (cd $(srcdir) \ + && glib-mkenums \ + --fhead "#include \n" \ + --fhead "#include \n" \ + --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/gdomenumtypes.h\"\n\n" \ + --fhead "extern \"C\" {\n\n" \ + --fprod "\n/* enumerations from \"@filename@\" */" \ + --vhead "static const G@Type@Value _@enum_name@_values[] = {" \ + --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ + --vtail " { 0, NULL, NULL }\n};\n\n" \ + --vtail "GType @enum_name@_get_type(void)\n{\n" \ + --vtail " static GType type = 0;\n\n" \ + --vtail " if (!type)\n" \ + --vtail " type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \ + --vtail " return type;\n}\n\n" \ + --ftail "}\n" \ + $(libgdom_h_api) | \ + sed 's,web_kit,gdom,' \ + ) > xgen-cgtc \ + && cp xgen-cgtc $@ \ + && rm -f xgen-cgtc + # END WEBKIT GTK+ # # Files that will be distributed @@ -470,6 +542,7 @@ # Build unit test noinst_PROGRAMS += Programs/UnitTests Programs_UnitTests_CPPFLAGS = \ + -I$(srcdir)/WebCore/bindings \ -I$(srcdir)/WebKit/gtk \ -I$(top_builddir)/WebKit/gtk \ $(global_cppflags) \ @@ -497,7 +570,8 @@ $(webcore_built_sources) \ $(webcore_built_nosources) \ $(webkitgtk_built_sources) \ - $(webkitgtk_built_nosources) + $(webkitgtk_built_nosources) \ + $(gobject_built_nosources) # Project-wide clean rules CLEANFILES += \ diff -Naur WebKit-r41128/JavaScriptCore/API/JSContextRef.h WebKit-r41137-nx/JavaScriptCore/API/JSContextRef.h --- WebKit-r41128/JavaScriptCore/API/JSContextRef.h 2009-01-21 00:13:27.000000000 -0500 +++ WebKit-r41137-nx/JavaScriptCore/API/JSContextRef.h 2009-06-23 19:48:34.036477916 -0400 @@ -123,7 +123,7 @@ @param ctx The JSContext whose group you want to get. @result ctx's group. */ -JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) AVAILABLE_AFTER_WEBKIT_VERSION_3_1; +JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx); #ifdef __cplusplus } diff -Naur WebKit-r41128/JavaScriptCore/wtf/unicode/glib/CasefoldTableFromGLib.h WebKit-r41137-nx/JavaScriptCore/wtf/unicode/glib/CasefoldTableFromGLib.h --- WebKit-r41128/JavaScriptCore/wtf/unicode/glib/CasefoldTableFromGLib.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/JavaScriptCore/wtf/unicode/glib/CasefoldTableFromGLib.h 2009-02-23 16:01:26.000000000 -0500 @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2006 George Staikos + * Copyright (C) 2006 Alexey Proskuryakov + * Copyright (C) 2007 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2008 Dominik Röttsches + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef CasefoldTableFromGLib_h +#define CasefoldTableFromGLib_h + +#include + +// copied from GLib + +/* Table of casefolding cases that can't be derived by lowercasing + */ +static const struct { + guint16 ch; + gchar data[7]; +} casefold_table[] = { + { 0x00b5, "\xce\xbc" }, + { 0x00df, "\x73\x73" }, + { 0x0130, "\x69\xcc\x87" }, + { 0x0149, "\xca\xbc\x6e" }, + { 0x017f, "\x73" }, + { 0x01f0, "\x6a\xcc\x8c" }, + { 0x0345, "\xce\xb9" }, + { 0x0390, "\xce\xb9\xcc\x88\xcc\x81" }, + { 0x03b0, "\xcf\x85\xcc\x88\xcc\x81" }, + { 0x03c2, "\xcf\x83" }, + { 0x03d0, "\xce\xb2" }, + { 0x03d1, "\xce\xb8" }, + { 0x03d5, "\xcf\x86" }, + { 0x03d6, "\xcf\x80" }, + { 0x03f0, "\xce\xba" }, + { 0x03f1, "\xcf\x81" }, + { 0x03f5, "\xce\xb5" }, + { 0x0587, "\xd5\xa5\xd6\x82" }, + { 0x1e96, "\x68\xcc\xb1" }, + { 0x1e97, "\x74\xcc\x88" }, + { 0x1e98, "\x77\xcc\x8a" }, + { 0x1e99, "\x79\xcc\x8a" }, + { 0x1e9a, "\x61\xca\xbe" }, + { 0x1e9b, "\xe1\xb9\xa1" }, + { 0x1f50, "\xcf\x85\xcc\x93" }, + { 0x1f52, "\xcf\x85\xcc\x93\xcc\x80" }, + { 0x1f54, "\xcf\x85\xcc\x93\xcc\x81" }, + { 0x1f56, "\xcf\x85\xcc\x93\xcd\x82" }, + { 0x1f80, "\xe1\xbc\x80\xce\xb9" }, + { 0x1f81, "\xe1\xbc\x81\xce\xb9" }, + { 0x1f82, "\xe1\xbc\x82\xce\xb9" }, + { 0x1f83, "\xe1\xbc\x83\xce\xb9" }, + { 0x1f84, "\xe1\xbc\x84\xce\xb9" }, + { 0x1f85, "\xe1\xbc\x85\xce\xb9" }, + { 0x1f86, "\xe1\xbc\x86\xce\xb9" }, + { 0x1f87, "\xe1\xbc\x87\xce\xb9" }, + { 0x1f88, "\xe1\xbc\x80\xce\xb9" }, + { 0x1f89, "\xe1\xbc\x81\xce\xb9" }, + { 0x1f8a, "\xe1\xbc\x82\xce\xb9" }, + { 0x1f8b, "\xe1\xbc\x83\xce\xb9" }, + { 0x1f8c, "\xe1\xbc\x84\xce\xb9" }, + { 0x1f8d, "\xe1\xbc\x85\xce\xb9" }, + { 0x1f8e, "\xe1\xbc\x86\xce\xb9" }, + { 0x1f8f, "\xe1\xbc\x87\xce\xb9" }, + { 0x1f90, "\xe1\xbc\xa0\xce\xb9" }, + { 0x1f91, "\xe1\xbc\xa1\xce\xb9" }, + { 0x1f92, "\xe1\xbc\xa2\xce\xb9" }, + { 0x1f93, "\xe1\xbc\xa3\xce\xb9" }, + { 0x1f94, "\xe1\xbc\xa4\xce\xb9" }, + { 0x1f95, "\xe1\xbc\xa5\xce\xb9" }, + { 0x1f96, "\xe1\xbc\xa6\xce\xb9" }, + { 0x1f97, "\xe1\xbc\xa7\xce\xb9" }, + { 0x1f98, "\xe1\xbc\xa0\xce\xb9" }, + { 0x1f99, "\xe1\xbc\xa1\xce\xb9" }, + { 0x1f9a, "\xe1\xbc\xa2\xce\xb9" }, + { 0x1f9b, "\xe1\xbc\xa3\xce\xb9" }, + { 0x1f9c, "\xe1\xbc\xa4\xce\xb9" }, + { 0x1f9d, "\xe1\xbc\xa5\xce\xb9" }, + { 0x1f9e, "\xe1\xbc\xa6\xce\xb9" }, + { 0x1f9f, "\xe1\xbc\xa7\xce\xb9" }, + { 0x1fa0, "\xe1\xbd\xa0\xce\xb9" }, + { 0x1fa1, "\xe1\xbd\xa1\xce\xb9" }, + { 0x1fa2, "\xe1\xbd\xa2\xce\xb9" }, + { 0x1fa3, "\xe1\xbd\xa3\xce\xb9" }, + { 0x1fa4, "\xe1\xbd\xa4\xce\xb9" }, + { 0x1fa5, "\xe1\xbd\xa5\xce\xb9" }, + { 0x1fa6, "\xe1\xbd\xa6\xce\xb9" }, + { 0x1fa7, "\xe1\xbd\xa7\xce\xb9" }, + { 0x1fa8, "\xe1\xbd\xa0\xce\xb9" }, + { 0x1fa9, "\xe1\xbd\xa1\xce\xb9" }, + { 0x1faa, "\xe1\xbd\xa2\xce\xb9" }, + { 0x1fab, "\xe1\xbd\xa3\xce\xb9" }, + { 0x1fac, "\xe1\xbd\xa4\xce\xb9" }, + { 0x1fad, "\xe1\xbd\xa5\xce\xb9" }, + { 0x1fae, "\xe1\xbd\xa6\xce\xb9" }, + { 0x1faf, "\xe1\xbd\xa7\xce\xb9" }, + { 0x1fb2, "\xe1\xbd\xb0\xce\xb9" }, + { 0x1fb3, "\xce\xb1\xce\xb9" }, + { 0x1fb4, "\xce\xac\xce\xb9" }, + { 0x1fb6, "\xce\xb1\xcd\x82" }, + { 0x1fb7, "\xce\xb1\xcd\x82\xce\xb9" }, + { 0x1fbc, "\xce\xb1\xce\xb9" }, + { 0x1fbe, "\xce\xb9" }, + { 0x1fc2, "\xe1\xbd\xb4\xce\xb9" }, + { 0x1fc3, "\xce\xb7\xce\xb9" }, + { 0x1fc4, "\xce\xae\xce\xb9" }, + { 0x1fc6, "\xce\xb7\xcd\x82" }, + { 0x1fc7, "\xce\xb7\xcd\x82\xce\xb9" }, + { 0x1fcc, "\xce\xb7\xce\xb9" }, + { 0x1fd2, "\xce\xb9\xcc\x88\xcc\x80" }, + { 0x1fd3, "\xce\xb9\xcc\x88\xcc\x81" }, + { 0x1fd6, "\xce\xb9\xcd\x82" }, + { 0x1fd7, "\xce\xb9\xcc\x88\xcd\x82" }, + { 0x1fe2, "\xcf\x85\xcc\x88\xcc\x80" }, + { 0x1fe3, "\xcf\x85\xcc\x88\xcc\x81" }, + { 0x1fe4, "\xcf\x81\xcc\x93" }, + { 0x1fe6, "\xcf\x85\xcd\x82" }, + { 0x1fe7, "\xcf\x85\xcc\x88\xcd\x82" }, + { 0x1ff2, "\xe1\xbd\xbc\xce\xb9" }, + { 0x1ff3, "\xcf\x89\xce\xb9" }, + { 0x1ff4, "\xcf\x8e\xce\xb9" }, + { 0x1ff6, "\xcf\x89\xcd\x82" }, + { 0x1ff7, "\xcf\x89\xcd\x82\xce\xb9" }, + { 0x1ffc, "\xcf\x89\xce\xb9" }, + { 0x2160, "\xe2\x85\xb0" }, + { 0x2161, "\xe2\x85\xb1" }, + { 0x2162, "\xe2\x85\xb2" }, + { 0x2163, "\xe2\x85\xb3" }, + { 0x2164, "\xe2\x85\xb4" }, + { 0x2165, "\xe2\x85\xb5" }, + { 0x2166, "\xe2\x85\xb6" }, + { 0x2167, "\xe2\x85\xb7" }, + { 0x2168, "\xe2\x85\xb8" }, + { 0x2169, "\xe2\x85\xb9" }, + { 0x216a, "\xe2\x85\xba" }, + { 0x216b, "\xe2\x85\xbb" }, + { 0x216c, "\xe2\x85\xbc" }, + { 0x216d, "\xe2\x85\xbd" }, + { 0x216e, "\xe2\x85\xbe" }, + { 0x216f, "\xe2\x85\xbf" }, + { 0x24b6, "\xe2\x93\x90" }, + { 0x24b7, "\xe2\x93\x91" }, + { 0x24b8, "\xe2\x93\x92" }, + { 0x24b9, "\xe2\x93\x93" }, + { 0x24ba, "\xe2\x93\x94" }, + { 0x24bb, "\xe2\x93\x95" }, + { 0x24bc, "\xe2\x93\x96" }, + { 0x24bd, "\xe2\x93\x97" }, + { 0x24be, "\xe2\x93\x98" }, + { 0x24bf, "\xe2\x93\x99" }, + { 0x24c0, "\xe2\x93\x9a" }, + { 0x24c1, "\xe2\x93\x9b" }, + { 0x24c2, "\xe2\x93\x9c" }, + { 0x24c3, "\xe2\x93\x9d" }, + { 0x24c4, "\xe2\x93\x9e" }, + { 0x24c5, "\xe2\x93\x9f" }, + { 0x24c6, "\xe2\x93\xa0" }, + { 0x24c7, "\xe2\x93\xa1" }, + { 0x24c8, "\xe2\x93\xa2" }, + { 0x24c9, "\xe2\x93\xa3" }, + { 0x24ca, "\xe2\x93\xa4" }, + { 0x24cb, "\xe2\x93\xa5" }, + { 0x24cc, "\xe2\x93\xa6" }, + { 0x24cd, "\xe2\x93\xa7" }, + { 0x24ce, "\xe2\x93\xa8" }, + { 0x24cf, "\xe2\x93\xa9" }, + { 0xfb00, "\x66\x66" }, + { 0xfb01, "\x66\x69" }, + { 0xfb02, "\x66\x6c" }, + { 0xfb03, "\x66\x66\x69" }, + { 0xfb04, "\x66\x66\x6c" }, + { 0xfb05, "\x73\x74" }, + { 0xfb06, "\x73\x74" }, + { 0xfb13, "\xd5\xb4\xd5\xb6" }, + { 0xfb14, "\xd5\xb4\xd5\xa5" }, + { 0xfb15, "\xd5\xb4\xd5\xab" }, + { 0xfb16, "\xd5\xbe\xd5\xb6" }, + { 0xfb17, "\xd5\xb4\xd5\xad" } +}; + + +#endif + diff -Naur WebKit-r41128/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h WebKit-r41137-nx/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h --- WebKit-r41128/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h 2009-02-23 16:01:26.000000000 -0500 @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2006 George Staikos + * Copyright (C) 2006 Alexey Proskuryakov + * Copyright (C) 2007 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2008 Dominik Röttsches + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef UnicodeGLib_h +#define UnicodeGLib_h + +#include +#include +#include + +#include +#include + +#include + +#include "CasefoldTableFromGLib.h" +#include "UnicodeGLibTypes.h" +#include "UnicodeMacrosFromICU.h" + +namespace WTF { + namespace Unicode { + + enum Direction { + LeftToRight, + RightToLeft, + EuropeanNumber, + EuropeanNumberSeparator, + EuropeanNumberTerminator, + ArabicNumber, + CommonNumberSeparator, + BlockSeparator, + SegmentSeparator, + WhiteSpaceNeutral, + OtherNeutral, + LeftToRightEmbedding, + LeftToRightOverride, + RightToLeftArabic, + RightToLeftEmbedding, + RightToLeftOverride, + PopDirectionalFormat, + NonSpacingMark, + BoundaryNeutral + }; + + enum DecompositionType { + DecompositionNone, + DecompositionCanonical, + DecompositionCompat, + DecompositionCircle, + DecompositionFinal, + DecompositionFont, + DecompositionFraction, + DecompositionInitial, + DecompositionIsolated, + DecompositionMedial, + DecompositionNarrow, + DecompositionNoBreak, + DecompositionSmall, + DecompositionSquare, + DecompositionSub, + DecompositionSuper, + DecompositionVertical, + DecompositionWide, + }; + + enum CharCategory { + NoCategory = 0, + Other_NotAssigned = U_MASK(G_UNICODE_UNASSIGNED), + Letter_Uppercase = U_MASK(G_UNICODE_UPPERCASE_LETTER), + Letter_Lowercase = U_MASK(G_UNICODE_LOWERCASE_LETTER), + Letter_Titlecase = U_MASK(G_UNICODE_TITLECASE_LETTER), + Letter_Modifier = U_MASK(G_UNICODE_MODIFIER_LETTER), + Letter_Other = U_MASK(G_UNICODE_OTHER_LETTER), + + Mark_NonSpacing = U_MASK(G_UNICODE_NON_SPACING_MARK), + Mark_Enclosing = U_MASK(G_UNICODE_ENCLOSING_MARK), + Mark_SpacingCombining = U_MASK(G_UNICODE_COMBINING_MARK), + + Number_DecimalDigit = U_MASK(G_UNICODE_DECIMAL_NUMBER), + Number_Letter = U_MASK(G_UNICODE_LETTER_NUMBER), + Number_Other = U_MASK(G_UNICODE_OTHER_NUMBER), + + Separator_Space = U_MASK(G_UNICODE_SPACE_SEPARATOR), + Separator_Line = U_MASK(G_UNICODE_LINE_SEPARATOR), + Separator_Paragraph = U_MASK(G_UNICODE_PARAGRAPH_SEPARATOR), + + Other_Control = U_MASK(G_UNICODE_CONTROL), + Other_Format = U_MASK(G_UNICODE_FORMAT), + Other_PrivateUse = U_MASK(G_UNICODE_PRIVATE_USE), + Other_Surrogate = U_MASK(G_UNICODE_SURROGATE), + + Punctuation_Dash = U_MASK(G_UNICODE_DASH_PUNCTUATION), + Punctuation_Open = U_MASK(G_UNICODE_OPEN_PUNCTUATION), + Punctuation_Close = U_MASK(G_UNICODE_CLOSE_PUNCTUATION), + Punctuation_Connector = U_MASK(G_UNICODE_CONNECT_PUNCTUATION), + Punctuation_Other = U_MASK(G_UNICODE_OTHER_PUNCTUATION), + + Symbol_Math = U_MASK(G_UNICODE_MATH_SYMBOL), + Symbol_Currency = U_MASK(G_UNICODE_CURRENCY_SYMBOL), + Symbol_Modifier = U_MASK(G_UNICODE_MODIFIER_SYMBOL), + Symbol_Other = U_MASK(G_UNICODE_OTHER_SYMBOL), + + Punctuation_InitialQuote = U_MASK(G_UNICODE_INITIAL_PUNCTUATION), + Punctuation_FinalQuote = U_MASK(G_UNICODE_FINAL_PUNCTUATION) + }; + + inline UChar32 foldCase(UChar32 ch) + { + // add g_unichar_casefold to GLib upstream? + + int start = 0; + int end = G_N_ELEMENTS(casefold_table); + + if (ch >= casefold_table[start].ch && + ch <= casefold_table[end - 1].ch) { + while (true) { + int half = (start + end) / 2; + if (ch == casefold_table[half].ch) + return g_utf8_get_char(casefold_table[half].data); + if (half == start) + break; + else if (ch > casefold_table[half].ch) + start = half; + else + end = half; + } + } + + return g_unichar_tolower (ch); + } + + inline int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error) + { + *error = false; + GOwnPtr gerror; + + GOwnPtr utf8src; + utf8src.set(g_utf16_to_utf8(src, srcLength, 0, 0, &gerror.outPtr())); + if (gerror) { + *error = true; + return -1; + } + + GOwnPtr utf8result; + utf8result.set(g_utf8_casefold(utf8src.get(), -1)); + + long utf16resultLength = -1; + GOwnPtr utf16result; + utf16result.set(g_utf8_to_utf16(utf8result.get(), -1, 0, &utf16resultLength, &gerror.outPtr())); + if (gerror) { + *error = true; + return -1; + } + + if (utf16resultLength > resultLength) { + *error = true; + return utf16resultLength; + } + memcpy(result, utf16result.get(), utf16resultLength * sizeof(UChar)); + + return utf16resultLength; + } + + inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error) + { + *error = false; + GOwnPtr gerror; + + GOwnPtr utf8src; + utf8src.set(g_utf16_to_utf8(src, srcLength, 0, 0, &gerror.outPtr())); + if (gerror) { + *error = true; + return -1; + } + + GOwnPtr utf8result; + utf8result.set(g_utf8_strdown(utf8src.get(), -1)); + + long utf16resultLength = -1; + GOwnPtr utf16result; + utf16result.set(g_utf8_to_utf16(utf8result.get(), -1, 0, &utf16resultLength, &gerror.outPtr())); + if (gerror) { + *error = true; + return -1; + } + + if (utf16resultLength > resultLength) { + *error = true; + return utf16resultLength; + } + memcpy(result, utf16result.get(), utf16resultLength * sizeof(UChar)); + + return utf16resultLength; + } + + inline UChar32 toLower(UChar32 c) + { + return g_unichar_tolower(c); + } + + inline UChar32 toUpper(UChar32 c) + { + return g_unichar_toupper(c); + } + + inline int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error) + { + *error = false; + GOwnPtr gerror; + + GOwnPtr utf8src; + utf8src.set(g_utf16_to_utf8(src, srcLength, 0, 0, &gerror.outPtr())); + if (gerror) { + *error = true; + return -1; + } + + GOwnPtr utf8result; + utf8result.set(g_utf8_strup(utf8src.get(), -1)); + + long utf16resultLength = -1; + GOwnPtr utf16result; + utf16result.set(g_utf8_to_utf16(utf8result.get(), -1, 0, &utf16resultLength, &gerror.outPtr())); + if (gerror) { + *error = true; + return -1; + } + + if (utf16resultLength > resultLength) { + *error = true; + return utf16resultLength; + } + memcpy(result, utf16result.get(), utf16resultLength * sizeof(UChar)); + + return utf16resultLength; + } + + inline UChar32 toTitleCase(UChar32 c) + { + return g_unichar_totitle(c); + } + + inline bool isArabicChar(UChar32 c) + { + return c >= 0x0600 && c <= 0x06FF; + } + + inline bool isFormatChar(UChar32 c) + { + return g_unichar_type(c) == G_UNICODE_FORMAT; + } + + inline bool isSeparatorSpace(UChar32 c) + { + return g_unichar_type(c) == G_UNICODE_SPACE_SEPARATOR; + } + + inline bool isPrintableChar(UChar32 c) + { + return g_unichar_isprint(c); + } + + inline bool isDigit(UChar32 c) + { + return g_unichar_isdigit(c); + } + + inline bool isPunct(UChar32 c) + { + return g_unichar_ispunct(c); + } + + inline UChar32 mirroredChar(UChar32 c) + { + gunichar mirror = 0; + g_unichar_get_mirror_char(c, &mirror); + return mirror; + } + + inline CharCategory category(UChar32 c) + { + if (c > 0xffff) + return NoCategory; + + return (CharCategory) U_MASK(g_unichar_type(c)); + } + + inline Direction direction(UChar32 c) + { + /*PangoBidiType*/ PangoDirection type = pango_unichar_direction(c);//pango_bidi_type_for_unichar(c); + switch (type) { + case PANGO_DIRECTION_LTR: + return LeftToRight; + case PANGO_DIRECTION_RTL: + return RightToLeft; + case PANGO_DIRECTION_WEAK_LTR: + return EuropeanNumber; + case PANGO_DIRECTION_WEAK_RTL: + return ArabicNumber; +/* case PANGO_BIDI_TYPE_L: + return LeftToRight; + case PANGO_BIDI_TYPE_R: + return RightToLeft; + case PANGO_BIDI_TYPE_AL: + return RightToLeftArabic; + case PANGO_BIDI_TYPE_LRE: + return LeftToRightEmbedding; + case PANGO_BIDI_TYPE_RLE: + return RightToLeftEmbedding; + case PANGO_BIDI_TYPE_LRO: + return LeftToRightOverride; + case PANGO_BIDI_TYPE_RLO: + return RightToLeftOverride; + case PANGO_BIDI_TYPE_PDF: + return PopDirectionalFormat; + case PANGO_BIDI_TYPE_EN: + return EuropeanNumber; + case PANGO_BIDI_TYPE_AN: + return ArabicNumber; + case PANGO_BIDI_TYPE_ES: + return EuropeanNumberSeparator; + case PANGO_BIDI_TYPE_ET: + return EuropeanNumberTerminator; + case PANGO_BIDI_TYPE_CS: + return CommonNumberSeparator; + case PANGO_BIDI_TYPE_NSM: + return NonSpacingMark; + case PANGO_BIDI_TYPE_BN: + return BoundaryNeutral; + case PANGO_BIDI_TYPE_B: + return BlockSeparator; + case PANGO_BIDI_TYPE_S: + return SegmentSeparator; + case PANGO_BIDI_TYPE_WS: + return WhiteSpaceNeutral;*/ + default: + return OtherNeutral; + } + } + + inline bool isLower(UChar32 c) + { + return g_unichar_islower(c); + } + + inline int digitValue(UChar32 c) + { + return g_unichar_digit_value(c); + } + + inline uint8_t combiningClass(UChar32 c) + { + // return g_unichar_combining_class(c); + return 0; + } + + inline DecompositionType decompositionType(UChar32 c) + { + // FIXME + return DecompositionNone; + } + + inline int umemcasecmp(const UChar* a, const UChar* b, int len) + { + GOwnPtr utf8a; + GOwnPtr utf8b; + + utf8a.set(g_utf16_to_utf8(a, len, 0, 0, 0)); + utf8b.set(g_utf16_to_utf8(b, len, 0, 0, 0)); + + GOwnPtr foldedA; + GOwnPtr foldedB; + + foldedA.set(g_utf8_casefold(utf8a.get(), -1)); + foldedB.set(g_utf8_casefold(utf8b.get(), -1)); + + int result = g_utf8_collate(foldedA.get(), foldedB.get()); + + return result; + } + + } +} + +#endif + diff -Naur WebKit-r41128/JavaScriptCore/wtf/unicode/glib/UnicodeGLibTypes.h WebKit-r41137-nx/JavaScriptCore/wtf/unicode/glib/UnicodeGLibTypes.h --- WebKit-r41128/JavaScriptCore/wtf/unicode/glib/UnicodeGLibTypes.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/JavaScriptCore/wtf/unicode/glib/UnicodeGLibTypes.h 2009-02-23 16:01:26.000000000 -0500 @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2006 George Staikos + * Copyright (C) 2006 Alexey Proskuryakov + * Copyright (C) 2007 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2008 Dominik Röttsches + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef UnicodeGLibTypes_h +#define UnicodeGLibTypes_h + +typedef uint16_t UChar; +typedef int32_t UChar32; + +#endif diff -Naur WebKit-r41128/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h WebKit-r41137-nx/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h --- WebKit-r41128/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h 2009-02-23 16:01:26.000000000 -0500 @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2006 George Staikos + * Copyright (C) 2006 Alexey Proskuryakov + * Copyright (C) 2007 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2008 Dominik Röttsches + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef UnicodeMacrosFromICU_h +#define UnicodeMacrosFromICU_h + +// some defines from ICU + +#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) +#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) +#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) +#define U16_GET_SUPPLEMENTARY(lead, trail) \ + (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET) + +#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) +#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) + +#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) +#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) +#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) +#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) + +#define U16_NEXT(s, i, length, c) { \ + (c)=(s)[(i)++]; \ + if(U16_IS_LEAD(c)) { \ + uint16_t __c2; \ + if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \ + ++(i); \ + (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ + } \ + } \ +} + +#define U_MASK(x) ((uint32_t)1<<(x)) + +#endif + diff -Naur WebKit-r41128/JavaScriptCore/wtf/unicode/Unicode.h WebKit-r41137-nx/JavaScriptCore/wtf/unicode/Unicode.h --- WebKit-r41128/JavaScriptCore/wtf/unicode/Unicode.h 2009-01-21 00:13:29.000000000 -0500 +++ WebKit-r41137-nx/JavaScriptCore/wtf/unicode/Unicode.h 2009-02-23 16:01:26.000000000 -0500 @@ -28,6 +28,8 @@ #include "qt4/UnicodeQt4.h" #elif USE(ICU_UNICODE) #include +#elif USE(GLIB_UNICODE) +#include #else #error "Unknown Unicode implementation" #endif diff -Naur WebKit-r41128/LayoutTests/fast/dom/empty-hash-and-search-expected.txt WebKit-r41137-nx/LayoutTests/fast/dom/empty-hash-and-search-expected.txt --- WebKit-r41128/LayoutTests/fast/dom/empty-hash-and-search-expected.txt 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/LayoutTests/fast/dom/empty-hash-and-search-expected.txt 2009-03-24 16:51:45.000000000 -0400 @@ -0,0 +1,13 @@ +Hash and search properties should be non-empty only if they were specified. + +link w/o hash link with empty hash link with hash + +location.hash: +link1.hash: +link2.hash: +link3.hash: #test +location.search: +link1.search: +link2.search: +link3.search: ?search + diff -Naur WebKit-r41128/LayoutTests/fast/dom/empty-hash-and-search.html WebKit-r41137-nx/LayoutTests/fast/dom/empty-hash-and-search.html --- WebKit-r41128/LayoutTests/fast/dom/empty-hash-and-search.html 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/LayoutTests/fast/dom/empty-hash-and-search.html 2009-03-24 16:51:45.000000000 -0400 @@ -0,0 +1,54 @@ + + +link's hash property + + +Hash and search properties should be non-empty only if they were specified.
+
+link w/o hash +link with empty hash +link with hash +
+ + + diff -Naur WebKit-r41128/LayoutTests/fast/dom/onload-open-expected.txt WebKit-r41137-nx/LayoutTests/fast/dom/onload-open-expected.txt --- WebKit-r41128/LayoutTests/fast/dom/onload-open-expected.txt 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/LayoutTests/fast/dom/onload-open-expected.txt 2009-03-24 16:51:20.000000000 -0400 @@ -0,0 +1,3 @@ +Test for bug 15707: Crash when manipulating document from within an iframe onload function. + +SUCCESS if no crash. diff -Naur WebKit-r41128/LayoutTests/fast/dom/onload-open.html WebKit-r41137-nx/LayoutTests/fast/dom/onload-open.html --- WebKit-r41128/LayoutTests/fast/dom/onload-open.html 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/LayoutTests/fast/dom/onload-open.html 2009-03-24 16:51:20.000000000 -0400 @@ -0,0 +1,19 @@ + + + + + + + + + diff -Naur WebKit-r41128/LayoutTests/fast/dom/resources/frame-onload-open.html WebKit-r41137-nx/LayoutTests/fast/dom/resources/frame-onload-open.html --- WebKit-r41128/LayoutTests/fast/dom/resources/frame-onload-open.html 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/LayoutTests/fast/dom/resources/frame-onload-open.html 2009-03-24 16:51:20.000000000 -0400 @@ -0,0 +1,5 @@ + + + + + diff -Naur WebKit-r41128/LayoutTests/fast/forms/numeric-input-name-expected.txt WebKit-r41137-nx/LayoutTests/fast/forms/numeric-input-name-expected.txt --- WebKit-r41128/LayoutTests/fast/forms/numeric-input-name-expected.txt 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/LayoutTests/fast/forms/numeric-input-name-expected.txt 2009-03-24 16:51:00.000000000 -0400 @@ -0,0 +1,10 @@ +Check form element indexed iteration (there should be no identical lines). + +field_000=Field_000 +0=0 +-1=-1 +method=Method +reset=Reset +focus=Focus +children=Children + diff -Naur WebKit-r41128/LayoutTests/fast/forms/numeric-input-name.html WebKit-r41137-nx/LayoutTests/fast/forms/numeric-input-name.html --- WebKit-r41128/LayoutTests/fast/forms/numeric-input-name.html 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/LayoutTests/fast/forms/numeric-input-name.html 2009-03-24 16:51:00.000000000 -0400 @@ -0,0 +1,52 @@ + + + + + +

Check form element indexed iteration (there should be no identical lines).

+
+
+ + + + + + + + +
+ + + diff -Naur WebKit-r41128/LayoutTests/fast/forms/select-no-name-expected.txt WebKit-r41137-nx/LayoutTests/fast/forms/select-no-name-expected.txt --- WebKit-r41128/LayoutTests/fast/forms/select-no-name-expected.txt 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/LayoutTests/fast/forms/select-no-name-expected.txt 2009-03-24 16:51:37.000000000 -0400 @@ -0,0 +1,5 @@ +Test for bug 20184: SELECT with no name generates invalid query string. + + +PASS +reload diff -Naur WebKit-r41128/LayoutTests/fast/forms/select-no-name.html WebKit-r41137-nx/LayoutTests/fast/forms/select-no-name.html --- WebKit-r41128/LayoutTests/fast/forms/select-no-name.html 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/LayoutTests/fast/forms/select-no-name.html 2009-03-24 16:51:37.000000000 -0400 @@ -0,0 +1,66 @@ + + + Submit + + + +

Test for bug 20184: +SELECT with no name generates invalid query string.

+
+ + + + + +
+

PASS

+

FAIL

+ +

+reload +

+ + diff -Naur WebKit-r41128/version.py WebKit-r41137-nx/version.py --- WebKit-r41128/version.py 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/version.py 2009-06-23 19:32:02.292478030 -0400 @@ -0,0 +1,2 @@ + +WebkitTitaniumVersion = "0.4.0" diff -Naur WebKit-r41128/WebCore/bindings/gobject/gstringconvert.h WebKit-r41137-nx/WebCore/bindings/gobject/gstringconvert.h --- WebKit-r41128/WebCore/bindings/gobject/gstringconvert.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/gobject/gstringconvert.h 2009-07-19 17:12:54.479045980 -0400 @@ -0,0 +1,37 @@ +/* +* Copyright (C) 2008 Luke Kenneth Casson Leighton +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public License +* along with this library; see the file COPYING.LIB. If not, write to +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301, USA. +*/ + + +#ifndef GSTRING_CONVERT_H +#define GSTRING_CONVERT_H + +/* convenience functions for converting various webkit string types into a utf8 glib string */ + +#include "AtomicString.h" +#include "CString.h" +#include "KURL.h" +#include "PlatformString.h" +//#include "unicode/ustring.h" + +inline gchar * gdom_gstring_convert(WebCore::String const& s) { return g_strdup(s.utf8().data()); } +inline gchar * gdom_gstring_convert(WebCore::KURL const& s) { return g_strdup(s.string().utf8().data()); } +inline gchar * gdom_gstring_convert(const JSC::UString & s) { return g_strdup(s.UTF8String().c_str()); } +inline gchar * gdom_gstring_convert(WebCore::AtomicString const&s) { return g_strdup(s.string().utf8().data()); } + +#endif /* GSTRING_CONVERT_H */ diff -Naur WebKit-r41128/WebCore/bindings/gobject/webkitbinding.cpp WebKit-r41137-nx/WebCore/bindings/gobject/webkitbinding.cpp --- WebKit-r41128/WebCore/bindings/gobject/webkitbinding.cpp 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/gobject/webkitbinding.cpp 2009-07-19 16:15:19.547044081 -0400 @@ -0,0 +1,367 @@ +/* + * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) + * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Samuel Weinig + * Copyright (C) 2008 Luke Kenneth Casson Leighton + * Copyright (C) 2008 Martin Soto + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +// gcc 3.x can't handle including the HashMap pointer specialization +// in this file +#if defined __GNUC__ && !defined __GLIBCXX__ // less than gcc 3.4 +#define HASH_MAP_PTR_SPEC_WORKAROUND 1 +#endif + +#include "config.h" +#include +#include "webkit/webkitdom.h" +#include "webkitbinding.h" +#include "webkithtmlelementwrapperfactory.h" + +#include +#include + +#include "config.h" + +#include "AtomicString.h" +#include "Attr.h" +#include "CDATASection.h" +#include "Clipboard.h" +#include "Comment.h" +#include "CSSValue.h" +#include "CString.h" +#include "DocumentFragment.h" +#include "Document.h" +#include "DocumentType.h" +#include "Entity.h" +#include "EntityReference.h" +#include "EventException.h" +#include "Event.h" +#include "ExceptionCode.h" +#include "Frame.h" +#include "HTMLCollection.h" +#include "HTMLElement.h" +#include "HTMLImageElement.h" +#include "HTMLNames.h" +#include "HTMLOptionsCollection.h" +#include "Notation.h" +#include "ProcessingInstruction.h" +#include "Text.h" + +#include "CSSCharsetRule.h" +#include "CSSFontFaceRule.h" +#include "CSSImportRule.h" +#include "CSSMediaRule.h" +#include "CSSPageRule.h" +#include "CSSStyleRule.h" +#include "CSSStyleSheet.h" +#include "CSSVariablesRule.h" + +#include "WebKitAttrPrivate.h" +#include "WebKitCDATASectionPrivate.h" +#include "WebKitClipboardPrivate.h" +#include "WebKitCommentPrivate.h" +#include "WebKitCSSCharsetRulePrivate.h" +#include "WebKitCSSFontFaceRulePrivate.h" +#include "WebKitCSSImportRulePrivate.h" +#include "WebKitCSSMediaRulePrivate.h" +#include "WebKitCSSPageRulePrivate.h" +#include "WebKitCSSPrimitiveValuePrivate.h" +#include "WebKitCSSRulePrivate.h" +#include "WebKitCSSStyleRulePrivate.h" +#include "WebKitCSSStyleSheetPrivate.h" +#include "WebKitCSSValueListPrivate.h" +#include "WebKitCSSValuePrivate.h" +#include "WebKitCSSVariablesRulePrivate.h" +#include "WebKitDocumentFragmentPrivate.h" +#include "WebKitDocumentPrivate.h" +#include "WebKitDocumentTypePrivate.h" +#include "WebKitElementPrivate.h" +#include "WebKitEntityPrivate.h" +#include "WebKitEntityReferencePrivate.h" +#include "WebKitHTMLCollectionPrivate.h" +#include "WebKitHTMLDocumentPrivate.h" +#include "WebKitHTMLOptionsCollectionPrivate.h" +#include "WebKitNodePrivate.h" +#include "WebKitNotationPrivate.h" +#include "WebKitProcessingInstructionPrivate.h" +#include "WebKitStyleSheetPrivate.h" +#include "WebKitTextPrivate.h" + +namespace WebKit { + +using namespace WebCore; +using namespace WebCore::HTMLNames; + +typedef HashMap DOMObjectMap; + +static DOMObjectMap& domObjects() +{ + static DOMObjectMap staticDOMObjects; + return staticDOMObjects; +} + +gpointer GDOMObjectCache::getDOMObject(void* objectHandle) +{ + return domObjects().get(objectHandle); +} + +gpointer GDOMObjectCache::putDOMObject(void* objectHandle, gpointer wrapper) +{ + domObjects().set(objectHandle, wrapper); + return wrapper; +} + +void GDOMObjectCache::forgetDOMObject(void* objectHandle) +{ + domObjects().take(objectHandle); +} + +gpointer toGDOM(Document* doc) +{ + if (!doc) + return NULL; + + gpointer gobj = GDOMObjectCache::getDOMObject(doc); + if (gobj) + return gobj; + + gpointer ret; + + if (doc->isHTMLDocument()) + ret = wrapHTMLDocument(static_cast(doc)); + else + ret = wrapDocument(doc); + + return GDOMObjectCache::putDOMObject(doc, ret); +} + +static gpointer createWrapper(Node* node); + +gpointer toGDOMNewlyCreated(Node* node) +{ + if (!node) + return NULL; + + return createWrapper(node); +} + +gpointer toGDOM(Node* node) +{ + if (!node) + return NULL; + + gpointer ret = GDOMObjectCache::getDOMObject(node); + if (ret) + return ret; + + return createWrapper(node); +} + +gpointer toGDOM(CSSValue* value) +{ + if (!value) + return NULL; + + gpointer gobj = GDOMObjectCache::getDOMObject(value); + + if (gobj) + return gobj; + + gpointer ret; + + if (value->isValueList()) + ret = wrapCSSValueList(static_cast(value)); + else if (value->isPrimitiveValue()) + ret = wrapCSSPrimitiveValue(static_cast(value)); + else + ret = wrapCSSValue(value); + + return GDOMObjectCache::putDOMObject(value, ret); +} + +static ALWAYS_INLINE gpointer createWrapper(Node* node) +{ + ASSERT(node); + ASSERT(!ScriptInterpreter::getDOMObject(node)); + + gpointer ret = NULL; + + switch (node->nodeType()) { + case Node::ELEMENT_NODE: + if (node->isHTMLElement()) + ret = createGDOMHTMLWrapper(static_cast(node)); + else + ret = wrapElement(static_cast(node)); + break; + case Node::ATTRIBUTE_NODE: + ret = wrapAttr(static_cast(node)); + break; + case Node::TEXT_NODE: + ret = wrapText(static_cast(node)); + break; + case Node::CDATA_SECTION_NODE: + ret = wrapCDATASection(static_cast(node)); + break; + case Node::ENTITY_NODE: + ret = wrapEntity(static_cast(node)); + break; + case Node::PROCESSING_INSTRUCTION_NODE: + ret = wrapProcessingInstruction(static_cast(node)); + break; + case Node::COMMENT_NODE: + ret = wrapComment(static_cast(node)); + break; + case Node::DOCUMENT_NODE: + // we don't want to cache the document itself in the per-document dictionary + return toGDOM(static_cast(node)); + case Node::DOCUMENT_TYPE_NODE: + ret = wrapDocumentType(static_cast(node)); + break; + case Node::NOTATION_NODE: + ret = wrapNotation(static_cast(node)); + break; + case Node::DOCUMENT_FRAGMENT_NODE: + ret = wrapDocumentFragment(static_cast(node)); + break; + case Node::ENTITY_REFERENCE_NODE: + ret = wrapEntityReference(static_cast(node)); + break; + default: + ret = wrapNode(node); + } + + return GDOMObjectCache::putDOMObject(node, ret); +} + +gpointer toGDOM(HTMLCollection* collection) +{ + if (!collection) + return NULL; + + gpointer gobj = GDOMObjectCache::getDOMObject(collection); + + if (gobj) + return gobj; + + gpointer ret; + switch (collection->type()) { + case HTMLCollection::SelectOptions: + ret = wrapHTMLOptionsCollection(static_cast(collection)); + break; + default: + ret = wrapHTMLCollection(static_cast(collection)); + break; + } + + return GDOMObjectCache::putDOMObject(collection, ret); +} + +gpointer toGDOM(Text* text) +{ + if (!text) + return NULL; + + gpointer gobj = GDOMObjectCache::getDOMObject(text); + if (gobj) + return gobj; + + gpointer ret = wrapText(text); + return GDOMObjectCache::putDOMObject(text, ret); +} + +gpointer toGDOM(CSSRule* rule) +{ + if (!rule) + return NULL; + + gpointer gobj = GDOMObjectCache::getDOMObject(rule); + + if (gobj) + return gobj; + + gpointer ret; + switch (rule->type()) { + case CSSRule::STYLE_RULE: + ret = wrapCSSStyleRule(static_cast(rule)); + break; + case CSSRule::MEDIA_RULE: + ret = wrapCSSMediaRule(static_cast(rule)); + break; + case CSSRule::FONT_FACE_RULE: + ret = wrapCSSFontFaceRule(static_cast(rule)); + break; + case CSSRule::PAGE_RULE: + ret = wrapCSSPageRule(static_cast(rule)); + break; + case CSSRule::IMPORT_RULE: + ret = wrapCSSImportRule(static_cast(rule)); + break; + case CSSRule::CHARSET_RULE: + ret = wrapCSSCharsetRule(static_cast(rule)); + break; + case CSSRule::VARIABLES_RULE: + ret = wrapCSSVariablesRule(static_cast(rule)); + break; + default: + ret = wrapCSSRule(rule); + break; + } + + GDOMObjectCache::putDOMObject(rule, ret); + return ret; +} + +gpointer toGDOM(Element* element) +{ + if (!element) + return NULL; + + gpointer gobj = GDOMObjectCache::getDOMObject(element); + if (gobj) + return gobj; + + gpointer ret; + + if (element->isHTMLElement()) + ret = createGDOMHTMLWrapper(static_cast(element)); + else + ret = wrapElement(element); + + return GDOMObjectCache::putDOMObject(element, ret); +} + +gpointer toGDOM(StyleSheet* styleSheet) +{ + if (!styleSheet) + return NULL; + + gpointer gobj = GDOMObjectCache::getDOMObject(styleSheet); + if (gobj) + return gobj; + + gpointer ret; + if (styleSheet->isCSSStyleSheet()) + ret = wrapCSSStyleSheet(static_cast(styleSheet)); + else + ret = wrapStyleSheet(styleSheet); + + return GDOMObjectCache::putDOMObject(styleSheet, ret); +} + +} // namespace WebKit + diff -Naur WebKit-r41128/WebCore/bindings/gobject/webkitbinding.h WebKit-r41137-nx/WebCore/bindings/gobject/webkitbinding.h --- WebKit-r41128/WebCore/bindings/gobject/webkitbinding.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/gobject/webkitbinding.h 2009-07-19 16:15:38.675923608 -0400 @@ -0,0 +1,74 @@ +/* + * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) + * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Samuel Weinig + * Copyright (C) 2008 Luke Kenneth Casson Leighton + * Copyright (C) 2008 Martin Soto + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WEBKIT_BINDING_H +#define WEBKIT_BINDING_H + +#include + +#include "CanvasPixelArray.h" +#include "CSSRule.h" +#include "CSSValue.h" +#include "Document.h" +#include "DOMWindow.h" +#include "Element.h" +#include "HTMLCollection.h" +#include "Node.h" +#include "StyleSheet.h" +#include "Text.h" + +namespace WebCore { + + class AtomicString; + class Document; + class Event; + class Frame; + class KURL; + class Node; + class String; + +#if ENABLE(SVG) + class SVGElement; +#endif +} // namespace WebCore + +namespace WebKit { + gpointer toGDOM(WebCore::CanvasPixelArray* node); + gpointer toGDOM(WebCore::CSSRule* node); + gpointer toGDOM(WebCore::CSSValue* node); + gpointer toGDOM(WebCore::Document* node); + gpointer toGDOM(WebCore::DOMWindow* node); + gpointer toGDOM(WebCore::Element* node); + gpointer toGDOM(WebCore::HTMLCollection* node); + gpointer toGDOM(WebCore::Node* node); + gpointer toGDOM(WebCore::StyleSheet* node); + gpointer toGDOM(WebCore::Text* node); + + class GDOMObjectCache { + public: + static gpointer getDOMObject(void *objectHandle); + static gpointer putDOMObject(void *objectHandle, gpointer wrapper); + static void forgetDOMObject(void *objectHandle); + }; +} // namespace WebKit + +#endif // WEBKIT_BINDING_H diff -Naur WebKit-r41128/WebCore/bindings/gobject/WebKitDOMObject.cpp WebKit-r41137-nx/WebCore/bindings/gobject/WebKitDOMObject.cpp --- WebKit-r41128/WebCore/bindings/gobject/WebKitDOMObject.cpp 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/gobject/WebKitDOMObject.cpp 2009-07-19 16:13:51.111539239 -0400 @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2008 Luke Kenneth Casson Leighton + * Copyright (C) 2008 Martin Soto + * Copyright (C) 2008 Alp Toker + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + */ + + +#include + +#include "config.h" +#include "webkitbinding.h" +#include "WebKitDOMObject.h" + +extern "C" { + +G_DEFINE_TYPE(WebKitDOMObject, webkit_dom_object, G_TYPE_OBJECT); + +static void webkit_dom_object_init(WebKitDOMObject* request) +{ +} + +static void webkit_dom_object_class_init(WebKitDOMObjectClass* requestClass) +{ +} + +} /* extern "C" */ + diff -Naur WebKit-r41128/WebCore/bindings/gobject/WebKitDOMObject.h WebKit-r41137-nx/WebCore/bindings/gobject/WebKitDOMObject.h --- WebKit-r41128/WebCore/bindings/gobject/WebKitDOMObject.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/gobject/WebKitDOMObject.h 2009-07-19 16:14:30.799044102 -0400 @@ -0,0 +1,55 @@ +/* Copyright (C) 2008 Luke Kenneth Casson Leighton +* Copyright (C) 2008 Martin Soto +* Copyright (C) 2008 Alp Toker +* Copyright (C) 2008 Apple Inc. All Rights Reserved. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public License +* along with this library; see the file COPYING.LIB. If not, write to +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301, USA. +*/ + + +#ifndef WebKitDOMObject_h +#define WebKitDOMObject_h + +#include "glib-object.h" +#include "webkit/webkitdomdefines.h" +#include + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_DOM_OBJECT (webkit_dom_object_get_type()) +#define WEBKIT_DOM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_OBJECT, WebKitDOMObject)) +#define WEBKIT_DOM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_OBJECT, WebKitDOMObjectClass)) +#define WEBKIT_IS_DOM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_OBJECT)) +#define WEBKIT_IS_DOM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_OBJECT)) +#define WEBKIT_DOM_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_OBJECT, WebKitDOMObjectClass)) + +struct _WebKitDOMObject { + GObject parent_instance; + + void *coreObject; +}; + +struct _WebKitDOMObjectClass { + GObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_dom_object_get_type (void); + +G_END_DECLS + +#endif /* WebKitDOMObject_h */ + diff -Naur WebKit-r41128/WebCore/bindings/gobject/webkithtmlelementwrapperfactory.cpp WebKit-r41137-nx/WebCore/bindings/gobject/webkithtmlelementwrapperfactory.cpp --- WebKit-r41128/WebCore/bindings/gobject/webkithtmlelementwrapperfactory.cpp 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/gobject/webkithtmlelementwrapperfactory.cpp 2009-07-19 16:16:00.927045949 -0400 @@ -0,0 +1,525 @@ +/* + * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 Luke Kenneth Casson Leighton + * Copyright (C) 2008 Martin Soto + * + * This file is derived by hand from an automatically generated file. + * Keeping it up-to-date could potentially be done by adding + * a make_names.pl generator, or by writing a separate + * generater which takes JSHTMLElementWrapperFactory.h as input. + * + * 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 "webkithtmlelementwrapperfactory.h" +#include "webkit/webkitdom.h" + +#include "webkit/WebKitHTMLAnchorElementPrivate.h" +#include "webkit/WebKitHTMLAppletElementPrivate.h" +#include "webkit/WebKitHTMLAreaElementPrivate.h" +#include "webkit/WebKitHTMLBaseElementPrivate.h" +#include "webkit/WebKitHTMLBaseFontElementPrivate.h" +#include "webkit/WebKitHTMLBlockquoteElementPrivate.h" +#include "webkit/WebKitHTMLBodyElementPrivate.h" +#include "webkit/WebKitHTMLBRElementPrivate.h" +#include "webkit/WebKitHTMLButtonElementPrivate.h" +#include "webkit/WebKitHTMLCanvasElementPrivate.h" +#include "webkit/WebKitHTMLDirectoryElementPrivate.h" +#include "webkit/WebKitHTMLDivElementPrivate.h" +#include "webkit/WebKitHTMLDListElementPrivate.h" +#include "webkit/WebKitHTMLElementPrivate.h" +#include "webkit/WebKitHTMLEmbedElementPrivate.h" +#include "webkit/WebKitHTMLFieldSetElementPrivate.h" +#include "webkit/WebKitHTMLFontElementPrivate.h" +#include "webkit/WebKitHTMLFormElementPrivate.h" +#include "webkit/WebKitHTMLFrameElementPrivate.h" +#include "webkit/WebKitHTMLFrameSetElementPrivate.h" +#include "webkit/WebKitHTMLHeadElementPrivate.h" +#include "webkit/WebKitHTMLHeadingElementPrivate.h" +#include "webkit/WebKitHTMLHRElementPrivate.h" +#include "webkit/WebKitHTMLHtmlElementPrivate.h" +#include "webkit/WebKitHTMLIFrameElementPrivate.h" +#include "webkit/WebKitHTMLImageElementPrivate.h" +#include "webkit/WebKitHTMLInputElementPrivate.h" +#include "webkit/WebKitHTMLIsIndexElementPrivate.h" +#include "webkit/WebKitHTMLLabelElementPrivate.h" +#include "webkit/WebKitHTMLLegendElementPrivate.h" +#include "webkit/WebKitHTMLLIElementPrivate.h" +#include "webkit/WebKitHTMLLinkElementPrivate.h" +#include "webkit/WebKitHTMLMapElementPrivate.h" +#include "webkit/WebKitHTMLMarqueeElementPrivate.h" +#include "webkit/WebKitHTMLMenuElementPrivate.h" +#include "webkit/WebKitHTMLMetaElementPrivate.h" +#include "webkit/WebKitHTMLModElementPrivate.h" +#include "webkit/WebKitHTMLObjectElementPrivate.h" +#include "webkit/WebKitHTMLOListElementPrivate.h" +#include "webkit/WebKitHTMLOptGroupElementPrivate.h" +#include "webkit/WebKitHTMLOptionElementPrivate.h" +#include "webkit/WebKitHTMLParagraphElementPrivate.h" +#include "webkit/WebKitHTMLParamElementPrivate.h" +#include "webkit/WebKitHTMLPreElementPrivate.h" +#include "webkit/WebKitHTMLQuoteElementPrivate.h" +#include "webkit/WebKitHTMLScriptElementPrivate.h" +#include "webkit/WebKitHTMLSelectElementPrivate.h" +#include "webkit/WebKitHTMLStyleElementPrivate.h" +#include "webkit/WebKitHTMLTableCaptionElementPrivate.h" +#include "webkit/WebKitHTMLTableCellElementPrivate.h" +#include "webkit/WebKitHTMLTableColElementPrivate.h" +#include "webkit/WebKitHTMLTableElementPrivate.h" +#include "webkit/WebKitHTMLTableRowElementPrivate.h" +#include "webkit/WebKitHTMLTableSectionElementPrivate.h" +#include "webkit/WebKitHTMLTextAreaElementPrivate.h" +#include "webkit/WebKitHTMLTitleElementPrivate.h" +#include "webkit/WebKitHTMLUListElementPrivate.h" + +#include "CString.h" +#include "HTMLAnchorElement.h" +#include "HTMLAppletElement.h" +#include "HTMLAreaElement.h" +#include "HTMLBaseElement.h" +#include "HTMLBaseFontElement.h" +#include "HTMLBlockquoteElement.h" +#include "HTMLBodyElement.h" +#include "HTMLBRElement.h" +#include "HTMLButtonElement.h" +#include "HTMLCanvasElement.h" +#include "HTMLDirectoryElement.h" +#include "HTMLDivElement.h" +#include "HTMLDListElement.h" +#include "HTMLEmbedElement.h" +#include "HTMLFieldSetElement.h" +#include "HTMLFontElement.h" +#include "HTMLFormElement.h" +#include "HTMLFrameElement.h" +#include "HTMLFrameSetElement.h" +#include "HTMLHeadElement.h" +#include "HTMLHeadingElement.h" +#include "HTMLHRElement.h" +#include "HTMLHtmlElement.h" +#include "HTMLIFrameElement.h" +#include "HTMLImageElement.h" +#include "HTMLInputElement.h" +#include "HTMLIsIndexElement.h" +#include "HTMLLabelElement.h" +#include "HTMLLegendElement.h" +#include "HTMLLIElement.h" +#include "HTMLLinkElement.h" +#include "HTMLMapElement.h" +#include "HTMLMarqueeElement.h" +#include "HTMLMenuElement.h" +#include "HTMLMetaElement.h" +#include "HTMLModElement.h" +#include "HTMLNames.h" +#include "HTMLObjectElement.h" +#include "HTMLOListElement.h" +#include "HTMLOptGroupElement.h" +#include "HTMLOptionElement.h" +#include "HTMLParagraphElement.h" +#include "HTMLParamElement.h" +#include "HTMLPreElement.h" +#include "HTMLQuoteElement.h" +#include "HTMLScriptElement.h" +#include "HTMLSelectElement.h" +#include "HTMLStyleElement.h" +#include "HTMLTableCaptionElement.h" +#include "HTMLTableCellElement.h" +#include "HTMLTableColElement.h" +#include "HTMLTableElement.h" +#include "HTMLTableRowElement.h" +#include "HTMLTableSectionElement.h" +#include "HTMLTextAreaElement.h" +#include "HTMLTitleElement.h" +#include "HTMLUListElement.h" + +namespace WebKit { + +using namespace WebCore; +using namespace WebCore::HTMLNames; + +typedef gpointer (*CreateHTMLElementWrapperFunction)(PassRefPtr); + +static gpointer createAnchorWrapper(PassRefPtr element) +{ + return wrapHTMLAnchorElement(static_cast(element.get())); +} + +static gpointer createAppletWrapper(PassRefPtr element) +{ + return wrapHTMLAppletElement(static_cast(element.get())); +} + +static gpointer createAreaWrapper(PassRefPtr element) +{ + return wrapHTMLAreaElement(static_cast(element.get())); +} + +static gpointer createBaseWrapper(PassRefPtr element) +{ + return wrapHTMLBaseElement(static_cast(element.get())); +} + +static gpointer createBaseFontWrapper(PassRefPtr element) +{ + return wrapHTMLBaseFontElement(static_cast(element.get())); +} + +static gpointer createBlockquoteWrapper(PassRefPtr element) +{ + return wrapHTMLBlockquoteElement(static_cast(element.get())); +} + +static gpointer createBodyWrapper(PassRefPtr element) +{ + return wrapHTMLBodyElement(static_cast(element.get())); +} + +static gpointer createBRWrapper(PassRefPtr element) +{ + return wrapHTMLBRElement(static_cast(element.get())); +} + +static gpointer createButtonWrapper(PassRefPtr element) +{ + return wrapHTMLButtonElement(static_cast(element.get())); +} + +static gpointer createCanvasWrapper(PassRefPtr element) +{ + return wrapHTMLCanvasElement(static_cast(element.get())); +} + +static gpointer createTableCaptionWrapper(PassRefPtr element) +{ + return wrapHTMLTableCaptionElement(static_cast(element.get())); +} + +static gpointer createTableColWrapper(PassRefPtr element) +{ + return wrapHTMLTableColElement(static_cast(element.get())); +} + +static gpointer createModWrapper(PassRefPtr element) +{ + return wrapHTMLModElement(static_cast(element.get())); +} + +static gpointer createDirectoryWrapper(PassRefPtr element) +{ + return wrapHTMLDirectoryElement(static_cast(element.get())); +} + +static gpointer createDivWrapper(PassRefPtr element) +{ + return wrapHTMLDivElement(static_cast(element.get())); +} + +static gpointer createDListWrapper(PassRefPtr element) +{ + return wrapHTMLDListElement(static_cast(element.get())); +} + +static gpointer createEmbedWrapper(PassRefPtr element) +{ + return wrapHTMLEmbedElement(static_cast(element.get())); +} + +static gpointer createFieldSetWrapper(PassRefPtr element) +{ + return wrapHTMLFieldSetElement(static_cast(element.get())); +} + +static gpointer createFontWrapper(PassRefPtr element) +{ + return wrapHTMLFontElement(static_cast(element.get())); +} + +static gpointer createFormWrapper(PassRefPtr element) +{ + return wrapHTMLFormElement(static_cast(element.get())); +} + +static gpointer createFrameWrapper(PassRefPtr element) +{ + return wrapHTMLFrameElement(static_cast(element.get())); +} + +static gpointer createFrameSetWrapper(PassRefPtr element) +{ + return wrapHTMLFrameSetElement(static_cast(element.get())); +} + +static gpointer createHeadingWrapper(PassRefPtr element) +{ + return wrapHTMLHeadingElement(static_cast(element.get())); +} + +static gpointer createHeadWrapper(PassRefPtr element) +{ + return wrapHTMLHeadElement(static_cast(element.get())); +} + +static gpointer createHRWrapper(PassRefPtr element) +{ + return wrapHTMLHRElement(static_cast(element.get())); +} + +static gpointer createHtmlWrapper(PassRefPtr element) +{ + return wrapHTMLHtmlElement(static_cast(element.get())); +} + +static gpointer createIFrameWrapper(PassRefPtr element) +{ + return wrapHTMLIFrameElement(static_cast(element.get())); +} + +static gpointer createImageWrapper(PassRefPtr element) +{ + return wrapHTMLImageElement(static_cast(element.get())); +} + +static gpointer createInputWrapper(PassRefPtr element) +{ + return wrapHTMLInputElement(static_cast(element.get())); +} + +static gpointer createIsIndexWrapper(PassRefPtr element) +{ + return wrapHTMLIsIndexElement(static_cast(element.get())); +} + +static gpointer createLabelWrapper(PassRefPtr element) +{ + return wrapHTMLLabelElement(static_cast(element.get())); +} + +static gpointer createLegendWrapper(PassRefPtr element) +{ + return wrapHTMLLegendElement(static_cast(element.get())); +} + +static gpointer createLIWrapper(PassRefPtr element) +{ + return wrapHTMLLIElement(static_cast(element.get())); +} + +static gpointer createLinkWrapper(PassRefPtr element) +{ + return wrapHTMLLinkElement(static_cast(element.get())); +} + +static gpointer createMapWrapper(PassRefPtr element) +{ + return wrapHTMLMapElement(static_cast(element.get())); +} + +static gpointer createMarqueeWrapper(PassRefPtr element) +{ + return wrapHTMLMarqueeElement(static_cast(element.get())); +} + +static gpointer createMenuWrapper(PassRefPtr element) +{ + return wrapHTMLMenuElement(static_cast(element.get())); +} + +static gpointer createMetaWrapper(PassRefPtr element) +{ + return wrapHTMLMetaElement(static_cast(element.get())); +} + +static gpointer createObjectWrapper(PassRefPtr element) +{ + return wrapHTMLObjectElement(static_cast(element.get())); +} + +static gpointer createOListWrapper(PassRefPtr element) +{ + return wrapHTMLOListElement(static_cast(element.get())); +} + +static gpointer createOptGroupWrapper(PassRefPtr element) +{ + return wrapHTMLOptGroupElement(static_cast(element.get())); +} + +static gpointer createOptionWrapper(PassRefPtr element) +{ + return wrapHTMLOptionElement(static_cast(element.get())); +} + +static gpointer createParagraphWrapper(PassRefPtr element) +{ + return wrapHTMLParagraphElement(static_cast(element.get())); +} + +static gpointer createParamWrapper(PassRefPtr element) +{ + return wrapHTMLParamElement(static_cast(element.get())); +} + +static gpointer createPreWrapper(PassRefPtr element) +{ + return wrapHTMLPreElement(static_cast(element.get())); +} + +static gpointer createQuoteWrapper(PassRefPtr element) +{ + return wrapHTMLQuoteElement(static_cast(element.get())); +} + +static gpointer createScriptWrapper(PassRefPtr element) +{ + return wrapHTMLScriptElement(static_cast(element.get())); +} + +static gpointer createSelectWrapper(PassRefPtr element) +{ + return wrapHTMLSelectElement(static_cast(element.get())); +} + +static gpointer createStyleWrapper(PassRefPtr element) +{ + return wrapHTMLStyleElement(static_cast(element.get())); +} + +static gpointer createTableWrapper(PassRefPtr element) +{ + return wrapHTMLTableElement(static_cast(element.get())); +} + +static gpointer createTableSectionWrapper(PassRefPtr element) +{ + return wrapHTMLTableSectionElement(static_cast(element.get())); +} + +static gpointer createTableCellWrapper(PassRefPtr element) +{ + return wrapHTMLTableCellElement(static_cast(element.get())); +} + +static gpointer createTextAreaWrapper(PassRefPtr element) +{ + return wrapHTMLTextAreaElement(static_cast(element.get())); +} + +static gpointer createTitleWrapper(PassRefPtr element) +{ + return wrapHTMLTitleElement(static_cast(element.get())); +} + +static gpointer createTableRowWrapper(PassRefPtr element) +{ + return wrapHTMLTableRowElement(static_cast(element.get())); +} + +static gpointer createUListWrapper(PassRefPtr element) +{ + return wrapHTMLUListElement(static_cast(element.get())); +} + +gpointer createGDOMHTMLWrapper(PassRefPtr element) +{ + static HashMap map; + if (map.isEmpty()) { + map.set(aTag.localName().impl(), createAnchorWrapper); + map.set(appletTag.localName().impl(), createAppletWrapper); + map.set(areaTag.localName().impl(), createAreaWrapper); + map.set(baseTag.localName().impl(), createBaseWrapper); + map.set(basefontTag.localName().impl(), createBaseFontWrapper); + map.set(blockquoteTag.localName().impl(), createBlockquoteWrapper); + map.set(bodyTag.localName().impl(), createBodyWrapper); + map.set(brTag.localName().impl(), createBRWrapper); + map.set(buttonTag.localName().impl(), createButtonWrapper); + map.set(canvasTag.localName().impl(), createCanvasWrapper); + map.set(captionTag.localName().impl(), createTableCaptionWrapper); + map.set(colTag.localName().impl(), createTableColWrapper); + map.set(delTag.localName().impl(), createModWrapper); + map.set(dirTag.localName().impl(), createDirectoryWrapper); + map.set(divTag.localName().impl(), createDivWrapper); + map.set(dlTag.localName().impl(), createDListWrapper); + map.set(embedTag.localName().impl(), createEmbedWrapper); + map.set(fieldsetTag.localName().impl(), createFieldSetWrapper); + map.set(fontTag.localName().impl(), createFontWrapper); + map.set(formTag.localName().impl(), createFormWrapper); + map.set(frameTag.localName().impl(), createFrameWrapper); + map.set(framesetTag.localName().impl(), createFrameSetWrapper); + map.set(h1Tag.localName().impl(), createHeadingWrapper); + map.set(headTag.localName().impl(), createHeadWrapper); + map.set(hrTag.localName().impl(), createHRWrapper); + map.set(htmlTag.localName().impl(), createHtmlWrapper); + map.set(iframeTag.localName().impl(), createIFrameWrapper); + map.set(imgTag.localName().impl(), createImageWrapper); + map.set(inputTag.localName().impl(), createInputWrapper); + map.set(isindexTag.localName().impl(), createIsIndexWrapper); + map.set(labelTag.localName().impl(), createLabelWrapper); + map.set(legendTag.localName().impl(), createLegendWrapper); + map.set(liTag.localName().impl(), createLIWrapper); + map.set(linkTag.localName().impl(), createLinkWrapper); + map.set(mapTag.localName().impl(), createMapWrapper); + map.set(marqueeTag.localName().impl(), createMarqueeWrapper); + map.set(menuTag.localName().impl(), createMenuWrapper); + map.set(metaTag.localName().impl(), createMetaWrapper); + map.set(objectTag.localName().impl(), createObjectWrapper); + map.set(olTag.localName().impl(), createOListWrapper); + map.set(optgroupTag.localName().impl(), createOptGroupWrapper); + map.set(optionTag.localName().impl(), createOptionWrapper); + map.set(pTag.localName().impl(), createParagraphWrapper); + map.set(paramTag.localName().impl(), createParamWrapper); + map.set(preTag.localName().impl(), createPreWrapper); + map.set(qTag.localName().impl(), createQuoteWrapper); + map.set(scriptTag.localName().impl(), createScriptWrapper); + map.set(selectTag.localName().impl(), createSelectWrapper); + map.set(styleTag.localName().impl(), createStyleWrapper); + map.set(tableTag.localName().impl(), createTableWrapper); + map.set(tbodyTag.localName().impl(), createTableSectionWrapper); + map.set(tdTag.localName().impl(), createTableCellWrapper); + map.set(textareaTag.localName().impl(), createTextAreaWrapper); + map.set(titleTag.localName().impl(), createTitleWrapper); + map.set(trTag.localName().impl(), createTableRowWrapper); + map.set(ulTag.localName().impl(), createUListWrapper); + map.set(colgroupTag.localName().impl(), createTableColWrapper); + map.set(h2Tag.localName().impl(), createHeadingWrapper); + map.set(h3Tag.localName().impl(), createHeadingWrapper); + map.set(h4Tag.localName().impl(), createHeadingWrapper); + map.set(h5Tag.localName().impl(), createHeadingWrapper); + map.set(h6Tag.localName().impl(), createHeadingWrapper); + map.set(imageTag.localName().impl(), createImageWrapper); + map.set(insTag.localName().impl(), createModWrapper); + map.set(keygenTag.localName().impl(), createSelectWrapper); + map.set(listingTag.localName().impl(), createPreWrapper); + map.set(tfootTag.localName().impl(), createTableSectionWrapper); + map.set(thTag.localName().impl(), createTableCellWrapper); + map.set(theadTag.localName().impl(), createTableSectionWrapper); + map.set(xmpTag.localName().impl(), createPreWrapper); + } + + CreateHTMLElementWrapperFunction createWrapperFunction = + map.get(element->localName().impl()); + if (createWrapperFunction) + return createWrapperFunction(element); + return wrapHTMLElement(element.get()); +} + +} diff -Naur WebKit-r41128/WebCore/bindings/gobject/webkithtmlelementwrapperfactory.h WebKit-r41137-nx/WebCore/bindings/gobject/webkithtmlelementwrapperfactory.h --- WebKit-r41128/WebCore/bindings/gobject/webkithtmlelementwrapperfactory.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/gobject/webkithtmlelementwrapperfactory.h 2009-07-19 16:16:16.883066247 -0400 @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2005 Apple Computer, 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: + * 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. +*/ + +#ifndef WEBKIT_HTML_ELEMENT_WRAPPER_FACTORY_H +#define WEBKIT_HTML_ELEMENT_WRAPPER_FACTORY_H + +#include "glib-object.h" +#include +#include "HTMLElement.h" + +namespace WebCore { + class HTMLElement; +} + +namespace WebKit { + gpointer createGDOMHTMLWrapper(PassRefPtr); +} + +#endif // WEBKIT_HTML_ELEMENT_WRAPPER_FACTORY_H diff -Naur WebKit-r41128/WebCore/bindings/scripts/CodeGeneratorGObject.pm WebKit-r41137-nx/WebCore/bindings/scripts/CodeGeneratorGObject.pm --- WebKit-r41128/WebCore/bindings/scripts/CodeGeneratorGObject.pm 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/scripts/CodeGeneratorGObject.pm 2009-07-19 16:40:37.272043468 -0400 @@ -0,0 +1,1339 @@ +# Copyright (C) 2008 Luke Kenneth Casson Leighton +# Copyright (C) 2008 Martin Soto +# Copyright (C) 2008 Alp Toker +# Copyright (C) 2009 Adam Dingle +# Copyright (C) 2009 Jim Nelson +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with this library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +package CodeGeneratorGObject; + +my $licenceTemplate = << "EOF"; +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ +EOF + +my %implIncludes = (); +my %hdrIncludes = (); +my %hdrPropIncludes = (); + +# Default constructor +sub new { + my $object = shift; + my $reference = { }; + + $codeGenerator = shift; + $outputDir = shift; + mkdir $outputDir; + + bless($reference, $object); + return $reference; +} + +sub finish { + my $object = shift; +} + +# Params: 'domClass' struct +sub GenerateInterface { + my $object = shift; + my $class = shift; + my $defines = shift; + + my $name = $class->name; + + print "$name\n"; + + $object->Generate($class); + + # Write private header + $object->WritePrivateHeader($class); + + # Write public header and implementation + my $fname = "WebKit_" . $name; + $fname =~ s/_//g; + $object->WriteData($fname); +} + +# Params: 'idlDocument' struct +sub GenerateModule { + my $object = shift; + my $document = shift; + + $module = $document->module; +} + +sub GetParentClassName { + my $class = shift; + + return "WebKitDOMObject" if @{$class->parents} eq 0; + return "WebKit" . $codeGenerator->StripModule($class->parents(0)); +} + +sub GetParentGObjectType { + my $class = shift; + + return "WEBKIT_TYPE_DOM_OBJECT" if @{$class->parents} eq 0; + return "WEBKIT_TYPE_" . uc(decamelize($codeGenerator->StripModule($class->parents(0)))); +} + +# Algorithm taken from String::CamelCase 0.01 +sub camelize { + my $s = shift; + join('', map{ ucfirst $_ } split(/(?<=[A-Za-z])_(?=[A-Za-z])|\b/, $s)); +} + +# Algorithm taken from String::CamelCase 0.01 +sub decamelize { + my $s = shift; + $s =~ s#([^a-zA-Z]?)([A-Z]*)([A-Z])([a-z]?)# + my $fc = pos($s)==0; + my ($p0,$p1,$p2,$p3) = ($1,lc$2,lc$3,$4); + my $t = $p0 || $fc ? $p0 : '_'; + $t .= $p3 ? $p1 ? "${p1}_$p2$p3" : "$p2$p3" : "$p1$p2"; + $t; + #ge; + $s; +} + +sub GetHeaderName { + my $name = $codeGenerator->StripModule(shift); + + return "WebKit$name"; +} + +sub GetClassName { + my $name = $codeGenerator->StripModule(shift); + + return "WebKit$name"; +} + +sub getIncludeHeader { + my $type = shift; + my $name = GetHeaderName($type); + + return "" if $type eq "boolean"; + return "" if $type eq "int"; + return "" if $type eq "long"; + return "" if $type eq "short"; + return "" if $type eq "char"; + return "" if $type eq "float"; + return "" if $type eq "double"; + return "" if $type eq "unsigned"; + return "" if $type eq "unsigned char"; + return "" if $type eq "unsigned int"; + return "" if $type eq "unsigned long"; + return "" if $type eq "unsigned long long"; + return "" if $type eq "unsigned short"; + return "" if $type eq "void"; + + return "Range.h" if $type eq "CompareHow"; + return "" if $type eq "DOMString"; + return "" if $type eq "DOMTimeStamp"; + return "" if $type eq "RGBColor"; # TODO - DOM class wrapper + + return "$name.h"; +} + +# returns 1 if we need to create a GObject wrapper around the return result +sub IsGDOMClassType { + my $type = shift; + my $name = GetClassName($type); + + return 0 if $type eq "float"; + return 0 if $type eq "double"; + return 0 if $type eq "boolean"; + return 0 if $type eq "char"; + return 0 if $type eq "long"; + return 0 if $type eq "short"; + return 0 if $type eq "uchar"; + return 0 if $type eq "unsigned"; + return 0 if $type eq "int"; + return 0 if $type eq "unsigned int"; + return 0 if $type eq "unsigned long"; + return 0 if $type eq "unsigned long long"; + return 0 if $type eq "unsigned short"; + return 0 if $type eq "void"; + + return 0 if $type eq "CompareHow"; + return 0 if $type eq "DOMString"; + return 0 if $type eq "DOMTimeStamp"; + return 0 if $type eq "RGBColor"; # TODO - DOM class wrapper + + return 1; +} + +sub GetPropGType { + my $type = shift; + my $name = GetClassName($type); + + return "string" if $type eq "DOMString"; + return "float" if $type eq "float"; + return "notyetsupported" if $type eq "CompareHow"; + return "double" if $type eq "double"; + return "boolean" if $type eq "boolean"; + return "char" if $type eq "char"; + return "long" if $type eq "long"; + return "int" if $type eq "short"; + return "uchar" if $type eq "uchar"; + return "uint" if $type eq "unsigned"; + return "int" if $type eq "int"; + return "uint" if $type eq "unsigned int"; + return "uint64" if $type eq "unsigned long long"; + return "ulong" if $type eq "unsigned long"; + return "ushort" if $type eq "unsigned short"; + return "ulong" if $type eq "RGBColor"; # TODO - DOM class wrapper + + return "object"; +} + +sub GetGType { + my $type = shift; + my $name = GetClassName($type); + + return "gchar *" if $type eq "DOMString"; + return "gfloat" if $type eq "float"; + return "WebCore::Range::CompareHow " if $type eq "CompareHow"; + return "gdouble" if $type eq "double"; + return "gboolean" if $type eq "boolean"; + return "gchar" if $type eq "char"; + return "glong" if $type eq "long"; + return "gshort" if $type eq "short"; + return "guchar" if $type eq "uchar"; + return "guint" if $type eq "unsigned"; + return "gint" if $type eq "int"; + return "guint" if $type eq "unsigned int"; + return "gulong" if $type eq "unsigned long"; + return "guint64" if $type eq "unsigned long long"; + return "gushort" if $type eq "unsigned short"; + return "gulong" if $type eq "RGBColor"; # TODO - DOM class wrapper + + return "void" if $type eq "void"; + + return "$name *"; +} + +sub addPropIncludeHeader { + my $type = shift; + + my $hdr = getIncludeHeader($type); + if ($hdr ne "") { + if (IsGDOMClassType($type)) { + $hdr = substr($hdr, 0, length($hdr)-2); # strip off ".h" + $hdrPropIncludes{"webkit/".$hdr.".h"} = 1; + if ($hdr ne "WebKitDOMObject") { + $hdrPropIncludes{"webkit/".$hdr."Private.h"} = 1; + } + } else { + $hdrPropIncludes{$hdr} = 1; + } + } +} + +sub addIncludeBody { + my $type = shift; + + my $hdr = getIncludeHeader($type); + if ($hdr ne "") { + if (IsGDOMClassType($type)) { + $implIncludes{"webkit/$hdr"} = 1; + } else { + $implIncludes{$hdr} = 1; + } + } +} + +sub skipAttribute { + my $attribute = shift; + + if ($attribute->signature->extendedAttributes->{"CustomGetter"} || + $attribute->signature->extendedAttributes->{"CustomSetter"}) { + return 1; + } + + my $prop_type = $attribute->signature->type; + + if ($prop_type eq "stylesheets::MediaList" or + $prop_type eq "CSSVariablesDeclaration" or + $prop_type eq "EventListener" or + $prop_type =~ /Constructor$/ or + $prop_type eq "custom" or + $prop_type eq "Array" or + $prop_type eq "DOMTimeStamp") { + return 1; # can't handle these yet + } + + my $type = GetGType($prop_type); + + # TODO: SVG + if ($codeGenerator->IsPodType($type) || $codeGenerator->IsSVGAnimatedType($type)) { + return 1; + } + return 0; +} + +sub UsesManualToJSImplementation { + my $type = shift; + + # skipped out CanvasPixelArray - see JSCanvasPixelArrayCustom.cpp for why. + return 1 if $type eq "Node" or $type eq "Document" or $type eq "HTMLCollection" or + $type eq "SVGPathSeg" or $type eq "StyleSheet" or $type eq "CSSRule" or $type eq "CSSValue" or + $type eq "Event" or $type eq "Element" or $type eq "Text"; + return 0; +} + +sub WritePrivateHeader { + my $object = shift; + my $class = shift; + + my $interfaceName = $class->name; + my $className = GetClassName($interfaceName); + my $filename = "$outputDir/" . $className . "Private.h"; + my $guard = uc(decamelize($className)) . "_PRIVATE_H"; + my $parentClassName = GetParentClassName($class); + + my $hasLegacyParent = $class->extendedAttributes->{"LegacyParent"}; + my $hasRealParent = @{$class->parents} > 0; + my $hasParent = $hasLegacyParent || $hasRealParent; + + open(PRIVHEADER, ">$filename") or die "Couldn't open file $filename for writing"; + + print PRIVHEADER split("\r", $licenceTemplate); + print PRIVHEADER "\n"; + + my $text = << "EOF"; +#ifndef $guard +#define $guard + +#include +#include +#include "${interfaceName}.h" +EOF + + print PRIVHEADER $text; + + print PRIVHEADER map { "#include \"$_\"\n" } sort keys(%hdrPropIncludes); + print PRIVHEADER "\n" if keys(%hdrPropIncludes); + + $text = << "EOF"; +typedef struct _${className} ${className}; + +namespace WebKit { + ${className} * + wrap${interfaceName}(WebCore::${interfaceName} *coreObject); + + WebCore::${interfaceName} * + core(${className} *request); + +EOF + + print PRIVHEADER $text; + + if (${interfaceName} eq "DOMWindow" || (!$hasParent or $class->extendedAttributes->{"GenerateToJS"}) and + !UsesManualToJSImplementation($interfaceName)) { + $text = << "EOF"; + gpointer + toGDOM(WebCore::${interfaceName}* node); + +EOF + + print PRIVHEADER $text; + } + + $text = << "EOF"; +} // namespace WebKit + +#endif /* ${guard} */ + +EOF + + print PRIVHEADER $text; + + close(PRIVHEADER); +} + +sub ClassHasFunction { + my $class = shift; + my $name = shift; + foreach my $function (@{$class->functions}) { + if ($function->signature->name eq $name) { + return 1; + } + } + return 0; +} + +sub Uniquify { + my $name = shift; + my $avoid = shift; + if ($name eq $avoid) { + $name = $name . "2"; + } + return $name; +} + +sub ReturnIfFail { + my $condition = shift; + my $returnType = shift; + + if ($returnType eq "void") { + return " g_return_if_fail ($condition);\n"; + } else { + return " g_return_val_if_fail ($condition, 0);\n"; # TODO: return proper default result + } +} + +# Generate code for a function. $kind should be either "" for an ordinary function, +# "get" for an attribute getter or "set" for an attribute setter. +sub GenerateFunction { + my $object = shift; + my $interfaceName = shift; + my $function = shift; + my $kind = shift; + + my $className = GetClassName($interfaceName); + my $classCaps = uc(decamelize($interfaceName)); + + my $fn_sig_name = $function->signature->name; + my $fn_sig_type = $function->signature->type; + my $interface_name = decamelize($interfaceName); + my $prefix = $kind eq "get" ? "get_" : ""; + my $functionName = "webkit_" . $interface_name . "_" . $prefix . decamelize($fn_sig_name); + my $returnType = GetGType($fn_sig_type); + my $ret_is_class_type = IsGDOMClassType($fn_sig_type); + + my $this = $interface_name; + $this =~ s/.*_//; + + my $functionSig = "$className *$this"; + + my $call_impl_params = ""; + my $gdom_fn_prefix = "webkit_" . decamelize($fn_sig_type); + + if ($functionName eq "webkit_css_style_declaration_set_property") { + # reserved name clash in glib! + $functionName = "webkit_css_style_declaration_set_css_property"; + } + # skip CompareHow functions for now + if ($functionName eq "webkit_range_compare_boundary_points") { + push(@hBody, "\n/* TODO: skipping CompareHow function ${functionName} */\n\n"); + push(@cBody, "\n/* TODO: skipping CompareHow function ${functionName} */\n\n"); + return; + } + + # skip SVGDocument functions for now + if ($returnType eq "WebKitVGDocument *") { + push(@hBody, "\n/* TODO: skipping SVGDocument function ${functionName} */\n\n"); + push(@cBody, "\n/* TODO: skipping SVGDocument function ${functionName} */\n\n"); + return; + } + + # skip some custom functions for now + my $is_custom_fn = $function->signature->extendedAttributes->{"Custom"} || + $function->signature->extendedAttributes->{"CustomArgumentHandling"}; + if ($functionName eq "webkit_html_collection_item" || + $functionName eq "webkit_html_collection_named_item" || + $functionName eq "webkit_xml_http_request_open" || + $functionName eq "webkit_xml_http_request_set_request_header" || + $functionName eq "webkit_xml_http_request_send" || + $functionName eq "webkit_xml_http_request_get_response_header" || + $functionName eq "webkit_xml_http_request_override_mime_type" || + $functionName eq "webkit_xml_http_request_dispatch_event" || + $functionName eq "webkit_element_set_attribute") { + $is_custom_fn = 0; + } + if ($is_custom_fn && + $functionName ne "webkit_node_append_child" && + $functionName ne "webkit_node_remove_child" && + $functionName ne "webkit_node_insert_before" && + $functionName ne "webkit_node_replace_child") { + push(@hBody, "\n/* TODO: custom function ${functionName} */\n\n"); + push(@cBody, "\n/* TODO: custom function ${functionName} */\n\n"); + return; + } + + foreach my $param (@{$function->parameters}) { + my $paramIDLType = $param->type; + if ($paramIDLType eq "Event") { + push(@hBody, "\n/* TODO: event function ${functionName} */\n\n"); + push(@cBody, "\n/* TODO: event function ${functionName} */\n\n"); + return; + } + addIncludeBody($paramIDLType); + my $paramType = GetGType($paramIDLType); + my $paramName = Uniquify(decamelize($param->name), $this); + + $functionSig .= ", $paramType $paramName"; + + my $param_is_cls_type = IsGDOMClassType($paramIDLType); + if ($param_is_cls_type) { + if ($paramIDLType ne "DOMObject") { + $implIncludes{"webkit/WebKit${paramIDLType}Private.h"} = 1; + } + } + if ($param_is_cls_type || ($paramIDLType eq "DOMString")) { + $paramName = "_g_" . $paramName; + } + if ($call_impl_params) { + $call_impl_params .= ", $paramName"; + } else { + $call_impl_params = "$paramName"; + } + } + + if ($fn_sig_type eq "Event") { + push(@hBody, "\n/* TODO: event function ${functionName} */\n\n"); + push(@cBody, "\n/* TODO: event function ${functionName} */\n\n"); + return; + } + + if ($ret_is_class_type and $fn_sig_type ne "DOMObject") { + $implIncludes{"webkit/WebKit${fn_sig_type}Private.h"} = 1; + $implIncludes{"webkit/WebKit${fn_sig_type}.h"} = 1; + $implIncludes{"${fn_sig_type}.h"} = 1; + } + + if ($fn_sig_type eq 'DOMObject' && + ($functionName eq 'webkit_html_canvas_element_get_context' or + $functionName eq 'webkit_document_get_css_canvas_context')) { + return; # too involved for now; skip + } + + if(@{$function->raisesExceptions}) { + $functionSig .= ", GError **error"; + } + + push(@hBody, "WEBKIT_API $returnType\n$functionName ($functionSig);\n\n"); + + push(@cBody, "$returnType\n$functionName ($functionSig)\n{\n"); + + push(@cBody, ReturnIfFail("WEBKIT_IS_$classCaps($this)", $returnType)); + + # Check that arguments are non-NULL. For attribute setters, we allow a NULL argument, + # which can be used to remove an attribute. + if ($kind ne "set") { + foreach my $param (@{$function->parameters}) { + if (!$codeGenerator->IsPrimitiveType($param->type)) { + my $paramName = Uniquify(decamelize($param->name), $this); + push(@cBody, ReturnIfFail($paramName, $returnType)); + } + } + } + + if(@{$function->raisesExceptions}) { + push(@cBody, ReturnIfFail("!error || !*error", $returnType)); + } + + # The WebKit::core implementations check for NULL already; no need to + # duplicate effort. + push(@cBody, " WebCore::${interfaceName} * item = WebKit::core($this);\n"); + + $returnParamName = ""; + foreach my $param (@{$function->parameters}) { + my $paramIDLType = $param->type; + my $paramName = Uniquify(decamelize($param->name), $this); + + my $param_is_class_type = IsGDOMClassType($paramIDLType); + # HACK! + if ($functionName eq "webkit_xml_http_request_open" && $param->name eq "url") { + push(@cBody, " WebCore::KURL _g_${paramName} = WebCore::KURL($paramName);\n"); + } elsif ($paramIDLType eq "DOMString") { + push(@cBody, " WebCore::String _g_${paramName} = WebCore::String::fromUTF8($paramName);\n"); + } + if ($param_is_class_type) { + my $param_gdom_fn = "webkit_" . decamelize($paramIDLType); + push(@cBody, " WebCore::${paramIDLType} * _g_${paramName} = WebKit::core($paramName);\n"); + } + $returnParamName = "_g_".$paramName if $param->extendedAttributes->{"Return"}; + } + + my $assign = ""; + my $assign_pre = ""; + my $assign_post = ""; + if ($returnType ne "void" && !$is_custom_fn) { + if ($ret_is_class_type) { + $assign = "PassRefPtr g_res = "; + $assign_pre = "WTF::getPtr("; + $assign_post = ")"; + } else { + $assign = "${returnType} res = "; + } + } + my $exceptions = ""; + if (@{$function->raisesExceptions}) { + push(@cBody, " WebCore::ExceptionCode ec = 0;\n"); + if (${call_impl_params} ne "") { + $exceptions = ", ec"; + } else { + $exceptions = "ec"; + } + } + + # We need to special-case these Node methods because their C++ signature is different + # from what we'd expect given their IDL description; see Node.h. + if ($functionName eq "webkit_node_append_child" || + $functionName eq "webkit_node_insert_before" || + $functionName eq "webkit_node_replace_child" || + $functionName eq "webkit_node_remove_child") { + my $custom_gdom_node_append_child = << "EOF"; + bool ok = item->${fn_sig_name}(${call_impl_params}${exceptions}); + if (ok) + { + ${returnType} res = static_cast<${returnType}>(WebKit::toGDOM($returnParamName)); + return res; + } +EOF + push(@cBody, $custom_gdom_node_append_child); + + if(@{$function->raisesExceptions}) { + my $exception_handling = << "EOF"; + + WebCore::ExceptionCodeDescription ecdesc; + WebCore::getExceptionCodeDescription(ec, ecdesc); + g_set_error(error, g_quark_from_string("GDOM"), ecdesc.code, ecdesc.name); +EOF + push(@cBody, $exception_handling); + } + push(@cBody, "return NULL;"); + push(@cBody, "}\n\n"); + return; + } elsif ($fn_sig_type eq "DOMObject" && + $functionName ne 'webkit_document_get_css_canvas_context') { + push(@cBody, " /* TODO - get canvas object (item->${fn_sig_name}(${call_impl_params}${exceptions}));*/\n" ); + + } elsif ($fn_sig_type eq "DOMString") { + push(@cBody, " ${assign}gdom_gstring_convert(item->${fn_sig_name}(${call_impl_params}${exceptions}));\n" ); + } else { + push(@cBody, " ${assign}${assign_pre}item->${fn_sig_name}(${call_impl_params}${exceptions}${assign_post});\n" ); + + if(@{$function->raisesExceptions}) { + my $exception_handling = << "EOF"; + if(ec) { + WebCore::ExceptionCodeDescription ecdesc; + WebCore::getExceptionCodeDescription(ec, ecdesc); + g_set_error(error, g_quark_from_string("GDOM"), ecdesc.code, ecdesc.name); + } +EOF + push(@cBody, $exception_handling); + } + } + if ($returnType ne "void" && !$is_custom_fn) { + + if ($fn_sig_type ne "DOMObject") { + if ($ret_is_class_type) { + push(@cBody, " ${returnType} res = static_cast<${returnType}>(WebKit::toGDOM(g_res.get()));\n"); + } + } + if ($fn_sig_type eq "DOMObject") { + push(@cBody, " return NULL; /* TODO: return canvas object */\n"); + } else { + push(@cBody, " return res;\n"); + } + } + push(@cBody, "\n"); + + push(@cBody, "}\n\n"); +} + +sub CountGetProperties { + my $class = shift; + + my $count = 0; + + foreach my $attribute (@{$class->attributes}) { + if(!skipAttribute($attribute)) { + # all properties not skipped are either read-only or read-write + $count++; + } + } + + return $count; +} + +sub CountSetProperties { + my $class = shift; + + my $count = 0; + + SKIPPROP: + foreach my $attribute (@{$class->attributes}) { + if(skipAttribute($attribute)) { + next SKIPPROP; + } + + my $writeable = $attribute->type !~ /^readonly/; + if($writeable && !$custom) { + # custom properties are read-only for now + $count++; + } + } + + return $count; +} + +sub GenerateProperties { + my $object = shift; + my $class = shift; + my $classCaps = shift; + my $lcase_ifacename = shift; + + my $interfaceName = $class->name; + my $className = GetClassName($interfaceName); # e.g. WebKitElement + + # This function is expected to open a G_BEGIN_DECLS block, but does not end it + push(@cBodyPriv, "G_BEGIN_DECLS\n\n"); + + my $get_count = CountGetProperties($class); + my $set_count = CountSetProperties($class); + + if(($get_count == 0) && ($set_count == 0)) { + return (); + } + + SKIPPROP: + foreach my $attribute (@{$class->attributes}) { + if (skipAttribute($attribute)) { + next SKIPPROP; + } + + my $prop_type = $attribute->signature->type; + addPropIncludeHeader($prop_type); + } + + my $implContent = << "EOF"; +enum { + PROP_0, +EOF + push(@cBodyPriv, $implContent); + + my @txt_install_props = (); + my @txt_set_props = (); + my @txt_get_props = (); + + my $txt_get_prop = << "EOF"; +static void ${lcase_ifacename}__get_property_fn(GObject * object, guint prop_id, + GValue * value, + GParamSpec * pspec) +{ + ${className} *self = WEBKIT_${classCaps}(object); + WebCore::${interfaceName} * gself = WebKit::core(self); + switch (prop_id) { +EOF + push(@txt_get_props, $txt_get_prop); + + my $txt_set_prop = << "EOF"; +static void ${lcase_ifacename}__set_property_fn(GObject * object, guint prop_id, + const GValue * value, + GParamSpec * pspec) +{ + ${className} *self = WEBKIT_${classCaps}(object); + WebCore::${interfaceName} * gself = WebKit::core(self); + switch (prop_id) { +EOF + push(@txt_set_props, $txt_set_prop); + + # Iterate over the interface attributes and generate a property for + # each one of them. + SKIPENUM: + foreach my $attribute (@{$class->attributes}) { + if (skipAttribute($attribute)) { + next SKIPENUM; + } + + my $prop_name = $attribute->signature->name; + my $setprop_name_fn = $codeGenerator->WK_ucfirst($prop_name); + my $getprop_name_fn = $codeGenerator->WK_lcfirst($prop_name); + my $prop_name_decamel = decamelize($prop_name); + my $propName = $prop_name_decamel; + $propName =~ s/_/-/g; + my $propCaps = uc($prop_name_decamel); + my $prop_type = $attribute->signature->type; + my $type = GetGType($prop_type); + my ${propEnum} = "PROP_${propCaps}"; + my ${prop_gtype} = decamelize($prop_type); + my ${propGType} = uc($prop_gtype); + my $lcase_gtypename = "webkit_" . $prop_gtype; + + push(@cBodyPriv, " ${propEnum},\n"); + + my $gtype = GetPropGType($prop_type); + my $gparamflag = "G_PARAM_READABLE"; + my $writeable = $attribute->type !~ /^readonly/; + my $const = "read-only "; + if ($writeable && $custom) { + $const = "read-only (due to custom functions needed in webkit/gobject)"; + next SKIPENUM; + } + if ($writeable && !$custom) { + $gparamflag = "G_PARAM_READWRITE"; + $const = "read-write "; + } + + my $_gtype = $gtype; + if ($gtype eq "ushort") { + $_gtype = "uint"; # yuk + } + $nick = decamelize(${interfaceName}) . "_" . $prop_name_decamel; + $nick =~ s/_/ /g; + $nick =~ s/\b(\w)/\U$1/g; # capitalize each word + $long = "${const} ${type} ${interfaceName}.${propName}"; + my $txt_install_prop = << "EOF"; + g_object_class_install_property (g_klass, ${propEnum}, + g_param_spec_${_gtype} ("${propName}", /* name */ + "$nick", /* short description */ + "$long", /* longer - could use some extra doc here */ +EOF + push(@txt_install_props, $txt_install_prop); + $txt_install_prop = "/* TODO! $gtype */\n"; + + if ($writeable) { + my $ok = 0; + my $convert_fn = ""; + + if ($gtype eq "string") { + $convert_fn = "WebCore::String::fromUTF8"; + $ok = 1; + } + elsif (($gtype eq "boolean" and ${interfaceName} ne "DOMWindow") or # TODO: handle DOMWindow + $gtype eq "float" or + ($gtype eq "double" and ${interfaceName} ne "DOMWindow") or + $gtype eq "uint64" or + ($gtype eq "ulong" and ${interfaceName} ne "DOMWindow") or + ($gtype eq "long" and ${interfaceName} ne "DOMWindow") or + $gtype eq "uint" or + $gtype eq "ushort" or + $gtype eq "uchar" or + $gtype eq "char") { + $ok = 1; + } + # TODO: handle Location + if ($interfaceName eq "Location") { + $ok = 0; + } + + if ($ok) { + push(@txt_set_props, " case ${propEnum}:\n {\n"); + push(@txt_set_props, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; + + if($attribute->signature->extendedAttributes->{"ConvertFromString"}) { + $convert_fn = "WebCore::String::number"; + } + + push(@txt_set_props, " gself->set${setprop_name_fn}(${convert_fn}(g_value_get_$gtype (value))"); + + push(@txt_set_props, ", ec") if @{$attribute->setterExceptions}; + push(@txt_set_props, ");\n"); + + push(@txt_set_props, " break;\n }\n"); + } + } + + push(@txt_get_props, " case ${propEnum}:\n {\n"); + + my $exception = ""; + if (@{$attribute->getterExceptions}) { + $exception = "ec"; + push(@txt_get_props, " WebCore::ExceptionCode ec = 0;\n"); + } + + my $convert_fn = ""; + my $post_convert_fn = ""; + my $done = 0; + if ($gtype eq "string") { + push(@txt_get_props, " g_value_take_string (value, gdom_gstring_convert(gself->${getprop_name_fn}(${exception})));\n"); + $done = 1; + } + elsif ($gtype eq "object") { + $txt_get_prop = << "EOF"; + PassRefPtr ptr = gself->${getprop_name_fn}(${exception}); + g_value_set_object (value, WebKit::toGDOM(ptr.get())); +EOF + push(@txt_get_props, $txt_get_prop); + + $done = 1; + } + + if($attribute->signature->extendedAttributes->{"ConvertFromString"}) { + # TODO: Add other conversion functions for different types. Current + # IDLs only list longs. + if($gtype eq "long") { + $convert_fn = ""; + $post_convert_fn = ".toInt()"; + } else { + die "Can't convert to type ${gtype}."; + } + } + + if (!$done) { + push(@txt_get_props, " g_value_set_$_gtype (value, ${convert_fn}gself->${getprop_name_fn}(${exception})${post_convert_fn});\n"); + } + + push(@txt_get_props, " break;\n }\n"); + + # is this _entirely_ necessary??? + # can it be done with generic g_param_spec_gtype + # and getting a few things, ignoring the min-max for example? + if ($gtype eq "int") { + $txt_install_prop = << "EOF"; + G_MININT, /* min */ + G_MAXINT, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "boolean") { + $txt_install_prop = << "EOF"; + FALSE, /* default */ +EOF + } elsif ($gtype eq "float") { + $txt_install_prop = << "EOF"; + G_MINFLOAT, /* min */ + G_MAXFLOAT, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "double") { + $txt_install_prop = << "EOF"; + G_MINDOUBLE, /* min */ + G_MAXDOUBLE, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "uint64") { + $txt_install_prop = << "EOF"; + 0, /* min */ + G_MAXUINT64, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "ulong") { + $txt_install_prop = << "EOF"; + 0, /* min */ + G_MAXULONG, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "long") { + $txt_install_prop = << "EOF"; + G_MINLONG, /* min */ + G_MAXLONG, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "uint") { + $txt_install_prop = << "EOF"; + 0, /* min */ + G_MAXUINT, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "ushort") { + $txt_install_prop = << "EOF"; + 0, /* min */ + G_MAXUINT16, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "uchar") { + $txt_install_prop = << "EOF"; + G_MININT8, /* min */ + G_MAXINT8, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "char") { + $txt_install_prop = << "EOF"; + 0, /* min */ + G_MAXUINT8, /* max */ + 0, /* default */ +EOF + } elsif ($gtype eq "string") { + $txt_install_prop = << "EOF"; + "", /* default */ +EOF + } elsif ($gtype eq "object") { + $txt_install_prop = << "EOF"; + WEBKIT_TYPE_${propGType}, /* gobject type */ +EOF + } + push(@txt_install_props, $txt_install_prop); + $txt_install_prop = << "EOF"; + (GParamFlags)${gparamflag})); + +EOF + push(@txt_install_props, $txt_install_prop); + } + + push(@cBodyPriv, "};\n\n"); + + $txt_get_prop = << "EOF"; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} +EOF + push(@txt_get_props, $txt_get_prop); + + $txt_set_prop = << "EOF"; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} +EOF + push(@txt_set_props, $txt_set_prop); + + if ($get_count > 0) { + push(@cBodyPriv, @txt_get_props); + } + + if ($set_count > 0) { + push(@cBodyPriv, @txt_set_props); + } + + return @txt_install_props; +} + +# Generate header and implementation +sub Generate { + my $object = shift; + my $class = shift; + + my $hasLegacyParent = $class->extendedAttributes->{"LegacyParent"}; + my $hasRealParent = @{$class->parents} > 0; + my $hasParent = $hasLegacyParent || $hasRealParent; + my $parentClassName = GetParentClassName($class); + my $parentGObjType = GetParentGObjectType($class); + my $interfaceName = $class->name; + my $className = GetClassName($interfaceName); # e.g. WebKitElement + my $hdrName = GetHeaderName($interfaceName); + + # Add the default implementation header template + @cPrefix = split("\r", $licenceTemplate); + push(@cPrefix, "\n"); + + $implIncludes{"webkitmarshal.h"} = 1; + $implIncludes{"webkitbinding.h"} = 1; + $implIncludes{"webkit/$hdrName.h"} = 1; + $implIncludes{"webkit/${hdrName}Private.h"} = 1; + $implIncludes{"gobject/gstringconvert.h"} = 1; + $implIncludes{"${interfaceName}.h"} = 1; + $implIncludes{"ExceptionCode.h"} = 1; + + my $parentInterfaceName = substr($parentClassName, length("WebKit")); # strip WebKit prefix + my $parentHdrName = GetHeaderName($parentInterfaceName); + $implIncludes{"webkit/${parentHdrName}.h"} = 1; + if ($parentHdrName ne "WebKitDOMObject") { + $implIncludes{"webkit/${parentHdrName}Private.h"} = 1; + } + $hdrIncludes{"webkit/${parentHdrName}.h"} = 1; + + # Get correct pass/store types respecting PODType flag + my $podType = $class->extendedAttributes->{"PODType"}; + my $passType = $podType ? "JSSVGPODTypeWrapper<$podType>*" : "$interfaceName*"; + + if (${interfaceName} eq "DOMWindow" || (!$hasParent or $class->extendedAttributes->{"GenerateToJS"}) + and !UsesManualToJSImplementation($interfaceName)) { + my $converter = << "EOF"; +namespace WebKit { + +gpointer toGDOM(WebCore::$passType obj) +{ + g_return_val_if_fail(obj != NULL, NULL); + + if (gpointer ret = GDOMObjectCache::getDOMObject(obj)) + return ret; + + return GDOMObjectCache::putDOMObject(obj, WebKit::wrap${interfaceName}(obj)); +} + +} // namespace WebKit // + +EOF + + push(@cBody, $converter); + } + + my $implContent = ""; + + push(@cBody, "extern \"C\" {\n\n"); + + # Add the default header template + @hPrefix = split("\r", $licenceTemplate); + + # Header guard + my $guard = "__" . $className . "_H__"; + + my $classCaps = uc(decamelize($interfaceName)); + my $lcase_ifacename = "webkit_" . decamelize($interfaceName); + + @hPrefixGuard = << "EOF"; +#ifndef $guard +#define $guard +EOF + + $implContent = << "EOF"; +G_BEGIN_DECLS + +EOF + + push(@hBodyPre, $implContent); + + $implContent = << "EOF"; + +#define WEBKIT_TYPE_${classCaps} (${lcase_ifacename}_get_type()) +#define WEBKIT_${classCaps}(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_${classCaps}, ${className})) +#define WEBKIT_${classCaps}_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_${classCaps}, $className)Class) +#define WEBKIT_IS_${classCaps}(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_${classCaps})) +#define WEBKIT_IS_${classCaps}_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_${classCaps})) +#define WEBKIT_${classCaps}_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_${classCaps}, ${className}Class)) + +struct _${className} { + ${parentClassName} parent_instance; +}; + +struct _${className}Class { + ${parentClassName}Class parent_class; +}; + +WEBKIT_API GType +${lcase_ifacename}_get_type (void); + +EOF + + push(@hBody, $implContent); + + $implContent = << "EOF"; + +G_BEGIN_DECLS + +G_DEFINE_TYPE(${className}, ${lcase_ifacename}, ${parentGObjType}); + +G_END_DECLS + +namespace WebKit { + +${className} * +wrap${interfaceName}(WebCore::${interfaceName} *coreObject) +{ + g_return_val_if_fail(coreObject != NULL, NULL); + + ${className} *wrapper = WEBKIT_${classCaps}(g_object_new(WEBKIT_TYPE_${classCaps}, NULL)); + + coreObject->ref(); + WEBKIT_DOM_OBJECT(wrapper)->coreObject = coreObject; + + return wrapper; +} + +WebCore::${interfaceName} * +core(${className} *request) +{ + g_return_val_if_fail(request != NULL, NULL); + + WebCore::${interfaceName} *coreObject = static_cast(WEBKIT_DOM_OBJECT(request)->coreObject); + g_assert(coreObject != NULL); + + return coreObject; +} + +} // namespace WebKit / + +EOF + push(@cBodyPriv, $implContent); + + my @txt_install_props = $object->GenerateProperties($class, $classCaps, $lcase_ifacename); + + my $install_get_prop = "// no get properties"; + my $install_set_prop = "// no set properties"; + + if (CountGetProperties($class) > 0) { + $install_get_prop = "g_klass->get_property = ${lcase_ifacename}__get_property_fn;"; + } + + if (CountSetProperties($class) > 0) { + $install_set_prop = "g_klass->set_property = ${lcase_ifacename}__set_property_fn;"; + } + + $implContent = << "EOF"; + +static void ${lcase_ifacename}_finalize(GObject* object) +{ + WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); + + if (dom_object != NULL && dom_object->coreObject != NULL) { + WebCore::${interfaceName} *coreObject = static_cast(dom_object->coreObject); + coreObject->deref(); + + dom_object->coreObject = NULL; + + WebKit::GDOMObjectCache::forgetDOMObject(coreObject); + } + + G_OBJECT_CLASS(${lcase_ifacename}_parent_class)->finalize(object); +} + +static void ${lcase_ifacename}_class_init(${className}Class* requestClass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS (requestClass); + g_klass->finalize = ${lcase_ifacename}_finalize; + ${install_get_prop} + ${install_set_prop} + +@txt_install_props +} + +static void ${lcase_ifacename}_init(${className}* request) +{ +} + +EOF + push(@cBodyPriv, $implContent); + + $implIncludes{"webkit/WebKit${interfaceName}Private.h"} = 1; + + $implIncludes{"${interfaceName}.h"} = 1; + + foreach my $function (@{$class->functions}) { + $object->GenerateFunction($interfaceName, $function, ""); + } + + TOP: + foreach my $attribute (@{$class->attributes}) { + if (skipAttribute($attribute)) { + next TOP; + } + + if ($attribute->signature->name eq "type" + # This will conflict with the get_type() function we define to return a GType + # according to GObject conventions. Skip this for now. + || $attribute->signature->name eq "URL" # TODO: handle this + || $attribute->signature->extendedAttributes->{"ConvertFromString"} # TODO: handle this + ) { + next TOP; + } + + my $attname_upper = $codeGenerator->WK_ucfirst($attribute->signature->name); + my $getname = "get${attname_upper}"; + my $setname = "set${attname_upper}"; + if (ClassHasFunction($class, $getname) || ClassHasFunction($class, $setname)) { + # Very occasionally an IDL file defines getter/setter functions for one of its + # attributes; in this case we don't need to autogenerate the getter/setter. + next TOP; + } + + # Generate an attribute getter. For an attribute "foo", this is a function named + # "get_foo" which calls a DOM class method named foo(). + my $function = new domFunction(); + $function->signature($attribute->signature); + $function->raisesExceptions($attribute->getterExceptions); + $object->GenerateFunction($interfaceName, $function, "get"); + + if ($attribute->type =~ /^readonly/ || + $attribute->signature->extendedAttributes->{"Replaceable"} # can't handle this yet + ) { + next TOP; + } + + # Generate an attribute setter. For an attribute, "foo", this is a function named + # "set_foo" which calls a DOM class method named setFoo(). + $function = new domFunction(); + + $function->signature(new domSignature()); + $function->signature->name($setname); + $function->signature->type("void"); + $function->signature->extendedAttributes($attribute->signature->extendedAttributes); + + my $param = new domSignature(); + $param->name("value"); + $param->type($attribute->signature->type); + my %attributes = (); + $param->extendedAttributes(attributes); + my $arrayRef = $function->parameters; + push(@$arrayRef, $param); + + $function->raisesExceptions($attribute->setterExceptions); + + $object->GenerateFunction($interfaceName, $function, "set"); + } + + push(@cBody, "} /* extern \"C\" */\n\n"); + push(@cBodyPriv, "G_END_DECLS\n\n"); + + push(@hBody, "G_END_DECLS\n\n"); + push(@hBody, "#endif /* $guard */\n"); +} + +# Internal helper +sub WriteData { + my ($object, $name) = @_; + + # Write public header. + my $hdrFName = "$outputDir/" . $name . ".h"; + open(HEADER, ">$hdrFName") or die "Couldn't open file $hdrFName"; + + print HEADER @hPrefix; + print HEADER @hPrefixGuard; + print HEADER "\n#include \"webkit/webkitdomdefines.h\"\n"; + print HEADER "#include \n"; + print HEADER "#include \n"; + print HEADER map { "#include \"$_\"\n" } sort keys(%hdrIncludes); + print HEADER "\n" if keys(%hdrIncludes); + print HEADER "\n"; + print HEADER @hBodyPre; + print HEADER @hBody; + + close(HEADER); + + # Write the implementation + my $implFileName = "$outputDir/" . $name . ".cpp"; + open(IMPL, ">$implFileName") or die "Couldn't open file $implFileName"; + + print IMPL @cPrefix; + print IMPL "#include \n"; + print IMPL "#include \"config.h\"\n\n"; + print IMPL "#include \n"; + print IMPL "#include \n"; + print IMPL map { "#include \"$_\"\n" } sort keys(%implIncludes); + print IMPL "\n" if keys(%implIncludes); + print IMPL @cBody; + + print IMPL "\n"; + print IMPL @cBodyPriv; + + close(IMPL); + + %implIncludes = (); + %hdrIncludes = (); + @hPrefix = (); + @hPrefixGuard = (); + @hBodyPre = (); + @hBody = (); + + @cPrefix = (); + @cBody = (); + @cBodyPriv = (); +} + +1; diff -Naur WebKit-r41128/WebCore/bindings/scripts/CodeGeneratorJS.pm WebKit-r41137-nx/WebCore/bindings/scripts/CodeGeneratorJS.pm --- WebKit-r41128/WebCore/bindings/scripts/CodeGeneratorJS.pm 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/scripts/CodeGeneratorJS.pm 2009-03-24 16:50:58.000000000 -0400 @@ -284,29 +284,19 @@ push(@getOwnPropertySlotImpl, " return false;\n\n"); } - my $hasNameGetterGeneration = sub { - push(@getOwnPropertySlotImpl, " if (canGetItemsForName(exec, static_cast<$implClassName*>(impl()), propertyName)) {\n"); - push(@getOwnPropertySlotImpl, " slot.setCustom(this, nameGetter);\n"); - push(@getOwnPropertySlotImpl, " return true;\n"); - push(@getOwnPropertySlotImpl, " }\n"); - if ($inlined) { - $headerIncludes{"AtomicString.h"} = 1; - } else { - $implIncludes{"AtomicString.h"} = 1; + my $manualLookupGetterGeneration = sub { + my $requiresManualLookup = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNameGetter"}; + if ($requiresManualLookup) { + push(@getOwnPropertySlotImpl, " const ${namespaceMaybe}HashEntry* entry = ${className}Table.entry(exec, propertyName);\n"); + push(@getOwnPropertySlotImpl, " if (entry) {\n"); + push(@getOwnPropertySlotImpl, " slot.setCustom(this, entry->propertyGetter());\n"); + push(@getOwnPropertySlotImpl, " return true;\n"); + push(@getOwnPropertySlotImpl, " }\n"); } }; - if ($dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { - &$hasNameGetterGeneration(); - } - - my $requiresManualLookup = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNameGetter"}; - if ($requiresManualLookup) { - push(@getOwnPropertySlotImpl, " const ${namespaceMaybe}HashEntry* entry = ${className}Table.entry(exec, propertyName);\n"); - push(@getOwnPropertySlotImpl, " if (entry) {\n"); - push(@getOwnPropertySlotImpl, " slot.setCustom(this, entry->propertyGetter());\n"); - push(@getOwnPropertySlotImpl, " return true;\n"); - push(@getOwnPropertySlotImpl, " }\n"); + if (!$dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + &$manualLookupGetterGeneration(); } if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"}) { @@ -322,8 +312,20 @@ push(@getOwnPropertySlotImpl, " }\n"); } - if ($dataNode->extendedAttributes->{"HasNameGetter"}) { - &$hasNameGetterGeneration(); + if ($dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + push(@getOwnPropertySlotImpl, " if (canGetItemsForName(exec, static_cast<$implClassName*>(impl()), propertyName)) {\n"); + push(@getOwnPropertySlotImpl, " slot.setCustom(this, nameGetter);\n"); + push(@getOwnPropertySlotImpl, " return true;\n"); + push(@getOwnPropertySlotImpl, " }\n"); + if ($inlined) { + $headerIncludes{"AtomicString.h"} = 1; + } else { + $implIncludes{"AtomicString.h"} = 1; + } + } + + if ($dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + &$manualLookupGetterGeneration(); } if ($dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}) { diff -Naur WebKit-r41128/WebCore/bindings/scripts/gobject-generate.pl WebKit-r41137-nx/WebCore/bindings/scripts/gobject-generate.pl --- WebKit-r41128/WebCore/bindings/scripts/gobject-generate.pl 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bindings/scripts/gobject-generate.pl 2009-07-19 16:11:03.563277886 -0400 @@ -0,0 +1,79 @@ +#!/usr/bin/perl -w +# +# Copyright (C) 2009 Adam Dingle +# +# This file is part of WebKit +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# aint with this library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# + +my $classlist = ; +chomp($classlist); +my @classes = split / /, $classlist; +@classes = sort @classes; + +print <\n"; + } +} + +print "\n"; +print "#endif\n"; + + diff -Naur WebKit-r41128/WebCore/bridge/IdentifierRep.h WebKit-r41137-nx/WebCore/bridge/IdentifierRep.h --- WebKit-r41128/WebCore/bridge/IdentifierRep.h 2009-02-15 03:48:41.000000000 -0500 +++ WebKit-r41137-nx/WebCore/bridge/IdentifierRep.h 2009-02-23 16:01:26.000000000 -0500 @@ -26,6 +26,7 @@ #ifndef IdentifierRep_h #define IdentifierRep_h +#include #include #include diff -Naur WebKit-r41128/WebCore/css/CSSPrimitiveValueMappings.h WebKit-r41137-nx/WebCore/css/CSSPrimitiveValueMappings.h --- WebKit-r41128/WebCore/css/CSSPrimitiveValueMappings.h 2009-02-16 04:14:50.000000000 -0500 +++ WebKit-r41137-nx/WebCore/css/CSSPrimitiveValueMappings.h 2009-02-23 16:01:26.000000000 -0500 @@ -1676,72 +1676,6 @@ } } -template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e) - : m_type(CSS_IDENT) -{ - switch (e) { - case PE_NONE: - m_value.ident = CSSValueNone; - break; - case PE_STROKE: - m_value.ident = CSSValueStroke; - break; - case PE_FILL: - m_value.ident = CSSValueFill; - break; - case PE_PAINTED: - m_value.ident = CSSValuePainted; - break; - case PE_VISIBLE: - m_value.ident = CSSValueVisible; - break; - case PE_VISIBLE_STROKE: - m_value.ident = CSSValueVisiblestroke; - break; - case PE_VISIBLE_FILL: - m_value.ident = CSSValueVisiblefill; - break; - case PE_VISIBLE_PAINTED: - m_value.ident = CSSValueVisiblepainted; - break; - case PE_AUTO: - m_value.ident = CSSValueAuto; - break; - case PE_ALL: - m_value.ident = CSSValueAll; - break; - } -} - -template<> inline CSSPrimitiveValue::operator EPointerEvents() const -{ - switch (m_value.ident) { - case CSSValueAll: - return PE_ALL; - case CSSValueAuto: - return PE_AUTO; - case CSSValueNone: - return PE_NONE; - case CSSValueVisiblepainted: - return PE_VISIBLE_PAINTED; - case CSSValueVisiblefill: - return PE_VISIBLE_FILL; - case CSSValueVisiblestroke: - return PE_VISIBLE_STROKE; - case CSSValueVisible: - return PE_VISIBLE; - case CSSValuePainted: - return PE_PAINTED; - case CSSValueFill: - return PE_FILL; - case CSSValueStroke: - return PE_STROKE; - default: - ASSERT_NOT_REACHED(); - return PE_ALL; - } -} - #if ENABLE(SVG) template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e) @@ -2078,6 +2012,76 @@ } } +#endif + +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e) + : m_type(CSS_IDENT) +{ + switch (e) { + case PE_NONE: + m_value.ident = CSSValueNone; + break; + case PE_STROKE: + m_value.ident = CSSValueStroke; + break; + case PE_FILL: + m_value.ident = CSSValueFill; + break; + case PE_PAINTED: + m_value.ident = CSSValuePainted; + break; + case PE_VISIBLE: + m_value.ident = CSSValueVisible; + break; + case PE_VISIBLE_STROKE: + m_value.ident = CSSValueVisiblestroke; + break; + case PE_VISIBLE_FILL: + m_value.ident = CSSValueVisiblefill; + break; + case PE_VISIBLE_PAINTED: + m_value.ident = CSSValueVisiblepainted; + break; + case PE_AUTO: + m_value.ident = CSSValueAuto; + break; + case PE_ALL: + m_value.ident = CSSValueAll; + break; + } +} + +template<> inline CSSPrimitiveValue::operator EPointerEvents() const +{ + switch (m_value.ident) { + case CSSValueAll: + return PE_ALL; + case CSSValueAuto: + return PE_AUTO; + case CSSValueNone: + return PE_NONE; + case CSSValueVisiblepainted: + return PE_VISIBLE_PAINTED; + case CSSValueVisiblefill: + return PE_VISIBLE_FILL; + case CSSValueVisiblestroke: + return PE_VISIBLE_STROKE; + case CSSValueVisible: + return PE_VISIBLE; + case CSSValuePainted: + return PE_PAINTED; + case CSSValueFill: + return PE_FILL; + case CSSValueStroke: + return PE_STROKE; + default: + ASSERT_NOT_REACHED(); + return PE_ALL; + } +} + +#if ENABLE(SVG) + template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e) : m_type(CSS_IDENT) { diff -Naur WebKit-r41128/WebCore/dom/ContainerNode.cpp WebKit-r41137-nx/WebCore/dom/ContainerNode.cpp --- WebKit-r41128/WebCore/dom/ContainerNode.cpp 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/ContainerNode.cpp 2009-03-24 16:51:24.000000000 -0400 @@ -387,25 +387,25 @@ if (!m_firstChild) return false; - Node* n; + // The container node can be removed from event handlers. + RefPtr protect(this); - // do any prep work needed before actually starting to detach - // and remove... e.g. stop loading frames, fire unload events - for (n = m_firstChild; n; n = n->nextSibling()) - willRemoveChild(n); + // Do any prep work needed before actually starting to detach + // and remove... e.g. stop loading frames, fire unload events. + // FIXME: Adding new children from event handlers can cause an infinite loop here. + for (RefPtr n = m_firstChild; n; n = n->nextSibling()) + willRemoveChild(n.get()); // exclude this node when looking for removed focusedNode since only children will be removed document()->removeFocusedNodeOfSubtree(this, true); forbidEventDispatch(); int childCountDelta = 0; - while ((n = m_firstChild) != 0) { + while (RefPtr n = m_firstChild) { childCountDelta--; - Node *next = n->nextSibling(); + Node* next = n->nextSibling(); - n->ref(); - // Remove the node from the tree before calling detach or removedFromDocument (4427024, 4129744) n->setPreviousSibling(0); n->setNextSibling(0); @@ -420,8 +420,6 @@ if (n->inDocument()) n->removedFromDocument(); - - n->deref(); } allowEventDispatch(); diff -Naur WebKit-r41128/WebCore/dom/InputElement.cpp WebKit-r41137-nx/WebCore/dom/InputElement.cpp --- WebKit-r41128/WebCore/dom/InputElement.cpp 2009-02-16 02:39:40.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/InputElement.cpp 2009-06-30 19:11:09.041874808 -0400 @@ -180,7 +180,12 @@ string.replace('\n', ' '); StringImpl* s = string.impl(); +#ifdef MAEMO_CHANGES + int newLength = numCharactersInGraphemeClusters(s, maxLength + 2); + // This method returns value with 2 chars less in Maemo, probably bacause of the removed libicu. +#else int newLength = numCharactersInGraphemeClusters(s, maxLength); +#endif for (int i = 0; i < newLength; ++i) { const UChar& current = (*s)[i]; if (current < ' ' && current != '\t') { @@ -188,7 +193,7 @@ break; } } - + if (newLength < static_cast(string.length())) return string.left(newLength); @@ -216,12 +221,12 @@ ASSERT(event->isBeforeTextInsertedEvent()); // Make sure that the text to be inserted will not violate the maxLength. - int oldLength = numGraphemeClusters(data.inputElement()->value().impl()); + int oldLength = numGraphemeClusters(data.inputElement()->value().impl()); ASSERT(oldLength <= data.maxLength()); int selectionLength = numGraphemeClusters(plainText(document->frame()->selection()->selection().toNormalizedRange().get()).impl()); ASSERT(oldLength >= selectionLength); int maxNewLength = data.maxLength() - (oldLength - selectionLength); - + // Truncate the inserted text to avoid violating the maxLength and other constraints. BeforeTextInsertedEvent* textEvent = static_cast(event); textEvent->setText(constrainValue(data, textEvent->text(), maxNewLength)); @@ -243,7 +248,7 @@ int oldMaxLength = data.maxLength(); data.setMaxLength(maxLength); - + if (oldMaxLength != maxLength) updateValueIfNeeded(data); diff -Naur WebKit-r41128/WebCore/dom/KeyboardEvent.idl WebKit-r41137-nx/WebCore/dom/KeyboardEvent.idl --- WebKit-r41128/WebCore/dom/KeyboardEvent.idl 2009-01-21 00:14:15.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/KeyboardEvent.idl 2009-07-19 14:53:48.051048795 -0400 @@ -62,7 +62,9 @@ #if !defined(LANGUAGE_JAVASCRIPT) readonly attribute long keyCode; readonly attribute long charCode; - + + // FIXME: GObject is in C, which does not support overloaded functions +#if !defined(LANGUAGE_GOBJECT) void initKeyboardEvent(in DOMString type, in boolean canBubble, in boolean cancelable, @@ -75,6 +77,8 @@ in boolean metaKey); #endif +#endif + }; } diff -Naur WebKit-r41128/WebCore/dom/ScriptElement.cpp WebKit-r41137-nx/WebCore/dom/ScriptElement.cpp --- WebKit-r41128/WebCore/dom/ScriptElement.cpp 2009-01-22 18:57:28.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/ScriptElement.cpp 2009-06-23 19:59:28.996479591 -0400 @@ -33,6 +33,7 @@ #include "HTMLScriptElement.h" #include "MIMETypeRegistry.h" #include "ScriptController.h" +#include "ScriptEvaluator.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "StringHash.h" @@ -46,6 +47,13 @@ namespace WebCore { +WTF::Vector ScriptElement::evaluators; + +void ScriptElement::addScriptEvaluator(ScriptEvaluator* evaluator) +{ + evaluators.append(evaluator); +} + void ScriptElement::insertedIntoDocument(ScriptElementData& data, const String& sourceUrl) { if (data.createdByParser()) @@ -168,18 +176,33 @@ void ScriptElementData::evaluateScript(const ScriptSourceCode& sourceCode) { - if (m_evaluated || sourceCode.isEmpty() || !shouldExecuteAsJavaScript()) + if (m_evaluated || sourceCode.isEmpty()) return; - if (Frame* frame = m_element->document()->frame()) { - if (!frame->script()->isEnabled()) - return; - - m_evaluated = true; - - frame->script()->evaluate(sourceCode); - Document::updateDocumentsRendering(); - } + if (shouldExecuteAsJavaScript()) { + if (Frame* frame = m_element->document()->frame()) { + if (!frame->script()->isEnabled()) + return; + + m_evaluated = true; + + frame->script()->evaluate(sourceCode); + Document::updateDocumentsRendering(); + } + } else { + for (size_t i = 0; i < ScriptElement::evaluators.size(); i++) { + ScriptEvaluator* evaluator = ScriptElement::evaluators.at(i); + if (evaluator && evaluator->matchesMimeType(m_scriptElement->typeAttributeValue())) { + m_evaluated = true; + + if (Frame* frame = m_element->document()->frame()) { + evaluator->evaluate(m_scriptElement->typeAttributeValue(), sourceCode, (void*)frame->script()->windowShell()->window()->globalExec()); + Document::updateDocumentsRendering(); + break; + } + } + } + } } void ScriptElementData::stopLoadRequest() @@ -235,6 +258,26 @@ return true; } +ScriptEvaluator* ScriptElementData::findEvaluator() const +{ + String type = m_scriptElement->typeAttributeValue(); + String language = m_scriptElement->languageAttributeValue(); + + for (size_t i = 0; i < ScriptElement::evaluators.size(); i++) { + ScriptEvaluator* evaluator = ScriptElement::evaluators.at(i); + if (evaluator) { + if (!type.isEmpty() && evaluator->matchesMimeType(type)) { + return evaluator; + } + else if (!language.isEmpty() && evaluator->matchesMimeType(language)) { + return evaluator; + } + } + } + + return NULL; +} + String ScriptElementData::scriptCharset() const { // First we try to get encoding from charset attribute. diff -Naur WebKit-r41128/WebCore/dom/ScriptElement.h WebKit-r41137-nx/WebCore/dom/ScriptElement.h --- WebKit-r41128/WebCore/dom/ScriptElement.h 2009-01-22 18:57:28.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/ScriptElement.h 2009-06-23 20:01:47.814883565 -0400 @@ -30,6 +30,7 @@ class Element; class ScriptElementData; class ScriptSourceCode; +class ScriptEvaluator; class ScriptElement { public: @@ -49,6 +50,9 @@ // A charset for loading the script (may be overridden by HTTP headers or a BOM). virtual String scriptCharset() const = 0; + static void addScriptEvaluator(ScriptEvaluator* evaluator); + static WTF::Vector evaluators; + protected: // Helper functions used by our parent classes. static void insertedIntoDocument(ScriptElementData&, const String& sourceUrl); @@ -56,6 +60,7 @@ static void childrenChanged(ScriptElementData&); static void finishParsingChildren(ScriptElementData&, const String& sourceUrl); static void handleSourceAttribute(ScriptElementData&, const String& sourceUrl); + }; // HTML/SVGScriptElement hold this struct as member variable @@ -67,6 +72,7 @@ bool ignoresLoadRequest() const; bool shouldExecuteAsJavaScript() const; + ScriptEvaluator* findEvaluator() const; String scriptContent() const; String scriptCharset() const; diff -Naur WebKit-r41128/WebCore/dom/ScriptEvaluator.h WebKit-r41137-nx/WebCore/dom/ScriptEvaluator.h --- WebKit-r41128/WebCore/dom/ScriptEvaluator.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/ScriptEvaluator.h 2009-06-23 19:11:25.121475000 -0400 @@ -0,0 +1,16 @@ +#ifndef ScriptEvaluator_h +#define ScriptEvaluator_h + +namespace WebCore { + class String; + class ScriptSourceCode; + + class ScriptEvaluator { + public: + virtual ~ScriptEvaluator(){} + virtual bool matchesMimeType(const String& mimeType) = 0; + virtual void evaluate(const String& mimeType, const ScriptSourceCode& sourceCode, void *context) = 0; + }; +} + +#endif diff -Naur WebKit-r41128/WebCore/dom/Tokenizer.h WebKit-r41137-nx/WebCore/dom/Tokenizer.h --- WebKit-r41128/WebCore/dom/Tokenizer.h 2009-01-21 00:14:15.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/Tokenizer.h 2009-03-24 16:49:57.000000000 -0400 @@ -37,7 +37,7 @@ // received during executing a script must be appended, hence the // extra bool to be able to distinguish between both cases. // document.write() always uses false, while the loader uses true. - virtual bool write(const SegmentedString&, bool appendData) = 0; + virtual void write(const SegmentedString&, bool appendData) = 0; virtual void finish() = 0; virtual bool isWaitingForScripts() const = 0; virtual void stopParsing() { m_parserStopped = true; } diff -Naur WebKit-r41128/WebCore/dom/WorkerLocation.cpp WebKit-r41137-nx/WebCore/dom/WorkerLocation.cpp --- WebKit-r41128/WebCore/dom/WorkerLocation.cpp 2009-01-21 00:14:15.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/WorkerLocation.cpp 2009-03-24 16:51:41.000000000 -0400 @@ -66,12 +66,12 @@ String WorkerLocation::search() const { - return m_url.query(); + return m_url.query().isEmpty() ? "" : "?" + m_url.query(); } String WorkerLocation::hash() const { - return m_url.ref().isNull() ? "" : "#" + m_url.ref(); + return m_url.ref().isEmpty() ? "" : "#" + m_url.ref(); } String WorkerLocation::toString() const diff -Naur WebKit-r41128/WebCore/dom/XMLTokenizer.cpp WebKit-r41137-nx/WebCore/dom/XMLTokenizer.cpp --- WebKit-r41128/WebCore/dom/XMLTokenizer.cpp 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/XMLTokenizer.cpp 2009-03-24 16:50:04.000000000 -0400 @@ -89,7 +89,7 @@ m_currentNodeIsReferenced = nodeNeedsReference; } -bool XMLTokenizer::write(const SegmentedString& s, bool /*appendData*/) +void XMLTokenizer::write(const SegmentedString& s, bool /*appendData*/) { String parseString = s.toString(); @@ -97,15 +97,14 @@ m_originalSourceForTransform += parseString; if (m_parserStopped || m_sawXSLTransform) - return false; + return; if (m_parserPaused) { m_pendingSrc.append(s); - return false; + return; } doWrite(s.toString()); - return false; } void XMLTokenizer::handleError(ErrorType type, const char* m, int lineNumber, int columnNumber) diff -Naur WebKit-r41128/WebCore/dom/XMLTokenizer.h WebKit-r41137-nx/WebCore/dom/XMLTokenizer.h --- WebKit-r41128/WebCore/dom/XMLTokenizer.h 2009-01-22 18:57:28.000000000 -0500 +++ WebKit-r41137-nx/WebCore/dom/XMLTokenizer.h 2009-03-24 16:49:52.000000000 -0400 @@ -60,7 +60,7 @@ enum ErrorType { warning, nonFatal, fatal }; // from Tokenizer - virtual bool write(const SegmentedString&, bool appendData); + virtual void write(const SegmentedString&, bool appendData); virtual void finish(); virtual bool isWaitingForScripts() const; virtual void stopParsing(); diff -Naur WebKit-r41128/WebCore/GNUmakefile.am WebKit-r41137-nx/WebCore/GNUmakefile.am --- WebKit-r41128/WebCore/GNUmakefile.am 2009-02-20 22:38:13.000000000 -0500 +++ WebKit-r41137-nx/WebCore/GNUmakefile.am 2009-07-19 16:08:06.083042608 -0400 @@ -1,7 +1,7 @@ WebCore := $(srcdir)/WebCore -FEATURE_DEFINES_JAVASCRIPT := LANGUAGE_JAVASCRIPT=1 +FEATURE_DEFINES := SVG_FEATURES := HTML_FEATURES := @@ -9,7 +9,11 @@ WEBCORE_CSS_VALUE_KEYWORDS := $(WebCore)/css/CSSValueKeywords.in webcore_cppflags += \ + -I$(srcdir)/WebKit/gtk \ + -I$(srcdir)/WebKit/gtk/WebCoreSupport \ + -I$(srcdir)/WebKit/gtk/webkit \ -I$(srcdir)/WebCore \ + -I$(srcdir)/WebCore/bindings/gobject \ -I$(srcdir)/WebCore/bindings/js \ -I$(srcdir)/WebCore/bridge \ -I$(srcdir)/WebCore/bridge/c \ @@ -56,6 +60,7 @@ DerivedSources/DocTypeStrings.cpp \ DerivedSources/tokenizer.cpp \ DerivedSources/ColorData.c \ + DerivedSources/webkit/webkitdomdummy.c \ WebCore/bindings/js/JSDOMWindowBase.lut.h \ WebCore/bindings/js/JSRGBColor.lut.h @@ -238,6 +243,14 @@ WebCore/xml/XMLSerializer.idl \ WebCore/xml/XSLTProcessor.idl +webcoregtk_sources += \ + WebCore/bindings/gobject/webkitbinding.cpp \ + WebCore/bindings/gobject/webkitbinding.h \ + WebCore/bindings/gobject/WebKitDOMObject.cpp \ + WebCore/bindings/gobject/WebKitDOMObject.h \ + WebCore/bindings/gobject/webkithtmlelementwrapperfactory.cpp \ + WebCore/bindings/gobject/webkithtmlelementwrapperfactory.h + webcore_sources += \ WebCore/WebCorePrefix.h \ WebCore/bindings/js/CachedScriptSourceProvider.h \ @@ -669,6 +682,7 @@ WebCore/dom/RegisteredEventListener.h \ WebCore/dom/ScriptElement.cpp \ WebCore/dom/ScriptElement.h \ + WebCore/dom/ScriptEvaluator.h \ WebCore/dom/ScriptExecutionContext.cpp \ WebCore/dom/ScriptExecutionContext.h \ WebCore/dom/SelectorNodeList.cpp \ @@ -1447,14 +1461,9 @@ WebCore/platform/text/StringImpl.cpp \ WebCore/platform/text/StringImpl.h \ WebCore/platform/text/TextBoundaries.h \ - WebCore/platform/text/TextBoundariesICU.cpp \ WebCore/platform/text/TextBreakIterator.h \ - WebCore/platform/text/TextBreakIteratorICU.cpp \ - WebCore/platform/text/TextBreakIteratorInternalICU.h \ WebCore/platform/text/TextCodec.cpp \ WebCore/platform/text/TextCodec.h \ - WebCore/platform/text/TextCodecICU.cpp \ - WebCore/platform/text/TextCodecICU.h \ WebCore/platform/text/TextCodecLatin1.cpp \ WebCore/platform/text/TextCodecLatin1.h \ WebCore/platform/text/TextCodecUTF16.cpp \ @@ -1793,8 +1802,31 @@ WebCore/platform/image-decoders/png/PNGImageDecoder.cpp \ WebCore/platform/image-decoders/png/PNGImageDecoder.h \ WebCore/platform/image-decoders/xbm/XBMImageDecoder.cpp \ - WebCore/platform/image-decoders/xbm/XBMImageDecoder.h \ + WebCore/platform/image-decoders/xbm/XBMImageDecoder.h + +# ---- +# icu unicode backend +# ---- +if USE_ICU_UNICODE +webcoregtk_sources += \ + WebCore/platform/text/TextCodecICU.cpp \ + WebCore/platform/text/TextCodecICU.h \ + WebCore/platform/text/TextBoundariesICU.cpp \ + WebCore/platform/text/TextBreakIteratorICU.cpp \ + WebCore/platform/text/TextBreakIteratorInternalICU.h \ WebCore/platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp +endif # USE_ICU_UNICODE + +# ---- +# glib unicode backend +# ---- +if USE_GLIB_UNICODE +webcoregtk_sources += \ + WebCore/platform/text/gtk/TextCodecGtk.cpp \ + WebCore/platform/text/gtk/TextCodecGtk.h \ + WebCore/platform/text/gtk/TextBoundariesGtk.cpp \ + WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp +endif # ---- # curl http backend @@ -1868,7 +1900,7 @@ # Offline Web Applications # ---- if ENABLE_OFFLINE_WEB_APPLICATIONS -FEATURE_DEFINES_JAVASCRIPT += ENABLE_OFFLINE_WEB_APPLICATIONS=1 +FEATURE_DEFINES += ENABLE_OFFLINE_WEB_APPLICATIONS=1 IDL_BINDINGS += \ WebCore/loader/appcache/DOMApplicationCache.idl @@ -1909,7 +1941,7 @@ # Database Support # ---- if ENABLE_DATABASE -FEATURE_DEFINES_JAVASCRIPT += ENABLE_DATABASE=1 +FEATURE_DEFINES += ENABLE_DATABASE=1 IDL_BINDINGS += \ WebCore/storage/Database.idl \ @@ -1982,7 +2014,7 @@ # HTML5 client-side session and persistent storage # ---- if ENABLE_DOM_STORAGE -FEATURE_DEFINES_JAVASCRIPT += ENABLE_DOM_STORAGE=1 +FEATURE_DEFINES += ENABLE_DOM_STORAGE=1 IDL_BINDINGS += \ WebCore/storage/Storage.idl \ @@ -2041,7 +2073,7 @@ # Video Support # ---- if ENABLE_VIDEO -FEATURE_DEFINES_JAVASCRIPT += ENABLE_VIDEO=1 +FEATURE_DEFINES += ENABLE_VIDEO=1 HTML_FEATURES += ENABLE_VIDEO=1 webcore_cppflags += -DENABLE_VIDEO=1 @@ -2092,7 +2124,7 @@ # XPath Support # ---- if ENABLE_XPATH -FEATURE_DEFINES_JAVASCRIPT += ENABLE_XPATH=1 +FEATURE_DEFINES += ENABLE_XPATH=1 webcore_cppflags += -DENABLE_XPATH=1 @@ -2162,7 +2194,7 @@ # XSLT Support # ---- if ENABLE_XSLT -FEATURE_DEFINES_JAVASCRIPT += ENABLE_XSLT=1 +FEATURE_DEFINES += ENABLE_XSLT=1 webcore_cppflags += -DENABLE_XSLT=1 @@ -2183,7 +2215,7 @@ # Web Workers support # ---- if ENABLE_WORKERS -FEATURE_DEFINES_JAVASCRIPT += ENABLE_WORKERS=1 +FEATURE_DEFINES += ENABLE_WORKERS=1 webcore_cppflags += \ -DENABLE_WORKERS=1 @@ -2225,7 +2257,7 @@ # WML Support # ---- if ENABLE_WML -FEATURE_DEFINES_JAVASCRIPT += ENABLE_WML=1 +FEATURE_DEFINES += ENABLE_WML=1 webcore_built_sources += \ DerivedSources/WMLElementFactory.cpp \ @@ -2284,7 +2316,7 @@ # ---- if ENABLE_GEOLOCATION -FEATURE_DEFINES_JAVASCRIPT += ENABLE_GEOLOCATION=1 +FEATURE_DEFINES += ENABLE_GEOLOCATION=1 webcore_cppflags += \ -DENABLE_GEOLOCATION=1 @@ -2300,7 +2332,7 @@ # FIXME: allow a more fine-grained inclusion/generation of sources per SVG feature # ---- if ENABLE_SVG -FEATURE_DEFINES_JAVASCRIPT += ENABLE_SVG=1 +FEATURE_DEFINES += ENABLE_SVG=1 WEBCORE_CSS_PROPERTY_NAMES += $(WebCore)/css/SVGCSSPropertyNames.in WEBCORE_CSS_VALUE_KEYWORDS += $(WebCore)/css/SVGCSSValueKeywords.in @@ -2885,37 +2917,37 @@ # SVG Features if ENABLE_SVG_USE -FEATURE_DEFINES_JAVASCRIPT += ENABLE_SVG_USE=1 +FEATURE_DEFINES += ENABLE_SVG_USE=1 SVG_FEATURES += ENABLE_SVG_USE=1 webcore_cppflags += -DENABLE_SVG_USE=1 endif if ENABLE_SVG_FOREIGN_OBJECT -FEATURE_DEFINES_JAVASCRIPT += ENABLE_SVG_FOREIGN_OBJECT=1 +FEATURE_DEFINES += ENABLE_SVG_FOREIGN_OBJECT=1 SVG_FEATURES += ENABLE_SVG_FOREIGN_OBJECT=1 webcore_cppflags += -DENABLE_SVG_FOREIGN_OBJECT=1 endif if ENABLE_SVG_FONTS -FEATURE_DEFINES_JAVASCRIPT += ENABLE_SVG_FONTS=1 +FEATURE_DEFINES += ENABLE_SVG_FONTS=1 SVG_FEATURES += ENABLE_SVG_FONTS=1 webcore_cppflags += -DENABLE_SVG_FONTS=1 endif if ENABLE_SVG_FILTERS -FEATURE_DEFINES_JAVASCRIPT += ENABLE_SVG_FILTERS=1 +FEATURE_DEFINES += ENABLE_SVG_FILTERS=1 SVG_FEATURES += ENABLE_SVG_FILTERS=1 webcore_cppflags += -DENABLE_SVG_FILTERS=1 endif if ENABLE_SVG_AS_IMAGE -FEATURE_DEFINES_JAVASCRIPT += ENABLE_SVG_AS_IMAGE=1 +FEATURE_DEFINES += ENABLE_SVG_AS_IMAGE=1 SVG_FEATURES += ENABLE_SVG_AS_IMAGE=1 webcore_cppflags += -DENABLE_SVG_AS_IMAGE=1 endif if ENABLE_SVG_ANIMATION -FEATURE_DEFINES_JAVASCRIPT += ENABLE_SVG_ANIMATION=1 +FEATURE_DEFINES += ENABLE_SVG_ANIMATION=1 SVG_FEATURES += ENABLE_SVG_ANIMATION=1 webcore_cppflags += -DENABLE_SVG_ANIMATION=1 endif @@ -3053,7 +3085,7 @@ .SECONDARY: DerivedSources/JS%.cpp: %.idl $(SCRIPTS_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm - $(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES)" --defines "$(FEATURE_DEFINES_JAVASCRIPT)" --generator JS $< + $(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES)" --defines "LANGUAGE_JAVASCRIPT=1 $(FEATURE_DEFINES)" --generator JS $< IDL_BINDINGS_JS_PURE := \ WebCore/svg/ElementTimeControl.idl \ @@ -3093,6 +3125,81 @@ libWebCoreJS.la: $(libWebCoreJS_objects) $(CXXLINK) $(libWebCoreJS_objects) $(LIBS) +# This dummy file causes configure to generate the DerivedSources/webkit/.deps directory, which must +# exist for us to be able to build other sources in DerivedSources/webkit with dynamically generated +# names. +DerivedSources/webkit/webkitdomdummy.c: + echo > $@ + +# Because WebCore/bindings/gobject/WebKitDOMObject.h is static source but is also a distributed header +# required by other distributed headers (both static and auto-generated), need to move this to the +# DerivedSources/webkit directory. The reason is that we want all header files distributed in the +# include/webkit-x.y/webkit directory, but do not want to name the WebCore/bindings/gobject directory +# "webkit", as that's a bit presumptuous for a GTK binding. +$(top_builddir)/DerivedSources/webkit/WebKitDOMObject.h: + cp -f $(WebCore)/bindings/gobject/WebKitDOMObject.h $@ + +# Bindings autogenerated in GObject, but not in JS. +IDL_BINDINGS_GOBJECT_EXTRA := \ + WebCore/html/CanvasPixelArray.idl + +# Bindings autogenerated in JS, but not in GObject. +IDL_BINDINGS_GOBJECT_MINUS := + +# All IDL files used for autogeneration in GObject. We filter out SVG and events for now. +IDL_BINDINGS_GOBJECT := $(filter-out $(IDL_BINDINGS_GOBJECT_MINUS) WebCore/svg% WebCore/dom/Event%.idl WebCore/%Event.idl, \ + $(IDL_BINDINGS) $(IDL_BINDINGS_GOBJECT_EXTRA)) + +# All classes autogenerated in GObject. +GOBJECT_AUTO_CLASSES := $(basename $(notdir $(IDL_BINDINGS_GOBJECT))) + +# Classes which we've coded by hand. +GOBJECT_FIXED_CLASSES := DOMObject + +GOBJECT_CLASSES := $(GOBJECT_AUTO_CLASSES) $(GOBJECT_FIXED_CLASSES) + +# Filter out SVG for now. +FEATURE_DEFINES_GOBJECT := $(filter-out ENABLE_SVG%, $(FEATURE_DEFINES)) + +# Autogenerated header files. +GOBJECT_HEADERS_BUILT := $(patsubst %,DerivedSources/webkit/WebKit%.h, $(GOBJECT_AUTO_CLASSES)) \ + $(top_builddir)/DerivedSources/webkit/webkitdom.h \ + $(top_builddir)/DerivedSources/webkit/webkitdomdefines.h \ + $(top_builddir)/DerivedSources/webkit/WebKitDOMObject.h + +# Autogenerated source files. +GOBJECT_SOURCES_BUILT := $(patsubst %,DerivedSources/webkit/WebKit%.cpp, $(GOBJECT_AUTO_CLASSES)) + +# Hand-coded header files. +GOBJECT_HEADERS_FIXED := $(patsubst %, $(srcdir)/WebCore/bindings/gobject/WebKit%.h, $(GOBJECT_FIXED_CLASSES)) + +# All header files that get installed. +libgobject_h_api := $(GOBJECT_HEADERS_FIXED) $(GOBJECT_HEADERS_BUILT) + +DerivedSources/webkit/webkitdom.h: $(WebCore)/bindings/scripts/gobject-generate.pl + echo $(GOBJECT_CLASSES) | $(PERL) $< webkitdom > $@ + +DerivedSources/webkit/webkitdomdefines.h: $(WebCore)/bindings/scripts/gobject-generate.pl + echo $(GOBJECT_CLASSES) | $(PERL) $< defines > $@ + +DerivedSources/webkit/WebKit%.h: DerivedSources/webkit/WebKit%.cpp; + +DerivedSources/webkit/WebKit%.cpp: %.idl $(SCRIPTS_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorGObject.pm + $(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl --include $(WebCore)/dom --include $(WebCore)/html --include $(WebCore)/css --include $(WebCore)/page --include $(WebCore)/xml --include $(WebCore)/svg --outputDir "$(GENSOURCESGOBJECT)" --defines "LANGUAGE_GOBJECT=1 $(FEATURE_DEFINES_GOBJECT)" --generator GObject $< + +gobject_built_nosources := $(GOBJECT_HEADERS_BUILT) $(GOBJECT_SOURCES_BUILT) + +libgobject_objects := $(subst .cpp,.lo,$(GOBJECT_SOURCES_BUILT)) + +-include WebCore/bindings/gobject/$(DEPDIR)/%.Plo +-include DerivedSources/webkit/$(DEPDIR)/%.Plo + +$(libgobject_objects): AM_CPPFLAGS+=$(libWebCore_la_CPPFLAGS) + +$(libgobject_objects): AM_CXXFLAGS+=$(libWebCore_la_CXXFLAGS) + +libgobject.la: $(libgobject_objects) + $(CXXLINK) $(libgobject_objects) $(LIBS) noinst_HEADERS += \ $(IDL_BINDINGS) @@ -3108,6 +3215,7 @@ WebCore/bindings/scripts/InFilesParser.pm \ WebCore/bindings/scripts/generate-bindings.pl \ WebCore/bindings/scripts/CodeGeneratorJS.pm \ + WebCore/bindings/scripts/CodeGeneratorGObject.pm \ WebCore/css/html4.css \ WebCore/css/quirks.css \ WebCore/css/view-source.css \ diff -Naur WebKit-r41128/WebCore/html/HTMLAnchorElement.cpp WebKit-r41137-nx/WebCore/html/HTMLAnchorElement.cpp --- WebKit-r41128/WebCore/html/HTMLAnchorElement.cpp 2009-02-15 03:48:45.000000000 -0500 +++ WebKit-r41137-nx/WebCore/html/HTMLAnchorElement.cpp 2009-03-24 16:51:42.000000000 -0400 @@ -430,7 +430,8 @@ String HTMLAnchorElement::hash() const { - return "#" + href().ref(); + String ref = href().ref(); + return ref.isEmpty() ? "" : "#" + ref; } String HTMLAnchorElement::host() const @@ -463,7 +464,8 @@ String HTMLAnchorElement::search() const { - return href().query(); + String query = href().query(); + return query.isEmpty() ? "" : "?" + query; } String HTMLAnchorElement::text() const diff -Naur WebKit-r41128/WebCore/html/HTMLInputElement.cpp WebKit-r41137-nx/WebCore/html/HTMLInputElement.cpp --- WebKit-r41128/WebCore/html/HTMLInputElement.cpp 2009-02-16 02:39:40.000000000 -0500 +++ WebKit-r41137-nx/WebCore/html/HTMLInputElement.cpp 2009-06-30 01:07:35.101877343 -0400 @@ -173,7 +173,7 @@ bool HTMLInputElement::shouldUseInputMethod() const { - return m_type == TEXT || m_type == SEARCH || m_type == ISINDEX; + return m_type == TEXT || m_type == SEARCH || m_type == ISINDEX || m_type == PASSWORD; } void HTMLInputElement::dispatchFocusEvent() diff -Naur WebKit-r41128/WebCore/html/HTMLScriptElement.cpp WebKit-r41137-nx/WebCore/html/HTMLScriptElement.cpp --- WebKit-r41128/WebCore/html/HTMLScriptElement.cpp 2009-01-21 00:14:17.000000000 -0500 +++ WebKit-r41137-nx/WebCore/html/HTMLScriptElement.cpp 2009-06-24 15:37:36.380492705 -0400 @@ -27,6 +27,7 @@ #include "EventNames.h" #include "HTMLNames.h" #include "Text.h" +#include "ScriptEvaluator.h" namespace WebCore { @@ -54,6 +55,11 @@ return m_data.shouldExecuteAsJavaScript(); } +ScriptEvaluator* HTMLScriptElement::findEvaluator() const +{ + return m_data.findEvaluator(); +} + void HTMLScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { ScriptElement::childrenChanged(m_data); diff -Naur WebKit-r41128/WebCore/html/HTMLScriptElement.h WebKit-r41137-nx/WebCore/html/HTMLScriptElement.h --- WebKit-r41128/WebCore/html/HTMLScriptElement.h 2009-01-21 00:14:17.000000000 -0500 +++ WebKit-r41137-nx/WebCore/html/HTMLScriptElement.h 2009-06-24 15:37:44.001164060 -0400 @@ -36,6 +36,7 @@ ~HTMLScriptElement(); bool shouldExecuteAsJavaScript() const; + ScriptEvaluator* findEvaluator() const; virtual String scriptContent() const; virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; } diff -Naur WebKit-r41128/WebCore/html/HTMLSelectElement.cpp WebKit-r41137-nx/WebCore/html/HTMLSelectElement.cpp --- WebKit-r41128/WebCore/html/HTMLSelectElement.cpp 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/html/HTMLSelectElement.cpp 2009-03-24 16:51:36.000000000 -0400 @@ -422,6 +422,9 @@ bool HTMLSelectElement::appendFormData(FormDataList& list, bool) { + if (name().isEmpty()) + return false; + bool successful = false; const Vector& items = listItems(); diff -Naur WebKit-r41128/WebCore/html/HTMLTokenizer.cpp WebKit-r41137-nx/WebCore/html/HTMLTokenizer.cpp --- WebKit-r41128/WebCore/html/HTMLTokenizer.cpp 2009-02-15 03:48:47.000000000 -0500 +++ WebKit-r41137-nx/WebCore/html/HTMLTokenizer.cpp 2009-06-24 15:44:28.320987872 -0400 @@ -44,6 +44,7 @@ #include "Page.h" #include "PreloadScanner.h" #include "ScriptController.h" +#include "ScriptEvaluator.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" #include @@ -158,6 +159,7 @@ , m_scriptCodeCapacity(0) , m_scriptCodeResync(0) , m_executingScript(0) + , m_scriptEvaluator(0) , m_requestingScript(false) , m_hasScriptsWaitingForStylesheets(false) , m_timer(this, &HTMLTokenizer::timerFired) @@ -177,6 +179,7 @@ , m_scriptCodeCapacity(0) , m_scriptCodeResync(0) , m_executingScript(0) + , m_scriptEvaluator(0) , m_requestingScript(false) , m_hasScriptsWaitingForStylesheets(false) , m_timer(this, &HTMLTokenizer::timerFired) @@ -195,6 +198,7 @@ , m_scriptCodeCapacity(0) , m_scriptCodeResync(0) , m_executingScript(0) + , m_scriptEvaluator(0) , m_requestingScript(false) , m_hasScriptsWaitingForStylesheets(false) , m_timer(this, &HTMLTokenizer::timerFired) @@ -215,7 +219,7 @@ m_pendingScripts.removeFirst(); ASSERT(cache()->disabled() || cs->accessCount() > 0); cs->removeClient(this); - } + } fastFree(m_buffer); m_buffer = m_dest = 0; @@ -233,6 +237,7 @@ m_doctypeToken.reset(); m_doctypeSearchCount = 0; m_doctypeSecondarySearchCount = 0; + m_scriptEvaluator = 0; m_hasScriptsWaitingForStylesheets = false; } @@ -454,7 +459,9 @@ doScriptExec = false; } else #endif - doScriptExec = m_scriptNode->shouldExecuteAsJavaScript(); + m_scriptEvaluator = m_scriptNode->findEvaluator(); + m_scriptMimeType = m_scriptNode->type(); + doScriptExec = m_scriptNode->shouldExecuteAsJavaScript() || (m_scriptEvaluator != NULL); m_scriptNode = 0; } } @@ -560,7 +567,14 @@ #endif m_state = state; - m_doc->frame()->loader()->executeScript(sourceCode); + + if (!m_scriptEvaluator || m_scriptMimeType.length() == 0 || !m_scriptEvaluator->matchesMimeType(m_scriptMimeType)) { + m_doc->frame()->loader()->executeScript(sourceCode); + } else { + m_doc->frame()->loader()->executeScript(sourceCode, m_scriptMimeType, m_scriptEvaluator); + m_scriptMimeType = ""; + } + state = m_state; state.setAllowYield(true); @@ -1588,13 +1602,13 @@ return true; } -bool HTMLTokenizer::write(const SegmentedString& str, bool appendData) +void HTMLTokenizer::write(const SegmentedString& str, bool appendData) { if (!m_buffer) - return false; + return; if (m_parserStopped) - return false; + return; SegmentedString source(str); if (m_executingScript) @@ -1611,7 +1625,7 @@ m_preloadScanner->write(source); #endif } - return false; + return; } #if PRELOAD_SCANNER_ENABLED @@ -1626,7 +1640,7 @@ // Once a timer is set, it has control of when the tokenizer continues. if (m_timer.isActive()) - return false; + return; bool wasInWrite = m_inWrite; m_inWrite = true; @@ -1764,11 +1778,8 @@ m_state = state; - if (m_noMoreData && !m_inWrite && !state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) { + if (m_noMoreData && !m_inWrite && !state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) end(); // this actually causes us to be deleted - return true; - } - return false; } void HTMLTokenizer::stopParsing() @@ -1982,8 +1993,18 @@ if (errorOccurred) n->dispatchEventForType(eventNames().errorEvent, true, false); else { - if (static_cast(n.get())->shouldExecuteAsJavaScript()) + HTMLScriptElement *el = static_cast(n.get()); + + if (el->shouldExecuteAsJavaScript()) { m_state = scriptExecution(sourceCode, m_state); + } + m_scriptEvaluator = el->findEvaluator(); + m_scriptMimeType = el->type(); + + if (m_scriptEvaluator && m_scriptEvaluator->matchesMimeType(m_scriptMimeType)) { + m_state = scriptExecution(sourceCode, m_state); + m_scriptMimeType = ""; + } n->dispatchEventForType(eventNames().loadEvent, false, false); } diff -Naur WebKit-r41128/WebCore/html/HTMLTokenizer.h WebKit-r41137-nx/WebCore/html/HTMLTokenizer.h --- WebKit-r41128/WebCore/html/HTMLTokenizer.h 2009-01-21 00:14:17.000000000 -0500 +++ WebKit-r41137-nx/WebCore/html/HTMLTokenizer.h 2009-06-24 15:34:21.588479112 -0400 @@ -47,6 +47,7 @@ class Node; class PreloadScanner; class ScriptSourceCode; +class ScriptEvaluator; /** * @internal @@ -138,7 +139,7 @@ HTMLTokenizer(DocumentFragment*); virtual ~HTMLTokenizer(); - virtual bool write(const SegmentedString&, bool appendData); + virtual void write(const SegmentedString&, bool appendData); virtual void finish(); virtual void setForceSynchronous(bool force); virtual bool isWaitingForScripts() const; @@ -379,6 +380,8 @@ int m_executingScript; Deque > m_pendingScripts; RefPtr m_scriptNode; + ScriptEvaluator *m_scriptEvaluator; + String m_scriptMimeType; bool m_requestingScript; bool m_hasScriptsWaitingForStylesheets; diff -Naur WebKit-r41128/WebCore/loader/DocLoader.cpp WebKit-r41137-nx/WebCore/loader/DocLoader.cpp --- WebKit-r41128/WebCore/loader/DocLoader.cpp 2009-01-27 02:55:34.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/DocLoader.cpp 2009-04-07 20:22:16.000000000 -0400 @@ -38,6 +38,7 @@ #include "DOMWindow.h" #include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderClient.h" #include "loader.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -113,10 +114,10 @@ CachedImage* DocLoader::requestImage(const String& url) { CachedImage* resource = static_cast(requestResource(CachedResource::ImageResource, url, String())); - if (autoLoadImages() && resource && resource->stillNeedsLoad()) { - resource->setLoading(true); - cache()->loader()->load(this, resource, true); - } + if (autoLoadImages() && resource && resource->stillNeedsLoad()) { + resource->setLoading(true); + cache()->loader()->load(this, resource, true); + } return resource; } @@ -166,6 +167,11 @@ case CachedResource::FontResource: // These types of resources can be loaded from any origin. // FIXME: Are we sure about CachedResource::FontResource? +//#ifdef MAEMO_CHANGES +// if ( !m_doc->frame()->loader()->client()->dispatchDecidePolicyForNetworkResource(url) ) { +// return false; +// } +//#endif break; #if ENABLE(XSLT) case CachedResource::XSLStyleSheet: diff -Naur WebKit-r41128/WebCore/loader/EmptyClients.h WebKit-r41137-nx/WebCore/loader/EmptyClients.h --- WebKit-r41128/WebCore/loader/EmptyClients.h 2009-02-15 03:48:47.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/EmptyClients.h 2009-04-21 17:25:57.036136200 -0400 @@ -182,6 +182,9 @@ virtual Frame* dispatchCreatePage() { return 0; } virtual void dispatchShow() { } +#ifdef MAEMO_CHANGES + virtual bool dispatchDecidePolicyForNetworkResource(const KURL&) { return true; } +#endif virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String&, const ResourceRequest&) { } virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr, const String&) { } virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr) { } diff -Naur WebKit-r41128/WebCore/loader/FrameLoaderClient.h WebKit-r41137-nx/WebCore/loader/FrameLoaderClient.h --- WebKit-r41128/WebCore/loader/FrameLoaderClient.h 2009-02-15 03:48:47.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/FrameLoaderClient.h 2009-04-21 17:25:46.167131320 -0400 @@ -126,6 +126,9 @@ virtual Frame* dispatchCreatePage() = 0; virtual void dispatchShow() = 0; +#ifdef MAEMO_CHANGES + virtual bool dispatchDecidePolicyForNetworkResource(const KURL&) = 0; +#endif virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, const ResourceRequest&) = 0; virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr, const String& frameName) = 0; virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr) = 0; diff -Naur WebKit-r41128/WebCore/loader/FrameLoader.cpp WebKit-r41137-nx/WebCore/loader/FrameLoader.cpp --- WebKit-r41128/WebCore/loader/FrameLoader.cpp 2009-02-19 01:12:25.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/FrameLoader.cpp 2009-06-23 20:13:58.392478484 -0400 @@ -79,6 +79,7 @@ #include "ResourceHandle.h" #include "ResourceRequest.h" #include "ScriptController.h" +#include "ScriptEvaluator.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "SecurityOrigin.h" @@ -770,6 +771,30 @@ return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_URL)); } +ScriptValue FrameLoader::executeScript(const ScriptSourceCode& sourceCode, const String& mimeType, ScriptEvaluator *evaluator) +{ + if (!evaluator || mimeType.length() == 0) { + return executeScript(sourceCode); + } + + if (!m_frame->script()->isEnabled() || m_frame->script()->isPaused()) + return ScriptValue(); + + bool wasRunningScript = m_isRunningScript; + m_isRunningScript = true; + ScriptValue result = ScriptValue(); // FIXME, we should eventually pull this from the ScriptEvaluator + evaluator->evaluate(mimeType, sourceCode, (void*)m_frame->script()->windowShell()->window()->globalExec()); + + + if (!wasRunningScript) { + m_isRunningScript = false; + submitFormAgain(); + Document::updateDocumentsRendering(); + } + + return result; +} + ScriptValue FrameLoader::executeScript(const ScriptSourceCode& sourceCode) { if (!m_frame->script()->isEnabled() || m_frame->script()->isPaused()) diff -Naur WebKit-r41128/WebCore/loader/FrameLoader.h WebKit-r41137-nx/WebCore/loader/FrameLoader.h --- WebKit-r41128/WebCore/loader/FrameLoader.h 2009-02-15 03:48:47.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/FrameLoader.h 2009-06-24 15:40:43.184492069 -0400 @@ -65,6 +65,7 @@ class ResourceError; class ResourceLoader; class ResourceResponse; + class ScriptEvaluator; class ScriptSourceCode; class ScriptValue; class SecurityOrigin; @@ -333,6 +334,7 @@ // Returns true if url is a JavaScript URL. bool executeIfJavaScriptURL(const KURL& url, bool userGesture = false, bool replaceDocument = true); + ScriptValue executeScript(const ScriptSourceCode& sourceCode, const String& mimeType, ScriptEvaluator *evaluator); ScriptValue executeScript(const ScriptSourceCode&); ScriptValue executeScript(const String& script, bool forceUserGesture = false); diff -Naur WebKit-r41128/WebCore/loader/FTPDirectoryDocument.cpp WebKit-r41137-nx/WebCore/loader/FTPDirectoryDocument.cpp --- WebKit-r41128/WebCore/loader/FTPDirectoryDocument.cpp 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/FTPDirectoryDocument.cpp 2009-03-24 16:50:26.000000000 -0400 @@ -57,7 +57,7 @@ public: FTPDirectoryTokenizer(HTMLDocument*); - virtual bool write(const SegmentedString&, bool appendData); + virtual void write(const SegmentedString&, bool appendData); virtual void finish(); virtual bool isWaitingForScripts() const { return false; } @@ -399,7 +399,7 @@ bodyElement->appendChild(m_tableElement, ec); } -bool FTPDirectoryTokenizer::write(const SegmentedString& s, bool /*appendData*/) +void FTPDirectoryTokenizer::write(const SegmentedString& s, bool /*appendData*/) { // Make sure we have the table element to append to by loading the template set in the pref, or // creating a very basic document with the appropriate table @@ -439,7 +439,7 @@ if (!foundNewLine) { m_dest = m_buffer; - return false; + return; } UChar* start = m_buffer; @@ -460,8 +460,6 @@ // Copy the partial line we have left to the carryover buffer if (cursor - start > 1) m_carryOver.append(String(start, cursor - start - 1)); - - return false; } void FTPDirectoryTokenizer::finish() diff -Naur WebKit-r41128/WebCore/loader/ImageDocument.cpp WebKit-r41137-nx/WebCore/loader/ImageDocument.cpp --- WebKit-r41128/WebCore/loader/ImageDocument.cpp 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/ImageDocument.cpp 2009-03-24 16:50:34.000000000 -0400 @@ -63,7 +63,7 @@ public: ImageTokenizer(ImageDocument* doc) : m_doc(doc) {} - virtual bool write(const SegmentedString&, bool appendData); + virtual void write(const SegmentedString&, bool appendData); virtual void finish(); virtual bool isWaitingForScripts() const; @@ -91,10 +91,9 @@ // -------- -bool ImageTokenizer::write(const SegmentedString&, bool) +void ImageTokenizer::write(const SegmentedString&, bool) { ASSERT_NOT_REACHED(); - return false; } bool ImageTokenizer::writeRawData(const char*, int) diff -Naur WebKit-r41128/WebCore/loader/loader.cpp WebKit-r41137-nx/WebCore/loader/loader.cpp --- WebKit-r41128/WebCore/loader/loader.cpp 2009-02-15 03:48:47.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/loader.cpp 2009-04-25 20:18:48.126731240 -0400 @@ -49,7 +49,7 @@ #if REQUEST_MANAGEMENT_ENABLED // Match the parallel connection count used by the networking layer // FIXME should not hardcode something like this -static const unsigned maxRequestsInFlightPerHost = 4; +static const unsigned maxRequestsInFlightPerHost = 8; // Having a limit might still help getting more important resources first static const unsigned maxRequestsInFlightForNonHTTPProtocols = 20; #else diff -Naur WebKit-r41128/WebCore/loader/MainResourceLoader.cpp WebKit-r41137-nx/WebCore/loader/MainResourceLoader.cpp --- WebKit-r41128/WebCore/loader/MainResourceLoader.cpp 2009-02-15 03:48:47.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/MainResourceLoader.cpp 2009-05-04 19:12:49.825166073 -0400 @@ -45,6 +45,11 @@ #include "ResourceHandle.h" #include "Settings.h" +#ifdef MAEMO_CHANGES +#include "ResourceHandleInternal.h" +#include +#endif + // FIXME: More that is in common with SubresourceLoader should move up into ResourceLoader. namespace WebCore { @@ -219,9 +224,12 @@ return; } frameLoader()->client()->download(m_handle.get(), request(), m_handle.get()->request(), r); + // CURL reuses the same ResourceHandle to download the file, so we cannot close it. +#if !USE(CURL) // It might have gone missing if (frameLoader()) receivedError(interruptionForPolicyChangeError()); +#endif return; case PolicyIgnore: @@ -363,6 +371,13 @@ RefPtr dl = documentLoader(); #endif +#ifdef MAEMO_CHANGES + if (m_handle) { + ResourceHandleInternal* d = m_handle->getInternal(); + curl_easy_setopt(d->m_handle, CURLOPT_COOKIEJAR, "/home/user/.webkitcookies"); + } +#endif + frameLoader()->finishedLoading(); ResourceLoader::didFinishLoading(); diff -Naur WebKit-r41128/WebCore/loader/MediaDocument.cpp WebKit-r41137-nx/WebCore/loader/MediaDocument.cpp --- WebKit-r41128/WebCore/loader/MediaDocument.cpp 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/MediaDocument.cpp 2009-03-24 16:50:29.000000000 -0400 @@ -54,7 +54,7 @@ MediaTokenizer(Document* doc) : m_doc(doc), m_mediaElement(0) {} private: - virtual bool write(const SegmentedString&, bool appendData); + virtual void write(const SegmentedString&, bool appendData); virtual void stopParsing(); virtual void finish(); virtual bool isWaitingForScripts() const; @@ -68,10 +68,9 @@ HTMLMediaElement* m_mediaElement; }; -bool MediaTokenizer::write(const SegmentedString&, bool) +void MediaTokenizer::write(const SegmentedString&, bool) { ASSERT_NOT_REACHED(); - return false; } void MediaTokenizer::createDocumentStructure() diff -Naur WebKit-r41128/WebCore/loader/PluginDocument.cpp WebKit-r41137-nx/WebCore/loader/PluginDocument.cpp --- WebKit-r41128/WebCore/loader/PluginDocument.cpp 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/PluginDocument.cpp 2009-03-24 16:50:45.000000000 -0400 @@ -49,7 +49,7 @@ PluginTokenizer(Document* doc) : m_doc(doc), m_embedElement(0) {} private: - virtual bool write(const SegmentedString&, bool appendData); + virtual void write(const SegmentedString&, bool appendData); virtual void stopParsing(); virtual void finish(); virtual bool isWaitingForScripts() const; @@ -63,10 +63,9 @@ HTMLEmbedElement* m_embedElement; }; -bool PluginTokenizer::write(const SegmentedString&, bool) +void PluginTokenizer::write(const SegmentedString&, bool) { ASSERT_NOT_REACHED(); - return false; } void PluginTokenizer::createDocumentStructure() diff -Naur WebKit-r41128/WebCore/loader/ResourceLoader.cpp WebKit-r41137-nx/WebCore/loader/ResourceLoader.cpp --- WebKit-r41128/WebCore/loader/ResourceLoader.cpp 2009-01-21 00:14:18.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/ResourceLoader.cpp 2009-03-26 02:47:17.000000000 -0400 @@ -29,10 +29,12 @@ #include "config.h" #include "ResourceLoader.h" +#include "CString.h" #include "DocumentLoader.h" #include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderClient.h" #include "Page.h" #include "ProgressTracker.h" #include "ResourceHandle.h" @@ -171,7 +173,7 @@ m_resourceData = SharedBuffer::create(data, length); return; } - + if (ResourceHandle::supportsBufferedData()) { // Buffer data only if the connection has handed us the data because is has stopped buffering it. if (m_resourceData) @@ -387,6 +389,7 @@ return; } #endif + willSendRequest(request, redirectResponse); } diff -Naur WebKit-r41128/WebCore/loader/SubresourceLoader.cpp WebKit-r41137-nx/WebCore/loader/SubresourceLoader.cpp --- WebKit-r41128/WebCore/loader/SubresourceLoader.cpp 2009-01-21 00:14:18.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/SubresourceLoader.cpp 2009-03-30 19:36:13.000000000 -0400 @@ -32,6 +32,7 @@ #include "DocumentLoader.h" #include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderClient.h" #include "ResourceHandle.h" #include "SubresourceLoaderClient.h" #include diff -Naur WebKit-r41128/WebCore/loader/TextDocument.cpp WebKit-r41137-nx/WebCore/loader/TextDocument.cpp --- WebKit-r41128/WebCore/loader/TextDocument.cpp 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/loader/TextDocument.cpp 2009-03-24 16:50:41.000000000 -0400 @@ -43,7 +43,7 @@ TextTokenizer(Document*); TextTokenizer(HTMLViewSourceDocument*); - virtual bool write(const SegmentedString&, bool appendData); + virtual void write(const SegmentedString&, bool appendData); virtual void finish(); virtual bool isWaitingForScripts() const; @@ -93,7 +93,7 @@ m_dest = m_buffer; } -bool TextTokenizer::write(const SegmentedString& s, bool) +void TextTokenizer::write(const SegmentedString& s, bool) { ExceptionCode ec; @@ -142,7 +142,7 @@ String string = String(m_buffer, m_dest - m_buffer); if (inViewSourceMode()) { static_cast(m_doc)->addViewSourceText(string); - return false; + return; } unsigned charsLeft = string.length(); @@ -151,8 +151,6 @@ RefPtr text = Text::createWithLengthLimit(m_doc, string, charsLeft); m_preElement->appendChild(text, ec); } - - return false; } void TextTokenizer::finish() diff -Naur WebKit-r41128/WebCore/page/Location.cpp WebKit-r41137-nx/WebCore/page/Location.cpp --- WebKit-r41128/WebCore/page/Location.cpp 2009-01-21 00:14:18.000000000 -0500 +++ WebKit-r41137-nx/WebCore/page/Location.cpp 2009-03-24 16:51:42.000000000 -0400 @@ -111,7 +111,8 @@ if (!m_frame) return String(); - return url().query(); + const KURL& url = this->url(); + return url.query().isEmpty() ? "" : "?" + url.query(); } String Location::hash() const @@ -120,7 +121,7 @@ return String(); const KURL& url = this->url(); - return url.ref().isNull() ? "" : "#" + url.ref(); + return url.ref().isEmpty() ? "" : "#" + url.ref(); } String Location::toString() const diff -Naur WebKit-r41128/WebCore/page/Settings.cpp WebKit-r41137-nx/WebCore/page/Settings.cpp --- WebKit-r41128/WebCore/page/Settings.cpp 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/page/Settings.cpp 2009-06-23 19:31:53.605380982 -0400 @@ -57,7 +57,7 @@ , m_loadsImagesAutomatically(false) , m_privateBrowsingEnabled(false) , m_arePluginsEnabled(false) - , m_databasesEnabled(false) + , m_databasesEnabled(true) , m_localStorageEnabled(false) , m_isJavaScriptEnabled(false) , m_isWebSecurityEnabled(true) @@ -244,6 +244,11 @@ setNeedsReapplyStylesInAllFrames(m_page); } +void Settings::setUserAgent(const String& userAgent) +{ + m_userAgent = userAgent; +} + void Settings::setShouldPrintBackgrounds(bool shouldPrintBackgrounds) { m_shouldPrintBackgrounds = shouldPrintBackgrounds; diff -Naur WebKit-r41128/WebCore/page/Settings.h WebKit-r41137-nx/WebCore/page/Settings.h --- WebKit-r41128/WebCore/page/Settings.h 2009-02-20 22:38:14.000000000 -0500 +++ WebKit-r41137-nx/WebCore/page/Settings.h 2009-04-20 17:58:37.628133680 -0400 @@ -116,6 +116,9 @@ void setUserStyleSheetLocation(const KURL&); const KURL& userStyleSheetLocation() const { return m_userStyleSheetLocation; } + void setUserAgent(const String&); + const String& userAgent() const { return m_userAgent; } + void setShouldPrintBackgrounds(bool); bool shouldPrintBackgrounds() const { return m_shouldPrintBackgrounds; } @@ -212,6 +215,7 @@ String m_ftpDirectoryTemplatePath; String m_localStorageDatabasePath; KURL m_userStyleSheetLocation; + String m_userAgent; AtomicString m_standardFontFamily; AtomicString m_fixedFontFamily; AtomicString m_serifFontFamily; diff -Naur WebKit-r41128/WebCore/platform/ContextMenu.cpp WebKit-r41137-nx/WebCore/platform/ContextMenu.cpp --- WebKit-r41128/WebCore/platform/ContextMenu.cpp 2009-02-15 03:48:48.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/ContextMenu.cpp 2009-02-26 02:13:04.000000000 -0500 @@ -297,12 +297,12 @@ } appendItem(CopyItem); } else { -#if PLATFORM(GTK) +/*#if PLATFORM(GTK) appendItem(BackItem); appendItem(ForwardItem); appendItem(StopItem); appendItem(ReloadItem); -#else +#else*/ if (loader->canGoBackOrForward(-1)) appendItem(BackItem); @@ -315,7 +315,7 @@ appendItem(StopItem); else appendItem(ReloadItem); -#endif +/*#endif*/ if (frame->page() && frame != frame->page()->mainFrame()) appendItem(OpenFrameItem); @@ -586,7 +586,7 @@ case ContextMenuItemTagCheckSpellingWhileTyping: shouldCheck = frame->editor()->isContinuousSpellCheckingEnabled(); break; -#if PLATFORM(GTK) +/*#if PLATFORM(GTK) case ContextMenuItemTagGoBack: shouldEnable = frame->loader()->canGoBackOrForward(-1); break; @@ -602,13 +602,13 @@ case ContextMenuItemTagFontMenu: shouldEnable = frame->editor()->canEditRichly(); break; -#else +#else*/ case ContextMenuItemTagGoBack: case ContextMenuItemTagGoForward: case ContextMenuItemTagStop: case ContextMenuItemTagReload: case ContextMenuItemTagFontMenu: -#endif +/*#endif*/ case ContextMenuItemTagNoAction: case ContextMenuItemTagOpenLinkInNewWindow: case ContextMenuItemTagDownloadLinkToDisk: diff -Naur WebKit-r41128/WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp WebKit-r41137-nx/WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp --- WebKit-r41128/WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp 2009-02-12 18:01:53.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp 2009-02-23 16:01:26.000000000 -0500 @@ -39,8 +39,6 @@ #include "FontDescription.h" #include "GlyphBuffer.h" #include -#include -#include #include namespace WebCore { diff -Naur WebKit-r41128/WebCore/platform/gtk/gtk2drawing.c WebKit-r41137-nx/WebCore/platform/gtk/gtk2drawing.c --- WebKit-r41128/WebCore/platform/gtk/gtk2drawing.c 2009-01-27 02:55:34.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/gtk/gtk2drawing.c 2009-02-23 16:01:26.000000000 -0500 @@ -1925,7 +1925,7 @@ /* this is for drawing a prelight box */ if (state_type == GTK_STATE_PRELIGHT || state_type == GTK_STATE_ACTIVE) { gtk_paint_flat_box(style, drawable, GTK_STATE_PRELIGHT, - GTK_SHADOW_ETCHED_OUT, cliprect, widget, + GTK_SHADOW_NONE, cliprect, widget, // ETCHED_OUT "checkbutton", rect->x, rect->y, rect->width, rect->height); } @@ -2803,7 +2803,7 @@ w = gRadiobuttonWidget; } - *left = *top = *right = *bottom = GTK_CONTAINER(w)->border_width; + *left = *top = *right = *bottom = 2; //GTK_CONTAINER(w)->border_width; // In Maemo better use smaller borders? if (!interior_focus) { *left += (focus_width + focus_pad); diff -Naur WebKit-r41128/WebCore/platform/gtk/RenderThemeGtk.cpp WebKit-r41137-nx/WebCore/platform/gtk/RenderThemeGtk.cpp --- WebKit-r41128/WebCore/platform/gtk/RenderThemeGtk.cpp 2009-01-25 22:06:55.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/gtk/RenderThemeGtk.cpp 2009-02-23 16:01:26.000000000 -0500 @@ -229,7 +229,7 @@ // Other ports hard-code this to 13, but GTK+ users tend to demand the native look. // It could be made a configuration option values other than 13 actually break site compatibility. - int length = indicator_size + indicator_spacing; + int length = indicator_size + indicator_spacing; // Check if this helps Maemo rendering if (style->width().isIntrinsicOrAuto()) style->setWidth(Length(length, Fixed)); diff -Naur WebKit-r41128/WebCore/platform/KURL.cpp WebKit-r41137-nx/WebCore/platform/KURL.cpp --- WebKit-r41128/WebCore/platform/KURL.cpp 2009-02-20 22:38:15.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/KURL.cpp 2009-03-24 16:51:42.000000000 -0400 @@ -38,6 +38,10 @@ #include #elif USE(QT4_UNICODE) #include +#elif USE(GLIB_UNICODE) +#include +#include +#include #endif #include @@ -639,7 +643,10 @@ String KURL::query() const { - return m_string.substring(m_pathEnd, m_queryEnd - m_pathEnd); + if (m_queryEnd == m_pathEnd) + return String(); + + return m_string.substring(m_pathEnd + 1, m_queryEnd - (m_pathEnd + 1)); } String KURL::path() const @@ -823,7 +830,11 @@ } append(result, path()); - append(result, query()); + + if (m_pathEnd != m_queryEnd) { + result.append('?'); + append(result, query()); + } if (m_fragmentEnd != m_queryEnd) { result.append('#'); @@ -1384,6 +1395,19 @@ #elif USE(QT4_UNICODE) QByteArray result = QUrl::toAce(String(str, strLen)); buffer.append(result.constData(), result.length()); +#elif USE(GLIB_UNICODE) + // first translate to ucs4, libidn is expecting code points + GOwnPtr ucs4Hostname; + GOwnPtr ucs4Err; + ucs4Hostname.set(g_utf16_to_ucs4(str, strLen, 0, 0, &ucs4Err.outPtr())); + if(ucs4Err) + return; + char* encodedHostname = 0; + int err; + err = idna_to_ascii_4z(ucs4Hostname.get(), &encodedHostname, IDNA_ALLOW_UNASSIGNED); + if(err == IDNA_SUCCESS) + buffer.append(encodedHostname, strlen(encodedHostname)); + free(encodedHostname); #endif } diff -Naur WebKit-r41128/WebCore/platform/MIMETypeRegistry.cpp WebKit-r41137-nx/WebCore/platform/MIMETypeRegistry.cpp --- WebKit-r41128/WebCore/platform/MIMETypeRegistry.cpp 2009-02-20 22:38:15.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/MIMETypeRegistry.cpp 2009-02-23 16:01:26.000000000 -0500 @@ -186,6 +186,7 @@ "text/html", "text/xml", "text/xsl", +/* Mozilla asks before opening text/plain */ "text/plain", "text/", "application/xml", diff -Naur WebKit-r41128/WebCore/platform/network/curl/ResourceHandleCurl.cpp WebKit-r41137-nx/WebCore/platform/network/curl/ResourceHandleCurl.cpp --- WebKit-r41128/WebCore/platform/network/curl/ResourceHandleCurl.cpp 2009-01-21 00:14:21.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/network/curl/ResourceHandleCurl.cpp 2009-05-03 19:23:13.037127973 -0400 @@ -103,7 +103,10 @@ bool ResourceHandle::start(Frame* frame) { - ASSERT(frame); + /* + * The frame could be null is the ResourceHandle is not associated + * to any Frame, i.e. if we are downloading a file. + */ ResourceHandleManager::sharedInstance()->add(this); return true; } diff -Naur WebKit-r41128/WebCore/platform/network/curl/ResourceHandleManager.cpp WebKit-r41137-nx/WebCore/platform/network/curl/ResourceHandleManager.cpp --- WebKit-r41128/WebCore/platform/network/curl/ResourceHandleManager.cpp 2009-01-21 00:14:21.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/network/curl/ResourceHandleManager.cpp 2009-06-23 19:49:51.480709668 -0400 @@ -45,6 +45,9 @@ #include #include #include +#ifdef MAEMO_CHANGES +#include +#endif #if PLATFORM(GTK) #if GLIB_CHECK_VERSION(2,12,0) @@ -55,14 +58,17 @@ namespace WebCore { const int selectTimeoutMS = 5; -const double pollTimeSeconds = 0.05; +const double pollTimeSeconds = 0.0; //5; const int maxRunningJobs = 5; +#if MAEMO_CHANGES +bool cookies_loaded; +#endif static const bool ignoreSSLErrors = getenv("WEBKIT_IGNORE_SSL_ERRORS"); ResourceHandleManager::ResourceHandleManager() : m_downloadTimer(this, &ResourceHandleManager::downloadTimerCallback) - , m_cookieJarFileName(0) + , m_cookieJarFileName("/home/user/.webkitcookies") , m_runningJobs(0) { curl_global_init(CURL_GLOBAL_ALL); @@ -70,6 +76,9 @@ m_curlShareHandle = curl_share_init(); curl_share_setopt(m_curlShareHandle, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE); curl_share_setopt(m_curlShareHandle, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); +#if MAEMO_CHANGES + cookies_loaded = false; +#endif } ResourceHandleManager::~ResourceHandleManager() @@ -175,9 +184,21 @@ CURLcode err; double contentLength = 0; - err = curl_easy_getinfo(h, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &contentLength); + String cLength = d->m_response.httpHeaderField("Content-Length"); + + int index = cLength.find(':'); + if (index == -1) { + index = 0; + } + + contentLength = cLength.substring(0, index-1).toDouble(); d->m_response.setExpectedContentLength(static_cast(contentLength)); +// CURL doesn't seem to get Content-Length properly .stripWhiteSpace() +// err = curl_easy_getinfo(h, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &contentLength); +// if (CURLE_OK == err) +// d->m_response.setExpectedContentLength(static_cast(contentLength)); + const char* hdr; err = curl_easy_getinfo(h, CURLINFO_EFFECTIVE_URL, &hdr); d->m_response.setUrl(KURL(hdr)); @@ -186,9 +207,23 @@ err = curl_easy_getinfo(h, CURLINFO_RESPONSE_CODE, &httpCode); d->m_response.setHTTPStatusCode(httpCode); - d->m_response.setMimeType(extractMIMETypeFromMediaType(d->m_response.httpHeaderField("Content-Type"))); - d->m_response.setTextEncodingName(extractCharsetFromMediaType(d->m_response.httpHeaderField("Content-Type"))); - d->m_response.setSuggestedFilename(filenameFromHTTPContentDisposition(d->m_response.httpHeaderField("Content-Disposition"))); + + if (d->m_response.httpHeaderField("Content-Type").isEmpty()) { + d->m_response.setMimeType("text/html"); + d->m_response.setTextEncodingName("UTF-8"); + } else { + d->m_response.setMimeType(extractMIMETypeFromMediaType(d->m_response.httpHeaderField("Content-Type"))); + d->m_response.setTextEncodingName(extractCharsetFromMediaType(d->m_response.httpHeaderField("Content-Type"))); + d->m_response.setSuggestedFilename(filenameFromHTTPContentDisposition(d->m_response.httpHeaderField("Content-Disposition"))); + } + +/* HTTPHeaderMap customHeaders = d->m_response.httpHeaderFields(); + printf( "-------------------\n" ); + if (!customHeaders.isEmpty()) { + HTTPHeaderMap::const_iterator end = customHeaders.end(); + for (HTTPHeaderMap::const_iterator it = customHeaders.begin(); it != end; ++it) + printf( "Key: %s, data: %s\n", it->first.string().utf8().data(), it->second.utf8().data()); + }*/ // HTTP redirection if (httpCode >= 300 && httpCode < 400) { @@ -368,6 +403,20 @@ if (!job->request().httpBody()) return; +/* struct curl_slist *heads = *headers; + printf( "POST, headers: \n" ); + for(;heads;heads = heads->next){ + char *line = strdup(heads->data); + char *word; + char *brk2; + word = strtok_r(line,": ",&brk2); + if(word){ + printf( "%s: %s\n", line, brk2 ); + } + free(line); + } + free(heads); +*/ Vector elements = job->request().httpBody()->elements(); size_t numElements = elements.size(); if (!numElements) @@ -411,6 +460,7 @@ if (getFileSize(element.m_filename, fileSizeResult)) { if (fileSizeResult > maxCurlOffT) { // File size is too big for specifying it to cURL + printf( "Too big POST transfer, not specifying file size. %d", fileSizeResult ); chunkedTransfer = true; break; } @@ -424,15 +474,23 @@ } // cURL guesses that we want chunked encoding as long as we specify the header - if (chunkedTransfer) + if (chunkedTransfer) { *headers = curl_slist_append(*headers, "Transfer-Encoding: chunked"); - else { + } else { if (sizeof(long long) == expectedSizeOfCurlOffT) curl_easy_setopt(d->m_handle, CURLOPT_POSTFIELDSIZE_LARGE, (long long)size); else curl_easy_setopt(d->m_handle, CURLOPT_POSTFIELDSIZE_LARGE, (int)size); } +/* HTTPHeaderMap customHeaders = job->request().httpHeaderFields(); + printf( "-------------------\n" ); + if (!customHeaders.isEmpty()) { + HTTPHeaderMap::const_iterator end = customHeaders.end(); + for (HTTPHeaderMap::const_iterator it = customHeaders.begin(); it != end; ++it) + printf( "Key: %s, data: %s\n", it->first.string().utf8().data(), it->second.utf8().data()); + }*/ + curl_easy_setopt(d->m_handle, CURLOPT_READFUNCTION, readCallback); curl_easy_setopt(d->m_handle, CURLOPT_READDATA, job); } @@ -504,6 +562,9 @@ String mimeType = extractMIMETypeFromMediaType(mediaType); String charset = extractCharsetFromMediaType(mediaType); + if (mimeType.isEmpty()) + mimeType = "application/octet-stream"; + ResourceResponse response; response.setMimeType(mimeType); @@ -603,7 +664,7 @@ ResourceHandleInternal* d = job->getInternal(); String url = kurl.string(); - if (kurl.isLocalFile()) { + if (kurl.isLocalFile() || kurl.protocolIs("app") || kurl.protocolIs("ti") || kurl.protocolIs("app-storage")) { String query = kurl.query(); // Remove any query part sent to a local file. if (!query.isEmpty()) @@ -633,14 +694,16 @@ curl_easy_setopt(d->m_handle, CURLOPT_HEADERFUNCTION, headerCallback); curl_easy_setopt(d->m_handle, CURLOPT_WRITEHEADER, job); curl_easy_setopt(d->m_handle, CURLOPT_AUTOREFERER, 1); + curl_easy_setopt(d->m_handle, CURLOPT_NOPROGRESS, 1); curl_easy_setopt(d->m_handle, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(d->m_handle, CURLOPT_MAXREDIRS, 10); curl_easy_setopt(d->m_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_setopt(d->m_handle, CURLOPT_SHARE, m_curlShareHandle); + curl_easy_setopt(d->m_handle, CURLOPT_CAPATH, "/etc/ssl/certs"); curl_easy_setopt(d->m_handle, CURLOPT_DNS_CACHE_TIMEOUT, 60 * 5); // 5 minutes // FIXME: Enable SSL verification when we have a way of shipping certs // and/or reporting SSL errors to the user. - if (ignoreSSLErrors) +// if (ignoreSSLErrors) curl_easy_setopt(d->m_handle, CURLOPT_SSL_VERIFYPEER, false); // enable gzip and deflate through Accept-Encoding: curl_easy_setopt(d->m_handle, CURLOPT_ENCODING, ""); @@ -653,8 +716,14 @@ curl_easy_setopt(d->m_handle, CURLOPT_URL, d->m_url); if (m_cookieJarFileName) { +#ifdef MAEMO_CHANGES + if (!cookies_loaded) { + curl_easy_setopt(d->m_handle, CURLOPT_COOKIEFILE, m_cookieJarFileName); + cookies_loaded = true; + } +#else curl_easy_setopt(d->m_handle, CURLOPT_COOKIEFILE, m_cookieJarFileName); - curl_easy_setopt(d->m_handle, CURLOPT_COOKIEJAR, m_cookieJarFileName); +#endif } struct curl_slist* headers = 0; diff -Naur WebKit-r41128/WebCore/platform/network/HTTPParsers.cpp WebKit-r41137-nx/WebCore/platform/network/HTTPParsers.cpp --- WebKit-r41128/WebCore/platform/network/HTTPParsers.cpp 2009-01-21 00:14:21.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/network/HTTPParsers.cpp 2009-04-25 16:58:41.354731680 -0400 @@ -131,18 +131,18 @@ String extractMIMETypeFromMediaType(const String& mediaType) { - String mimeType; + Vector mimeType; unsigned length = mediaType.length(); + mimeType.reserveCapacity(length); for (unsigned offset = 0; offset < length; offset++) { UChar c = mediaType[offset]; if (c == ';') break; else if (isSpaceOrNewline(c)) // FIXME: This seems wrong, " " is an invalid MIME type character according to RFC 2045. bug 8644 continue; - // FIXME: This is a very slow way to build a string, given WebCore::String's implementation. - mimeType += String(&c, 1); + mimeType.append(c); } - return mimeType; + return String(mimeType.data(), mimeType.size()); } String extractCharsetFromMediaType(const String& mediaType) diff -Naur WebKit-r41128/WebCore/platform/network/soup/ResourceHandleSoup.cpp WebKit-r41137-nx/WebCore/platform/network/soup/ResourceHandleSoup.cpp --- WebKit-r41128/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2009-02-20 22:38:15.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -475,9 +475,12 @@ { ASSERT(!d->m_msg); - // If we are no longer attached to a Page, this must be an attempted load from an - // onUnload handler, so let's just block it. - if (!frame->page()) + + /* The frame could be null is the ResourceHandle is not associated to any + * Frame, i.e. if we are downloading a file. + * If the frame is not null but the page is null this must be an attempted + * load from an onUnload handler, so let's just block it. */ + if (frame && !frame->page()) return false; KURL url = request().url(); diff -Naur WebKit-r41128/WebCore/platform/ScrollView.cpp WebKit-r41137-nx/WebCore/platform/ScrollView.cpp --- WebKit-r41128/WebCore/platform/ScrollView.cpp 2009-02-13 00:50:35.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/ScrollView.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -281,6 +281,7 @@ void ScrollView::setScrollPosition(const IntPoint& scrollPoint) { +#if 0 if (prohibitsScrolling()) return; @@ -288,12 +289,13 @@ platformSetScrollPosition(scrollPoint); return; } +#endif IntPoint newScrollPosition = scrollPoint.shrunkTo(maximumScrollPosition()); newScrollPosition.clampNegativeToZero(); - if (newScrollPosition == scrollPosition()) - return; + //if (newScrollPosition == scrollPosition()) + // return; updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y())); } @@ -316,7 +318,8 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset) { // Don't allow re-entrancy into this function. - if (m_inUpdateScrollbars || prohibitsScrolling() || platformWidget()) + //if (m_inUpdateScrollbars || prohibitsScrolling() || platformWidget()) + if (m_inUpdateScrollbars || platformWidget()) return; m_inUpdateScrollbars = true; diff -Naur WebKit-r41128/WebCore/platform/text/gtk/TextBoundariesGtk.cpp WebKit-r41137-nx/WebCore/platform/text/gtk/TextBoundariesGtk.cpp --- WebKit-r41128/WebCore/platform/text/gtk/TextBoundariesGtk.cpp 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/text/gtk/TextBoundariesGtk.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Jürg Billeter + * + * 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 "TextBoundaries.h" + +#include + +#include "StringImpl.h" +#include "TextBreakIterator.h" + +namespace WebCore { + +int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward) +{ + TextBreakIterator* it = wordBreakIterator(chars, len); + + if (forward) { + position = textBreakFollowing(it, position); + while (position != TextBreakDone) { + // We stop searching when the character preceeding the break + // is alphanumeric. + if (position < len && g_unichar_isalnum(chars[position - 1])) + return position; + + position = textBreakFollowing(it, position); + } + + return len; + } else { + position = textBreakPreceding(it, position); + while (position != TextBreakDone) { + // We stop searching when the character following the break + // is alphanumeric. + if (position > 0 && g_unichar_isalnum(chars[position])) + return position; + + position = textBreakPreceding(it, position); + } + + return 0; + } +} + +void findWordBoundary(const UChar* chars, int len, int position, int* start, int* end) +{ + TextBreakIterator* it = wordBreakIterator(chars, len); + *end = textBreakFollowing(it, position); + if (*end < 0) + *end = textBreakLast(it); + *start = textBreakPrevious(it); +} + +} // namespace WebCore diff -Naur WebKit-r41128/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp WebKit-r41137-nx/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp --- WebKit-r41128/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2006 Lars Knoll + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2008 Dominik Röttsches + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "TextBreakIterator.h" + +#include + +#include + +namespace WebCore { + +enum UBreakIteratorType { + UBRK_CHARACTER, + UBRK_WORD, + UBRK_LINE, + UBRK_SENTENCE +}; + +class TextBreakIterator { +public: + UBreakIteratorType m_type; + int m_length; + PangoLogAttr* m_log_attrs; + + int m_index; +}; + +static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator*& iterator, + UBreakIteratorType type, const UChar* string, int length) +{ + if (!string) + return 0; + + if (!createdIterator) { + iterator = new TextBreakIterator(); + createdIterator = true; + } + if (!iterator) + return 0; + + long utf8len; + GOwnPtr utf8; + utf8.set(g_utf16_to_utf8(string, length, 0, &utf8len, 0)); + + // FIXME: assumes no surrogate pairs + + iterator->m_type = type; + iterator->m_length = length; + if(createdIterator) + g_free(iterator->m_log_attrs); + iterator->m_log_attrs = g_new0(PangoLogAttr, length + 1); + iterator->m_index = -1; + pango_get_log_attrs(utf8.get(), utf8len, -1, 0, iterator->m_log_attrs, length + 1); + + return iterator; +} + +TextBreakIterator* characterBreakIterator(const UChar* string, int length) +{ + static bool createdCharacterBreakIterator = false; + static TextBreakIterator* staticCharacterBreakIterator; + return setUpIterator(createdCharacterBreakIterator, + staticCharacterBreakIterator, UBRK_CHARACTER, string, length); +} + +TextBreakIterator* wordBreakIterator(const UChar* string, int length) +{ + static bool createdWordBreakIterator = false; + static TextBreakIterator* staticWordBreakIterator; + return setUpIterator(createdWordBreakIterator, + staticWordBreakIterator, UBRK_WORD, string, length); +} + +TextBreakIterator* lineBreakIterator(const UChar* string, int length) +{ + static bool createdLineBreakIterator = false; + static TextBreakIterator* staticLineBreakIterator; + return setUpIterator(createdLineBreakIterator, + staticLineBreakIterator, UBRK_LINE, string, length); +} + +TextBreakIterator* sentenceBreakIterator(const UChar* string, int length) +{ + static bool createdSentenceBreakIterator = false; + static TextBreakIterator* staticSentenceBreakIterator; + return setUpIterator(createdSentenceBreakIterator, + staticSentenceBreakIterator, UBRK_SENTENCE, string, length); +} + +int textBreakFirst(TextBreakIterator* bi) +{ + // see textBreakLast + + int firstCursorPosition = -1; + int pos = 0; + while(pos <= bi->m_length && (firstCursorPosition < 0)) { + if (bi->m_log_attrs[pos].is_cursor_position) + firstCursorPosition = pos; + } + bi->m_index = firstCursorPosition; + return firstCursorPosition; +} + +int textBreakLast(TextBreakIterator* bi) +{ + // textBreakLast is not meant to find breaks according to bi->m_type but really last character + // (cmp ICU documentation for ubrk_first and ubrk_last) + // so we should advance or traverse back based on bi->m_log_attrs cursor positions + + // from ICU docs for ubrk_last: + // "Determine the index immediately beyond the last character in the text being scanned." + + // If last character position in the original string is a whitespace, + // traverse to the left until the first non-white character position is found + // and return the position of the first white-space char after this one. + // otherwise return m_length, as "the first character beyond the last" is outside our string. + + bool whiteSpaceAtTheEnd = true; + int nextWhiteSpacePos = bi->m_length; + + int pos = bi->m_length; + while (pos >= 0 && whiteSpaceAtTheEnd) { + if (bi->m_log_attrs[pos].is_cursor_position) { + if (whiteSpaceAtTheEnd = bi->m_log_attrs[pos].is_white) + nextWhiteSpacePos = pos; + } + pos--; + } + bi->m_index = nextWhiteSpacePos; + return nextWhiteSpacePos; +} + +int textBreakNext(TextBreakIterator* bi) +{ + for (int i = bi->m_index + 1; i <= bi->m_length; i++) { + if (bi->m_type == UBRK_LINE && bi->m_log_attrs[i].is_line_break) { + bi->m_index = i; + return i; + } + if (bi->m_type == UBRK_WORD && (bi->m_log_attrs[i].is_word_start || bi->m_log_attrs[i].is_word_end)) { + // FIXME: Single multibyte characters (i.e. white space around them), such as the euro symbol €, + // are not marked as word_start & word_end as opposed to the way ICU does it + // This leads - for example - to different word selection behaviour when right clicking. + bi->m_index = i; + return i; + } + if (bi->m_type == UBRK_CHARACTER && bi->m_log_attrs[i].is_cursor_position) { + bi->m_index = i; + return i; + } + if (bi->m_type == UBRK_SENTENCE && (bi->m_log_attrs[i].is_sentence_start || bi->m_log_attrs[i].is_sentence_end)) { + bi->m_index = i; + return i; + } + } + return TextBreakDone; +} + +int textBreakPrevious(TextBreakIterator* bi) +{ + for (int i = bi->m_index - 1; i >= 0; i--) { + if (bi->m_type == UBRK_LINE && bi->m_log_attrs[i].is_line_break) { + bi->m_index = i; + return i; + } + if (bi->m_type == UBRK_WORD && (bi->m_log_attrs[i].is_word_start || bi->m_log_attrs[i].is_word_end)) { + bi->m_index = i; + return i; + } + if (bi->m_type == UBRK_CHARACTER && bi->m_log_attrs[i].is_cursor_position) { + bi->m_index = i; + return i; + } + if (bi->m_type == UBRK_SENTENCE && (bi->m_log_attrs[i].is_sentence_start || bi->m_log_attrs[i].is_sentence_end)) { + bi->m_index = i; + return i; + } + } + return textBreakFirst(bi); +} + +int textBreakPreceding(TextBreakIterator* bi, int pos) +{ + bi->m_index = pos; + return textBreakPrevious(bi); +} + +int textBreakFollowing(TextBreakIterator* bi, int pos) +{ + if (pos < 0) + pos = -1; + bi->m_index = pos; + return textBreakNext(bi); +} + +int textBreakCurrent(TextBreakIterator* bi) +{ + return bi->m_index; +} + +bool isTextBreak(TextBreakIterator* bi, int pos) +{ + if (bi->m_index >= 0) { + if (bi->m_type == UBRK_LINE && bi->m_log_attrs[bi->m_index].is_line_break) { + return true; + } + if (bi->m_type == UBRK_WORD && bi->m_log_attrs[bi->m_index].is_word_end) { + return true; + } + if (bi->m_type == UBRK_CHARACTER && bi->m_log_attrs[bi->m_index].is_char_break) { + return true; + } + if (bi->m_type == UBRK_SENTENCE && bi->m_log_attrs[bi->m_index].is_sentence_end) { + return true; + } + } + return FALSE; +} + +} diff -Naur WebKit-r41128/WebCore/platform/text/gtk/TextCodecGtk.cpp WebKit-r41137-nx/WebCore/platform/text/gtk/TextCodecGtk.cpp --- WebKit-r41128/WebCore/platform/text/gtk/TextCodecGtk.cpp 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/text/gtk/TextCodecGtk.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -0,0 +1,471 @@ +/* + * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006 Alexey Proskuryakov + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2008 Dominik Röttsches + * + * 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 "TextCodecGtk.h" + +#include "CString.h" +#include "PlatformString.h" +#include +#include +#include +#include "Logging.h" + +using std::auto_ptr; +using std::min; + +namespace WebCore { + + + +// appendOmittingBOM is gone (http://trac.webkit.org/changeset/33380), so we need to avoid generating extra BOM's +// here. This can be achieved by specifying the UTF-16 codecs' endianness explicitly when initializing iconv + +#if (G_BYTE_ORDER == G_BIG_ENDIAN) + const gchar* WebCore::TextCodecGtk::m_internalEncodingName = "UTF-16BE"; +#else + const gchar* WebCore::TextCodecGtk::m_internalEncodingName = "UTF-16LE"; +#endif + + +// list of text encodings and their aliases +// the first entry/"alias" is the canonical name, each alias list must be terminated by a 0 + +// Unicode +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_UTF_8 = { "UTF-8", 0}; + +// Western +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_8859_1 = { "ISO-8859-1", "CP819", "IBM819", "ISO-IR-100", "ISO8859-1", "ISO_8859-1", "ISO_8859-1:1987", "L1", "LATIN1", "CSISOLATIN1", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_MACROMAN = { "MACROMAN", "MAC", "MACINTOSH", "CSMACINTOSH", 0}; + +// Japanese +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_SHIFT_JIS = { "Shift_JIS", "MS_KANJI", "SHIFT-JIS", "SJIS", "CSSHIFTJIS", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_EUC_JP = { "EUC_JP", "EUC-JP", "EUCJP", "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", "CSEUCPKDFMTJAPANESE", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_2022_JP = { "ISO-2022-JP", 0}; + +// Traditional Chinese +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_BIG5 = { "BIG5", "BIG-5", "BIG-FIVE", "BIG5", "BIGFIVE", "CN-BIG5", "CSBIG5", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_BIG5_HKSCS = { "BIG5-HKSCS", "BIG5-HKSCS:2004", "BIG5HKSCS", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP950 = { "CP950", 0}; + +// Korean +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_2022_KR = { "ISO-2022-KR", "CSISO2022KR", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP949 = { "CP949", "UHC", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_EUC_KR = { "EUC-KR", "CSEUCKR", 0 }; + +// Arabic +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_8859_6 = { "ISO-8859-6", "ARABIC", "ASMO-708", "ECMA-114", "ISO-IR-127", "ISO8859-6", "ISO_8859-6", "ISO_8859-6:1987", "CSISOLATINARABIC", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP1256 = { "windows-1256", "CP1256", "MS-ARAB", 0}; // rearranged, windows-1256 now declared the canonical name and put to lowercase to fix /fast/encoding/ahram-org-eg.html test case + +// Hebrew +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_8859_8 = { "ISO-8859-8", "HEBREW", "ISO-8859-8", "ISO-IR-138", "ISO8859-8", "ISO_8859-8", "ISO_8859-8:1988", "CSISOLATINHEBREW", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP1255 = { "windows-1255", "CP1255", "MS-HEBR", 0}; // rearranged, moved windows-1255 as canonical and lowercased, fixing /fast/encoding/meta-charset.html + +// Greek +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_8859_7 = { "ISO-8859-7", "ECMA-118", "ELOT_928", "GREEK", "GREEK8", "ISO-IR-126", "ISO8859-7", "ISO_8859-7", "ISO_8859-7:1987", "ISO_8859-7:2003", "CSI", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP869 = { "CP869", "869", "CP-GR", "IBM869", "CSIBM869", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_WINDOWS_1253 = { "WINDOWS-1253", 0 }; + +// Cyrillic +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_8859_5 = { "ISO-8859-5", "CYRILLIC", "ISO-IR-144", "ISO8859-5", "ISO_8859-5", "ISO_8859-5:1988", "CSISOLATINCYRILLIC", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_KOI8_R = { "KOI8-R", "CSKOI8R", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP866 = { "CP866", "866", "IBM866", "CSIBM866", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_KOI8_U = { "KOI8-U", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_WINDOWS_1251 = { "windows-1251", "CP1251", 0}; // CP1251 added to pass /fast/encoding/charset-cp1251.html +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_MACCYRILLIC = { "mac-cyrillic", "MACCYRILLIC", "x-mac-cyrillic", 0}; + +// Thai +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP874 = { "CP874", "WINDOWS-874", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_TIS_620 = { "TIS-620", 0}; + +// Simplified Chinese +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_GBK = { "GBK", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_HZ = { "HZ", "HZ-GB-2312", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_GB18030 = { "GB18030", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_EUC_CN = { "EUC_CN", "EUCCN", "GB2312", "CN-GB", "CSGB2312", "EUC_CN", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_2312_80 = { "GB_2312-80", "CHINESE", "csISO58GB231280", "GB2312.1980-0", "ISO-IR-58" }; + +// Central European +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_8859_2 = { "ISO-8859-2", "ISO-IR-101", "ISO8859-2", "ISO_8859-2", "ISO_8859-2:1987", "L2", "LATIN2", "CSISOLATIN2", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP1250 = { "CP1250", "MS-EE", "WINDOWS-1250", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_MACCENTRALEUROPE = { "MACCENTRALEUROPE", 0}; + +// Vietnamese +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP1258 = { "CP1258", "WINDOWS-1258", 0}; + +// Turkish +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP1254 = { "CP1254", "MS-TURK", "WINDOWS-1254", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_8859_9 = { "ISO-8859-9", "ISO-IR-148", "ISO8859-9", "ISO_8859-9", "ISO_8859-9:1989", "L5", "LATIN5", "CSISOLATIN5", 0}; + +// Baltic +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_CP1257 = { "CP1257", "WINBALTRIM", "WINDOWS-1257", 0}; +TextCodecGtk::codecAliasList TextCodecGtk::m_codecAliases_ISO_8859_4 = { "ISO-8859-4", "ISO-IR-110", "ISO8859-4", "ISO_8859-4", "ISO_8859-4:1988", "L4", "LATIN4", "CSISOLATIN4", 0}; + +gconstpointer const TextCodecGtk::m_iconvBaseCodecList[] = { + // Unicode + &m_codecAliases_UTF_8, + + // Western + &m_codecAliases_ISO_8859_1 +}; + +gconstpointer const TextCodecGtk::m_iconvExtendedCodecList[] = +{ + // Western + &m_codecAliases_MACROMAN, + + // Japanese + &m_codecAliases_SHIFT_JIS, + &m_codecAliases_EUC_JP, + &m_codecAliases_ISO_2022_JP, + + // Simplified Chinese + &m_codecAliases_BIG5, + &m_codecAliases_BIG5_HKSCS, + &m_codecAliases_CP950, + + // Korean + &m_codecAliases_ISO_2022_KR, + &m_codecAliases_CP949, + &m_codecAliases_EUC_KR, + + // Arabic + &m_codecAliases_ISO_8859_6, + &m_codecAliases_CP1256, + + // Hebrew + &m_codecAliases_ISO_8859_8, + &m_codecAliases_CP1255, + + // Greek + &m_codecAliases_ISO_8859_7, + &m_codecAliases_CP869, + &m_codecAliases_WINDOWS_1253, + + // Cyrillic + &m_codecAliases_ISO_8859_5, + &m_codecAliases_KOI8_R, + &m_codecAliases_CP866, + &m_codecAliases_KOI8_U, + &m_codecAliases_WINDOWS_1251, + &m_codecAliases_MACCYRILLIC, + + // Thai + &m_codecAliases_CP874, + &m_codecAliases_TIS_620, + + // Traditional Chinese + &m_codecAliases_GBK, + &m_codecAliases_HZ, + &m_codecAliases_GB18030, + &m_codecAliases_EUC_CN, + &m_codecAliases_2312_80, + + // Central European + &m_codecAliases_ISO_8859_2, + &m_codecAliases_CP1250, + &m_codecAliases_MACCENTRALEUROPE, + + // Vietnamese + &m_codecAliases_CP1258, + + // Turkish + &m_codecAliases_CP1254, + &m_codecAliases_ISO_8859_9, + + // Baltic + &m_codecAliases_CP1257, + &m_codecAliases_ISO_8859_4 +}; + + +const size_t ConversionBufferSize = 16384; + + +static auto_ptr newTextCodecGtk(const TextEncoding& encoding, const void*) +{ +#ifndef NDEBUG + // too noisy if each UTF-8 codec creation is logged + // if (strcmp(encoding.name(), "UTF-8")) + // LOG(TextConversion, "creating new text codec for encoding name %s", encoding.name()); +#endif + + return auto_ptr(new TextCodecGtk(encoding)); +} + +gboolean TextCodecGtk::isEncodingAvailable(const gchar* encName) +{ + GIConv tester; + // test decoding + tester = g_iconv_open(m_internalEncodingName, encName); + if (tester == reinterpret_cast(-1)) { + LOG_ERROR("%s not decodable => not available!", encName); + return false; + } else { + g_iconv_close(tester); + // test encoding + tester = g_iconv_open(encName, m_internalEncodingName); + if (tester == reinterpret_cast(-1)) { + LOG_ERROR("%s not encodable => not available!", encName); + return false; + } else { + g_iconv_close(tester); + return true; + } + } +} + +void TextCodecGtk::registerEncodingNames(EncodingNameRegistrar registrar, bool extended) +{ + const void* const* encodingList; + unsigned int listLength = 0; + if (extended) { + encodingList = m_iconvExtendedCodecList; + listLength = sizeof(m_iconvExtendedCodecList)/sizeof(gpointer); + } else { + encodingList = m_iconvBaseCodecList; + listLength = sizeof(m_iconvBaseCodecList)/sizeof(gpointer); + } + + for (unsigned int i = 0; i < listLength; ++i) { + codecAliasList *codecAliases = static_cast(encodingList[i]); + int codecCount = -1; + const gchar *canonicalName, *currentAlias; + bool canonicalAvailable = true; + + // for each of the alias lists: + // bail out if canonical is not available, + // then continue testing each alias, + // if available, add it to the list, mapping it to its canonical name + + while ((currentAlias = (*codecAliases)[++codecCount]) && canonicalAvailable) { + bool currentAvailable = isEncodingAvailable(currentAlias); + + if (codecCount == 0 && currentAvailable) { + canonicalName = currentAlias; + canonicalAvailable = true; + LOG_VERBOSE(TextConversion, "registering encoding canonical %s", canonicalName); + registrar(canonicalName, canonicalName); + } else if (codecCount == 0 && !currentAvailable) + canonicalAvailable = false; + else if (codecCount > 0) { + if (isEncodingAvailable(currentAlias)) { + LOG_VERBOSE(TextConversion, "registering encoding name alias %s to canonical %s", currentAlias, canonicalName); + registrar(currentAlias, canonicalName); + } + } + } + + } +} + +void TextCodecGtk::registerCodecs(TextCodecRegistrar registrar, bool extended) +{ + const void* const* encodingList; + unsigned int listLength = 0; + if (extended) { + encodingList = m_iconvExtendedCodecList; + listLength = sizeof(m_iconvExtendedCodecList)/sizeof(gpointer); + } else { + encodingList = m_iconvBaseCodecList; + listLength = sizeof(m_iconvBaseCodecList)/sizeof(gpointer); + } + + for (unsigned int i = 0; i < listLength; ++i) { + codecAliasList *codecAliases = static_cast(encodingList[i]); + // by convention, the first "alias" should be the canonical name, see the definition of the alias lists + const gchar *codecName = (*codecAliases)[0]; + if (isEncodingAvailable(codecName)) + registrar(codecName, newTextCodecGtk, 0); + } +} + +void TextCodecGtk::registerBaseEncodingNames(EncodingNameRegistrar registrar) +{ + registerEncodingNames(registrar, false); +} + +void TextCodecGtk::registerBaseCodecs(TextCodecRegistrar registrar) +{ + registerCodecs(registrar, false); +} + +void TextCodecGtk::registerExtendedEncodingNames(EncodingNameRegistrar registrar) +{ + registerEncodingNames(registrar, true); +} + +void TextCodecGtk::registerExtendedCodecs(TextCodecRegistrar registrar) +{ + registerCodecs(registrar, true); +} + +TextCodecGtk::TextCodecGtk(const TextEncoding& encoding) + : m_encoding(encoding) + , m_numBufferedBytes(0) + , m_iconvDecoder(reinterpret_cast(-1)) + , m_iconvEncoder(reinterpret_cast(-1)) +{ +} + +TextCodecGtk::~TextCodecGtk() +{ + releaseIConv(); +} + +void TextCodecGtk::releaseIConv() const +{ + if (m_iconvDecoder != reinterpret_cast(-1)) { + g_iconv_close(m_iconvDecoder); + m_iconvDecoder = reinterpret_cast(-1); + } + if (m_iconvEncoder != reinterpret_cast(-1)) { + g_iconv_close(m_iconvEncoder); + m_iconvEncoder = reinterpret_cast(-1); + } +} + +void TextCodecGtk::createIConvDecoder() const +{ + ASSERT(m_iconvDecoder == reinterpret_cast(-1)); + + m_iconvDecoder = g_iconv_open(m_internalEncodingName, m_encoding.name()); +} + +void TextCodecGtk::createIConvEncoder() const +{ + ASSERT(m_iconvDecoder == reinterpret_cast(-1)); + + m_iconvEncoder = g_iconv_open(m_encoding.name(), m_internalEncodingName); +} + +String TextCodecGtk::decode(const char* bytes, size_t length, bool flush, bool stopOnError, bool& sawError) +{ + // Get a converter for the passed-in encoding. + if (m_iconvDecoder == reinterpret_cast(-1)) { + createIConvDecoder(); + ASSERT(m_iconvDecoder != reinterpret_cast(-1)); + if (m_iconvDecoder == reinterpret_cast(-1)) { + LOG_ERROR("error creating IConv encoder even though encoding was in table"); + return String(); + } + } + + size_t countWritten, countRead, conversionLength; + const char* conversionBytes; + char* prefixedBytes = 0; + + if (m_numBufferedBytes) { + conversionLength = length + m_numBufferedBytes; + prefixedBytes = static_cast(fastMalloc(conversionLength)); + memcpy(prefixedBytes, m_bufferedBytes, m_numBufferedBytes); + memcpy(prefixedBytes + m_numBufferedBytes, bytes, length); + + conversionBytes = prefixedBytes; + + // all buffered bytes are consumed now + m_numBufferedBytes = 0; + } else { + // no previously buffered partial data, + // just convert the data that was passed in + conversionBytes = bytes; + conversionLength = length; + } + + GOwnPtr err; + GOwnPtr buffer; + + if (conversionLength == 0) return ""; + + buffer.outPtr() = reinterpret_cast(g_convert_with_iconv(conversionBytes, conversionLength, m_iconvDecoder, &countRead, &countWritten, &err.outPtr())); + + + if (err) { + LOG_ERROR("GIConv conversion error"); + m_numBufferedBytes = 0; // reset state for subsequent calls to decode + fastFree(prefixedBytes); + sawError = true; + return String(); + } + + // Partial input at the end of the string may not result in an error being raised. + // From the gnome library documentation on g_convert_with_iconv: + // "Even if the conversion was successful, this may be less than len if there were partial characters at the end of the input." + // That's why we need to compare conversionLength against countRead + + m_numBufferedBytes = conversionLength - countRead; + if (m_numBufferedBytes > 0) { + if (flush) { + LOG_ERROR("Partial bytes at end of input while flush requested."); + m_numBufferedBytes = 0; // reset state for subsequent calls to decode + fastFree(prefixedBytes); + sawError = true; + return String(); + } + memcpy(m_bufferedBytes, conversionBytes + countRead, m_numBufferedBytes); + } + + fastFree(prefixedBytes); + + Vector result; + + result.append(buffer.get(), countWritten / sizeof(UChar)); + + return String::adopt(result); +} + +CString TextCodecGtk::encode(const UChar* characters, size_t length, UnencodableHandling handling) +{ + if (!length) + return ""; + + if (m_iconvEncoder == reinterpret_cast(-1)) + createIConvEncoder(); + if (m_iconvEncoder == reinterpret_cast(-1)) + return CString(); + + size_t count; + + GOwnPtr err; + GOwnPtr buffer; + + if (length == 0) return ""; + + buffer.outPtr() = g_convert_with_iconv(reinterpret_cast(characters), length * sizeof(UChar), m_iconvEncoder, 0, &count, &err.outPtr()); + if (err) { + LOG_ERROR("GIConv conversion error"); + return CString(); + } + + CString result = CString(buffer.get(), count); + + return result; +} + + +} // namespace WebCore diff -Naur WebKit-r41128/WebCore/platform/text/gtk/TextCodecGtk.h WebKit-r41137-nx/WebCore/platform/text/gtk/TextCodecGtk.h --- WebKit-r41128/WebCore/platform/text/gtk/TextCodecGtk.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/text/gtk/TextCodecGtk.h 2009-02-23 16:01:27.000000000 -0500 @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006 Alexey Proskuryakov + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2008 Dominik Röttsches + * + * 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. + */ + +#ifndef TextCodecGTK_h +#define TextCodecGTK_h + +#include + +#include "TextCodec.h" +#include "TextEncoding.h" + +namespace WebCore { + + class TextCodecGtk : public TextCodec { + public: + static void registerBaseEncodingNames(EncodingNameRegistrar); + static void registerBaseCodecs(TextCodecRegistrar); + + static void registerExtendedEncodingNames(EncodingNameRegistrar); + static void registerExtendedCodecs(TextCodecRegistrar); + + TextCodecGtk(const TextEncoding&); + virtual ~TextCodecGtk(); + + virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError); + virtual CString encode(const UChar*, size_t length, UnencodableHandling); + + private: + void createIConvDecoder() const; + void createIConvEncoder() const; + void releaseIConv() const; + + static void registerEncodingNames(EncodingNameRegistrar registrar, bool extended); + static void registerCodecs(TextCodecRegistrar registrar, bool extended); + static gboolean isEncodingAvailable(const gchar*); + + TextEncoding m_encoding; + size_t m_numBufferedBytes; + unsigned char m_bufferedBytes[16]; // bigger than any single multi-byte character + mutable GIConv m_iconvDecoder; + mutable GIConv m_iconvEncoder; + + static const gchar* m_internalEncodingName; + + typedef const gchar* const codecAliasList[]; + + // Unicode + static codecAliasList m_codecAliases_UTF_8; + + // Western + static codecAliasList m_codecAliases_ISO_8859_1; + static codecAliasList m_codecAliases_MACROMAN; + + // Japanese + static codecAliasList m_codecAliases_SHIFT_JIS; + static codecAliasList m_codecAliases_EUC_JP; + static codecAliasList m_codecAliases_ISO_2022_JP; + + // Traditional Chinese + static codecAliasList m_codecAliases_BIG5; + static codecAliasList m_codecAliases_BIG5_HKSCS; + static codecAliasList m_codecAliases_CP950; + + // Korean + static codecAliasList m_codecAliases_ISO_2022_KR; + static codecAliasList m_codecAliases_CP949; + static codecAliasList m_codecAliases_EUC_KR; + + // Arabic + static codecAliasList m_codecAliases_ISO_8859_6; + static codecAliasList m_codecAliases_CP1256; + + // Hebrew + static codecAliasList m_codecAliases_ISO_8859_8; + static codecAliasList m_codecAliases_CP1255; + + // Greek + static codecAliasList m_codecAliases_ISO_8859_7; + static codecAliasList m_codecAliases_CP869; + static codecAliasList m_codecAliases_WINDOWS_1253; + + // Cyrillic + static codecAliasList m_codecAliases_ISO_8859_5; + static codecAliasList m_codecAliases_KOI8_R; + static codecAliasList m_codecAliases_CP866; + static codecAliasList m_codecAliases_KOI8_U; + static codecAliasList m_codecAliases_WINDOWS_1251; + static codecAliasList m_codecAliases_MACCYRILLIC; + + // Thai + static codecAliasList m_codecAliases_CP874; + static codecAliasList m_codecAliases_TIS_620; + + // Simplified Chinese + static codecAliasList m_codecAliases_GBK; + static codecAliasList m_codecAliases_HZ; + static codecAliasList m_codecAliases_GB18030; + static codecAliasList m_codecAliases_EUC_CN; + static codecAliasList m_codecAliases_2312_80; + + // Central European + static codecAliasList m_codecAliases_ISO_8859_2; + static codecAliasList m_codecAliases_CP1250; + static codecAliasList m_codecAliases_MACCENTRALEUROPE; + + // Vietnamese + static codecAliasList m_codecAliases_CP1258; + + // Turkish + static codecAliasList m_codecAliases_CP1254; + static codecAliasList m_codecAliases_ISO_8859_9; + + // Baltic + static codecAliasList m_codecAliases_CP1257; + static codecAliasList m_codecAliases_ISO_8859_4; + + static gconstpointer const m_iconvBaseCodecList[]; + static gconstpointer const m_iconvExtendedCodecList[]; + + }; + +} // namespace WebCore + +#endif // TextCodecGTK_h diff -Naur WebKit-r41128/WebCore/platform/text/TextBreakIterator.h WebKit-r41137-nx/WebCore/platform/text/TextBreakIterator.h --- WebKit-r41128/WebCore/platform/text/TextBreakIterator.h 2008-12-24 23:47:41.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/text/TextBreakIterator.h 2009-02-23 16:01:27.000000000 -0500 @@ -35,7 +35,9 @@ TextBreakIterator* sentenceBreakIterator(const UChar*, int length); int textBreakFirst(TextBreakIterator*); + int textBreakLast(TextBreakIterator*); int textBreakNext(TextBreakIterator*); + int textBreakPrevious(TextBreakIterator*); int textBreakCurrent(TextBreakIterator*); int textBreakPreceding(TextBreakIterator*, int); int textBreakFollowing(TextBreakIterator*, int); diff -Naur WebKit-r41128/WebCore/platform/text/TextBreakIteratorICU.cpp WebKit-r41137-nx/WebCore/platform/text/TextBreakIteratorICU.cpp --- WebKit-r41128/WebCore/platform/text/TextBreakIteratorICU.cpp 2009-01-21 00:14:22.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/text/TextBreakIteratorICU.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -89,11 +89,21 @@ return ubrk_first(bi); } +int textBreakLast(TextBreakIterator* bi) +{ + return ubrk_last(bi); +} + int textBreakNext(TextBreakIterator* bi) { return ubrk_next(bi); } +int textBreakPrevious(TextBreakIterator* bi) +{ + return ubrk_previous(bi); +} + int textBreakPreceding(TextBreakIterator* bi, int pos) { return ubrk_preceding(bi, pos); diff -Naur WebKit-r41128/WebCore/platform/text/TextEncoding.cpp WebKit-r41137-nx/WebCore/platform/text/TextEncoding.cpp --- WebKit-r41128/WebCore/platform/text/TextEncoding.cpp 2009-01-21 00:14:22.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/text/TextEncoding.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -36,6 +36,9 @@ #include #elif USE(QT4_UNICODE) #include +#elif USE(GLIB_UNICODE) +#include +#include #endif #include #include @@ -114,6 +117,20 @@ QString str(reinterpret_cast(characters), length); str = str.normalized(QString::NormalizationForm_C); return newTextCodec(*this)->encode(reinterpret_cast(str.utf16()), str.length(), handling); +#elif USE(GLIB_UNICODE) + GOwnPtr utf8source; + utf8source.set(g_utf16_to_utf8(characters, length, 0, 0, 0)); + + GOwnPtr utf8normalized; + utf8normalized.set(g_utf8_normalize(utf8source.get(), -1, G_NORMALIZE_NFC)); + + long utf16length; + GOwnPtr utf16normalized; + utf16normalized.set(g_utf8_to_utf16(utf8normalized.get(), -1, 0, &utf16length, 0)); + + CString result = newTextCodec(*this)->encode(utf16normalized.get(), utf16length, handling); + + return result; #endif } diff -Naur WebKit-r41128/WebCore/platform/text/TextEncodingRegistry.cpp WebKit-r41137-nx/WebCore/platform/text/TextEncodingRegistry.cpp --- WebKit-r41128/WebCore/platform/text/TextEncodingRegistry.cpp 2009-01-21 00:14:22.000000000 -0500 +++ WebKit-r41137-nx/WebCore/platform/text/TextEncodingRegistry.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -47,6 +47,9 @@ #if PLATFORM(QT) #include "qt/TextCodecQt.h" #endif +#if PLATFORM(GTK) +#include "gtk/TextCodecGtk.h" +#endif using namespace WTF; @@ -189,6 +192,11 @@ TextCodecICU::registerBaseEncodingNames(addToTextEncodingNameMap); TextCodecICU::registerBaseCodecs(addToTextCodecMap); #endif + +#if USE(GLIB_UNICODE) + TextCodecGtk::registerBaseEncodingNames(addToTextEncodingNameMap); + TextCodecGtk::registerBaseCodecs(addToTextCodecMap); +#endif } static void extendTextCodecMaps() @@ -207,6 +215,11 @@ TextCodecMac::registerEncodingNames(addToTextEncodingNameMap); TextCodecMac::registerCodecs(addToTextCodecMap); #endif + +#if USE(GLIB_UNICODE) + TextCodecGtk::registerExtendedEncodingNames(addToTextEncodingNameMap); + TextCodecGtk::registerExtendedCodecs(addToTextCodecMap); +#endif } std::auto_ptr newTextCodec(const TextEncoding& encoding) diff -Naur WebKit-r41128/WebCore/rendering/SVGInlineTextBox.cpp WebKit-r41137-nx/WebCore/rendering/SVGInlineTextBox.cpp --- WebKit-r41128/WebCore/rendering/SVGInlineTextBox.cpp 2009-02-15 03:48:53.000000000 -0500 +++ WebKit-r41137-nx/WebCore/rendering/SVGInlineTextBox.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -484,7 +484,7 @@ float thickness = SVGRenderStyle::cssPrimitiveToLength(object, object->style()->svgStyle()->strokeWidth(), 1.0f); const Font& font = object->style()->font(); - thickness = max(thickness * powf(font.size(), 2.0f) / font.unitsPerEm(), 1.0f); + thickness = max(thickness * (float) pow(font.size(), 2.0f) / font.unitsPerEm(), 1.0f); if (decoration == UNDERLINE) y += thickness * 1.5f; // For compatibility with Batik/Opera diff -Naur WebKit-r41128/WebCore/svg/SVGLength.cpp WebKit-r41137-nx/WebCore/svg/SVGLength.cpp --- WebKit-r41128/WebCore/svg/SVGLength.cpp 2009-02-15 03:48:53.000000000 -0500 +++ WebKit-r41137-nx/WebCore/svg/SVGLength.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -314,7 +314,7 @@ else if (mode == LengthModeHeight) return value * height; else if (mode == LengthModeOther) - return value * sqrtf(powf(width, 2) + powf(height, 2)) / sqrtf(2.0f); + return value * sqrtf(pow(width, 2) + pow(height, 2)) / sqrtf(2.0f); return 0.0f; } diff -Naur WebKit-r41128/WebCore/WebCore.base.exp WebKit-r41137-nx/WebCore/WebCore.base.exp --- WebKit-r41128/WebCore/WebCore.base.exp 2009-02-20 22:38:13.000000000 -0500 +++ WebKit-r41137-nx/WebCore/WebCore.base.exp 2009-06-23 19:31:41.188785890 -0400 @@ -953,3 +953,4 @@ _wkSignalCFReadStreamEnd _wkSignalCFReadStreamError _wkSignalCFReadStreamHasBytes +__ZN7WebCore13ScriptElement18addScriptEvaluatorEPNS_15ScriptEvaluatorE diff -Naur WebKit-r41128/WebKit/gtk/tests/main.c WebKit-r41137-nx/WebKit/gtk/tests/main.c --- WebKit-r41128/WebKit/gtk/tests/main.c 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/tests/main.c 2009-03-24 16:51:48.000000000 -0400 @@ -63,6 +63,98 @@ } static void +test_webkit_web_back_forward_list_order(void) +{ + WebKitWebView* webView; + WebKitWebBackForwardList* webBackForwardList; + WebKitWebHistoryItem* item1; + WebKitWebHistoryItem* item2; + WebKitWebHistoryItem* item3; + WebKitWebHistoryItem* item4; + WebKitWebHistoryItem* currentItem; + GList* backList = NULL; + GList* forwardList = NULL; + g_test_bug("22694"); + + webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + g_object_ref_sink(webView); + + webkit_web_view_set_maintains_back_forward_list(webView, TRUE); + webBackForwardList = webkit_web_view_get_back_forward_list(webView); + g_assert(webBackForwardList); + + // Check that there is no item. + g_assert(!webkit_web_back_forward_list_get_current_item(webBackForwardList)); + g_assert_cmpint(webkit_web_back_forward_list_get_forward_length(webBackForwardList), ==, 0); + g_assert_cmpint(webkit_web_back_forward_list_get_back_length(webBackForwardList), ==, 0); + g_assert(!webkit_web_view_can_go_forward(webView)); + g_assert(!webkit_web_view_can_go_back(webView)); + + // Add a new items + item1 = webkit_web_history_item_new_with_data("http://example.com/1/", "Site 1"); + webkit_web_back_forward_list_add_item(webBackForwardList, item1); + g_assert(webkit_web_back_forward_list_contains_item(webBackForwardList, item1)); + + item2 = webkit_web_history_item_new_with_data("http://example.com/2/", "Site 2"); + webkit_web_back_forward_list_add_item(webBackForwardList, item2); + g_assert(webkit_web_back_forward_list_contains_item(webBackForwardList, item2)); + + item3 = webkit_web_history_item_new_with_data("http://example.com/3/", "Site 3"); + webkit_web_back_forward_list_add_item(webBackForwardList, item3); + g_assert(webkit_web_back_forward_list_contains_item(webBackForwardList, item3)); + + item4 = webkit_web_history_item_new_with_data("http://example.com/4/", "Site 4"); + webkit_web_back_forward_list_add_item(webBackForwardList, item4); + g_assert(webkit_web_back_forward_list_contains_item(webBackForwardList, item4)); + + // check the back list order + backList = webkit_web_back_forward_list_get_back_list_with_limit(webBackForwardList, 5); + g_assert(backList); + + currentItem = WEBKIT_WEB_HISTORY_ITEM(backList->data); + g_assert_cmpstr(webkit_web_history_item_get_uri(currentItem), ==, "http://example.com/3/"); + g_assert_cmpstr(webkit_web_history_item_get_title(currentItem), ==, "Site 3"); + backList = backList->next; + + currentItem = WEBKIT_WEB_HISTORY_ITEM(backList->data); + g_assert_cmpstr(webkit_web_history_item_get_uri(currentItem), ==, "http://example.com/2/"); + g_assert_cmpstr(webkit_web_history_item_get_title(currentItem), ==, "Site 2"); + backList = backList->next; + + currentItem = WEBKIT_WEB_HISTORY_ITEM(backList->data); + g_assert_cmpstr(webkit_web_history_item_get_uri(currentItem), ==, "http://example.com/1/"); + g_assert_cmpstr(webkit_web_history_item_get_title(currentItem), ==, "Site 1"); + g_list_free(backList); + + // check the forward list order + g_assert(webkit_web_view_go_to_back_forward_item(webView, item1)); + forwardList = webkit_web_back_forward_list_get_forward_list_with_limit(webBackForwardList,5); + g_assert(forwardList); + + currentItem = WEBKIT_WEB_HISTORY_ITEM(forwardList->data); + g_assert_cmpstr(webkit_web_history_item_get_uri(currentItem), ==, "http://example.com/4/"); + g_assert_cmpstr(webkit_web_history_item_get_title(currentItem), ==, "Site 4"); + forwardList = forwardList->next; + + currentItem = WEBKIT_WEB_HISTORY_ITEM(forwardList->data); + g_assert_cmpstr(webkit_web_history_item_get_uri(currentItem), ==, "http://example.com/3/"); + g_assert_cmpstr(webkit_web_history_item_get_title(currentItem), ==, "Site 3"); + forwardList = forwardList->next; + + currentItem = WEBKIT_WEB_HISTORY_ITEM(forwardList->data); + g_assert_cmpstr(webkit_web_history_item_get_uri(currentItem), ==, "http://example.com/2/"); + g_assert_cmpstr(webkit_web_history_item_get_title(currentItem), ==, "Site 2"); + + g_object_unref(currentItem); + g_object_unref(item1); + g_object_unref(item2); + g_object_unref(item3); + g_object_unref(item4); + g_list_free(forwardList); + g_object_unref(webView); +} + +static void test_webkit_web_back_forward_list_add_item(void) { WebKitWebView* webView; @@ -143,7 +235,7 @@ g_test_add_func("/webkit/webview/create_destroy", test_webkit_web_frame_create_destroy); g_test_add_func("/webkit/webframe/lifetime", test_webkit_web_frame_lifetime); g_test_add_func("/webkit/webbackforwardlist/add_item", test_webkit_web_back_forward_list_add_item); - + g_test_add_func("/webkit/webbackforwardlist/list_order", test_webkit_web_back_forward_list_order); return g_test_run (); } diff -Naur WebKit-r41128/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp --- WebKit-r41128/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp 2009-01-21 00:14:25.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp 2009-02-25 20:35:26.000000000 -0500 @@ -23,11 +23,13 @@ #include "HitTestResult.h" #include "KURL.h" #include "NotImplemented.h" +#include "CString.h" #include #include #include #include "webkitprivate.h" +#include "webkitwebdownload.h" using namespace WebCore; @@ -163,7 +165,18 @@ void ContextMenuClient::downloadURL(const KURL& url) { - notImplemented(); + WebKitWebDownload* download = webkit_web_download_new(url.string().utf8().data()); + + gboolean handled; + + g_signal_emit_by_name(m_webView, "download-created", download, &handled); + + if (handled) + webkit_web_download_start(download); + else { + webkit_web_download_cancel(download); + g_object_unref(download); + } } void ContextMenuClient::copyImageToClipboard(const HitTestResult&) diff -Naur WebKit-r41128/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp --- WebKit-r41128/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp 2009-06-28 19:05:29.993322187 -0400 @@ -72,6 +72,62 @@ editor->setComposition(preeditString, underlines, cursorPos, 0); } +static void imContextDeleteSurrounding(GtkIMContext* context, gint offset, gint length, EditorClient* client) +{ +#ifdef MAEMO_CHANGES + Frame* frame = core(client->m_webView)->focusController()->focusedOrMainFrame(); + SelectionController* selection = frame->selection(); + if (selection) { + // Hack: we just select all text, so the following commit will overwrite all of it. + selection->selectAll(); + } +#endif +} + +static void imContextRetrieveSurrounding(GtkIMContext* context, EditorClient* client) +{ +#ifdef MAEMO_CHANGES + Frame* frame = core(client->m_webView)->focusController()->focusedOrMainFrame(); + SelectionController* selection = frame->selection(); + if (selection) { + Element* element = selection->rootEditableElement(); + gchar* str = g_strdup(element->innerText().utf8().data()); + if (str != NULL) { + gtk_im_context_set_surrounding(context, str, strlen(str), selection->base().offset()); + g_free(str); + } + } +#endif +} + +static gboolean imContextHasSelection(GtkIMContext* context, EditorClient* client) +{ + Frame* frame = core(client->m_webView)->focusController()->focusedOrMainFrame(); + SelectionController* selection = frame->selection(); + if (selection) { + return selection->start().offset() != selection->end().offset(); + } + return FALSE; +} + +static void imContextClipboardOperation(GtkIMContext* context, int operation, EditorClient* client) +{ +#ifdef MAEMO_CHANGES + switch(operation) + { + case GTK_IM_CONTEXT_CLIPBOARD_OP_COPY: + webkit_web_view_copy_clipboard(client->m_webView); + break; + case GTK_IM_CONTEXT_CLIPBOARD_OP_CUT: + webkit_web_view_cut_clipboard(client->m_webView); + break; + case GTK_IM_CONTEXT_CLIPBOARD_OP_PASTE: + webkit_web_view_paste_clipboard(client->m_webView); + break; + } +#endif +} + void EditorClient::setInputMethodState(bool active) { WebKitWebViewPrivate* priv = m_webView->priv; @@ -82,9 +138,7 @@ gtk_im_context_focus_out(priv->imContext); #ifdef MAEMO_CHANGES - if (active) - hildon_gtk_im_context_show(priv->imContext); - else + if (!active) hildon_gtk_im_context_hide(priv->imContext); #endif } @@ -459,6 +513,13 @@ { WebKitWebViewPrivate* priv = m_webView->priv; +#ifdef MAEMO_CHANGES + if (hildon_gtk_im_context_filter_event(priv->imContext, (GdkEvent*)event)) { + event->setDefaultHandled(); + return; + } +#endif + // TODO: Dispatch IE-compatible text input events for IM events. if (gtk_im_context_filter_keypress(priv->imContext, event->keyEvent()->gdkEventKey())) event->setDefaultHandled(); @@ -470,6 +531,17 @@ WebKitWebViewPrivate* priv = m_webView->priv; g_signal_connect(priv->imContext, "commit", G_CALLBACK(imContextCommitted), this); g_signal_connect(priv->imContext, "preedit-changed", G_CALLBACK(imContextPreeditChanged), this); +#ifdef MAEMO_CHANGES + g_signal_connect(priv->imContext, "retrieve-surrounding", G_CALLBACK(imContextRetrieveSurrounding), this); + g_signal_connect(priv->imContext, "delete-surrounding", G_CALLBACK(imContextDeleteSurrounding), this); + g_signal_connect(priv->imContext, "has_selection", G_CALLBACK(imContextHasSelection), this); + g_signal_connect(priv->imContext, "clipboard_operation", G_CALLBACK(imContextClipboardOperation), this); + + int mode; + g_object_get(priv->imContext, "hildon-input-mode", &mode, NULL); + mode ^= HILDON_GTK_INPUT_MODE_AUTOCAP; + g_object_set(priv->imContext, "hildon-input-mode", mode, NULL); +#endif } EditorClient::~EditorClient() @@ -477,6 +549,12 @@ WebKitWebViewPrivate* priv = m_webView->priv; g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextCommitted, this); g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextPreeditChanged, this); +#ifdef MAEMO_CHANGES + g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextRetrieveSurrounding, this); + g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextDeleteSurrounding, this); + g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextHasSelection, this); + g_signal_handlers_disconnect_by_func(priv->imContext, (gpointer)imContextClipboardOperation, this); +#endif } void EditorClient::textFieldDidBeginEditing(Element*) diff -Naur WebKit-r41128/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp --- WebKit-r41128/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp 2009-06-23 20:24:25.836484145 -0400 @@ -21,6 +21,7 @@ #include "config.h" #include "FrameLoaderClientGtk.h" +#include "ResourceHandleClient.h" #include "Color.h" #include "DocumentLoader.h" @@ -40,6 +41,8 @@ #include "MouseEvent.h" #include "NotImplemented.h" #include "PlatformString.h" +#include "ResourceHandle.h" +#include "ResourceHandleInternal.h" #include "PluginDatabase.h" #include "RenderPart.h" #include "ResourceRequest.h" @@ -80,85 +83,18 @@ g_object_unref(m_policyDecision); } -static String agentPlatform() -{ -#ifdef GDK_WINDOWING_X11 - return "X11"; -#elif defined(GDK_WINDOWING_WIN32) - return "Windows"; -#elif defined(GDK_WINDOWING_QUARTZ) - return "Macintosh"; -#elif defined(GDK_WINDOWING_DIRECTFB) - return "DirectFB"; -#else - notImplemented(); - return "Unknown"; -#endif -} - -static String agentOS() -{ -#if PLATFORM(DARWIN) -#if PLATFORM(X86) - return "Intel Mac OS X"; -#else - return "PPC Mac OS X"; -#endif -#elif PLATFORM(UNIX) - struct utsname name; - if (uname(&name) != -1) - return String::format("%s %s", name.sysname, name.machine); - else - return "Unknown"; -#elif PLATFORM(WIN_OS) - // FIXME: Compute the Windows version - return "Windows"; -#else - notImplemented(); - return "Unknown"; -#endif -} - -static String composeUserAgent() -{ - // This is a liberal interpretation of http://www.mozilla.org/build/revised-user-agent-strings.html - // See also http://developer.apple.com/internet/safari/faq.html#anchor2 - - String ua; - - // Product - ua += "Mozilla/5.0"; - - // Comment - ua += " ("; - ua += agentPlatform(); // Platform - ua += "; U; "; // Security - ua += agentOS(); // OS-or-CPU - ua += "; "; - ua += defaultLanguage(); // Localization information - ua += ") "; - - // WebKit Product - // FIXME: The WebKit version is hardcoded - static const String webKitVersion = "528.5+"; - ua += "AppleWebKit/" + webKitVersion; - ua += " (KHTML, like Gecko, "; - // We mention Safari since many broken sites check for it (OmniWeb does this too) - // We re-use the WebKit version, though it doesn't seem to matter much in practice - ua += "Safari/" + webKitVersion; - ua += ") "; - - // Vendor Product - ua += g_get_prgname(); - - return ua; -} - String FrameLoaderClient::userAgent(const KURL&) { - if (m_userAgent.isEmpty()) - m_userAgent = composeUserAgent(); - + Frame* coreFrame = core(webFrame()); + ASSERT(coreFrame); + Settings* settings = coreFrame->settings(); + + if (m_userAgent.isEmpty() || settings->userAgent().isEmpty()) { + m_userAgent = composeUserAgent(); + } else if (!settings->userAgent().isEmpty()) { + m_userAgent = settings->userAgent(); + } + return m_userAgent; } @@ -264,6 +200,18 @@ m_response = response; } +#ifdef MAEMO_CHANGES +bool FrameLoaderClient::dispatchDecidePolicyForNetworkResource(const KURL& url) +{ + WebKitWebView* page = getViewFromFrame(m_frame); + + gboolean isHandled = false; + g_signal_emit_by_name(page, "resource-policy-decision-requested", m_frame, url.string().utf8().data(), &isHandled); + + return !isHandled; +} +#endif + void FrameLoaderClient::dispatchDecidePolicyForMIMEType(FramePolicyFunction policyFunction, const String& mimeType, const ResourceRequest& resourceRequest) { ASSERT(policyFunction); @@ -292,14 +240,27 @@ webkit_web_policy_decision_download (policyDecision); } -void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction policyFunction, const NavigationAction& action, const ResourceRequest& resourceRequest, PassRefPtr, const String& s) +void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction policyFunction, const NavigationAction&, const ResourceRequest& resourceRequest, PassRefPtr, const String& frameName) { ASSERT(policyFunction); if (!policyFunction) return; - // FIXME: I think Qt version marshals this to another thread so when we - // have multi-threaded download, we might need to do the same - (core(m_frame)->loader()->*policyFunction)(PolicyUse); + + WebKitWebView* webView = getViewFromFrame(m_frame); + WebKitNetworkRequest* request = webkit_network_request_new(strdup(resourceRequest.url().string().utf8().data())); + WebKitNavigationResponse response; + gchar* frame_name = strdup(frameName.utf8().data()); + + g_signal_emit_by_name(webView, "new-window-navigation-requested", m_frame, request, frame_name, &response); + + free(frame_name); + g_object_unref(request); + + if (response == WEBKIT_NAVIGATION_RESPONSE_IGNORE) { + (core(m_frame)->loader()->*policyFunction)(PolicyIgnore); + } else { + (core(m_frame)->loader()->*policyFunction)(PolicyUse); + } } void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction policyFunction, const NavigationAction& action, const ResourceRequest& resourceRequest, PassRefPtr) @@ -387,7 +348,6 @@ { Frame* coreFrame = core(webFrame()); - ASSERT(core(getViewFromFrame(webFrame())) == coreFrame->page()); RefPtr childFrame = webkit_web_frame_init_with_web_view(getViewFromFrame(webFrame()), ownerElement); @@ -395,7 +355,12 @@ childFrame->tree()->setName(name); childFrame->init(); - childFrame->loader()->loadURL(url, referrer, String(), false, FrameLoadTypeRedirectWithLockedBackForwardList, 0, 0); + + // The creation of the frame may have run arbitrary JavaScript that removed it from the page already. + if (!childFrame->page()) + return 0; + + childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get()); // The frame's onload handler may have removed it from the document. if (!childFrame->tree()->parent()) @@ -423,7 +388,7 @@ String type = mimeType; // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "application/octet-stream" upon failure if (type.isEmpty()) - type = MIMETypeRegistry::getMIMETypeForExtension(url.path().substring(url.path().reverseFind('.') + 1)); + type = MIMETypeRegistry::getMIMETypeForPath/*Extension*/(url.path().substring(url.path().reverseFind('.') + 1)); if (type.isEmpty()) return WebCore::ObjectContentFrame; @@ -754,9 +719,23 @@ g_signal_emit_by_name(m_frame, "load-done", false); } -void FrameLoaderClient::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) +void FrameLoaderClient::download(ResourceHandle* handle, const ResourceRequest& request, const ResourceRequest& initialRequest, const ResourceResponse& response) { - notImplemented(); + WebKitWebView* view = getViewFromFrame(m_frame); + // FIXME: Use initialRequest? + // FIXME: Don't create networkRequest from the URI but from the full object when the new API is merged. + WebKitNetworkRequest* networkRequest = webkit_network_request_new(request.url().string().utf8().data()); + WebKitWebDownload* download = webkit_web_download_new_from_existing_connection(handle, networkRequest, response); + gboolean handled; + g_signal_emit_by_name(view, "download-created", download, &handled); + + if (handled) { + webkit_web_download_start(download); + } + else { + handle->cancel(); + g_object_unref(download); + } } ResourceError FrameLoaderClient::cancelledError(const ResourceRequest&) diff -Naur WebKit-r41128/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h --- WebKit-r41128/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h 2009-06-24 16:48:40.033764408 -0400 @@ -90,6 +90,9 @@ virtual WebCore::Frame* dispatchCreatePage(); virtual void dispatchShow(); +#ifdef MAEMO_CHANGES + virtual bool dispatchDecidePolicyForNetworkResource(const WebCore::KURL&); +#endif virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction, const WebCore::String& MIMEType, const WebCore::ResourceRequest&); virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WTF::PassRefPtr, const WebCore::String& frameName); virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WTF::PassRefPtr); diff -Naur WebKit-r41128/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp --- WebKit-r41128/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp 2009-06-23 19:31:53.696508321 -0400 @@ -31,6 +31,7 @@ namespace WebKit { +gchar* InspectorClient::runtimePath = NULL; static void notifyWebViewDestroyed(WebKitWebView* webView, InspectorClient* inspectorClient) { inspectorClient->webViewDestroyed(); @@ -92,7 +93,15 @@ g_signal_connect(m_webView, "destroy", G_CALLBACK(notifyWebViewDestroyed), (gpointer)this); - webkit_web_view_open(m_webView, "file://"DATA_DIR"/webkit-1.0/webinspector/inspector.html"); + if (runtimePath == NULL) + webkit_web_view_open(m_webView, "file://"DATA_DIR"/webkit-1.0/webinspector/inspector.html"); + else + { + String inspectorPath("file://"); + inspectorPath.append(runtimePath); + inspectorPath.append("/webinspector/inspector.html"); + webkit_web_view_open(m_webView, inspectorPath.utf8().data()); + } gtk_widget_show(GTK_WIDGET(m_webView)); return core(m_webView); diff -Naur WebKit-r41128/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h --- WebKit-r41128/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h 2009-06-23 19:31:53.724637050 -0400 @@ -69,6 +69,7 @@ virtual void populateSetting(const WebCore::String& key, WebCore::InspectorController::Setting&); virtual void storeSetting(const WebCore::String& key, const WebCore::InspectorController::Setting&); virtual void removeSetting(const WebCore::String& key); + static gchar* runtimePath; private: WebKitWebView* m_webView; diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitdefines.h WebKit-r41137-nx/WebKit/gtk/webkit/webkitdefines.h --- WebKit-r41128/WebKit/gtk/webkit/webkitdefines.h 2009-01-21 00:14:25.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitdefines.h 2009-02-23 16:01:27.000000000 -0500 @@ -68,6 +68,9 @@ typedef struct _WebKitWebView WebKitWebView; typedef struct _WebKitWebViewClass WebKitWebViewClass; +typedef struct _WebKitWebDownload WebKitWebDownload; +typedef struct _WebKitWebDownloadClass WebKitWebDownloadClass; + G_END_DECLS #endif diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkit.h WebKit-r41137-nx/WebKit/gtk/webkit/webkit.h --- WebKit-r41128/WebKit/gtk/webkit/webkit.h 2009-01-21 00:14:25.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkit.h 2009-07-19 14:53:19.404475285 -0400 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -34,5 +35,7 @@ #include #include #include +#include +#include #endif /* __WEBKIT_H__ */ diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitprivate.cpp WebKit-r41137-nx/WebKit/gtk/webkit/webkitprivate.cpp --- WebKit-r41128/WebKit/gtk/webkit/webkitprivate.cpp 2009-01-21 00:14:25.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitprivate.cpp 2009-05-25 18:26:55.473974435 -0400 @@ -24,6 +24,7 @@ #include "ChromeClientGtk.h" #include "FrameLoader.h" #include "FrameLoaderClientGtk.h" +#include "Language.h" #include "Logging.h" #include "NotImplemented.h" #include "PageCache.h" @@ -36,10 +37,88 @@ #include "DatabaseTracker.h" #endif +#if PLATFORM(UNIX) +#include +#endif + using namespace WebCore; namespace WebKit { +static String agentPlatform() +{ +#ifdef GDK_WINDOWING_X11 + return "X11"; +#elif defined(GDK_WINDOWING_WIN32) + return "Windows"; +#elif defined(GDK_WINDOWING_QUARTZ) + return "Macintosh"; +#elif defined(GDK_WINDOWING_DIRECTFB) + return "DirectFB"; +#else + notImplemented(); + return "Unknown"; +#endif +} + +static String agentOS() +{ +#if PLATFORM(DARWIN) +#if PLATFORM(X86) + return "Intel Mac OS X"; +#else + return "PPC Mac OS X"; +#endif +#elif PLATFORM(UNIX) + struct utsname name; + if (uname(&name) != -1) + return String::format("%s %s", name.sysname, name.machine); + else + return "Unknown"; +#elif PLATFORM(WIN_OS) + // FIXME: Compute the Windows version + return "Windows"; +#else + notImplemented(); + return "Unknown"; +#endif +} + +String composeUserAgent() +{ + // This is a liberal interpretation of http://www.mozilla.org/build/revised-user-agent-strings.html + // See also http://developer.apple.com/internet/safari/faq.html#anchor2 + + String ua; + + // Product + ua += "Mozilla/5.0"; + + // Comment + ua += " ("; + ua += agentPlatform(); // Platform + ua += "; U; "; // Security + ua += agentOS(); // OS-or-CPU + ua += "; "; + ua += defaultLanguage(); // Localization information + ua += ") "; + + // WebKit Product + // FIXME: The WebKit version is hardcoded + static const String webKitVersion = "528.5+"; + ua += "AppleWebKit/" + webKitVersion; + ua += " (KHTML, like Gecko, "; + // We mention Safari since many broken sites check for it (OmniWeb does this too) + // We re-use the WebKit version, though it doesn't seem to matter much in practice + ua += "Safari/" + webKitVersion; + ua += ") "; + + // Vendor Product + ua += g_get_prgname(); + + return ua; +} + WebKitWebView* getViewFromFrame(WebKitWebFrame* frame) { WebKitWebFramePrivate* priv = frame->priv; @@ -113,7 +192,7 @@ #if ENABLE(DATABASE) // FIXME: It should be possible for client applications to override this default location - gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL); + gchar* databaseDirectory = "/media/mmc1/"; //g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL); WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(databaseDirectory); g_free(databaseDirectory); #endif diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitprivate.h WebKit-r41137-nx/WebKit/gtk/webkit/webkitprivate.h --- WebKit-r41128/WebKit/gtk/webkit/webkitprivate.h 2009-01-21 00:14:25.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitprivate.h 2009-04-22 21:28:31.700005250 -0400 @@ -27,11 +27,14 @@ * They are using WebCore which musn't be exposed to the outer world. */ +#include + #include #include #include #include #include +#include #include #include #include @@ -44,10 +47,16 @@ #include "InspectorClientGtk.h" #include "FrameLoaderClient.h" #include "WindowFeatures.h" +#include "ResourceHandleClient.h" +#include "ResourceResponse.h" #include +class DownloadClient; + namespace WebKit { + WebCore::String composeUserAgent(); + WebKitWebView* getViewFromFrame(WebKitWebFrame*); WebCore::Frame* core(WebKitWebFrame*); @@ -114,6 +123,20 @@ gchar* uri; }; + #define WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_DOWNLOAD, WebKitWebDownloadPrivate)) + typedef struct _WebKitWebDownloadPrivate WebKitWebDownloadPrivate; + struct _WebKitWebDownloadPrivate { + gchar* localUri; + gchar* suggestedFilename; + guint currentSize; + WebKitWebDownloadState state; + GIOChannel* outputChannel; + DownloadClient* downloadClient; + WebKitNetworkRequest* networkRequest; + WebCore::ResourceResponse* networkResponse; + RefPtr resourceHandle; + }; + PassRefPtr webkit_web_frame_init_with_web_view(WebKitWebView*, WebCore::HTMLFrameOwnerElement*); @@ -144,6 +167,9 @@ void webkit_web_policy_decision_cancel (WebKitWebPolicyDecision* decision); + WebKitWebDownload* + webkit_web_download_new_from_existing_connection(WebCore::ResourceHandle*, WebKitNetworkRequest*, const WebCore::ResourceResponse&); + // FIXME: Move these to webkitwebframe.h once their API has been discussed. WEBKIT_API GSList* diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitversion.h WebKit-r41137-nx/WebKit/gtk/webkit/webkitversion.h --- WebKit-r41128/WebKit/gtk/webkit/webkitversion.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitversion.h 2009-07-19 15:41:53.000000000 -0400 @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2008 Christian Dywan + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WEBKIT_VERSION_H +#define WEBKIT_VERSION_H + +#include +#include + +G_BEGIN_DECLS + +#define WEBKIT_MAJOR_VERSION (1) +#define WEBKIT_MINOR_VERSION (1) +#define WEBKIT_MICRO_VERSION (0) + +#define WEBKIT_CHECK_VERSION(major, minor, micro) \ + (WEBKIT_MAJOR_VERSION > (major) || \ + (WEBKIT_MAJOR_VERSION == (major) && WEBKIT_MINOR_VERSION > (minor)) || \ + (WEBKIT_MAJOR_VERSION == (major) && WEBKIT_MINOR_VERSION == (minor) && \ + WEBKIT_MICRO_VERSION >= (micro))) + +WEBKIT_API guint +webkit_major_version (void); + +WEBKIT_API guint +webkit_minor_version (void); + +WEBKIT_API guint +webkit_micro_version (void); + +WEBKIT_API gboolean +webkit_check_version (guint major, guint minor, guint micro); + +G_END_DECLS + +#endif diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp --- WebKit-r41128/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebbackforwardlist.cpp 2009-03-24 16:51:48.000000000 -0400 @@ -193,7 +193,7 @@ forwardItems = g_list_prepend(forwardItems, g_object_ref(webHistoryItem)); } - return g_list_reverse(forwardItems); + return forwardItems; } /** @@ -223,8 +223,9 @@ backItems = g_list_prepend(backItems, g_object_ref(webHistoryItem)); } - return g_list_reverse(backItems); + return backItems; } + /** * webkit_web_back_forward_list_get_back_item: * @web_back_forward_list: a #WebBackForwardList diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebdownload.cpp WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebdownload.cpp --- WebKit-r41128/WebKit/gtk/webkit/webkitwebdownload.cpp 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebdownload.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -0,0 +1,633 @@ +/* + * Copyright (C) 2008 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#include "CString.h" +#include "Noncopyable.h" +#include "NotImplemented.h" +#include "ResourceHandle.h" +#include "ResourceHandleClient.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" +#include "webkitmarshal.h" +#include "webkitwebdownload.h" +#include "webkitprivate.h" +#include + +using namespace WebKit; +using namespace WebCore; + +extern "C" { + +class DownloadClient : Noncopyable, public WebCore::ResourceHandleClient { + public: + DownloadClient(WebKitWebDownload*); + + virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&); + virtual void didReceiveData(ResourceHandle*, const char*, int, int); + virtual void didFinishLoading(ResourceHandle*); + virtual void didFail(ResourceHandle*, const ResourceError&); + virtual void wasBlocked(ResourceHandle*); + virtual void cannotShowURL(ResourceHandle*); + + private: + WebKitWebDownload* m_download; +}; + +enum { + /* normal signals */ + STARTED, + PROGRESS_UPDATE, + FINISHED, + ERROR, + LAST_SIGNAL +}; + +static guint webkit_web_download_signals[LAST_SIGNAL] = { 0, }; + +enum { + PROP_0, + + PROP_NETWORK_REQUEST, + PROP_LOCAL_URI, + PROP_SUGGESTED_FILENAME, + PROP_CURRENT_SIZE, + PROP_TOTAL_SIZE, +}; + +G_DEFINE_TYPE(WebKitWebDownload, webkit_web_download, G_TYPE_OBJECT); + +static void webkit_web_download_finalize(GObject* object) +{ + WebKitWebDownload* download = WEBKIT_WEB_DOWNLOAD(object); + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + + /* We don't call webkit_web_download_cancel() because we don't want to emit + * signals when finalising an object. */ + if (priv->resourceHandle) { + if (priv->state == WEBKIT_WEB_DOWNLOAD_STATE_STARTED) { + priv->resourceHandle->setClient(0); + priv->resourceHandle->cancel(); + } + priv->resourceHandle.release(); + } + + delete priv->downloadClient; + delete priv->networkResponse; + + g_free(priv->localUri); + g_free(priv->suggestedFilename); + if (priv->outputChannel) + g_io_channel_unref(priv->outputChannel); + g_object_unref(priv->networkRequest); + + G_OBJECT_CLASS(webkit_web_download_parent_class)->finalize(object); +} + +static void webkit_web_download_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + WebKitWebDownload* download = WEBKIT_WEB_DOWNLOAD(object); + + switch(prop_id) { + case PROP_NETWORK_REQUEST: + g_value_set_object(value, webkit_web_download_get_network_request(download)); + break; + case PROP_LOCAL_URI: + g_value_set_string(value, webkit_web_download_get_local_uri(download)); + break; + case PROP_SUGGESTED_FILENAME: + g_value_set_string(value, webkit_web_download_get_suggested_filename(download)); + break; + case PROP_CURRENT_SIZE: + g_value_set_uint64(value, webkit_web_download_get_current_size(download)); + break; + case PROP_TOTAL_SIZE: + g_value_set_uint64(value, webkit_web_download_get_total_size(download)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + } +} + +static void webkit_web_download_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec *pspec) +{ + WebKitWebDownload* download = WEBKIT_WEB_DOWNLOAD(object); + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + + switch(prop_id) { + case PROP_NETWORK_REQUEST: + priv->networkRequest = (WebKitNetworkRequest*)g_value_dup_object(value); + /* This is safe as network-request is a construct only property and suggestedFilename + * is initially null. */ + priv->suggestedFilename = g_path_get_basename(webkit_network_request_get_uri(priv->networkRequest)); + break; + case PROP_LOCAL_URI: + webkit_web_download_set_local_uri(download, g_value_get_string(value)); + break; + case PROP_SUGGESTED_FILENAME: + webkit_web_download_set_suggested_filename(download, g_value_get_string(value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + } +} + +static void webkit_web_download_class_init(WebKitWebDownloadClass* downloadClass) +{ + /* + * implementations of virtual methods + */ + GObjectClass* objectClass = G_OBJECT_CLASS(downloadClass); + objectClass->finalize = webkit_web_download_finalize; + objectClass->get_property = webkit_web_download_get_property; + objectClass->set_property = webkit_web_download_set_property; + + /** + * WebKitWebView::finished: + * @download: the object on which the signal is emitted + * + * The file has been successfully downloaded. + */ + webkit_web_download_signals[FINISHED] = g_signal_new("finished", + G_TYPE_FROM_CLASS(downloadClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, + NULL, + NULL, + webkit_marshal_VOID__VOID, + G_TYPE_NONE, 0, + G_TYPE_NONE); + + /** + * WebKitWebView::started: + * @download: the object on which the signal is emitted + * + * The download has started. Happens just before the first progress-update signal. + */ + webkit_web_download_signals[STARTED] = g_signal_new("started", + G_TYPE_FROM_CLASS(downloadClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, + NULL, + NULL, + webkit_marshal_VOID__VOID, + G_TYPE_NONE, 0, + G_TYPE_NONE); + + /** + * WebKitWebView::progress-update: + * @download: the object on which the signal is emitted + * @current_bytes: the current count of bytes downloaded + * @total_bytes: the total bytes count in the downloaded file, aka file size. + * + * Indicates progress in the download. + */ + webkit_web_download_signals[PROGRESS_UPDATE] = g_signal_new("progress-update", + G_TYPE_FROM_CLASS(downloadClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, + NULL, + NULL, + webkit_marshal_VOID__UINT_UINT, + G_TYPE_NONE, 2, + G_TYPE_UINT, + G_TYPE_UINT); + + /** + * WebKitWebView::progress-update: + * @download: the object on which the signal is emitted + * @current_bytes: the current count of bytes downloaded + * @total_bytes: the total bytes count in the downloaded file, aka file size. + * + * Indicates progress in the download. + */ + webkit_web_download_signals[ERROR] = g_signal_new("error", + G_TYPE_FROM_CLASS(downloadClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, + g_signal_accumulator_true_handled, + NULL, + webkit_marshal_BOOLEAN__INT_INT_STRING, + G_TYPE_BOOLEAN, 3, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_STRING); + + /* + * properties + */ + g_object_class_install_property(objectClass, + PROP_NETWORK_REQUEST, + g_param_spec_object( + "network-request", + "Network Request", + "The network request for the URI that should be downloaded", + WEBKIT_TYPE_NETWORK_REQUEST, + (GParamFlags)(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); + + g_object_class_install_property(objectClass, + PROP_LOCAL_URI, + g_param_spec_string( + "local-uri", + "Local URI", + "The local URI where to save the file", + "", + WEBKIT_PARAM_READWRITE)); + + g_object_class_install_property(objectClass, + PROP_SUGGESTED_FILENAME, + g_param_spec_string( + "suggested-filename", + "Suggested Filename", + "The filename suggested as default when saving", + "", + WEBKIT_PARAM_READWRITE)); + + g_object_class_install_property(objectClass, + PROP_CURRENT_SIZE, + g_param_spec_uint64( + "current-size", + "Current Size", + "The length of the data already downloaded", + 0, G_MAXUINT64, 0, + WEBKIT_PARAM_READABLE)); + + g_object_class_install_property(objectClass, + PROP_CURRENT_SIZE, + g_param_spec_uint64( + "total-size", + "Total Size", + "The total size of the file", + 0, G_MAXUINT64, 0, + WEBKIT_PARAM_READABLE)); + + g_type_class_add_private(downloadClass, sizeof(WebKitWebDownloadPrivate)); +} + +static void webkit_web_download_init(WebKitWebDownload* download) +{ + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + + priv->downloadClient = new DownloadClient(download); + priv->currentSize = 0; + priv->state = WEBKIT_WEB_DOWNLOAD_STATE_CREATED; +} + +WebKitWebDownload* webkit_web_download_new(const gchar* uri) +{ + g_return_val_if_fail(uri, 0); + + WebKitNetworkRequest* request = webkit_network_request_new(uri); + WebKitWebDownload* download = webkit_web_download_new_from_request(request); + g_object_unref(request); + return download; +} + +WebKitWebDownload* webkit_web_download_new_from_request(WebKitNetworkRequest* request) +{ + g_return_val_if_fail(request, 0); + + WebKitWebDownload* download = WEBKIT_WEB_DOWNLOAD(g_object_new(WEBKIT_TYPE_WEB_DOWNLOAD, "network-request", request, NULL)); + return download; +} + +// Private function. +// FIXME Use WebKitNetworkResponse when we have it +WebKitWebDownload* webkit_web_download_new_from_existing_connection(ResourceHandle* handle, WebKitNetworkRequest* request, const ResourceResponse& response) +{ + g_return_val_if_fail(request, 0); + + WebKitWebDownload* download = webkit_web_download_new_from_request (request); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + priv->resourceHandle = handle; + priv->networkResponse = new ResourceResponse(response); + + return download; +} + +static gboolean webkit_web_download_open_channel_with_tmp_file(WebKitWebDownload* download) +{ + gchar* filename; + gint fd = g_file_open_tmp("download-XXXXXX", &filename, 0); + if (fd < 0) + return FALSE; + + gchar* uri = g_filename_to_uri(filename, 0, 0); + g_free(filename); + if (!uri) + return FALSE; + + webkit_web_download_set_local_uri(download, uri); + g_free(uri); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + priv->outputChannel = g_io_channel_unix_new(fd); + if (priv->outputChannel) + g_io_channel_set_close_on_unref(priv->outputChannel, TRUE); + + if (priv->outputChannel) + g_io_channel_set_encoding(priv->outputChannel, 0, 0); + + return priv->outputChannel != 0; +} + +static gboolean webkit_web_download_open_channel_for_uri(WebKitWebDownload* download, const gchar* uri, gboolean append=FALSE) +{ + g_return_val_if_fail(uri, FALSE); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + gchar* filename = g_filename_from_uri(uri, 0, 0); + if (!filename) + return FALSE; + + priv->outputChannel = g_io_channel_new_file(filename, append ? "a" : "w", 0); + g_free(filename); + + if (priv->outputChannel) + g_io_channel_set_encoding(priv->outputChannel, 0, 0); + + return priv->outputChannel != 0; +} + +static void webkit_web_download_close_channel(WebKitWebDownload* download) +{ + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + if (priv->outputChannel) { + g_io_channel_unref(priv->outputChannel); + priv->outputChannel = 0; + } +} + +void webkit_web_download_start(WebKitWebDownload* download) +{ + g_return_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download)); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + g_return_if_fail(priv->state == WEBKIT_WEB_DOWNLOAD_STATE_CREATED); + + if (priv->resourceHandle) + priv->resourceHandle->setClient(priv->downloadClient); + else { + // FIXME use kit(priv->networkRequest) when WebKitNetworkRequest will be finished. + ResourceRequest request(webkit_network_request_get_uri(priv->networkRequest)); + priv->resourceHandle = ResourceHandle::create(request, priv->downloadClient, 0, false, false, false); + } + + if (priv->localUri) + webkit_web_download_open_channel_for_uri(download, priv->localUri); + else + webkit_web_download_open_channel_with_tmp_file(download); + + if (!priv->outputChannel) { + // FIXME Handle errors. + g_warning("Failed to create the output file: %s", priv->localUri); + return; + } +} + +void webkit_web_download_cancel (WebKitWebDownload* download) +{ + g_return_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download)); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + + if (priv->resourceHandle) + priv->resourceHandle->cancel(); + + priv->state = WEBKIT_WEB_DOWNLOAD_STATE_CANCELLED; + + gboolean handled; + g_signal_emit_by_name(download, "error", 0, WEBKIT_WEB_DOWNLOAD_ERROR_CANCELLED_BY_USER, "User cancelled the download", &handled); +} + +const gchar* webkit_web_download_get_uri(WebKitWebDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download), NULL); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + return webkit_network_request_get_uri(priv->networkRequest); +} + +WebKitNetworkRequest* webkit_web_download_get_network_request(WebKitWebDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download), NULL); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + return priv->networkRequest; +} + +static void webkit_web_download_set_response(WebKitWebDownload* download, const ResourceResponse& response) +{ + // FIXME Use WebKitNetworkResponse when it's merged + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + priv->networkResponse = new ResourceResponse(response); +} + +const gchar* webkit_web_download_get_suggested_filename(WebKitWebDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download), NULL); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + return priv->suggestedFilename; +} + +void webkit_web_download_set_suggested_filename(WebKitWebDownload* download, const gchar* filename) +{ + g_return_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download)); + g_return_if_fail(filename); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + if (priv->suggestedFilename && !strcmp(priv->suggestedFilename, filename)) + return; + + g_free(priv->suggestedFilename); + priv->suggestedFilename = g_strdup(filename); + g_object_notify(G_OBJECT(download), "suggested-filename"); +} + +const gchar* webkit_web_download_get_local_uri(WebKitWebDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download), NULL); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + return priv->localUri; +} + +void webkit_web_download_set_local_uri(WebKitWebDownload* download, const gchar* localUri) +{ + g_return_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download)); + g_return_if_fail(localUri); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + if (priv->localUri && !strcmp(priv->localUri, localUri)) + return; + + // FIXME can we have a better check? + if (priv->state != WEBKIT_WEB_DOWNLOAD_STATE_CREATED && priv->state != WEBKIT_WEB_DOWNLOAD_STATE_CANCELLED) { + ASSERT(priv->localUri); + + gboolean downloading = priv->outputChannel != 0; + if (downloading) + webkit_web_download_close_channel(download); + + gchar* srcFilename = g_filename_from_uri(priv->localUri, 0, 0); + gchar* destFilename = g_filename_from_uri(localUri, 0, 0); + if (!srcFilename || !destFilename) + return; + if (g_rename(srcFilename, destFilename) < 0) { + g_warning("Impossible to move the download from %s to %s", srcFilename, destFilename); + g_free(srcFilename); + g_free(destFilename); + return; + } + + g_free(srcFilename); + g_free(destFilename); + + if (downloading) { + if (!webkit_web_download_open_channel_for_uri(download, localUri, TRUE)) { + webkit_web_download_cancel(download); + return; + } + } + } + + g_free(priv->localUri); + priv->localUri = g_strdup(localUri); + g_object_notify(G_OBJECT(download), "local-uri"); +} + +WebKitWebDownloadState webkit_web_download_get_state (WebKitWebDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download), WEBKIT_WEB_DOWNLOAD_STATE_ERROR); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + return priv->state; +} + +// FIXME document that this can be different from expectedContentLength(). +guint64 webkit_web_download_get_total_size (WebKitWebDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download), 0); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + if (!priv->networkResponse) + return 0; + + return MAX(priv->currentSize, priv->networkResponse->expectedContentLength()); +} + +guint64 webkit_web_download_get_current_size (WebKitWebDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_DOWNLOAD(download), 0); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + return priv->currentSize; +} + +static void webkit_web_download_received_data(WebKitWebDownload* download, const gchar* data, int length) +{ + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + + if (priv->currentSize == 0) { + priv->state = WEBKIT_WEB_DOWNLOAD_STATE_STARTED; + g_signal_emit_by_name(download, "started"); + } + + ASSERT(priv->outputChannel); + /* FIXME Make this async? Note that it's not possible with GIOChannel unless you buffer + * the data in memory. */ + if (g_io_channel_write_chars(priv->outputChannel, data, length, NULL, NULL) != G_IO_STATUS_NORMAL) { + // FIXME check errors + g_assert_not_reached(); + } + + priv->currentSize += length; + g_object_notify(G_OBJECT(download), "current-size"); + + ASSERT(priv->networkResponse); + if (priv->currentSize > priv->networkResponse->expectedContentLength()) + g_object_notify(G_OBJECT(download), "total-size"); + + /* FIXME throttle the number of updates? + * should we remove the previous g_object_notify()s if we are going to throttle + * the progress updates? */ + g_signal_emit_by_name(download, "progress-update", (guint)priv->currentSize, (guint)webkit_web_download_get_total_size(download)); +} + +static void webkit_web_download_finished_loading(WebKitWebDownload* download) +{ + webkit_web_download_close_channel(download); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + priv->state = WEBKIT_WEB_DOWNLOAD_STATE_FINISHED; + g_signal_emit_by_name(download, "finished"); +} + +static void webkit_web_download_error(WebKitWebDownload* download, const ResourceError& error) +{ + webkit_web_download_close_channel(download); + + WebKitWebDownloadPrivate* priv = WEBKIT_WEB_DOWNLOAD_GET_PRIVATE(download); + priv->state = WEBKIT_WEB_DOWNLOAD_STATE_ERROR; + + gboolean handled; + g_signal_emit_by_name(download, "error", 0, WEBKIT_WEB_DOWNLOAD_ERROR_NETWORK, error.localizedDescription().utf8().data(), &handled); +} + +DownloadClient::DownloadClient(WebKitWebDownload* download) + : m_download(download) +{ +} + +void DownloadClient::didReceiveResponse(ResourceHandle*, const ResourceResponse& response) +{ + webkit_web_download_set_response(m_download, response); +} + +void DownloadClient::didReceiveData(ResourceHandle*, const char* data, int length, int lengthReceived) +{ + webkit_web_download_received_data(m_download, data, length); +} + +void DownloadClient::didFinishLoading(ResourceHandle*) +{ + webkit_web_download_finished_loading(m_download); +} + +void DownloadClient::didFail(ResourceHandle*, const ResourceError& error) +{ + webkit_web_download_error(m_download, error); +} + +void DownloadClient::wasBlocked(ResourceHandle*) +{ + // FIXME when we have the new frame loader signals and error handling. + notImplemented(); +} + +void DownloadClient::cannotShowURL(ResourceHandle*) +{ + // FIXME when we have the new frame loader signals and error handling. + notImplemented(); +} + +} diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebdownload.h WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebdownload.h --- WebKit-r41128/WebKit/gtk/webkit/webkitwebdownload.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebdownload.h 2009-02-23 16:01:27.000000000 -0500 @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2008 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WEBKIT_WEB_DOWNLOAD_H +#define WEBKIT_WEB_DOWNLOAD_H + +#include + +#include + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_WEB_DOWNLOAD (webkit_web_download_get_type()) +#define WEBKIT_WEB_DOWNLOAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_DOWNLOAD, WebKitWebDownload)) +#define WEBKIT_WEB_DOWNLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_DOWNLOAD, WebKitWebDownloadClass)) +#define WEBKIT_IS_WEB_DOWNLOAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_DOWNLOAD)) +#define WEBKIT_IS_WEB_DOWNLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_DOWNLOAD)) +#define WEBKIT_WEB_DOWNLOAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_DOWNLOAD, WebKitWebDownloadClass)) + +typedef enum { + WEBKIT_WEB_DOWNLOAD_STATE_ERROR = -1, + WEBKIT_WEB_DOWNLOAD_STATE_CREATED = 0, + WEBKIT_WEB_DOWNLOAD_STATE_STARTED, + WEBKIT_WEB_DOWNLOAD_STATE_CANCELLED, + WEBKIT_WEB_DOWNLOAD_STATE_FINISHED +} WebKitWebDownloadState; + +typedef enum { + WEBKIT_WEB_DOWNLOAD_ERROR_CANCELLED_BY_USER, + WEBKIT_WEB_DOWNLOAD_ERROR_NETWORK +} WebKitWebDownloadError; + +struct _WebKitWebDownload { + GObject parent; +}; + +struct _WebKitWebDownloadClass { + GObjectClass parent; +}; + +WEBKIT_API GType +webkit_web_download_get_type (void); + +WEBKIT_API WebKitWebDownload * +webkit_web_download_new (const gchar *uri); + +WEBKIT_API WebKitWebDownload * +webkit_web_download_new_from_request (WebKitNetworkRequest *request); + +WEBKIT_API void +webkit_web_download_start (WebKitWebDownload *download); + +WEBKIT_API void +webkit_web_download_cancel (WebKitWebDownload *download); + +WEBKIT_API const gchar* +webkit_web_download_get_uri (WebKitWebDownload *download); + +WEBKIT_API WebKitNetworkRequest* +webkit_web_download_get_network_request (WebKitWebDownload *download); + +WEBKIT_API const gchar* +webkit_web_download_get_suggested_filename (WebKitWebDownload *download); + +WEBKIT_API void +webkit_web_download_set_suggested_filename (WebKitWebDownload *download, + const gchar *filename); + +WEBKIT_API const gchar* +webkit_web_download_get_local_uri (WebKitWebDownload *download); + +WEBKIT_API void +webkit_web_download_set_local_uri (WebKitWebDownload *download, + const gchar *local_uri); + +WEBKIT_API guint64 +webkit_web_download_get_total_size (WebKitWebDownload *download); + +WEBKIT_API guint64 +webkit_web_download_get_current_size (WebKitWebDownload *download); + +WEBKIT_API WebKitWebDownloadState +webkit_web_download_get_state (WebKitWebDownload *download); + +G_END_DECLS + +#endif diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebframe.cpp WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebframe.cpp --- WebKit-r41128/WebKit/gtk/webkit/webkitwebframe.cpp 2009-02-19 01:12:25.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebframe.cpp 2009-07-19 15:02:35.647048027 -0400 @@ -1,5 +1,6 @@ /* * Copyright (C) 2007, 2008 Holger Hans Peter Freyther + * Copyright (C) 2008 Luke Kenneth Casson Leighton * Copyright (C) 2007 Alp Toker * Copyright (C) 2007 Apple Inc. * Copyright (C) 2008 Christian Dywan @@ -31,19 +32,29 @@ #include "AnimationController.h" #include "CString.h" -#include "FrameLoader.h" #include "FrameLoaderClientGtk.h" +#include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "HTMLDocument.h" #include "HTMLFrameOwnerElement.h" +#include "JSDOMBinding.h" #include "JSDOMWindow.h" #include "PrintContext.h" -#include "RenderView.h" #include "RenderTreeAsText.h" +#include "RenderView.h" #include "JSDOMBinding.h" #include "ScriptController.h" #include "SubstituteData.h" +#include "TextDocument.h" +#include "webkitbinding.h" +#include "WebKitDocument.h" +#include "WebKitDocumentPrivate.h" +#include "WebKitDOMWindow.h" +#include "WebKitDOMWindowPrivate.h" +#include "WebKitXMLHttpRequest.h" +#include "WebKitXMLHttpRequestPrivate.h" #include @@ -112,15 +123,6 @@ } } -// Called from the FrameLoaderClient when it is destroyed. Normally -// the unref in the FrameLoaderClient is destroying this object as -// well but due reference counting a user might have added a reference... -void webkit_web_frame_core_frame_gone(WebKitWebFrame* frame) -{ - ASSERT(WEBKIT_IS_WEB_FRAME(frame)); - frame->priv->coreFrame = 0; -} - static void webkit_web_frame_finalize(GObject* object) { WebKitWebFrame* frame = WEBKIT_WEB_FRAME(object); @@ -131,6 +133,7 @@ priv->coreFrame = 0; } + g_free(priv->name); g_free(priv->title); g_free(priv->uri); @@ -138,6 +141,15 @@ G_OBJECT_CLASS(webkit_web_frame_parent_class)->finalize(object); } +// Called from the FrameLoaderClient when it is destroyed. Normally +// the unref in the FrameLoaderClient is destroying this object as +// well but due reference counting a user might have added a reference... +void webkit_web_frame_core_frame_gone(WebKitWebFrame* frame) +{ + ASSERT(WEBKIT_IS_WEB_FRAME(frame)); + frame->priv->coreFrame = 0; +} + static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) { webkit_init(); @@ -329,6 +341,63 @@ } /** + * webkit_web_frame_get_xml_http_request: + * @frame: a #WebKitWebFrame + * + * returns a GObject wrapper around an XMLHttpRequest + * + * Return value: a WebKitXMLHttpRequest + * + * Since: 1.1.2 + */ +WebKitXMLHttpRequest* webkit_web_frame_get_xml_http_request(WebKitWebFrame* frame) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + + Frame* coreFrame = core(frame); + ASSERT(coreFrame); + return WEBKIT_XML_HTTP_REQUEST(WebKit::toGDOM(XMLHttpRequest::create(coreFrame->document()).get())); +} + +/** + * webkit_web_frame_get_dom_window: + * @frame: a #WebKitWebFrame + * + * returns a GObject wrapper around a DOMWindow + * + * Return value: a WebKitDOMWindow + * + * Since: 1.1.2 + */ +WebKitDOMWindow* webkit_web_frame_get_dom_window(WebKitWebFrame* frame) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + + Frame* coreFrame = core(frame); + ASSERT(coreFrame); + return WEBKIT_DOM_WINDOW(WebKit::toGDOM(coreFrame->domWindow())); +} + +/** + * webkit_web_frame_get_dom_document: + * @frame: a #WebKitWebFrame + * + * returns a GObject wrapper around a Document + * + * Return value: a WebKitDocument + * + * Since: 1.1.2 + */ +WebKitDocument* webkit_web_frame_get_dom_document(WebKitWebFrame* frame) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); + + Frame* coreFrame = core(frame); + ASSERT(coreFrame); + return WEBKIT_DOCUMENT(WebKit::toGDOM(coreFrame->document())); +} + +/** * webkit_web_frame_get_name: * @frame: a #WebKitWebFrame * @@ -349,6 +418,7 @@ if (!coreFrame) return ""; + String string = coreFrame->tree()->name(); priv->name = g_strdup(string.utf8().data()); return priv->name; diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebframe.h WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebframe.h --- WebKit-r41128/WebKit/gtk/webkit/webkitwebframe.h 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebframe.h 2009-07-19 14:52:51.259493337 -0400 @@ -1,6 +1,7 @@ /* * Copyright (C) 2007 Holger Hans Peter Freyther * Copyright (C) 2007 Alp Toker + * Copyright (C) 2008 Luke Kenneth Casson Leighton * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,6 +27,9 @@ #include #include +#include +#include +#include G_BEGIN_DECLS @@ -65,6 +69,15 @@ webkit_web_frame_new (WebKitWebView *web_view); #endif +WEBKIT_API WebKitXMLHttpRequest * +webkit_web_frame_get_xml_http_request (WebKitWebFrame *frame); + +WEBKIT_API WebKitDOMWindow * +webkit_web_frame_get_dom_window (WebKitWebFrame *frame); + +WEBKIT_API WebKitDocument * +webkit_web_frame_get_dom_document (WebKitWebFrame *frame); + WEBKIT_API WebKitWebView * webkit_web_frame_get_web_view (WebKitWebFrame *frame); diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebscriptelement.cpp WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebscriptelement.cpp --- WebKit-r41128/WebKit/gtk/webkit/webkitwebscriptelement.cpp 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebscriptelement.cpp 2009-06-23 19:32:02.144576292 -0400 @@ -0,0 +1,29 @@ +#include "config.h" +#include "StringHash.h" +#include +#include "webkitwebscriptelement.h" +#include "webkitwebscriptevaluator.h" +#include "ScriptSourceCode.h" +#include "ScriptEvaluator.h" +#include "ScriptElement.h" +#include "CString.h" + +EvaluatorAdapter::EvaluatorAdapter(WebKitWebScriptEvaluator *evaluator) + : evaluator(evaluator) +{ + +} + +bool EvaluatorAdapter::matchesMimeType(const WebCore::String &mimeType) { + return evaluator->matchesMimeType(mimeType.utf8().data()); + +} + +void EvaluatorAdapter::evaluate(const WebCore::String &mimeType, const WebCore::ScriptSourceCode& sourceCode, void *context) +{ + evaluator->evaluate(mimeType.utf8().data(), sourceCode.jsSourceCode().toString().ascii(), context); +} + +WEBKIT_API void addScriptEvaluator(WebKitWebScriptEvaluator *evaluator) { + WebCore::ScriptElement::addScriptEvaluator(new EvaluatorAdapter(evaluator)); +} diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebscriptelement.h WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebscriptelement.h --- WebKit-r41128/WebKit/gtk/webkit/webkitwebscriptelement.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebscriptelement.h 2009-06-24 14:58:09.004478002 -0400 @@ -0,0 +1,28 @@ +#ifndef WebScriptElement_h +#define WebScriptElement_h + +#include +#include "ScriptEvaluator.h" + +namespace WebCore { + class String; + class ScriptSourceCode; +} + +class WebKitWebScriptEvaluator; + +class EvaluatorAdapter : public WebCore::ScriptEvaluator { +public: + EvaluatorAdapter(WebKitWebScriptEvaluator *evaluator); + + virtual bool matchesMimeType(const WebCore::String &mimeType); + + virtual void evaluate(const WebCore::String &mimeType, const WebCore::ScriptSourceCode& sourceCode, void *context); + +protected: + WebKitWebScriptEvaluator *evaluator; +}; + +WEBKIT_API void addScriptEvaluator(WebKitWebScriptEvaluator *evaluator); + +#endif diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebscriptevaluator.h WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebscriptevaluator.h --- WebKit-r41128/WebKit/gtk/webkit/webkitwebscriptevaluator.h 1969-12-31 19:00:00.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebscriptevaluator.h 2009-06-23 19:32:02.148481657 -0400 @@ -0,0 +1,11 @@ +#ifndef WebScriptEvaluator_h +#define WebScriptEvaluator_h + +class WebKitWebScriptEvaluator +{ +public: + virtual bool matchesMimeType(const gchar * mimeType) = 0; + virtual void evaluate(const gchar *mimeType, const gchar *sourceCode, void*) = 0; +}; + +#endif diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebsettings.cpp WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebsettings.cpp --- WebKit-r41128/WebKit/gtk/webkit/webkitwebsettings.cpp 2009-01-21 00:14:25.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebsettings.cpp 2009-05-25 19:32:20.393498956 -0400 @@ -21,6 +21,7 @@ */ #include "config.h" +#include "CString.h" #include "webkitwebsettings.h" #include "webkitprivate.h" @@ -46,6 +47,7 @@ * */ +using namespace WebKit; using namespace WebCore; extern "C" { @@ -72,8 +74,11 @@ gboolean enable_plugins; gboolean resizable_text_areas; gchar* user_stylesheet_uri; + gchar* user_agent; gfloat zoom_step; gboolean enable_developer_extras; + gboolean enable_html5_database; + gboolean enable_html5_local_storage; }; #define WEBKIT_WEB_SETTINGS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SETTINGS, WebKitWebSettingsPrivate)) @@ -100,8 +105,11 @@ PROP_ENABLE_PLUGINS, PROP_RESIZABLE_TEXT_AREAS, PROP_USER_STYLESHEET_URI, + PROP_USER_AGENT, PROP_ZOOM_STEP, - PROP_ENABLE_DEVELOPER_EXTRAS + PROP_ENABLE_DEVELOPER_EXTRAS, + PROP_ENABLE_HTML5_DATABASE, + PROP_ENABLE_HTML5_LOCAL_STORAGE }; static void webkit_web_settings_finalize(GObject* object); @@ -335,6 +343,48 @@ FALSE, flags)); + /** + * WebKitWebSettings:enable-html5-database: + * + * Whether to enable HTML5 client-side SQL database support. Client-side + * SQL database allows web pages to store structured data and be able to + * use SQL to manipulate that data asynchronously. + * + * Since 1.1.7 + */ + g_object_class_install_property(gobject_class, + PROP_ENABLE_HTML5_DATABASE, + g_param_spec_boolean("enable-html5-database", + "Enable HTML5 Database", + "Whether to enable HTML5 database support", + TRUE, + flags)); + + /** + * WebKitWebSettings:enable-html5-local-storage: + * + * Whether to enable HTML5 localStorage support. localStorage provides + * simple synchronous storage access. + * + * Since 1.1.7 + */ + g_object_class_install_property(gobject_class, + PROP_ENABLE_HTML5_LOCAL_STORAGE, + g_param_spec_boolean("enable-html5-local-storage", + "Enable HTML5 Local Storage", + "Whether to enable HTML5 Local Storage support", + TRUE, + flags)); + + g_object_class_install_property(gobject_class, + PROP_USER_AGENT, + g_param_spec_string( + "user-agent", + "User Agent", + "The default User Agent used by the Browser.", + composeUserAgent().utf8().data(), + flags)); + g_type_class_add_private(klass, sizeof(WebKitWebSettingsPrivate)); } @@ -356,6 +406,7 @@ g_free(priv->sans_serif_font_family); g_free(priv->serif_font_family); g_free(priv->user_stylesheet_uri); + g_free(priv->user_agent); G_OBJECT_CLASS(webkit_web_settings_parent_class)->finalize(object); } @@ -431,12 +482,25 @@ g_free(priv->user_stylesheet_uri); priv->user_stylesheet_uri = g_strdup(g_value_get_string(value)); break; + case PROP_USER_AGENT: + g_free(priv->user_agent); + if (g_value_get_string(value) == NULL || strlen(g_value_get_string(value)) == 0) + priv->user_agent = g_strdup(composeUserAgent().utf8().data()); + else + priv->user_agent = g_strdup(g_value_get_string(value)); + break; case PROP_ZOOM_STEP: priv->zoom_step = g_value_get_float(value); break; case PROP_ENABLE_DEVELOPER_EXTRAS: priv->enable_developer_extras = g_value_get_boolean(value); break; + case PROP_ENABLE_HTML5_DATABASE: + priv->enable_html5_database = g_value_get_boolean(value); + break; + case PROP_ENABLE_HTML5_LOCAL_STORAGE: + priv->enable_html5_local_storage = g_value_get_boolean(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -506,12 +570,21 @@ case PROP_USER_STYLESHEET_URI: g_value_set_string(value, priv->user_stylesheet_uri); break; + case PROP_USER_AGENT: + g_value_set_string(value, priv->user_agent); + break; case PROP_ZOOM_STEP: g_value_set_float(value, priv->zoom_step); break; case PROP_ENABLE_DEVELOPER_EXTRAS: g_value_set_boolean(value, priv->enable_developer_extras); break; + case PROP_ENABLE_HTML5_DATABASE: + g_value_set_boolean(value, priv->enable_html5_database); + break; + case PROP_ENABLE_HTML5_LOCAL_STORAGE: + g_value_set_boolean(value, priv->enable_html5_local_storage); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -561,11 +634,14 @@ "enable-plugins", priv->enable_plugins, "resizable-text-areas", priv->resizable_text_areas, "user-stylesheet-uri", priv->user_stylesheet_uri, + "user-agent", priv->user_agent, "zoom-step", priv->zoom_step, "enable-developer-extras", priv->enable_developer_extras, + "enable-html5-database", priv->enable_html5_database, + "enable-html5-local-storage", priv->enable_html5_local_storage, NULL)); - return copy; + return copy; } /** diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebsettings.h WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebsettings.h --- WebKit-r41128/WebKit/gtk/webkit/webkitwebsettings.h 2009-01-21 00:14:25.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebsettings.h 2009-04-22 19:52:40.197008210 -0400 @@ -37,7 +37,7 @@ struct _WebKitWebSettings { GObject parent_instance; - + /*< private >*/ WebKitWebSettingsPrivate *priv; }; diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebview.cpp WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebview.cpp --- WebKit-r41128/WebKit/gtk/webkit/webkitwebview.cpp 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebview.cpp 2009-07-26 07:35:18.495071226 -0400 @@ -25,6 +25,7 @@ #include "config.h" +#include "webkitwebdownload.h" #include "webkitwebview.h" #include "webkitenumtypes.h" #include "webkitmarshal.h" @@ -49,14 +50,17 @@ #include "EventHandler.h" #include "FloatQuad.h" #include "FocusController.h" +#include "FloatQuad.h" #include "FrameLoaderTypes.h" #include "HitTestRequest.h" #include "HitTestResult.h" +#include "HTMLNames.h" #include "GraphicsContext.h" #include "InspectorClientGtk.h" #include "FrameLoader.h" #include "FrameView.h" #include "Editor.h" +#include "Text.h" #include "PasteboardHelper.h" #include "PlatformKeyboardEvent.h" #include "PlatformWheelEvent.h" @@ -65,6 +69,7 @@ #include #include +#include "FrameLoaderClientGtk.h" /** * SECTION:webkitwebview @@ -103,14 +108,19 @@ using namespace WebKit; using namespace WebCore; +using namespace HTMLNames; extern "C" { enum { /* normal signals */ NAVIGATION_REQUESTED, + NEW_WINDOW_NAVIGATION_REQUESTED, NAVIGATION_POLICY_DECISION_REQUESTED, MIME_TYPE_POLICY_DECISION_REQUESTED, +#ifdef MAEMO_CHANGES + RESOURCE_POLICY_DECISION_REQUESTED, +#endif CREATE_WEB_VIEW, WEB_VIEW_READY, WINDOW_OBJECT_CLEARED, @@ -132,6 +142,7 @@ COPY_CLIPBOARD, PASTE_CLIPBOARD, CUT_CLIPBOARD, + DOWNLOAD_CREATED, LAST_SIGNAL }; @@ -185,7 +196,16 @@ if (!menu) return FALSE; - g_signal_emit(webView, webkit_web_view_signals[POPULATE_POPUP], 0, menu); + gboolean isHandled = FALSE; + HitTestResult result = coreMenu->hitTestResult(); + KURL linkURL = result.absoluteLinkURL(); + KURL imageURL = result.absoluteImageURL(); + String text = result.textContent(); + + g_signal_emit(webView, webkit_web_view_signals[POPULATE_POPUP], 0, menu, linkURL.string().utf8().data(), text.utf8().data(), imageURL.string().utf8().data(), &isHandled); + + if (isHandled) + return TRUE; GList* items = gtk_container_get_children(GTK_CONTAINER(menu)); bool empty = !g_list_nth(items, 0); @@ -234,14 +254,14 @@ start.getInlineBoxAndOffset(DOWNSTREAM, startInlineBox, startCaretOffset); IntRect startCaretRect = renderer->localCaretRect(startInlineBox, startCaretOffset, &extraWidthToEndOfLine); if (startCaretRect != IntRect()) - startCaretRect = renderer->localToAbsoluteQuad(FloatRect(startCaretRect)).enclosingBoundingBox(); + startCaretRect = renderer->localToAbsoluteQuad(FloatQuad(startCaretRect)).enclosingBoundingBox(); InlineBox* endInlineBox; int endCaretOffset; end.getInlineBoxAndOffset(UPSTREAM, endInlineBox, endCaretOffset); IntRect endCaretRect = renderer->localCaretRect(endInlineBox, endCaretOffset); if (endCaretRect != IntRect()) - endCaretRect = renderer->localToAbsoluteQuad(FloatRect(endCaretRect)).enclosingBoundingBox(); + endCaretRect = renderer->localToAbsoluteQuad(FloatQuad(endCaretRect)).enclosingBoundingBox(); IntRect firstRect; if (startCaretRect.y() == endCaretRect.y()) @@ -400,6 +420,25 @@ return FALSE; } +static void webkit_web_view_update_im_context(Frame* frame, WebKitWebViewPrivate* priv) { + SelectionController* selection = frame->selection(); + if (selection) { + Element* element = selection->rootEditableElement(); + int mode; + g_object_get(G_OBJECT(priv->imContext), "hildon-input-mode", &mode, NULL); + Node* node = element->shadowAncestorNode(); + if (node != NULL && node->hasTagName(inputTag)) + mode &= ~HILDON_GTK_INPUT_MODE_MULTILINE; + else + mode |= HILDON_GTK_INPUT_MODE_MULTILINE; + if (frame->document()->useSecureKeyboardEntryWhenActive()) + mode |= HILDON_GTK_INPUT_MODE_INVISIBLE; + else + mode &= ~HILDON_GTK_INPUT_MODE_INVISIBLE; + g_object_set(G_OBJECT(priv->imContext), "hildon-input-mode", mode, NULL); + } +} + static gboolean webkit_web_view_key_press_event(GtkWidget* widget, GdkEventKey* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); @@ -410,6 +449,15 @@ if (!frame->view()) return FALSE; +#ifdef MAEMO_CHANGES + if (frame && frame->editor()->canEdit()) { + WebKitWebViewPrivate* priv = webView->priv; + gtk_im_context_focus_in(priv->imContext); + if (gtk_im_context_filter_keypress(priv->imContext, event)) + return TRUE; + } +#endif + if (frame->eventHandler()->keyEvent(keyboardEvent)) return TRUE; @@ -455,6 +503,16 @@ if (!frame->view()) return FALSE; +#ifdef MAEMO_CHANGES + if (frame && frame->editor()->canEdit()) { + WebKitWebViewPrivate* priv = webView->priv; + webkit_web_view_update_im_context(frame, priv); + gtk_im_context_focus_in(priv->imContext); + if (gtk_im_context_filter_keypress(priv->imContext, event)) + return TRUE; + } +#endif + PlatformKeyboardEvent keyboardEvent(event); if (frame->eventHandler()->keyEvent(keyboardEvent)) @@ -487,12 +545,13 @@ Frame* focusedFrame = core(webView)->focusController()->focusedFrame(); - if (focusedFrame && focusedFrame->editor()->canEdit()) { #ifdef MAEMO_CHANGES + if (focusedFrame && focusedFrame->editor()->canEdit()) { WebKitWebViewPrivate* priv = webView->priv; + webkit_web_view_update_im_context(focusedFrame, priv); hildon_gtk_im_context_filter_event(priv->imContext, (GdkEvent*)event); -#endif } +#endif Frame* mainFrame = core(webView)->mainFrame(); if (!mainFrame->view()) @@ -675,6 +734,12 @@ return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; } +static WebKitNavigationResponse webkit_web_view_real_new_window_navigation_requested(WebKitWebView*, WebKitWebFrame* frame, WebKitNetworkRequest*, gchar*) +{ + notImplemented(); + return WEBKIT_NAVIGATION_RESPONSE_ACCEPT; +} + static void webkit_web_view_real_window_object_cleared(WebKitWebView*, WebKitWebFrame*, JSGlobalContextRef context, JSObjectRef window_object) { notImplemented(); @@ -810,6 +875,13 @@ frame->editor()->command("Paste").execute(); } +static gboolean webkit_web_view_real_download_created(WebKitWebView* web_view, WebKitWebDownload* download) +{ + webkit_web_download_cancel(download); + // Return false to indicate it wasn't handled therefore the download is deleted + return FALSE; +} + static void webkit_web_view_dispose(GObject* object) { WebKitWebView* webView = WEBKIT_WEB_VIEW(object); @@ -883,6 +955,17 @@ return TRUE; } +static gboolean webkit_new_window_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy) +{ + int signalHandled = g_value_get_int(handlerReturn); + g_value_set_int(returnAccu, signalHandled); + + if (signalHandled != WEBKIT_NAVIGATION_RESPONSE_ACCEPT) + return FALSE; + + return TRUE; +} + static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); @@ -973,6 +1056,18 @@ webkit_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); + webkit_web_view_signals[NEW_WINDOW_NAVIGATION_REQUESTED] = g_signal_new("new-window-navigation-requested", + G_TYPE_FROM_CLASS(webViewClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + G_STRUCT_OFFSET (WebKitWebViewClass, new_window_navigation_requested), + webkit_navigation_request_handled, + NULL, + webkit_marshal_INT__OBJECT_OBJECT_STRING, + G_TYPE_INT, 3, + G_TYPE_OBJECT, + G_TYPE_OBJECT, + G_TYPE_STRING); + /** * WebKitWebView::navigation-requested: * @web_view: the object on which the signal is emitted @@ -1056,6 +1151,19 @@ G_TYPE_STRING, WEBKIT_TYPE_WEB_POLICY_DECISION); +#ifdef MAEMO_CHANGES + webkit_web_view_signals[RESOURCE_POLICY_DECISION_REQUESTED] = g_signal_new("resource-policy-decision-requested", + G_TYPE_FROM_CLASS(webViewClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + 0, + g_signal_accumulator_true_handled, + NULL, + webkit_marshal_BOOLEAN__OBJECT_OBJECT_STRING, + G_TYPE_BOOLEAN, 3, + WEBKIT_TYPE_WEB_FRAME, + G_TYPE_STRING); +#endif + /** * WebKitWebView::window-object-cleared: * @web_view: the object on which the signal is emitted @@ -1083,6 +1191,24 @@ G_TYPE_POINTER, G_TYPE_POINTER); + /** + * WebKitWebView::download-created: + * @web_view: the object on which the signal is emitted + * @download: the message text + * @return: TRUE if the download was handled, otherwise it'll be cancelled. + * + * A new Download has been created + */ + webkit_web_view_signals[DOWNLOAD_CREATED] = g_signal_new("download-created", + G_TYPE_FROM_CLASS(webViewClass), + (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), + G_STRUCT_OFFSET(WebKitWebViewClass, download_created), + g_signal_accumulator_true_handled, + NULL, + webkit_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, 1, + G_TYPE_OBJECT); + /** * WebKitWebView::load-started: * @web_view: the object on which the signal is emitted @@ -1194,11 +1320,14 @@ G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, + g_signal_accumulator_true_handled, NULL, - NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - GTK_TYPE_MENU); + webkit_marshal_BOOLEAN__OBJECT_STRING_STRING_STRING, + G_TYPE_BOOLEAN, 4, + GTK_TYPE_MENU, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING); webkit_web_view_signals[STATUS_BAR_TEXT_CHANGED] = g_signal_new("status-bar-text-changed", G_TYPE_FROM_CLASS(webViewClass), @@ -1382,6 +1511,7 @@ webViewClass->create_web_view = webkit_web_view_real_create_web_view; webViewClass->web_view_ready = webkit_web_view_real_web_view_ready; webViewClass->navigation_requested = webkit_web_view_real_navigation_requested; + webViewClass->new_window_navigation_requested = webkit_web_view_real_new_window_navigation_requested; webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared; webViewClass->choose_file = webkit_web_view_real_choose_file; webViewClass->script_alert = webkit_web_view_real_script_alert; @@ -1392,6 +1522,7 @@ webViewClass->cut_clipboard = webkit_web_view_real_cut_clipboard; webViewClass->copy_clipboard = webkit_web_view_real_copy_clipboard; webViewClass->paste_clipboard = webkit_web_view_real_paste_clipboard; + webViewClass->download_created = webkit_web_view_real_download_created; GObjectClass* objectClass = G_OBJECT_CLASS(webViewClass); objectClass->dispose = webkit_web_view_dispose; @@ -1623,8 +1754,9 @@ WebKitWebSettings* webSettings = priv->webSettings; Settings* settings = core(webView)->settings(); - gchar* defaultEncoding, *cursiveFontFamily, *defaultFontFamily, *fantasyFontFamily, *monospaceFontFamily, *sansSerifFontFamily, *serifFontFamily, *userStylesheetUri; - gboolean autoLoadImages, autoShrinkImages, printBackgrounds, enableScripts, enablePlugins, enableDeveloperExtras, resizableTextAreas; + gchar* defaultEncoding, *cursiveFontFamily, *defaultFontFamily, *fantasyFontFamily, *monospaceFontFamily, *sansSerifFontFamily, *serifFontFamily, *userStylesheetUri, *userAgent; + gboolean autoLoadImages, autoShrinkImages, printBackgrounds, enableScripts, enablePlugins, enableDeveloperExtras, resizableTextAreas, + enableHTML5Database, enableHTML5LocalStorage; g_object_get(webSettings, "default-encoding", &defaultEncoding, @@ -1641,7 +1773,10 @@ "enable-plugins", &enablePlugins, "resizable-text-areas", &resizableTextAreas, "user-stylesheet-uri", &userStylesheetUri, + "user-agent", &userAgent, "enable-developer-extras", &enableDeveloperExtras, + "enable-html5-database", &enableHTML5Database, + "enable-html5-local-storage", &enableHTML5LocalStorage, NULL); settings->setDefaultTextEncodingName(defaultEncoding); @@ -1658,7 +1793,10 @@ settings->setPluginsEnabled(enablePlugins); settings->setTextAreasAreResizable(resizableTextAreas); settings->setUserStyleSheetLocation(KURL(KURL(), userStylesheetUri)); + settings->setUserAgent(userAgent); settings->setDeveloperExtrasEnabled(enableDeveloperExtras); + settings->setDatabasesEnabled(enableHTML5Database); + settings->setLocalStorageEnabled(enableHTML5LocalStorage); g_free(defaultEncoding); g_free(cursiveFontFamily); @@ -1668,6 +1806,7 @@ g_free(sansSerifFontFamily); g_free(serifFontFamily); g_free(userStylesheetUri); + g_free(userAgent); webkit_web_view_screen_changed(webView, NULL, NULL); } @@ -1725,8 +1864,14 @@ settings->setTextAreasAreResizable(g_value_get_boolean(&value)); else if (name == g_intern_string("user-stylesheet-uri")) settings->setUserStyleSheetLocation(KURL(KURL(), g_value_get_string(&value))); - else if (name == g_intern_string("enable-developer-extras")) + else if (name == g_intern_string("user-agent")) + settings->setUserAgent(g_value_get_string(&value)); + else if (name == g_intern_string("enable-developer-extras")) settings->setDeveloperExtrasEnabled(g_value_get_boolean(&value)); + else if (name == g_intern_string("enable-html5-database")) + settings->setDatabasesEnabled(g_value_get_boolean(&value)); + else if (name == g_intern_string("enable-html5-local-storage")) + settings->setLocalStorageEnabled(g_value_get_boolean(&value)); else if (!g_object_class_find_property(G_OBJECT_GET_CLASS(webSettings), name)) g_warning("Unexpected setting '%s'", name); g_value_unset(&value); @@ -1870,6 +2015,26 @@ } /** + * webkit_web_view_inspect: + * @web_view: a #WebKitWebView + * + * Activates the #WebKitWebInspector associated with the + * #WebKitWebView. The inspector is started with the document + * node of the currently focused frame, or the main frame of + * the #WebKitWebView. + * + * Since: 1.0.3 + */ +void webkit_web_view_inspect(WebKitWebView* webView) +{ + g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); + + Frame* frame = core(webView)->focusController()->focusedOrMainFrame(); + + core(webView)->inspectorController()->inspect(frame->document()); +} + +/** * webkit_web_view_get_window_features * @web_view: a #WebKitWebView * @@ -2738,4 +2903,25 @@ g_object_notify(G_OBJECT(webView), "full-content-zoom"); } +void webkit_web_view_register_url_scheme_as_local(const gchar* scheme) +{ + FrameLoader::registerURLSchemeAsLocal(String(scheme, strlen(scheme))); +} + +gchar* webkit_web_view_get_user_agent(WebKitWebView* webView) +{ + WebKitWebViewPrivate* priv = webView->priv; + WebKitWebSettings* webSettings = priv->webSettings; + + gchar *ua; + g_object_get(webSettings, "user-agent", &ua, NULL); + + return ua; +} + +void webkit_titanium_set_inspector_path(const gchar* path) +{ + WebKit::InspectorClient::runtimePath = g_strdup(path); +} + } diff -Naur WebKit-r41128/WebKit/gtk/webkit/webkitwebview.h WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebview.h --- WebKit-r41128/WebKit/gtk/webkit/webkitwebview.h 2009-02-15 03:48:54.000000000 -0500 +++ WebKit-r41137-nx/WebKit/gtk/webkit/webkitwebview.h 2009-06-23 19:32:02.180536366 -0400 @@ -75,6 +75,10 @@ WebKitNavigationResponse (* navigation_requested) (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request); + WebKitNavigationResponse (* new_window_navigation_requested) (WebKitWebView *web_view, + WebKitWebFrame *frame, + WebKitNetworkRequest *request, + gchar *frame_name); void (* window_object_cleared) (WebKitWebView *web_view, WebKitWebFrame *frame, JSGlobalContextRef context, @@ -102,6 +106,8 @@ void (* cut_clipboard) (WebKitWebView *web_view); void (* copy_clipboard) (WebKitWebView *web_view); void (* paste_clipboard) (WebKitWebView *web_view); + gboolean (* download_created) (WebKitWebView *web_view, + WebKitWebDownload *download); /* * internal @@ -270,6 +276,9 @@ WEBKIT_API WebKitWebInspector * webkit_web_view_get_inspector (WebKitWebView *web_view); +WEBKIT_API void +webkit_web_view_inspect (WebKitWebView *web_view); + WEBKIT_API WebKitWebWindowFeatures* webkit_web_view_get_window_features (WebKitWebView *web_view); @@ -304,6 +313,15 @@ webkit_web_view_set_full_content_zoom (WebKitWebView *web_view, gboolean full_content_zoom); +WEBKIT_API void +webkit_web_view_register_url_scheme_as_local (const gchar *scheme); + +WEBKIT_API gchar* +webkit_web_view_get_user_agent (WebKitWebView *web_view); + +WEBKIT_API void +webkit_titanium_set_inspector_path (const gchar *path); + G_END_DECLS #endif diff -Naur WebKit-r41128/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm WebKit-r41137-nx/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm --- WebKit-r41128/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2009-02-16 02:39:41.000000000 -0500 +++ WebKit-r41137-nx/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2009-03-24 16:51:06.000000000 -0400 @@ -580,9 +580,9 @@ demarshalValues(exec, argumentsData, argumentsLength, argList); ProtectedPtr globalObject = frame->script()->globalObject(); - globalObject->startTimeoutCheck(); + globalObject->globalData()->timeoutChecker.start(); JSValuePtr value = call(exec, function, callType, callData, object, argList); - globalObject->stopTimeoutCheck(); + globalObject->globalData()->timeoutChecker.stop(); marshalValue(exec, value, resultData, resultLength); exec->clearException(); @@ -610,9 +610,9 @@ demarshalValues(exec, argumentsData, argumentsLength, argList); ProtectedPtr globalObject = frame->script()->globalObject(); - globalObject->startTimeoutCheck(); + globalObject->globalData()->timeoutChecker.start(); JSValuePtr value = call(exec, object, callType, callData, object, argList); - globalObject->stopTimeoutCheck(); + globalObject->globalData()->timeoutChecker.stop(); marshalValue(exec, value, resultData, resultLength); exec->clearException(); @@ -641,9 +641,9 @@ demarshalValues(exec, argumentsData, argumentsLength, argList); ProtectedPtr globalObject = frame->script()->globalObject(); - globalObject->startTimeoutCheck(); + globalObject->globalData()->timeoutChecker.start(); JSValuePtr value = JSC::construct(exec, object, constructType, constructData, argList); - globalObject->stopTimeoutCheck(); + globalObject->globalData()->timeoutChecker.stop(); marshalValue(exec, value, resultData, resultLength); exec->clearException(); diff -Naur WebKit-r41128/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm WebKit-r41137-nx/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm --- WebKit-r41128/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2009-02-19 01:12:25.000000000 -0500 +++ WebKit-r41137-nx/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2009-03-24 16:43:36.000000000 -0400 @@ -1539,7 +1539,7 @@ } if (parameterValue(paramNames, paramValues, "height").isNull()) { [names addObject:@"height"]; - [values addObject:[NSString stringWithFormat:@"%d", size.width()]]; + [values addObject:[NSString stringWithFormat:@"%d", size.height()]]; } view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, names, values, baseURL, kit(element), NO); } diff -Naur WebKit-r41128/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp WebKit-r41137-nx/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp --- WebKit-r41128/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp 2009-01-21 00:14:31.000000000 -0500 +++ WebKit-r41137-nx/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp 2009-05-25 17:59:38.344488374 -0400 @@ -208,6 +208,8 @@ "default-font-size", 16, "default-monospace-font-size", 13, "minimum-font-size", 1, + "enable-html5-database", TRUE, + "enable-html5-local-storage", TRUE, NULL); webkit_web_settings_add_extra_plugin_directory(webView, TEST_PLUGIN_DIR); @@ -348,7 +350,7 @@ int main(int argc, char* argv[]) { - g_thread_init(NULL); +// g_thread_init(NULL); gtk_init(&argc, &argv); struct option options[] = { diff -Naur WebKit-r41128/WebKitTools/DumpRenderTree/LayoutTestController.cpp WebKit-r41137-nx/WebKitTools/DumpRenderTree/LayoutTestController.cpp --- WebKit-r41128/WebKitTools/DumpRenderTree/LayoutTestController.cpp 2009-02-15 03:48:56.000000000 -0500 +++ WebKit-r41137-nx/WebKitTools/DumpRenderTree/LayoutTestController.cpp 2009-02-23 16:01:27.000000000 -0500 @@ -734,7 +734,7 @@ return JSValueMakeUndefined(context); LayoutTestController* controller = reinterpret_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(context, controller->numberOfActiveAnimations()); + return JSValueMakeUndefined(context);//JSValueMakeNumber(context, controller->numberOfActiveAnimations()); } // Static Values diff -Naur WebKit-r41128/WebKitTools/GNUmakefile.am WebKit-r41137-nx/WebKitTools/GNUmakefile.am --- WebKit-r41128/WebKitTools/GNUmakefile.am 2009-01-21 00:14:31.000000000 -0500 +++ WebKit-r41137-nx/WebKitTools/GNUmakefile.am 2009-07-19 14:59:26.351048122 -0400 @@ -7,8 +7,10 @@ # GtkLauncher Programs_GtkLauncher_CPPFLAGS = \ + -I$(srcdir)/WebCore/bindings \ -I$(srcdir)/WebKit/gtk \ -I$(top_builddir)/WebKit/gtk \ + -I$(srcdir)/WebKit/gtk/webkit \ $(global_cppflags) \ $(javascriptcore_cppflags) @@ -30,8 +32,10 @@ Programs_DumpRenderTree_CPPFLAGS = \ -I$(srcdir)/WebKitTools/DumpRenderTree \ -I$(srcdir)/WebKitTools/DumpRenderTree/gtk \ + -I$(srcdir)/WebCore/bindings \ -I$(srcdir)/WebKit/gtk \ -I$(top_builddir)/WebKit/gtk \ + -I$(srcdir)/WebKit/gtk/webkit \ -DTEST_PLUGIN_DIR=\"${shell pwd}/${top_builddir}/TestNetscapePlugin/.libs\" \ $(global_cppflags) \ $(javascriptcore_cppflags) diff -Naur WebKit-r41128/WebKitTools/GtkLauncher/main.c WebKit-r41137-nx/WebKitTools/GtkLauncher/main.c --- WebKit-r41128/WebKitTools/GtkLauncher/main.c 2009-01-27 02:55:35.000000000 -0500 +++ WebKit-r41137-nx/WebKitTools/GtkLauncher/main.c 2009-02-23 16:01:27.000000000 -0500 @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007 Apple Inc. * Copyright (C) 2007 Alp Toker + * Copyright (C) 2008 Collabora, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -106,6 +107,107 @@ webkit_web_view_go_forward (web_view); } +static gboolean +download_error_cb (WebKitWebDownload* download, guint domain, WebKitWebDownloadError error, const gchar * message, gpointer data) +{ + g_warning("Download Error: %s\n", message); + return TRUE; +} + +static void +download_finished_cb (WebKitWebDownload* download, gpointer data) +{ + gtk_button_set_label(GTK_BUTTON(data), GTK_STOCK_CLOSE); +} + +static void +download_progress_cb (WebKitWebDownload* download, guint current_bytes, guint total_bytes, gpointer progress_bar) +{ + if(GTK_IS_PROGRESS_BAR(progress_bar)) + { + gdouble progress = (double)current_bytes/total_bytes; + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar), progress); + } +} + +static void +download_button_cb (GtkButton* button, WebKitWebDownload* download) +{ + if (webkit_web_download_get_state(download) == WEBKIT_WEB_DOWNLOAD_STATE_FINISHED || + webkit_web_download_get_state(download) == WEBKIT_WEB_DOWNLOAD_STATE_ERROR) { + GdkWindow* window = gtk_widget_get_parent_window(GTK_WIDGET(button)); + gdk_window_hide(window); + g_object_unref(download); + } else + webkit_web_download_cancel(download); +} + +static void +save_dialog_response_cb (GtkFileChooser *file_chooser, gint response, WebKitWebDownload* download) +{ + if (response == GTK_RESPONSE_OK) { + webkit_web_download_set_local_uri(download, gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (file_chooser))); + } /*else { + gtk_widget_destroy (window); + handled = FALSE; + }*/ + + gtk_widget_destroy (file_chooser); +} + +static gboolean +download_created_cb (WebKitWebView* view, WebKitWebDownload* download, gpointer data) +{ + gboolean handled = TRUE; + GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "Download"); + + GtkWidget* vbox = gtk_vbox_new(TRUE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + + GtkWidget* uri_label = gtk_label_new(NULL); + gtk_label_set_single_line_mode(GTK_LABEL(uri_label), FALSE); + gtk_label_set_markup(GTK_LABEL(uri_label), + g_strconcat("URI: ", + webkit_web_download_get_uri(download), + "\nFilename: ", + webkit_web_download_get_suggested_filename(download), + NULL) + ); + gtk_label_set_justify(GTK_LABEL(uri_label), GTK_JUSTIFY_LEFT); + gtk_box_pack_start(GTK_BOX(vbox), uri_label, FALSE, FALSE, 0); + + GtkWidget* progress_bar = gtk_progress_bar_new(); + gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(progress_bar), GTK_PROGRESS_LEFT_TO_RIGHT); + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar), 0.0); + gtk_box_pack_start(GTK_BOX(vbox), progress_bar, FALSE, FALSE, 0); + + GtkWidget* button_box = gtk_hbutton_box_new(); + gtk_button_box_set_layout(GTK_BUTTON_BOX(button_box), GTK_BUTTONBOX_END); + GtkWidget* button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (download_button_cb), download); + gtk_box_pack_start(GTK_BOX(button_box), button, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), button_box, FALSE, FALSE, 0); + + gtk_container_add(GTK_CONTAINER(window), vbox); + + gtk_widget_show_all(GTK_WIDGET(window)); + + GtkWidget* file_chooser = gtk_file_chooser_dialog_new("Select destination...", GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL); + gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (file_chooser), webkit_web_download_get_suggested_filename (download)); + g_signal_connect (G_OBJECT (file_chooser), "response", G_CALLBACK (save_dialog_response_cb), download); + gtk_widget_show (file_chooser); + + g_signal_connect (G_OBJECT (download), "finished", G_CALLBACK (download_finished_cb), button); + g_signal_connect (G_OBJECT (download), "progress-update", G_CALLBACK (download_progress_cb), progress_bar); + g_signal_connect (G_OBJECT (download), "error", G_CALLBACK (download_error_cb), window); + + if (handled) + g_object_ref(download); + + return handled; +} + static GtkWidget* create_browser () { @@ -119,6 +221,7 @@ g_signal_connect (G_OBJECT (web_view), "load-progress-changed", G_CALLBACK (progress_change_cb), web_view); g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (load_commit_cb), web_view); g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view); + g_signal_connect (G_OBJECT (web_view), "download-created", G_CALLBACK (download_created_cb), web_view); return scrolled_window; } @@ -183,8 +286,8 @@ main (int argc, char* argv[]) { gtk_init (&argc, &argv); - if (!g_thread_supported ()) - g_thread_init (NULL); +/* if (!g_thread_supported ()) + g_thread_init (NULL);*/ GtkWidget* vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), create_toolbar (), FALSE, FALSE, 0); diff -Naur WebKit-r41128/WebKitTools/Scripts/check-for-global-initializers WebKit-r41137-nx/WebKitTools/Scripts/check-for-global-initializers --- WebKit-r41128/WebKitTools/Scripts/check-for-global-initializers 2009-01-21 00:14:31.000000000 -0500 +++ WebKit-r41137-nx/WebKitTools/Scripts/check-for-global-initializers 2009-06-23 19:32:02.268905055 -0400 @@ -68,6 +68,7 @@ my $sawError = 0; for my $file (sort @files) { + next if $file =~ /ScriptElement.o/; if (defined $buildTimestampAge && $buildTimestampAge < $scriptAge) { my $fileAge = -M $file; next if defined $fileAge && $fileAge > $buildTimestampAge;