| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "HTMLInputElement.h" | 54 #include "HTMLInputElement.h" |
| 55 #include "HitTestResult.h" | 55 #include "HitTestResult.h" |
| 56 #include "Image.h" | 56 #include "Image.h" |
| 57 #include "InspectorController.h" | 57 #include "InspectorController.h" |
| 58 #include "IntRect.h" | 58 #include "IntRect.h" |
| 59 #include "KeyboardCodes.h" | 59 #include "KeyboardCodes.h" |
| 60 #include "KeyboardEvent.h" | 60 #include "KeyboardEvent.h" |
| 61 #include "MIMETypeRegistry.h" | 61 #include "MIMETypeRegistry.h" |
| 62 #include "NodeRenderStyle.h" | 62 #include "NodeRenderStyle.h" |
| 63 #include "Page.h" | 63 #include "Page.h" |
| 64 #include "PageGroup.h" |
| 64 #include "PlatformContextSkia.h" | 65 #include "PlatformContextSkia.h" |
| 65 #include "PlatformKeyboardEvent.h" | 66 #include "PlatformKeyboardEvent.h" |
| 66 #include "PlatformMouseEvent.h" | 67 #include "PlatformMouseEvent.h" |
| 67 #include "PlatformWheelEvent.h" | 68 #include "PlatformWheelEvent.h" |
| 68 #include "PluginInfoStore.h" | 69 #include "PluginInfoStore.h" |
| 69 #include "PopupMenuChromium.h" | 70 #include "PopupMenuChromium.h" |
| 70 #include "PopupMenuClient.h" | 71 #include "PopupMenuClient.h" |
| 71 #if defined(OS_WIN) | 72 #if defined(OS_WIN) |
| 72 #include "RenderThemeChromiumWin.h" | 73 #include "RenderThemeChromiumWin.h" |
| 73 #else | 74 #else |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 using WebKit::WebSize; | 128 using WebKit::WebSize; |
| 128 | 129 |
| 129 // Change the text zoom level by kTextSizeMultiplierRatio each time the user | 130 // Change the text zoom level by kTextSizeMultiplierRatio each time the user |
| 130 // zooms text in or out (ie., change by 20%). The min and max values limit | 131 // zooms text in or out (ie., change by 20%). The min and max values limit |
| 131 // text zoom to half and 3x the original text size. These three values match | 132 // text zoom to half and 3x the original text size. These three values match |
| 132 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm | 133 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm |
| 133 static const double kTextSizeMultiplierRatio = 1.2; | 134 static const double kTextSizeMultiplierRatio = 1.2; |
| 134 static const double kMinTextSizeMultiplier = 0.5; | 135 static const double kMinTextSizeMultiplier = 0.5; |
| 135 static const double kMaxTextSizeMultiplier = 3.0; | 136 static const double kMaxTextSizeMultiplier = 3.0; |
| 136 | 137 |
| 138 // The group name identifies a namespace of pages. Page group is used on OSX |
| 139 // for some programs that use HTML views to display things that don't seem like |
| 140 // web pages to the user (so shouldn't have visited link coloring). We only use |
| 141 // one page group. |
| 142 static const char* kPageGroupName = "default"; |
| 143 |
| 137 // The webcore drag operation type when something is trying to be dropped on | 144 // The webcore drag operation type when something is trying to be dropped on |
| 138 // the webview. These values are taken from Apple's windows port. | 145 // the webview. These values are taken from Apple's windows port. |
| 139 static const WebCore::DragOperation kDropTargetOperation = | 146 static const WebCore::DragOperation kDropTargetOperation = |
| 140 static_cast<WebCore::DragOperation>(DragOperationCopy | DragOperationLink); | 147 static_cast<WebCore::DragOperation>(DragOperationCopy | DragOperationLink); |
| 141 | 148 |
| 142 // AutocompletePopupMenuClient | 149 // AutocompletePopupMenuClient |
| 143 class AutocompletePopupMenuClient : public WebCore::PopupMenuClient { | 150 class AutocompletePopupMenuClient : public WebCore::PopupMenuClient { |
| 144 public: | 151 public: |
| 145 AutocompletePopupMenuClient(WebViewImpl* webview) : text_field_(NULL), | 152 AutocompletePopupMenuClient(WebViewImpl* webview) : text_field_(NULL), |
| 146 selected_index_(0), | 153 selected_index_(0), |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 new WebDevToolsAgentImpl(instance, tools_delegate)); | 336 new WebDevToolsAgentImpl(instance, tools_delegate)); |
| 330 } | 337 } |
| 331 | 338 |
| 332 // Restrict the access to the local file system | 339 // Restrict the access to the local file system |
| 333 // (see WebView.mm WebView::_commonInitializationWithFrameName). | 340 // (see WebView.mm WebView::_commonInitializationWithFrameName). |
| 334 FrameLoader::setLocalLoadPolicy( | 341 FrameLoader::setLocalLoadPolicy( |
| 335 FrameLoader::AllowLocalLoadsForLocalOnly); | 342 FrameLoader::AllowLocalLoadsForLocalOnly); |
| 336 return instance; | 343 return instance; |
| 337 } | 344 } |
| 338 | 345 |
| 346 // static |
| 347 void WebView::UpdateVisitedLinkState(uint64 link_hash) { |
| 348 WebCore::Page::visitedStateChanged( |
| 349 WebCore::PageGroup::pageGroup(kPageGroupName), link_hash); |
| 350 } |
| 351 |
| 352 // static |
| 353 void WebView::ResetVisitedLinkState() { |
| 354 WebCore::Page::allVisitedStateChanged( |
| 355 WebCore::PageGroup::pageGroup(kPageGroupName)); |
| 356 } |
| 357 |
| 358 |
| 339 WebViewImpl::WebViewImpl() | 359 WebViewImpl::WebViewImpl() |
| 340 : ALLOW_THIS_IN_INITIALIZER_LIST(back_forward_list_client_impl_(this)), | 360 : ALLOW_THIS_IN_INITIALIZER_LIST(back_forward_list_client_impl_(this)), |
| 341 observed_new_navigation_(false), | 361 observed_new_navigation_(false), |
| 342 #ifndef NDEBUG | 362 #ifndef NDEBUG |
| 343 new_navigation_loader_(NULL), | 363 new_navigation_loader_(NULL), |
| 344 #endif | 364 #endif |
| 345 zoom_level_(0), | 365 zoom_level_(0), |
| 346 context_menu_allowed_(false), | 366 context_menu_allowed_(false), |
| 347 doing_drag_and_drop_(false), | 367 doing_drag_and_drop_(false), |
| 348 ignore_input_events_(false), | 368 ignore_input_events_(false), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 364 last_mouse_position_ = WebPoint(-1, -1); | 384 last_mouse_position_ = WebPoint(-1, -1); |
| 365 | 385 |
| 366 // the page will take ownership of the various clients | 386 // the page will take ownership of the various clients |
| 367 page_.reset(new Page(new ChromeClientImpl(this), | 387 page_.reset(new Page(new ChromeClientImpl(this), |
| 368 new ContextMenuClientImpl(this), | 388 new ContextMenuClientImpl(this), |
| 369 new EditorClientImpl(this), | 389 new EditorClientImpl(this), |
| 370 new DragClientImpl(this), | 390 new DragClientImpl(this), |
| 371 new WebInspectorClient(this))); | 391 new WebInspectorClient(this))); |
| 372 | 392 |
| 373 page_->backForwardList()->setClient(&back_forward_list_client_impl_); | 393 page_->backForwardList()->setClient(&back_forward_list_client_impl_); |
| 374 | 394 page_->setGroupName(kPageGroupName); |
| 375 // The group name identifies a namespace of pages. I'm not sure how it's | |
| 376 // intended to be used, but keeping all pages in the same group works for us. | |
| 377 page_->setGroupName("default"); | |
| 378 } | 395 } |
| 379 | 396 |
| 380 WebViewImpl::~WebViewImpl() { | 397 WebViewImpl::~WebViewImpl() { |
| 381 DCHECK(page_ == NULL); | 398 DCHECK(page_ == NULL); |
| 382 ReleaseFocusReferences(); | 399 ReleaseFocusReferences(); |
| 383 for (std::set<ImageResourceFetcher*>::iterator i = image_fetchers_.begin(); | 400 for (std::set<ImageResourceFetcher*>::iterator i = image_fetchers_.begin(); |
| 384 i != image_fetchers_.end(); ++i) { | 401 i != image_fetchers_.end(); ++i) { |
| 385 delete *i; | 402 delete *i; |
| 386 } | 403 } |
| 387 } | 404 } |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 | 1957 |
| 1941 return document->focusedNode(); | 1958 return document->focusedNode(); |
| 1942 } | 1959 } |
| 1943 | 1960 |
| 1944 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { | 1961 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { |
| 1945 IntPoint doc_point( | 1962 IntPoint doc_point( |
| 1946 page_->mainFrame()->view()->windowToContents(pos)); | 1963 page_->mainFrame()->view()->windowToContents(pos)); |
| 1947 return page_->mainFrame()->eventHandler()-> | 1964 return page_->mainFrame()->eventHandler()-> |
| 1948 hitTestResultAtPoint(doc_point, false); | 1965 hitTestResultAtPoint(doc_point, false); |
| 1949 } | 1966 } |
| OLD | NEW |