| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2007 Google Inc. All Rights Reserved. | 2 * Copyright 2007 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * ***** BEGIN LICENSE BLOCK ***** | 6 * ***** BEGIN LICENSE BLOCK ***** |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * | 28 * |
| 29 * ***** END LICENSE BLOCK ***** | 29 * ***** END LICENSE BLOCK ***** |
| 30 * | 30 * |
| 31 */ | 31 */ |
| 32 | 32 |
| 33 #include "config.h" | 33 #include "config.h" |
| 34 | 34 |
| 35 #include "base/compiler_specific.h" | 35 #include "base/compiler_specific.h" |
| 36 | 36 |
| 37 MSVC_PUSH_WARNING_LEVEL(0); | 37 MSVC_PUSH_WARNING_LEVEL(0); |
| 38 #if defined(OS_WIN) |
| 38 #include "Cursor.h" | 39 #include "Cursor.h" |
| 40 #endif |
| 39 #include "Document.h" | 41 #include "Document.h" |
| 40 #include "DocumentLoader.h" | 42 #include "DocumentLoader.h" |
| 41 #include "DragController.h" | 43 #include "DragController.h" |
| 42 #include "DragData.h" | 44 #include "DragData.h" |
| 43 #include "Editor.h" | 45 #include "Editor.h" |
| 44 #include "EventHandler.h" | 46 #include "EventHandler.h" |
| 45 #include "FocusController.h" | 47 #include "FocusController.h" |
| 46 #include "FontDescription.h" | 48 #include "FontDescription.h" |
| 47 #include "FrameLoader.h" | 49 #include "FrameLoader.h" |
| 48 #include "FrameTree.h" | 50 #include "FrameTree.h" |
| 49 #include "FrameView.h" | 51 #include "FrameView.h" |
| 50 #include "GraphicsContext.h" | 52 #include "GraphicsContext.h" |
| 51 #include "HitTestResult.h" | 53 #include "HitTestResult.h" |
| 52 #include "Image.h" | 54 #include "Image.h" |
| 53 #include "InspectorController.h" | 55 #include "InspectorController.h" |
| 54 #include "IntRect.h" | 56 #include "IntRect.h" |
| 55 #include "KeyboardEvent.h" | 57 #include "KeyboardEvent.h" |
| 56 #include "MIMETypeRegistry.h" | 58 #include "MIMETypeRegistry.h" |
| 57 #include "Page.h" | 59 #include "Page.h" |
| 58 #include "Pasteboard.h" | |
| 59 #include "PlatformKeyboardEvent.h" | 60 #include "PlatformKeyboardEvent.h" |
| 60 #include "PlatformMouseEvent.h" | 61 #include "PlatformMouseEvent.h" |
| 61 #include "PlatformWheelEvent.h" | 62 #include "PlatformWheelEvent.h" |
| 62 #include "PluginInfoStore.h" | 63 #include "PluginInfoStore.h" |
| 63 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
| 64 #include "RenderThemeWin.h" | 65 #include "RenderThemeWin.h" |
| 65 #endif | 66 #endif |
| 66 #include "ResourceHandle.h" | 67 #include "ResourceHandle.h" |
| 67 #include "SelectionController.h" | 68 #include "SelectionController.h" |
| 68 #include "Settings.h" | 69 #include "Settings.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Restrict the access to the local file system | 130 // Restrict the access to the local file system |
| 130 // (see WebView.mm WebView::_commonInitializationWithFrameName). | 131 // (see WebView.mm WebView::_commonInitializationWithFrameName). |
| 131 FrameLoader::setLocalLoadPolicy( | 132 FrameLoader::setLocalLoadPolicy( |
| 132 FrameLoader::AllowLocalLoadsForLocalOnly); | 133 FrameLoader::AllowLocalLoadsForLocalOnly); |
| 133 return instance; | 134 return instance; |
| 134 } | 135 } |
| 135 | 136 |
| 136 WebViewImpl::WebViewImpl() | 137 WebViewImpl::WebViewImpl() |
| 137 : delegate_(NULL), | 138 : delegate_(NULL), |
| 138 pending_history_item_(NULL), | 139 pending_history_item_(NULL), |
| 140 observed_new_navigation_(false), |
| 139 #ifndef NDEBUG | 141 #ifndef NDEBUG |
| 140 new_navigation_loader_(NULL), | 142 new_navigation_loader_(NULL), |
| 141 #endif | 143 #endif |
| 142 observed_new_navigation_(false), | |
| 143 text_zoom_level_(0), | 144 text_zoom_level_(0), |
| 144 context_menu_allowed_(false), | 145 context_menu_allowed_(false), |
| 145 doing_drag_and_drop_(false), | 146 doing_drag_and_drop_(false), |
| 146 suppress_next_keypress_event_(false), | 147 suppress_next_keypress_event_(false), |
| 147 window_open_disposition_(IGNORE_ACTION), | 148 window_open_disposition_(IGNORE_ACTION), |
| 148 ime_accept_events_(true) { | 149 ime_accept_events_(true) { |
| 149 // WebKit/win/WebView.cpp does the same thing, except they call the | 150 // WebKit/win/WebView.cpp does the same thing, except they call the |
| 150 // KJS specific wrapper around this method. We need to have threading | 151 // KJS specific wrapper around this method. We need to have threading |
| 151 // initialized because CollatorICU requires it. | 152 // initialized because CollatorICU requires it. |
| 152 WTF::initializeThreading(); | 153 WTF::initializeThreading(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 main_frame_->frame()->view()->windowToContents(pme.pos())); | 244 main_frame_->frame()->view()->windowToContents(pme.pos())); |
| 244 HitTestResult result = | 245 HitTestResult result = |
| 245 main_frame_->frame()->eventHandler()->hitTestResultAtPoint(doc_point, | 246 main_frame_->frame()->eventHandler()->hitTestResultAtPoint(doc_point, |
| 246 false); | 247 false); |
| 247 Frame* target_frame; | 248 Frame* target_frame; |
| 248 if (result.innerNonSharedNode()) | 249 if (result.innerNonSharedNode()) |
| 249 target_frame = result.innerNonSharedNode()->document()->frame(); | 250 target_frame = result.innerNonSharedNode()->document()->frame(); |
| 250 else | 251 else |
| 251 target_frame = page_->focusController()->focusedOrMainFrame(); | 252 target_frame = page_->focusController()->focusedOrMainFrame(); |
| 252 | 253 |
| 254 #if defined(OS_WIN) |
| 253 target_frame->view()->setCursor(pointerCursor()); | 255 target_frame->view()->setCursor(pointerCursor()); |
| 256 #endif |
| 254 | 257 |
| 255 context_menu_allowed_ = true; | 258 context_menu_allowed_ = true; |
| 256 target_frame->eventHandler()->sendContextMenuEvent(pme); | 259 target_frame->eventHandler()->sendContextMenuEvent(pme); |
| 257 context_menu_allowed_ = false; | 260 context_menu_allowed_ = false; |
| 258 // Actually showing the context menu is handled by the ContextMenuClient | 261 // Actually showing the context menu is handled by the ContextMenuClient |
| 259 // implementation... | 262 // implementation... |
| 260 } | 263 } |
| 261 | 264 |
| 262 void WebViewImpl::MouseUp(const WebMouseEvent& event) { | 265 void WebViewImpl::MouseUp(const WebMouseEvent& event) { |
| 263 if (!main_frame_->frameview()) | 266 if (!main_frame_->frameview()) |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 | 1260 |
| 1258 bool WebViewImpl::DragTargetDragEnter(const WebDropData& drop_data, | 1261 bool WebViewImpl::DragTargetDragEnter(const WebDropData& drop_data, |
| 1259 int client_x, int client_y, int screen_x, int screen_y) { | 1262 int client_x, int client_y, int screen_x, int screen_y) { |
| 1260 DCHECK(!current_drop_data_.get()); | 1263 DCHECK(!current_drop_data_.get()); |
| 1261 | 1264 |
| 1262 // Copy drop_data into current_drop_data_. | 1265 // Copy drop_data into current_drop_data_. |
| 1263 WebDropData* drop_data_copy = new WebDropData; | 1266 WebDropData* drop_data_copy = new WebDropData; |
| 1264 *drop_data_copy = drop_data; | 1267 *drop_data_copy = drop_data; |
| 1265 current_drop_data_.reset(drop_data_copy); | 1268 current_drop_data_.reset(drop_data_copy); |
| 1266 | 1269 |
| 1267 #if defined(OS_WIN) | 1270 #if defined(OS_WIN) || defined(OS_LINUX) |
| 1268 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), | 1271 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), |
| 1269 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), | 1272 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), |
| 1270 kDropTargetOperation); | 1273 kDropTargetOperation); |
| 1271 #elif defined(OS_MACOSX) | 1274 #elif defined(OS_MACOSX) |
| 1272 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), | 1275 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), |
| 1273 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), | 1276 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), |
| 1274 kDropTargetOperation, nil); | 1277 kDropTargetOperation, nil); |
| 1275 #endif | 1278 #endif |
| 1276 DragOperation effect = page_->dragController()->dragEntered(&drag_data); | 1279 DragOperation effect = page_->dragController()->dragEntered(&drag_data); |
| 1277 return effect != DragOperationNone; | 1280 return effect != DragOperationNone; |
| 1278 } | 1281 } |
| 1279 | 1282 |
| 1280 bool WebViewImpl::DragTargetDragOver( | 1283 bool WebViewImpl::DragTargetDragOver( |
| 1281 int client_x, int client_y, int screen_x, int screen_y) { | 1284 int client_x, int client_y, int screen_x, int screen_y) { |
| 1282 DCHECK(current_drop_data_.get()); | 1285 DCHECK(current_drop_data_.get()); |
| 1283 #if defined(OS_WIN) | 1286 #if defined(OS_WIN) || defined(OS_LINUX) |
| 1284 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), | 1287 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), |
| 1285 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), | 1288 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), |
| 1286 kDropTargetOperation); | 1289 kDropTargetOperation); |
| 1287 #elif defined(OS_MACOSX) | 1290 #elif defined(OS_MACOSX) |
| 1288 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), | 1291 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), |
| 1289 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), | 1292 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), |
| 1290 kDropTargetOperation, nil); | 1293 kDropTargetOperation, nil); |
| 1291 #endif | 1294 #endif |
| 1292 DragOperation effect = page_->dragController()->dragUpdated(&drag_data); | 1295 DragOperation effect = page_->dragController()->dragUpdated(&drag_data); |
| 1293 return effect != DragOperationNone; | 1296 return effect != DragOperationNone; |
| 1294 } | 1297 } |
| 1295 | 1298 |
| 1296 void WebViewImpl::DragTargetDragLeave() { | 1299 void WebViewImpl::DragTargetDragLeave() { |
| 1297 DCHECK(current_drop_data_.get()); | 1300 DCHECK(current_drop_data_.get()); |
| 1298 #if defined(OS_WIN) | 1301 #if defined(OS_WIN) || defined(OS_LINUX) |
| 1299 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), | 1302 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), |
| 1300 IntPoint(), IntPoint(), DragOperationNone); | 1303 IntPoint(), IntPoint(), DragOperationNone); |
| 1301 #elif defined(OS_MACOSX) | 1304 #elif defined(OS_MACOSX) |
| 1302 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), | 1305 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), |
| 1303 IntPoint(), IntPoint(), DragOperationNone, nil); | 1306 IntPoint(), IntPoint(), DragOperationNone, nil); |
| 1304 #endif | 1307 #endif |
| 1305 page_->dragController()->dragExited(&drag_data); | 1308 page_->dragController()->dragExited(&drag_data); |
| 1306 current_drop_data_.reset(NULL); | 1309 current_drop_data_.reset(NULL); |
| 1307 } | 1310 } |
| 1308 | 1311 |
| 1309 void WebViewImpl::DragTargetDrop( | 1312 void WebViewImpl::DragTargetDrop( |
| 1310 int client_x, int client_y, int screen_x, int screen_y) { | 1313 int client_x, int client_y, int screen_x, int screen_y) { |
| 1311 DCHECK(current_drop_data_.get()); | 1314 DCHECK(current_drop_data_.get()); |
| 1312 #if defined(OS_WIN) | 1315 #if defined(OS_WIN) || defined(OS_LINUX) |
| 1313 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), | 1316 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), |
| 1314 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), | 1317 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), |
| 1315 kDropTargetOperation); | 1318 kDropTargetOperation); |
| 1316 #elif defined(OS_MACOSX) | 1319 #elif defined(OS_MACOSX) |
| 1317 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), | 1320 DragData drag_data(reinterpret_cast<DragDataRef>(current_drop_data_.get()), |
| 1318 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), | 1321 IntPoint(client_x, client_y), IntPoint(screen_x, screen_y), |
| 1319 kDropTargetOperation, nil); | 1322 kDropTargetOperation, nil); |
| 1320 #endif | 1323 #endif |
| 1321 page_->dragController()->performDrag(&drag_data); | 1324 page_->dragController()->performDrag(&drag_data); |
| 1322 current_drop_data_.reset(NULL); | 1325 current_drop_data_.reset(NULL); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 } | 1538 } |
| 1536 | 1539 |
| 1537 void WebViewImpl::DeleteImageResourceFetcher(ImageResourceFetcher* fetcher) { | 1540 void WebViewImpl::DeleteImageResourceFetcher(ImageResourceFetcher* fetcher) { |
| 1538 DCHECK(image_fetchers_.find(fetcher) != image_fetchers_.end()); | 1541 DCHECK(image_fetchers_.find(fetcher) != image_fetchers_.end()); |
| 1539 image_fetchers_.erase(fetcher); | 1542 image_fetchers_.erase(fetcher); |
| 1540 | 1543 |
| 1541 // We're in the callback from the ImageResourceFetcher, best to delay | 1544 // We're in the callback from the ImageResourceFetcher, best to delay |
| 1542 // deletion. | 1545 // deletion. |
| 1543 MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher); | 1546 MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher); |
| 1544 } | 1547 } |
| OLD | NEW |