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 #define ANDROID_EXPOSE_COLUMN_GAP 77 78 #define ANDROID_LAYOUT 79 80 // Allows us to select all of the text in a <textarea> in onfocus 81 #define ANDROID_SELECT_TEXT_AREAS 82 83 #define ANDROID_FIX 84 85 // Fix for issue 878095. Only call onBlur on an element if it has an 86 // onBlur event. 87 #define ANDROID_IGNORE_BLUR 88 89 // Passes the webkit-originated changes of a focused textfield to our UI thread 90 #define ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS 91 92 // Fix for an issue where WebKit was scrolling a focused element onscreen. 93 // Unnecessary for us, since we handle scrolling outside of WebKit. 94 #define ANDROID_SCROLL_FIX 95 96 #define ANDROID_META_SUPPORT 97 98 // Give public access to a private method in HTMLSelectElement so that 99 // we can use information from the java UI to deselect items of the element. 100 #define ANDROID_DESELECT_SELECT 101 102 // Converts ListBoxes to dropdown popup lists. 103 #define ANDROID_LISTBOX_USES_MENU_LIST 104 105 #define ANDROID_ALLOW_TRANSPARENT_BACKGROUNDS 106 #define ANDROID_HISTORY_CLIENT 107 #define ANDROID_MULTIPLE_WINDOWS 108 #define ANDROID_CSS_TAP_HIGHLIGHT_COLOR 109 110 // Hack to make File Upload buttons draw disabled. 111 // Will be removed if/when we get file uploads working. 112 #define ANDROID_DISABLE_UPLOAD 113 114 #define ANDROID_BLOCK_NETWORK_IMAGE 115 116 // Changes needed to support native plugins (npapi.h). If the change is generic, 117 // it may be under a different #define (see: PLUGIN_PLATFORM_SETVALUE, 118 // PLUGIN_SCHEDULE_TIMER) 119 #define ANDROID_PLUGINS 120 121 // Prevent Webkit from drawing the selection in textfields/textareas, since we 122 // draw it ourselves in the UI thread. 123 #define ANDROID_DO_NOT_DRAW_TEXTFIELD_SELECTION 124 125 // This should possibly be patched back to WebKit since they seem to lose the 126 // user gesture hint. If we do decide to patch this back, the user gesture flag 127 // should probably be passed in the NavigationAction rather than the 128 // ResourceRequest. 129 #define ANDROID_USER_GESTURE 130 131 // Add support for the orientation window property 132 #define ANDROID_ORIENTATION_SUPPORT 133 134 // This enables a portable implementation of NPN_[Un]ScheduleTimer 135 // Will submit this as a patch to apple 136 #define PLUGIN_SCHEDULE_TIMER 137 138 // This adds platformInit() and platformSetValue() to pluginview 139 // Will submit this as a patch to apple 140 #define PLUGIN_PLATFORM_SETVALUE 141 142 // This enables logging the DOM tree, Render tree even for the release build 143 #define ANDROID_DOM_LOGGING 144 145 // Notify WebViewCore when a clipped out rectangle is drawn, 146 // so that all invals are captured by the display tree. 147 #define ANDROID_CAPTURE_OFFSCREEN_PAINTS 148 149 // This disables the css position:fixed to the Browser window. Instead the fixed 150 // element will be always fixed to the top page. 151 #define ANDROID_DISABLE_POSITION_FIXED 152 153 // Fix exceptions not surfacing through NPAPI bindings to the 154 // JavaScriptCore execution context. 155 #define ANDROID_NPN_SETEXCEPTION 1 156 157 // Enable dumping the display tree to a file (triggered in WebView.java) 158 #define ANDROID_DUMP_DISPLAY_TREE 159 160 // Allow webkit to initiate scroll when going to an anchor on a page 161 // The implementation is not acceptable to webkit. Either scrollRectToVisible 162 // needs additional flavor or parameter to know that it can't be ignored, 163 // and/or script engine must keep whether event was user initiated. 164 #define ANDROID_SCROLL_ON_GOTO_ANCHOR 165 166 // Animated GIF support. 167 #define ANDROID_ANIMATED_GIF 168