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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 m_maximumLegibleScale(1), | 354 m_maximumLegibleScale(1), |
355 m_doubleTapZoomPageScaleFactor(0), | 355 m_doubleTapZoomPageScaleFactor(0), |
356 m_doubleTapZoomPending(false), | 356 m_doubleTapZoomPending(false), |
357 m_enableFakePageScaleAnimationForTesting(false), | 357 m_enableFakePageScaleAnimationForTesting(false), |
358 m_fakePageScaleAnimationPageScaleFactor(0), | 358 m_fakePageScaleAnimationPageScaleFactor(0), |
359 m_fakePageScaleAnimationUseAnchor(false), | 359 m_fakePageScaleAnimationUseAnchor(false), |
360 m_compositorDeviceScaleFactorOverride(0), | 360 m_compositorDeviceScaleFactorOverride(0), |
361 m_suppressNextKeypressEvent(false), | 361 m_suppressNextKeypressEvent(false), |
362 m_imeAcceptEvents(true), | 362 m_imeAcceptEvents(true), |
363 m_devToolsEmulator(nullptr), | 363 m_devToolsEmulator(nullptr), |
364 m_needsUpdatePageOverlays(false), | |
364 m_isTransparent(false), | 365 m_isTransparent(false), |
365 m_tabsToLinks(false), | 366 m_tabsToLinks(false), |
366 m_layerTreeView(nullptr), | 367 m_layerTreeView(nullptr), |
367 m_rootLayer(nullptr), | 368 m_rootLayer(nullptr), |
368 m_rootGraphicsLayer(nullptr), | 369 m_rootGraphicsLayer(nullptr), |
369 m_visualViewportContainerLayer(nullptr), | 370 m_visualViewportContainerLayer(nullptr), |
370 m_matchesHeuristicsForGpuRasterization(false), | 371 m_matchesHeuristicsForGpuRasterization(false), |
371 m_flingModifier(0), | 372 m_flingModifier(0), |
372 m_flingSourceDevice(WebGestureDeviceUninitialized), | 373 m_flingSourceDevice(WebGestureDeviceUninitialized), |
373 m_fullscreenController(FullscreenController::create(this)), | 374 m_fullscreenController(FullscreenController::create(this)), |
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1990 if (!mainFrameImpl()) | 1991 if (!mainFrameImpl()) |
1991 return; | 1992 return; |
1992 | 1993 |
1993 DocumentLifecycle::AllowThrottlingScope throttlingScope( | 1994 DocumentLifecycle::AllowThrottlingScope throttlingScope( |
1994 mainFrameImpl()->frame()->document()->lifecycle()); | 1995 mainFrameImpl()->frame()->document()->lifecycle()); |
1995 updateLayerTreeBackgroundColor(); | 1996 updateLayerTreeBackgroundColor(); |
1996 | 1997 |
1997 PageWidgetDelegate::updateAllLifecyclePhases(*m_page, | 1998 PageWidgetDelegate::updateAllLifecyclePhases(*m_page, |
1998 *mainFrameImpl()->frame()); | 1999 *mainFrameImpl()->frame()); |
1999 | 2000 |
2001 // This needs to run after the compositing update. | |
2002 updatePageOverlays(); | |
bokan
2017/03/06 16:17:18
I think there's ways for compositing to be run wit
skobes
2017/03/06 22:44:23
Done, although doing this from WebViewImpl::layout
| |
2000 if (InspectorOverlay* overlay = inspectorOverlay()) { | 2003 if (InspectorOverlay* overlay = inspectorOverlay()) { |
2001 overlay->updateAllLifecyclePhases(); | 2004 overlay->updateAllLifecyclePhases(); |
2002 // TODO(chrishtr): integrate paint into the overlay's lifecycle. | 2005 // TODO(chrishtr): integrate paint into the overlay's lifecycle. |
2003 if (overlay->pageOverlay() && overlay->pageOverlay()->graphicsLayer()) | 2006 if (overlay->pageOverlay() && overlay->pageOverlay()->graphicsLayer()) |
2004 overlay->pageOverlay()->graphicsLayer()->paint(nullptr); | 2007 overlay->pageOverlay()->graphicsLayer()->paint(nullptr); |
2005 } | 2008 } |
2006 if (m_pageColorOverlay) | 2009 if (m_pageColorOverlay) |
2007 m_pageColorOverlay->graphicsLayer()->paint(nullptr); | 2010 m_pageColorOverlay->graphicsLayer()->paint(nullptr); |
2008 | 2011 |
2009 // TODO(chrishtr): link highlights don't currently paint themselves, it's | 2012 // TODO(chrishtr): link highlights don't currently paint themselves, it's |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3675 | 3678 |
3676 FrameView* view = webframe->frame()->view(); | 3679 FrameView* view = webframe->frame()->view(); |
3677 | 3680 |
3678 postLayoutResize(webframe); | 3681 postLayoutResize(webframe); |
3679 | 3682 |
3680 // Relayout immediately to avoid violating the rule that needsLayout() | 3683 // Relayout immediately to avoid violating the rule that needsLayout() |
3681 // isn't set at the end of a layout. | 3684 // isn't set at the end of a layout. |
3682 if (view->needsLayout()) | 3685 if (view->needsLayout()) |
3683 view->layout(); | 3686 view->layout(); |
3684 | 3687 |
3685 updatePageOverlays(); | 3688 m_needsUpdatePageOverlays = true; |
3686 | 3689 |
3687 m_fullscreenController->didUpdateLayout(); | 3690 m_fullscreenController->didUpdateLayout(); |
3688 m_client->didUpdateLayout(); | 3691 m_client->didUpdateLayout(); |
3689 } | 3692 } |
3690 | 3693 |
3691 void WebViewImpl::didChangeContentsSize() { | 3694 void WebViewImpl::didChangeContentsSize() { |
3692 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), | 3695 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), |
3693 pageScaleFactor()); | 3696 pageScaleFactor()); |
3694 } | 3697 } |
3695 | 3698 |
(...skipping 24 matching lines...) Expand all Loading... | |
3720 | 3723 |
3721 void WebViewImpl::setPageOverlayColor(WebColor color) { | 3724 void WebViewImpl::setPageOverlayColor(WebColor color) { |
3722 if (m_pageColorOverlay) | 3725 if (m_pageColorOverlay) |
3723 m_pageColorOverlay.reset(); | 3726 m_pageColorOverlay.reset(); |
3724 | 3727 |
3725 if (color == Color::transparent) | 3728 if (color == Color::transparent) |
3726 return; | 3729 return; |
3727 | 3730 |
3728 m_pageColorOverlay = PageOverlay::create( | 3731 m_pageColorOverlay = PageOverlay::create( |
3729 mainFrameImpl(), WTF::makeUnique<ColorOverlay>(color)); | 3732 mainFrameImpl(), WTF::makeUnique<ColorOverlay>(color)); |
3730 m_pageColorOverlay->update(); | 3733 m_needsUpdatePageOverlays = true; |
3731 } | 3734 } |
3732 | 3735 |
3733 WebPageImportanceSignals* WebViewImpl::pageImportanceSignals() { | 3736 WebPageImportanceSignals* WebViewImpl::pageImportanceSignals() { |
3734 return &m_pageImportanceSignals; | 3737 return &m_pageImportanceSignals; |
3735 } | 3738 } |
3736 | 3739 |
3737 Element* WebViewImpl::focusedElement() const { | 3740 Element* WebViewImpl::focusedElement() const { |
3738 LocalFrame* frame = m_page->focusController().focusedFrame(); | 3741 LocalFrame* frame = m_page->focusController().focusedFrame(); |
3739 if (!frame) | 3742 if (!frame) |
3740 return nullptr; | 3743 return nullptr; |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4132 | 4135 |
4133 CompositorWorkerProxyClient* WebViewImpl::createCompositorWorkerProxyClient() { | 4136 CompositorWorkerProxyClient* WebViewImpl::createCompositorWorkerProxyClient() { |
4134 return new CompositorWorkerProxyClientImpl(&mutator()); | 4137 return new CompositorWorkerProxyClientImpl(&mutator()); |
4135 } | 4138 } |
4136 | 4139 |
4137 AnimationWorkletProxyClient* WebViewImpl::createAnimationWorkletProxyClient() { | 4140 AnimationWorkletProxyClient* WebViewImpl::createAnimationWorkletProxyClient() { |
4138 return new AnimationWorkletProxyClientImpl(&mutator()); | 4141 return new AnimationWorkletProxyClientImpl(&mutator()); |
4139 } | 4142 } |
4140 | 4143 |
4141 void WebViewImpl::updatePageOverlays() { | 4144 void WebViewImpl::updatePageOverlays() { |
4142 if (m_pageColorOverlay) | 4145 if (m_needsUpdatePageOverlays) { |
4143 m_pageColorOverlay->update(); | 4146 if (m_pageColorOverlay) |
4144 if (InspectorOverlay* overlay = inspectorOverlay()) { | 4147 m_pageColorOverlay->update(); |
4145 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); | 4148 if (InspectorOverlay* overlay = inspectorOverlay()) { |
4146 if (inspectorPageOverlay) | 4149 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4147 inspectorPageOverlay->update(); | 4150 if (inspectorPageOverlay) |
4151 inspectorPageOverlay->update(); | |
4152 } | |
4153 m_needsUpdatePageOverlays = false; | |
4148 } | 4154 } |
4149 } | 4155 } |
4150 | 4156 |
4151 float WebViewImpl::deviceScaleFactor() const { | 4157 float WebViewImpl::deviceScaleFactor() const { |
4152 // TODO(oshima): Investigate if this should return the ScreenInfo's scale | 4158 // TODO(oshima): Investigate if this should return the ScreenInfo's scale |
4153 // factor rather than page's scale factor, which can be 1 in use-zoom-for-dsf | 4159 // factor rather than page's scale factor, which can be 1 in use-zoom-for-dsf |
4154 // mode. | 4160 // mode. |
4155 if (!page()) | 4161 if (!page()) |
4156 return 1; | 4162 return 1; |
4157 | 4163 |
4158 return page()->deviceScaleFactorDeprecated(); | 4164 return page()->deviceScaleFactorDeprecated(); |
4159 } | 4165 } |
4160 | 4166 |
4161 LocalFrame* WebViewImpl::focusedLocalFrameInWidget() const { | 4167 LocalFrame* WebViewImpl::focusedLocalFrameInWidget() const { |
4162 if (!mainFrameImpl()) | 4168 if (!mainFrameImpl()) |
4163 return nullptr; | 4169 return nullptr; |
4164 | 4170 |
4165 LocalFrame* focusedFrame = toLocalFrame(focusedCoreFrame()); | 4171 LocalFrame* focusedFrame = toLocalFrame(focusedCoreFrame()); |
4166 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4172 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4167 return nullptr; | 4173 return nullptr; |
4168 return focusedFrame; | 4174 return focusedFrame; |
4169 } | 4175 } |
4170 | 4176 |
4171 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4177 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4172 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4178 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4173 } | 4179 } |
4174 | 4180 |
4175 } // namespace blink | 4181 } // namespace blink |
OLD | NEW |