1 /* 2 * Copyright (C) 2004, 2005, 2006 Apple Inc. 3 * Copyright (C) 2009 Google Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 * 20 */ 21 22 #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H 23 #include "autotoolsconfig.h" 24 #endif 25 26 #include <wtf/Platform.h> 27 28 #if OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC) 29 #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) 30 #define JS_EXPORTDATA __declspec(dllexport) 31 #else 32 #define JS_EXPORTDATA __declspec(dllimport) 33 #endif 34 #if defined(BUILDING_WebCore) || defined(BUILDING_WebKit) 35 #define WEBKIT_EXPORTDATA __declspec(dllexport) 36 #else 37 #define WEBKIT_EXPORTDATA __declspec(dllimport) 38 #endif 39 #define JS_EXPORTCLASS JS_EXPORTDATA 40 #else 41 #define JS_EXPORTDATA 42 #define JS_EXPORTCLASS 43 #define WEBKIT_EXPORTDATA 44 #endif 45 46 #define MOBILE 0 47 48 #ifdef __APPLE__ 49 #define HAVE_FUNC_USLEEP 1 50 #endif /* __APPLE__ */ 51 52 #if OS(WINDOWS) 53 54 #ifndef _WIN32_WINNT 55 #define _WIN32_WINNT 0x0500 56 #endif 57 58 #ifndef WINVER 59 #define WINVER 0x0500 60 #endif 61 62 // If we don't define these, they get defined in windef.h. 63 // We want to use std::min and std::max. 64 #ifndef max 65 #define max max 66 #endif 67 #ifndef min 68 #define min min 69 #endif 70 71 // CURL needs winsock, so don't prevent inclusion of it 72 #if !USE(CURL) 73 #ifndef _WINSOCKAPI_ 74 #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h 75 #endif 76 #endif 77 78 #endif /* OS(WINDOWS) */ 79 80 // ANDROID def should be after all PLATFORM to avoid override. 81 #if PLATFORM(ANDROID) 82 #define WEBCORE_NAVIGATOR_VENDOR "Google Inc." 83 // This must be defined before we include FastMalloc.h, below. 84 #define USE_SYSTEM_MALLOC 1 85 #define LOG_DISABLED 1 86 #include <wtf/Assertions.h> 87 // Central place to set which optional features Android uses. 88 #define ENABLE_DOM_STORAGE 1 89 #undef ENABLE_FTPDIR // Enabled by default in Platform.h 90 #define ENABLE_FTPDIR 0 91 #ifndef ENABLE_SVG 92 #define ENABLE_SVG 0 93 #endif 94 #define ENABLE_3D_RENDERING 0 95 #define ENABLE_VIDEO 1 96 97 #if ENABLE_SVG 98 #if !defined(ENABLE_SVG_ANIMATION) 99 #define ENABLE_SVG_ANIMATION 0 // to enable: 100 // fix error: no matching function for call to 'sort(WebCore::SVGSMILElement**, WebCore::SVGSMILElement**, WebCore::PriorityCompare)' 101 // fix error: no matching function for call to 'sort(WebCore::SMILTime*, WebCore::SMILTime*)' 102 // add ENABLE_SVG_ANIMATION=1 to SVG_FLAGS in JavaScriptCore.derived.mk 103 #endif 104 #define ENABLE_SVG_AS_IMAGE 1 105 #define ENABLE_SVG_FILTERS 1 106 #define ENABLE_SVG_FONTS 1 107 #define ENABLE_SVG_FOREIGN_OBJECT 1 108 #define ENABLE_SVG_USE 1 109 #endif 110 111 #define ENABLE_XBL 0 112 #define ENABLE_XHTMLMP 0 113 #define ENABLE_XPATH 0 114 #define ENABLE_XSLT 0 115 #undef ENABLE_ARCHIVE // Enabled by default in Platform.h 116 #define ENABLE_ARCHIVE 0 117 #define ENABLE_OFFLINE_WEB_APPLICATIONS 1 118 #define ENABLE_TOUCH_EVENTS 1 119 #undef ENABLE_GEOLOCATION // Disabled by default in Platform.h 120 #define ENABLE_GEOLOCATION 1 121 #undef ENABLE_INSPECTOR // Enabled by default in Platform.h 122 #define ENABLE_INSPECTOR 0 123 #define ENABLE_EVENT_SOURCE 0 124 #undef ENABLE_APPLICATION_INSTALLED 125 #define ENABLE_APPLICATION_INSTALLED 1 126 127 // Uses composited RenderLayers for fixed elements 128 #undef ENABLE_COMPOSITED_FIXED_ELEMENTS // Disabled by default in Platform.h 129 #define ENABLE_COMPOSITED_FIXED_ELEMENTS 1 130 131 #define FLATTEN_FRAMESET 132 #define FLATTEN_IFRAME 133 134 #define ANDROID_EXPOSE_COLUMN_GAP 135 136 #define ANDROID_LAYOUT 137 138 #define ANDROID_FIX 139 140 // Ensure that the fixed elements are always relative to the top document. 141 #define ANDROID_FIXED_ELEMENTS 142 143 // Passes the webkit-originated changes of a focused textfield to our UI 144 // thread 145 #define ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS 146 147 #define ANDROID_META_SUPPORT 148 149 // Converts ListBoxes to dropdown popup lists. 150 #define ANDROID_LISTBOX_USES_MENU_LIST 151 152 #define ANDROID_MULTIPLE_WINDOWS 153 #define ANDROID_CSS_TAP_HIGHLIGHT_COLOR 154 155 #define ANDROID_BLOCK_NETWORK_IMAGE 156 157 // Changes needed to support native plugins (npapi.h). If the change is generic, 158 // it may be under a different #define (see: PLUGIN_PLATFORM_SETVALUE, 159 // PLUGIN_SCHEDULE_TIMER) 160 #define ANDROID_PLUGINS 161 162 // This enables a portable implementation of NPN_[Un]ScheduleTimer 163 // Will submit this as a patch to apple 164 #define PLUGIN_SCHEDULE_TIMER 165 166 // This adds platformInit() and platformSetValue() to pluginview 167 // Will submit this as a patch to apple 168 #define PLUGIN_PLATFORM_SETVALUE 169 170 // This enables logging the DOM tree, Render tree even for the release build 171 #define ANDROID_DOM_LOGGING 172 173 // Notify WebViewCore when a clipped out rectangle is drawn, 174 // so that all invals are captured by the display tree. 175 #define ANDROID_CAPTURE_OFFSCREEN_PAINTS 176 177 // Enable dumping the display tree to a file (triggered in WebView.java) 178 #define ANDROID_DUMP_DISPLAY_TREE 179 180 // Allow webkit to initiate scroll when going to an anchor on a page 181 // The implementation is not acceptable to webkit. Either scrollRectToVisible 182 // needs additional flavor or parameter to know that it can't be ignored, 183 // and/or script engine must keep whether event was user initiated. 184 #define ANDROID_SCROLL_ON_GOTO_ANCHOR 185 186 // Animated GIF support. 187 #define ANDROID_ANIMATED_GIF 188 189 // apple-touch-icon support in <link> tags 190 #define ANDROID_APPLE_TOUCH_ICON 191 192 // The user gesture flag is lost during a scheduled location change. We need to 193 // maintain that flag until canHandleRequest to determine if a link was clicked 194 // or if javascript tried to change the location. 195 #define ANDROID_USER_GESTURE 196 197 #endif /* PLATFORM(ANDROID) */ 198 199 #ifdef __cplusplus 200 201 // These undefs match up with defines in WebCorePrefix.h for Mac OS X. 202 // Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h". 203 #undef new 204 #undef delete 205 #include <wtf/FastMalloc.h> 206 207 #endif 208 209 // On MSW, wx headers need to be included before windows.h is. 210 // The only way we can always ensure this is if we include wx here. 211 #if PLATFORM(WX) 212 // The defines in KeyboardCodes.h conflict with Windows as well, and the only way I've found 213 // to address the problem is include KeyboarddCodes.h before windows.h, so do it here. 214 #include "KeyboardCodes.h" 215 #include <wx/defs.h> 216 #endif 217 218 // this breaks compilation of <QFontDatabase>, at least, so turn it off for now 219 // Also generates errors on wx on Windows, presumably because these functions 220 // are used from wx headers. 221 #if !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) 222 #include <wtf/DisallowCType.h> 223 #endif 224 225 #if COMPILER(MSVC) 226 #define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1 227 #else 228 #define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1 229 #endif 230 231 #if PLATFORM(WIN) 232 #if defined(WIN_CAIRO) 233 #undef WTF_PLATFORM_CG 234 #define WTF_PLATFORM_CAIRO 1 235 #undef WTF_USE_CFNETWORK 236 #define WTF_USE_CURL 1 237 #ifndef _WINSOCKAPI_ 238 #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h 239 #endif 240 #else 241 #define WTF_PLATFORM_CG 1 242 #undef WTF_PLATFORM_CAIRO 243 #define WTF_USE_CFNETWORK 1 244 #undef WTF_USE_CURL 245 #endif 246 #undef WTF_USE_WININET 247 #define WTF_PLATFORM_CF 1 248 #define WTF_USE_PTHREADS 0 249 #endif 250 251 #if PLATFORM(MAC) 252 // ATSUI vs. CoreText 253 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) 254 #define WTF_USE_ATSUI 0 255 #define WTF_USE_CORE_TEXT 1 256 #else 257 #define WTF_USE_ATSUI 1 258 #define WTF_USE_CORE_TEXT 0 259 #endif 260 261 // New theme 262 #define WTF_USE_NEW_THEME 1 263 #endif // PLATFORM(MAC) 264 265 #if OS(SYMBIAN) 266 #undef WIN32 267 #undef _WIN32 268 #undef SKIP_STATIC_CONSTRUCTORS_ON_GCC 269 #define USE_SYSTEM_MALLOC 1 270 #define U_HAVE_INT8_T 0 271 #define U_HAVE_INT16_T 0 272 #define U_HAVE_INT32_T 0 273 #define U_HAVE_INT64_T 0 274 #define U_HAVE_INTTYPES_H 0 275 276 #include <stdio.h> 277 #include <limits.h> 278 #include <wtf/MathExtras.h> 279 #endif 280 281 #if PLATFORM(CHROMIUM) 282 283 #if !OS(DARWIN) 284 // Define SKIA on non-Mac. 285 #define WTF_PLATFORM_SKIA 1 286 #endif /* !OS(DARWIN) */ 287 288 // Chromium uses this file instead of JavaScriptCore/config.h to compile 289 // JavaScriptCore/wtf (chromium doesn't compile the rest of JSC). Therefore, 290 // this define is required. 291 #define WTF_CHANGES 1 292 293 #define WTF_USE_GOOGLEURL 1 294 295 #if !defined(WTF_USE_V8) 296 #define WTF_USE_V8 1 297 #endif 298 299 #undef WTF_USE_CFNETWORK 300 301 #endif /* PLATFORM(CHROMIUM) */ 302 303 #if !defined(WTF_USE_V8) 304 #define WTF_USE_V8 0 305 #endif /* !defined(WTF_USE_V8) */ 306 307 /* Using V8 implies not using JSC and vice versa */ 308 #define WTF_USE_JSC !WTF_USE_V8 309 310 #if PLATFORM(CG) 311 #ifndef CGFLOAT_DEFINED 312 #ifdef __LP64__ 313 typedef double CGFloat; 314 #else 315 typedef float CGFloat; 316 #endif 317 #define CGFLOAT_DEFINED 1 318 #endif 319 #endif /* PLATFORM(CG) */ 320 321 #ifdef BUILDING_ON_TIGER 322 #undef ENABLE_FTPDIR 323 #define ENABLE_FTPDIR 0 324 #endif 325 326 #if PLATFORM(WIN) && PLATFORM(CG) 327 #define WTF_USE_SAFARI_THEME 1 328 #endif 329