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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
353 m_maximumLegibleScale(1), | 353 m_maximumLegibleScale(1), |
354 m_doubleTapZoomPageScaleFactor(0), | 354 m_doubleTapZoomPageScaleFactor(0), |
355 m_doubleTapZoomPending(false), | 355 m_doubleTapZoomPending(false), |
356 m_enableFakePageScaleAnimationForTesting(false), | 356 m_enableFakePageScaleAnimationForTesting(false), |
357 m_fakePageScaleAnimationPageScaleFactor(0), | 357 m_fakePageScaleAnimationPageScaleFactor(0), |
358 m_fakePageScaleAnimationUseAnchor(false), | 358 m_fakePageScaleAnimationUseAnchor(false), |
359 m_compositorDeviceScaleFactorOverride(0), | 359 m_compositorDeviceScaleFactorOverride(0), |
360 m_suppressNextKeypressEvent(false), | 360 m_suppressNextKeypressEvent(false), |
361 m_imeAcceptEvents(true), | 361 m_imeAcceptEvents(true), |
362 m_devToolsEmulator(nullptr), | 362 m_devToolsEmulator(nullptr), |
363 m_isTransparent(false), | |
364 m_tabsToLinks(false), | 363 m_tabsToLinks(false), |
365 m_layerTreeView(nullptr), | 364 m_layerTreeView(nullptr), |
366 m_rootLayer(nullptr), | 365 m_rootLayer(nullptr), |
367 m_rootGraphicsLayer(nullptr), | 366 m_rootGraphicsLayer(nullptr), |
368 m_visualViewportContainerLayer(nullptr), | 367 m_visualViewportContainerLayer(nullptr), |
369 m_matchesHeuristicsForGpuRasterization(false), | 368 m_matchesHeuristicsForGpuRasterization(false), |
370 m_flingModifier(0), | 369 m_flingModifier(0), |
371 m_flingSourceDevice(WebGestureDeviceUninitialized), | 370 m_flingSourceDevice(WebGestureDeviceUninitialized), |
372 m_fullscreenController(FullscreenController::create(this)), | 371 m_fullscreenController(FullscreenController::create(this)), |
373 m_baseBackgroundColor(Color::white), | 372 m_baseBackgroundColor(Color::white), |
374 m_baseBackgroundColorOverrideEnabled(false), | 373 m_baseBackgroundColorOverrideEnabled(false), |
375 m_baseBackgroundColorOverride(Color::transparent), | 374 m_baseBackgroundColorOverride(Color::transparent), |
375 m_backgroundColorOverrideEnabled(false), | |
376 m_backgroundColorOverride(Color::transparent), | 376 m_backgroundColorOverride(Color::transparent), |
377 m_zoomFactorOverride(0), | 377 m_zoomFactorOverride(0), |
378 m_userGestureObserved(false), | 378 m_userGestureObserved(false), |
379 m_shouldDispatchFirstVisuallyNonEmptyLayout(false), | 379 m_shouldDispatchFirstVisuallyNonEmptyLayout(false), |
380 m_shouldDispatchFirstLayoutAfterFinishedParsing(false), | 380 m_shouldDispatchFirstLayoutAfterFinishedParsing(false), |
381 m_shouldDispatchFirstLayoutAfterFinishedLoading(false), | 381 m_shouldDispatchFirstLayoutAfterFinishedLoading(false), |
382 m_displayMode(WebDisplayModeBrowser), | 382 m_displayMode(WebDisplayModeBrowser), |
383 m_elasticOverscroll(FloatSize()), | 383 m_elasticOverscroll(FloatSize()), |
384 m_mutator(nullptr), | 384 m_mutator(nullptr), |
385 m_scheduler(WTF::wrapUnique(Platform::current() | 385 m_scheduler(WTF::wrapUnique(Platform::current() |
(...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2438 | 2438 |
2439 FrameSelection& selection = frame->selection(); | 2439 FrameSelection& selection = frame->selection(); |
2440 if (!selection.isAvailable()) { | 2440 if (!selection.isAvailable()) { |
2441 // plugins/mouse-capture-inside-shadow.html reaches here. | 2441 // plugins/mouse-capture-inside-shadow.html reaches here. |
2442 return false; | 2442 return false; |
2443 } | 2443 } |
2444 return selection.computeVisibleSelectionInDOMTreeDeprecated().isBaseFirst(); | 2444 return selection.computeVisibleSelectionInDOMTreeDeprecated().isBaseFirst(); |
2445 } | 2445 } |
2446 | 2446 |
2447 WebColor WebViewImpl::backgroundColor() const { | 2447 WebColor WebViewImpl::backgroundColor() const { |
2448 if (isTransparent()) | 2448 if (m_backgroundColorOverrideEnabled) |
2449 return Color::transparent; | 2449 return m_backgroundColorOverride; |
2450 if (!m_page) | 2450 if (!m_page) |
2451 return baseBackgroundColor().rgb(); | 2451 return baseBackgroundColor().rgb(); |
2452 if (!m_page->mainFrame()) | 2452 if (!m_page->mainFrame()) |
2453 return baseBackgroundColor().rgb(); | 2453 return baseBackgroundColor().rgb(); |
2454 if (!m_page->mainFrame()->isLocalFrame()) | 2454 if (!m_page->mainFrame()->isLocalFrame()) |
2455 return baseBackgroundColor().rgb(); | 2455 return baseBackgroundColor().rgb(); |
2456 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); | 2456 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); |
2457 if (!view) | |
2458 return baseBackgroundColor().rgb(); | |
2457 return view->documentBackgroundColor().rgb(); | 2459 return view->documentBackgroundColor().rgb(); |
2458 } | 2460 } |
2459 | 2461 |
2460 WebPagePopup* WebViewImpl::pagePopup() const { | 2462 WebPagePopup* WebViewImpl::pagePopup() const { |
2461 return m_pagePopup.get(); | 2463 return m_pagePopup.get(); |
2462 } | 2464 } |
2463 | 2465 |
2464 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as | 2466 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as |
2465 // well. This code needs to be refactored (http://crbug.com/629721). | 2467 // well. This code needs to be refactored (http://crbug.com/629721). |
2466 WebRange WebViewImpl::caretOrSelectionRange() { | 2468 WebRange WebViewImpl::caretOrSelectionRange() { |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3509 void WebViewImpl::didCloseContextMenu() { | 3511 void WebViewImpl::didCloseContextMenu() { |
3510 LocalFrame* frame = m_page->focusController().focusedFrame(); | 3512 LocalFrame* frame = m_page->focusController().focusedFrame(); |
3511 if (frame) | 3513 if (frame) |
3512 frame->selection().setCaretBlinkingSuspended(false); | 3514 frame->selection().setCaretBlinkingSuspended(false); |
3513 } | 3515 } |
3514 | 3516 |
3515 void WebViewImpl::hidePopups() { | 3517 void WebViewImpl::hidePopups() { |
3516 cancelPagePopup(); | 3518 cancelPagePopup(); |
3517 } | 3519 } |
3518 | 3520 |
3519 void WebViewImpl::setIsTransparent(bool isTransparent) { | |
3520 // Set any existing frames to be transparent. | |
3521 Frame* frame = m_page->mainFrame(); | |
3522 while (frame) { | |
3523 if (frame->isLocalFrame()) | |
3524 toLocalFrame(frame)->view()->setTransparent(isTransparent); | |
3525 frame = frame->tree().traverseNext(); | |
3526 } | |
3527 | |
3528 // Future frames check this to know whether to be transparent. | |
3529 m_isTransparent = isTransparent; | |
3530 | |
3531 if (m_layerTreeView) | |
3532 m_layerTreeView->setHasTransparentBackground(this->isTransparent()); | |
3533 } | |
3534 | |
3535 bool WebViewImpl::isTransparent() const { | |
3536 return m_isTransparent; | |
3537 } | |
3538 | |
3539 WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController() | 3521 WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController() |
3540 const { | 3522 const { |
3541 return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget()); | 3523 return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget()); |
3542 } | 3524 } |
3543 | 3525 |
3544 Color WebViewImpl::baseBackgroundColor() const { | 3526 Color WebViewImpl::baseBackgroundColor() const { |
3545 return m_baseBackgroundColorOverrideEnabled ? m_baseBackgroundColorOverride | 3527 return m_baseBackgroundColorOverrideEnabled ? m_baseBackgroundColorOverride |
3546 : m_baseBackgroundColor; | 3528 : m_baseBackgroundColor; |
3547 } | 3529 } |
3548 | 3530 |
(...skipping 27 matching lines...) Expand all Loading... | |
3576 mainFrameImpl() | 3558 mainFrameImpl() |
3577 ->frame() | 3559 ->frame() |
3578 ->view() | 3560 ->view() |
3579 ->updateLifecycleToCompositingCleanPlusScrolling(); | 3561 ->updateLifecycleToCompositingCleanPlusScrolling(); |
3580 } | 3562 } |
3581 updateBaseBackgroundColor(); | 3563 updateBaseBackgroundColor(); |
3582 } | 3564 } |
3583 | 3565 |
3584 void WebViewImpl::updateBaseBackgroundColor() { | 3566 void WebViewImpl::updateBaseBackgroundColor() { |
3585 Color color = baseBackgroundColor(); | 3567 Color color = baseBackgroundColor(); |
3586 if (m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()) | 3568 if (m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()) { |
3587 m_page->deprecatedLocalMainFrame()->view()->setBaseBackgroundColor(color); | 3569 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); |
3570 view->setBaseBackgroundColor(color); | |
3571 view->updateBaseBackgroundColorRecursively(color); | |
chrishtr
2017/03/28 19:45:56
Why this new line?
Eric Seckler
2017/03/29 10:50:18
setIsTransparent was previously setting the transp
chrishtr
2017/03/29 15:36:41
Ok.
| |
3572 } | |
3588 } | 3573 } |
3589 | 3574 |
3590 void WebViewImpl::setIsActive(bool active) { | 3575 void WebViewImpl::setIsActive(bool active) { |
3591 if (page()) | 3576 if (page()) |
3592 page()->focusController().setActive(active); | 3577 page()->focusController().setActive(active); |
3593 } | 3578 } |
3594 | 3579 |
3595 bool WebViewImpl::isActive() const { | 3580 bool WebViewImpl::isActive() const { |
3596 return page() ? page()->focusController().isActive() : false; | 3581 return page() ? page()->focusController().isActive() : false; |
3597 } | 3582 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3703 | 3688 |
3704 void WebViewImpl::mainFrameScrollOffsetChanged() { | 3689 void WebViewImpl::mainFrameScrollOffsetChanged() { |
3705 m_devToolsEmulator->mainFrameScrollOrScaleChanged(); | 3690 m_devToolsEmulator->mainFrameScrollOrScaleChanged(); |
3706 } | 3691 } |
3707 | 3692 |
3708 bool WebViewImpl::useExternalPopupMenus() { | 3693 bool WebViewImpl::useExternalPopupMenus() { |
3709 return shouldUseExternalPopupMenus; | 3694 return shouldUseExternalPopupMenus; |
3710 } | 3695 } |
3711 | 3696 |
3712 void WebViewImpl::setBackgroundColorOverride(WebColor color) { | 3697 void WebViewImpl::setBackgroundColorOverride(WebColor color) { |
3698 m_backgroundColorOverrideEnabled = true; | |
3713 m_backgroundColorOverride = color; | 3699 m_backgroundColorOverride = color; |
3714 updateLayerTreeBackgroundColor(); | 3700 updateLayerTreeBackgroundColor(); |
3715 } | 3701 } |
3716 | 3702 |
3703 void WebViewImpl::clearBackgroundColorOverride() { | |
3704 m_backgroundColorOverrideEnabled = false; | |
3705 updateLayerTreeBackgroundColor(); | |
3706 } | |
3707 | |
3717 void WebViewImpl::setZoomFactorOverride(float zoomFactor) { | 3708 void WebViewImpl::setZoomFactorOverride(float zoomFactor) { |
3718 m_zoomFactorOverride = zoomFactor; | 3709 m_zoomFactorOverride = zoomFactor; |
3719 setZoomLevel(zoomLevel()); | 3710 setZoomLevel(zoomLevel()); |
3720 } | 3711 } |
3721 | 3712 |
3722 void WebViewImpl::setPageOverlayColor(WebColor color) { | 3713 void WebViewImpl::setPageOverlayColor(WebColor color) { |
3723 if (m_pageColorOverlay) | 3714 if (m_pageColorOverlay) |
3724 m_pageColorOverlay.reset(); | 3715 m_pageColorOverlay.reset(); |
3725 | 3716 |
3726 if (color == Color::transparent) | 3717 if (color == Color::transparent) |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4016 if (!page() || !m_layerTreeView) | 4007 if (!page() || !m_layerTreeView) |
4017 return; | 4008 return; |
4018 | 4009 |
4019 m_layerTreeView->setPageScaleFactorAndLimits( | 4010 m_layerTreeView->setPageScaleFactorAndLimits( |
4020 pageScaleFactor(), minimumPageScaleFactor(), maximumPageScaleFactor()); | 4011 pageScaleFactor(), minimumPageScaleFactor(), maximumPageScaleFactor()); |
4021 } | 4012 } |
4022 | 4013 |
4023 void WebViewImpl::updateLayerTreeBackgroundColor() { | 4014 void WebViewImpl::updateLayerTreeBackgroundColor() { |
4024 if (!m_layerTreeView) | 4015 if (!m_layerTreeView) |
4025 return; | 4016 return; |
4026 | 4017 m_layerTreeView->setBackgroundColor(backgroundColor()); |
4027 m_layerTreeView->setBackgroundColor(alphaChannel(m_backgroundColorOverride) | |
4028 ? m_backgroundColorOverride | |
4029 : backgroundColor()); | |
4030 } | 4018 } |
4031 | 4019 |
4032 void WebViewImpl::updateLayerTreeDeviceScaleFactor() { | 4020 void WebViewImpl::updateLayerTreeDeviceScaleFactor() { |
4033 DCHECK(page()); | 4021 DCHECK(page()); |
4034 DCHECK(m_layerTreeView); | 4022 DCHECK(m_layerTreeView); |
4035 | 4023 |
4036 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride | 4024 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride |
4037 ? m_compositorDeviceScaleFactorOverride | 4025 ? m_compositorDeviceScaleFactorOverride |
4038 : page()->deviceScaleFactorDeprecated(); | 4026 : page()->deviceScaleFactorDeprecated(); |
4039 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); | 4027 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4173 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4161 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4174 return nullptr; | 4162 return nullptr; |
4175 return focusedFrame; | 4163 return focusedFrame; |
4176 } | 4164 } |
4177 | 4165 |
4178 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4166 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4179 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4167 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4180 } | 4168 } |
4181 | 4169 |
4182 } // namespace blink | 4170 } // namespace blink |
OLD | NEW |