OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 { | 394 { |
395 DEFINE_STATIC_LOCAL(HashSet<WebViewImpl*>, allInstances, ()); | 395 DEFINE_STATIC_LOCAL(HashSet<WebViewImpl*>, allInstances, ()); |
396 return allInstances; | 396 return allInstances; |
397 } | 397 } |
398 | 398 |
399 WebViewImpl::WebViewImpl(WebViewClient* client) | 399 WebViewImpl::WebViewImpl(WebViewClient* client) |
400 : m_client(client) | 400 : m_client(client) |
401 , m_spellCheckClient(nullptr) | 401 , m_spellCheckClient(nullptr) |
402 , m_chromeClientImpl(ChromeClientImpl::create(this)) | 402 , m_chromeClientImpl(ChromeClientImpl::create(this)) |
403 , m_contextMenuClientImpl(this) | 403 , m_contextMenuClientImpl(this) |
404 , m_dragClientImpl(this) | |
405 , m_editorClientImpl(this) | 404 , m_editorClientImpl(this) |
406 , m_spellCheckerClientImpl(this) | 405 , m_spellCheckerClientImpl(this) |
407 , m_storageClientImpl(this) | 406 , m_storageClientImpl(this) |
408 , m_shouldAutoResize(false) | 407 , m_shouldAutoResize(false) |
409 , m_zoomLevel(0) | 408 , m_zoomLevel(0) |
410 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) | 409 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) |
411 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) | 410 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) |
412 , m_zoomFactorForDeviceScaleFactor(0.f) | 411 , m_zoomFactorForDeviceScaleFactor(0.f) |
413 , m_maximumLegibleScale(1) | 412 , m_maximumLegibleScale(1) |
414 , m_doubleTapZoomPageScaleFactor(0) | 413 , m_doubleTapZoomPageScaleFactor(0) |
(...skipping 28 matching lines...) Expand all Loading... |
443 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) | 442 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) |
444 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) | 443 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) |
445 , m_displayMode(WebDisplayModeBrowser) | 444 , m_displayMode(WebDisplayModeBrowser) |
446 , m_elasticOverscroll(FloatSize()) | 445 , m_elasticOverscroll(FloatSize()) |
447 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr
eateWebViewScheduler(this).release())) | 446 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr
eateWebViewScheduler(this).release())) |
448 { | 447 { |
449 Page::PageClients pageClients; | 448 Page::PageClients pageClients; |
450 pageClients.chromeClient = m_chromeClientImpl.get(); | 449 pageClients.chromeClient = m_chromeClientImpl.get(); |
451 pageClients.contextMenuClient = &m_contextMenuClientImpl; | 450 pageClients.contextMenuClient = &m_contextMenuClientImpl; |
452 pageClients.editorClient = &m_editorClientImpl; | 451 pageClients.editorClient = &m_editorClientImpl; |
453 pageClients.dragClient = &m_dragClientImpl; | |
454 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; | 452 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; |
455 | 453 |
456 m_page = Page::createOrdinary(pageClients); | 454 m_page = Page::createOrdinary(pageClients); |
457 MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl); | 455 MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl); |
458 provideSpeechRecognitionTo(*m_page, SpeechRecognitionClientProxy::create(cli
ent ? client->speechRecognizer() : nullptr)); | 456 provideSpeechRecognitionTo(*m_page, SpeechRecognitionClientProxy::create(cli
ent ? client->speechRecognizer() : nullptr)); |
459 provideContextFeaturesTo(*m_page, ContextFeaturesClientImpl::create()); | 457 provideContextFeaturesTo(*m_page, ContextFeaturesClientImpl::create()); |
460 provideDatabaseClientTo(*m_page, DatabaseClientImpl::create()); | 458 provideDatabaseClientTo(*m_page, DatabaseClientImpl::create()); |
461 | 459 |
462 provideStorageQuotaClientTo(*m_page, StorageQuotaClientImpl::create()); | 460 provideStorageQuotaClientTo(*m_page, StorageQuotaClientImpl::create()); |
463 m_page->setValidationMessageClient(ValidationMessageClientImpl::create(*this
)); | 461 m_page->setValidationMessageClient(ValidationMessageClientImpl::create(*this
)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 // If there is a popup open, close it as the user is clicking on the page | 527 // If there is a popup open, close it as the user is clicking on the page |
530 // (outside of the popup). We also save it so we can prevent a click on an | 528 // (outside of the popup). We also save it so we can prevent a click on an |
531 // element from immediately reopening the same popup. | 529 // element from immediately reopening the same popup. |
532 RefPtr<WebPagePopupImpl> pagePopup; | 530 RefPtr<WebPagePopupImpl> pagePopup; |
533 if (event.button == WebMouseEvent::ButtonLeft) { | 531 if (event.button == WebMouseEvent::ButtonLeft) { |
534 pagePopup = m_pagePopup; | 532 pagePopup = m_pagePopup; |
535 hidePopups(); | 533 hidePopups(); |
536 DCHECK(!m_pagePopup); | 534 DCHECK(!m_pagePopup); |
537 } | 535 } |
538 | 536 |
539 m_lastMouseDownPoint = WebPoint(event.x, event.y); | |
540 | |
541 // Take capture on a mouse down on a plugin so we can send it mouse events. | 537 // Take capture on a mouse down on a plugin so we can send it mouse events. |
542 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 538 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
543 // capture because it will interfere with the scrollbar receiving events. | 539 // capture because it will interfere with the scrollbar receiving events. |
544 IntPoint point(event.x, event.y); | 540 IntPoint point(event.x, event.y); |
545 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca
lFrame()) { | 541 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca
lFrame()) { |
546 point = m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(
point); | 542 point = m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(
point); |
547 HitTestResult result(m_page->deprecatedLocalMainFrame()->eventHandler().
hitTestResultAtPoint(point)); | 543 HitTestResult result(m_page->deprecatedLocalMainFrame()->eventHandler().
hitTestResultAtPoint(point)); |
548 result.setToShadowHostIfInUserAgentShadowRoot(); | 544 result.setToShadowHostIfInUserAgentShadowRoot(); |
549 Node* hitNode = result.innerNodeOrImageMapImage(); | 545 Node* hitNode = result.innerNodeOrImageMapImage(); |
550 | 546 |
(...skipping 4044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4595 { | 4591 { |
4596 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4592 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4597 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4593 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4598 if (!page()) | 4594 if (!page()) |
4599 return 1; | 4595 return 1; |
4600 | 4596 |
4601 return page()->deviceScaleFactor(); | 4597 return page()->deviceScaleFactor(); |
4602 } | 4598 } |
4603 | 4599 |
4604 } // namespace blink | 4600 } // namespace blink |
OLD | NEW |