1 /* 2 * Copyright 2007, The Android Open Source Project 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 // This prefix file is for Android only. It should contain only: 27 // - the special trick to catch us using new or delete without including "config.h" 28 // Things that need to be defined globally should go into "config.h". 29 30 #include <limits.h> 31 #include <math.h> // !!! is this allowed as a standard include? 32 #include <pthread.h> 33 #include <stddef.h> 34 #include <stdint.h> 35 #include <stdio.h> 36 #include <stdlib.h> 37 #include <string.h> 38 #include <time.h> 39 #include <unistd.h> 40 #include <fcntl.h> 41 #include <sys/stat.h> 42 43 // Both JavaScriptCore and WebCore include config.h in almost every file. 44 // Unfortunately only one gets picked up if we compile all the files in one 45 // library. Since they can operate together, include it here so it is always 46 // pulled in. 47 #include <JavaScriptCore/config.h> 48 49 #ifdef __cplusplus 50 #define PREFIX_FOR_WEBCORE 1 51 #define EXPORT __attribute__((visibility("default"))) 52 53 #include <algorithm> 54 #include "stl_iterator_base.h" 55 #include "heap.h" 56 #include <memory> 57 #include <new> 58 59 #endif 60 61 #ifdef __cplusplus 62 #define new ("if you use new/delete make sure to include config.h at the top of the file"()) 63 #define delete ("if you use new/delete make sure to include config.h at the top of the file"()) 64 #endif 65 66 typedef short int flex_int16_t; 67 typedef int flex_int32_t; 68 typedef signed char flex_int8_t; 69 typedef unsigned short int flex_uint16_t; 70 typedef unsigned int flex_uint32_t; 71 typedef unsigned char flex_uint8_t; 72 73 #define FLATTEN_FRAMESET 74 #define FLATTEN_IFRAME 75 76 // not android specific, should be submitted back 77 #define ANDROID_FASTER_MATRIX 78 79 #define ANDROID_EXPOSE_COLUMN_GAP 80 81 #define ANDROID_LAYOUT 82 83 #define ANDROID_FIX 84 85 // Passes the webkit-originated changes of a focused textfield to our UI thread 86 #define ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS 87 88 // Fix for an issue where WebKit was scrolling a focused element onscreen. 89 // Unnecessary for us, since we handle scrolling outside of WebKit. 90 #define ANDROID_SCROLL_FIX 91 92 #define ANDROID_META_SUPPORT 93 94 // Converts ListBoxes to dropdown popup lists. 95 #define ANDROID_LISTBOX_USES_MENU_LIST 96 97 #define ANDROID_ALLOW_TRANSPARENT_BACKGROUNDS 98 #define ANDROID_HISTORY_CLIENT 99 #define ANDROID_MULTIPLE_WINDOWS 100 #define ANDROID_CSS_TAP_HIGHLIGHT_COLOR 101 102 // Hack to make File Upload buttons draw disabled. 103 // Will be removed if/when we get file uploads working. 104 #define ANDROID_DISABLE_UPLOAD 105 106 #define ANDROID_BLOCK_NETWORK_IMAGE 107 108 // Changes needed to support native plugins (npapi.h). If the change is generic, 109 // it may be under a different #define (see: PLUGIN_PLATFORM_SETVALUE, 110 // PLUGIN_SCHEDULE_TIMER) 111 #define ANDROID_PLUGINS 112 113 // Add support for the orientation window property 114 #define ANDROID_ORIENTATION_SUPPORT 115 116 // This enables a portable implementation of NPN_[Un]ScheduleTimer 117 // Will submit this as a patch to apple 118 #define PLUGIN_SCHEDULE_TIMER 119 120 // This adds platformInit() and platformSetValue() to pluginview 121 // Will submit this as a patch to apple 122 #define PLUGIN_PLATFORM_SETVALUE 123 124 // This enables logging the DOM tree, Render tree even for the release build 125 #define ANDROID_DOM_LOGGING 126 127 // Notify WebViewCore when a clipped out rectangle is drawn, 128 // so that all invals are captured by the display tree. 129 #define ANDROID_CAPTURE_OFFSCREEN_PAINTS 130 131 // This disables the css position:fixed to the Browser window. Instead the fixed 132 // element will be always fixed to the top page. 133 #define ANDROID_DISABLE_POSITION_FIXED 134 135 // Fix exceptions not surfacing through NPAPI bindings to the 136 // JavaScriptCore execution context. 137 #define ANDROID_NPN_SETEXCEPTION 1 138 139 // Enable dumping the display tree to a file (triggered in WebView.java) 140 #define ANDROID_DUMP_DISPLAY_TREE 141 142 // Allow webkit to initiate scroll when going to an anchor on a page 143 // The implementation is not acceptable to webkit. Either scrollRectToVisible 144 // needs additional flavor or parameter to know that it can't be ignored, 145 // and/or script engine must keep whether event was user initiated. 146 #define ANDROID_SCROLL_ON_GOTO_ANCHOR 147 148 // Animated GIF support. 149 #define ANDROID_ANIMATED_GIF 150 151 // apple-touch-icon support in <link> tags 152 #define ANDROID_APPLE_TOUCH_ICON 153 154 // The user gesture flag is lost during a scheduled location change. We need to 155 // maintain that flag until canHandleRequest to determine if a link was clicked 156 // or if javascript tried to change the location. 157 #define ANDROID_USER_GESTURE 158