Chromium Code Reviews| 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 m_tabsToLinks(false), | 365 m_tabsToLinks(false), |
| 366 m_layerTreeView(nullptr), | 366 m_layerTreeView(nullptr), |
| 367 m_rootLayer(nullptr), | 367 m_rootLayer(nullptr), |
| 368 m_rootGraphicsLayer(nullptr), | 368 m_rootGraphicsLayer(nullptr), |
| 369 m_visualViewportContainerLayer(nullptr), | 369 m_visualViewportContainerLayer(nullptr), |
| 370 m_matchesHeuristicsForGpuRasterization(false), | 370 m_matchesHeuristicsForGpuRasterization(false), |
| 371 m_flingModifier(0), | 371 m_flingModifier(0), |
| 372 m_flingSourceDevice(WebGestureDeviceUninitialized), | 372 m_flingSourceDevice(WebGestureDeviceUninitialized), |
| 373 m_fullscreenController(FullscreenController::create(this)), | 373 m_fullscreenController(FullscreenController::create(this)), |
| 374 m_baseBackgroundColor(Color::white), | 374 m_baseBackgroundColor(Color::white), |
| 375 m_baseBackgroundColorOverrideEnabled(false), | |
| 375 m_baseBackgroundColorOverride(Color::transparent), | 376 m_baseBackgroundColorOverride(Color::transparent), |
| 376 m_backgroundColorOverride(Color::transparent), | 377 m_backgroundColorOverride(Color::transparent), |
| 377 m_zoomFactorOverride(0), | 378 m_zoomFactorOverride(0), |
| 378 m_userGestureObserved(false), | 379 m_userGestureObserved(false), |
| 379 m_shouldDispatchFirstVisuallyNonEmptyLayout(false), | 380 m_shouldDispatchFirstVisuallyNonEmptyLayout(false), |
| 380 m_shouldDispatchFirstLayoutAfterFinishedParsing(false), | 381 m_shouldDispatchFirstLayoutAfterFinishedParsing(false), |
| 381 m_shouldDispatchFirstLayoutAfterFinishedLoading(false), | 382 m_shouldDispatchFirstLayoutAfterFinishedLoading(false), |
| 382 m_displayMode(WebDisplayModeBrowser), | 383 m_displayMode(WebDisplayModeBrowser), |
| 383 m_elasticOverscroll(FloatSize()), | 384 m_elasticOverscroll(FloatSize()), |
| 384 m_mutator(nullptr), | 385 m_mutator(nullptr), |
| (...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2439 // plugins/mouse-capture-inside-shadow.html reaches here. | 2440 // plugins/mouse-capture-inside-shadow.html reaches here. |
| 2440 return false; | 2441 return false; |
| 2441 } | 2442 } |
| 2442 return selection.computeVisibleSelectionInDOMTreeDeprecated().isBaseFirst(); | 2443 return selection.computeVisibleSelectionInDOMTreeDeprecated().isBaseFirst(); |
| 2443 } | 2444 } |
| 2444 | 2445 |
| 2445 WebColor WebViewImpl::backgroundColor() const { | 2446 WebColor WebViewImpl::backgroundColor() const { |
| 2446 if (isTransparent()) | 2447 if (isTransparent()) |
| 2447 return Color::transparent; | 2448 return Color::transparent; |
| 2448 if (!m_page) | 2449 if (!m_page) |
| 2449 return m_baseBackgroundColor; | 2450 return baseBackgroundColor().rgb(); |
|
dgozman
2017/02/21 19:41:44
Nice one!
Eric Seckler
2017/02/22 09:19:30
yeah ... I should have seen that in the first plac
| |
| 2450 if (!m_page->mainFrame()) | 2451 if (!m_page->mainFrame()) |
| 2451 return m_baseBackgroundColor; | 2452 return baseBackgroundColor().rgb(); |
| 2452 if (!m_page->mainFrame()->isLocalFrame()) | 2453 if (!m_page->mainFrame()->isLocalFrame()) |
| 2453 return m_baseBackgroundColor; | 2454 return baseBackgroundColor().rgb(); |
| 2454 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); | 2455 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); |
| 2455 return view->documentBackgroundColor().rgb(); | 2456 return view->documentBackgroundColor().rgb(); |
| 2456 } | 2457 } |
| 2457 | 2458 |
| 2458 WebPagePopup* WebViewImpl::pagePopup() const { | 2459 WebPagePopup* WebViewImpl::pagePopup() const { |
| 2459 return m_pagePopup.get(); | 2460 return m_pagePopup.get(); |
| 2460 } | 2461 } |
| 2461 | 2462 |
| 2462 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as | 2463 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as |
| 2463 // well. This code needs to be refactored (http://crbug.com/629721). | 2464 // well. This code needs to be refactored (http://crbug.com/629721). |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3523 bool WebViewImpl::isTransparent() const { | 3524 bool WebViewImpl::isTransparent() const { |
| 3524 return m_isTransparent; | 3525 return m_isTransparent; |
| 3525 } | 3526 } |
| 3526 | 3527 |
| 3527 WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController() | 3528 WebInputMethodControllerImpl* WebViewImpl::getActiveWebInputMethodController() |
| 3528 const { | 3529 const { |
| 3529 return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget()); | 3530 return WebInputMethodControllerImpl::fromFrame(focusedLocalFrameInWidget()); |
| 3530 } | 3531 } |
| 3531 | 3532 |
| 3532 Color WebViewImpl::baseBackgroundColor() const { | 3533 Color WebViewImpl::baseBackgroundColor() const { |
| 3533 return alphaChannel(m_baseBackgroundColorOverride) | 3534 return m_baseBackgroundColorOverrideEnabled ? m_baseBackgroundColorOverride |
| 3534 ? m_baseBackgroundColorOverride | 3535 : m_baseBackgroundColor; |
| 3535 : m_baseBackgroundColor; | |
| 3536 } | 3536 } |
| 3537 | 3537 |
| 3538 void WebViewImpl::setBaseBackgroundColor(WebColor color) { | 3538 void WebViewImpl::setBaseBackgroundColor(WebColor color) { |
| 3539 if (m_baseBackgroundColor == color) | 3539 if (m_baseBackgroundColor == color) |
| 3540 return; | 3540 return; |
| 3541 | 3541 |
| 3542 m_baseBackgroundColor = color; | 3542 m_baseBackgroundColor = color; |
| 3543 updateBaseBackgroundColor(); | 3543 updateBaseBackgroundColor(); |
| 3544 } | 3544 } |
| 3545 | 3545 |
| 3546 void WebViewImpl::setBaseBackgroundColorOverride(WebColor color) { | 3546 void WebViewImpl::setBaseBackgroundColorOverride(WebColor color) { |
| 3547 m_baseBackgroundColorOverrideEnabled = true; | |
| 3547 m_baseBackgroundColorOverride = color; | 3548 m_baseBackgroundColorOverride = color; |
| 3548 if (mainFrameImpl()) { | 3549 if (mainFrameImpl()) { |
| 3549 // Force lifecycle update to ensure we're good to call | 3550 // Force lifecycle update to ensure we're good to call |
| 3550 // FrameView::setBaseBackgroundColor(). | 3551 // FrameView::setBaseBackgroundColor(). |
| 3551 mainFrameImpl() | 3552 mainFrameImpl() |
| 3552 ->frame() | 3553 ->frame() |
| 3553 ->view() | 3554 ->view() |
| 3554 ->updateLifecycleToCompositingCleanPlusScrolling(); | 3555 ->updateLifecycleToCompositingCleanPlusScrolling(); |
| 3555 } | 3556 } |
| 3556 updateBaseBackgroundColor(); | 3557 updateBaseBackgroundColor(); |
| 3557 } | 3558 } |
| 3558 | 3559 |
| 3560 void WebViewImpl::clearBaseBackgroundColorOverride() { | |
| 3561 m_baseBackgroundColorOverrideEnabled = false; | |
| 3562 if (mainFrameImpl()) { | |
| 3563 // Force lifecycle update to ensure we're good to call | |
| 3564 // FrameView::setBaseBackgroundColor(). | |
| 3565 mainFrameImpl() | |
| 3566 ->frame() | |
| 3567 ->view() | |
| 3568 ->updateLifecycleToCompositingCleanPlusScrolling(); | |
| 3569 } | |
| 3570 updateBaseBackgroundColor(); | |
| 3571 } | |
| 3572 | |
| 3559 void WebViewImpl::updateBaseBackgroundColor() { | 3573 void WebViewImpl::updateBaseBackgroundColor() { |
| 3560 Color color = baseBackgroundColor(); | 3574 Color color = baseBackgroundColor(); |
| 3561 if (m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()) | 3575 if (m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()) |
| 3562 m_page->deprecatedLocalMainFrame()->view()->setBaseBackgroundColor(color); | 3576 m_page->deprecatedLocalMainFrame()->view()->setBaseBackgroundColor(color); |
| 3563 } | 3577 } |
| 3564 | 3578 |
| 3565 void WebViewImpl::setIsActive(bool active) { | 3579 void WebViewImpl::setIsActive(bool active) { |
| 3566 if (page()) | 3580 if (page()) |
| 3567 page()->focusController().setActive(active); | 3581 page()->focusController().setActive(active); |
| 3568 } | 3582 } |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4142 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4156 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
| 4143 return nullptr; | 4157 return nullptr; |
| 4144 return focusedFrame; | 4158 return focusedFrame; |
| 4145 } | 4159 } |
| 4146 | 4160 |
| 4147 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4161 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
| 4148 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4162 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4149 } | 4163 } |
| 4150 | 4164 |
| 4151 } // namespace blink | 4165 } // namespace blink |
| OLD | NEW |