| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 2923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2934 | 2934 |
| 2935 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 2935 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 2936 if (view.compositor()->inCompositingMode()) | 2936 if (view.compositor()->inCompositingMode()) |
| 2937 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | 2937 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
| 2938 } | 2938 } |
| 2939 | 2939 |
| 2940 updateCompositedSelectionIfNeeded(); | 2940 updateCompositedSelectionIfNeeded(); |
| 2941 } | 2941 } |
| 2942 } | 2942 } |
| 2943 | 2943 |
| 2944 if (targetState >= DocumentLifecycle::PrePaintClean) { | 2944 if (targetState >= DocumentLifecycle::PrePaintClean) |
| 2945 updatePaintProperties(); | 2945 prePaint(); |
| 2946 } | |
| 2947 | 2946 |
| 2948 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 2947 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 2949 DocumentAnimations::updateAnimations(layoutView()->document()); | 2948 DocumentAnimations::updateAnimations(layoutView()->document()); |
| 2950 | 2949 |
| 2951 if (targetState == DocumentLifecycle::PaintClean) { | 2950 if (targetState == DocumentLifecycle::PaintClean) { |
| 2952 if (!m_frame->document()->printing()) | 2951 if (!m_frame->document()->printing()) |
| 2953 synchronizedPaint(); | 2952 paint(); |
| 2954 | 2953 |
| 2955 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 2954 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 2956 pushPaintArtifactToCompositor(); | 2955 pushPaintArtifactToCompositor(); |
| 2957 | 2956 |
| 2958 DCHECK(!view.hasPendingSelection()); | 2957 DCHECK(!view.hasPendingSelection()); |
| 2959 DCHECK((m_frame->document()->printing() && | 2958 DCHECK((m_frame->document()->printing() && |
| 2960 lifecycle().state() == DocumentLifecycle::PrePaintClean) || | 2959 lifecycle().state() == DocumentLifecycle::PrePaintClean) || |
| 2961 lifecycle().state() == DocumentLifecycle::PaintClean); | 2960 lifecycle().state() == DocumentLifecycle::PaintClean); |
| 2962 } | 2961 } |
| 2963 | 2962 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2978 void FrameView::performScrollAnchoringAdjustments() { | 2977 void FrameView::performScrollAnchoringAdjustments() { |
| 2979 for (WeakMember<ScrollableArea>& scroller : m_anchoringAdjustmentQueue) { | 2978 for (WeakMember<ScrollableArea>& scroller : m_anchoringAdjustmentQueue) { |
| 2980 if (scroller) { | 2979 if (scroller) { |
| 2981 DCHECK(scroller->scrollAnchor()); | 2980 DCHECK(scroller->scrollAnchor()); |
| 2982 scroller->scrollAnchor()->adjust(); | 2981 scroller->scrollAnchor()->adjust(); |
| 2983 } | 2982 } |
| 2984 } | 2983 } |
| 2985 m_anchoringAdjustmentQueue.clear(); | 2984 m_anchoringAdjustmentQueue.clear(); |
| 2986 } | 2985 } |
| 2987 | 2986 |
| 2988 void FrameView::updatePaintProperties() { | 2987 void FrameView::prePaint() { |
| 2989 TRACE_EVENT0("blink", "FrameView::updatePaintProperties"); | 2988 TRACE_EVENT0("blink", "FrameView::prePaint"); |
| 2990 | 2989 |
| 2991 if (!m_paintController) | 2990 if (!m_paintController) |
| 2992 m_paintController = PaintController::create(); | 2991 m_paintController = PaintController::create(); |
| 2993 | 2992 |
| 2994 forAllNonThrottledFrameViews([](FrameView& frameView) { | 2993 forAllNonThrottledFrameViews([](FrameView& frameView) { |
| 2995 frameView.lifecycle().advanceTo(DocumentLifecycle::InPrePaint); | 2994 frameView.lifecycle().advanceTo(DocumentLifecycle::InPrePaint); |
| 2996 }); | 2995 }); |
| 2997 | 2996 |
| 2998 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) | 2997 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| 2999 PrePaintTreeWalk().walk(*this); | 2998 PrePaintTreeWalk().walk(*this); |
| 3000 | 2999 |
| 3001 forAllNonThrottledFrameViews([](FrameView& frameView) { | 3000 forAllNonThrottledFrameViews([](FrameView& frameView) { |
| 3002 frameView.lifecycle().advanceTo(DocumentLifecycle::PrePaintClean); | 3001 frameView.lifecycle().advanceTo(DocumentLifecycle::PrePaintClean); |
| 3003 }); | 3002 }); |
| 3004 } | 3003 } |
| 3005 | 3004 |
| 3006 void FrameView::synchronizedPaint() { | 3005 void FrameView::paint() { |
| 3007 TRACE_EVENT0("blink", "FrameView::synchronizedPaint"); | 3006 TRACE_EVENT0("blink", "FrameView::paint"); |
| 3008 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); | 3007 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); |
| 3009 | 3008 |
| 3010 ASSERT(frame() == page()->mainFrame() || | 3009 ASSERT(frame() == page()->mainFrame() || |
| 3011 (!frame().tree().parent()->isLocalFrame())); | 3010 (!frame().tree().parent()->isLocalFrame())); |
| 3012 | 3011 |
| 3013 LayoutViewItem view = layoutViewItem(); | 3012 LayoutViewItem view = layoutViewItem(); |
| 3014 ASSERT(!view.isNull()); | 3013 ASSERT(!view.isNull()); |
| 3015 forAllNonThrottledFrameViews([](FrameView& frameView) { | 3014 forAllNonThrottledFrameViews([](FrameView& frameView) { |
| 3016 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint); | 3015 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint); |
| 3017 }); | 3016 }); |
| 3018 | 3017 |
| 3019 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 3018 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 3020 if (layoutView()->layer()->needsRepaint()) { | 3019 if (layoutView()->layer()->needsRepaint()) { |
| 3021 GraphicsContext graphicsContext(*m_paintController); | 3020 GraphicsContext graphicsContext(*m_paintController); |
| 3022 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect())); | 3021 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect())); |
| 3023 m_paintController->commitNewDisplayItems(LayoutSize()); | 3022 m_paintController->commitNewDisplayItems(LayoutSize()); |
| 3024 } | 3023 } |
| 3025 } else { | 3024 } else { |
| 3026 // A null graphics layer can occur for painting of SVG images that are not | 3025 // A null graphics layer can occur for painting of SVG images that are not |
| 3027 // parented into the main frame tree, or when the FrameView is the main | 3026 // parented into the main frame tree, or when the FrameView is the main |
| 3028 // frame view of a page overlay. The page overlay is in the layer tree of | 3027 // frame view of a page overlay. The page overlay is in the layer tree of |
| 3029 // the host page and will be painted during synchronized painting of the | 3028 // the host page and will be painted during painting of the host page. |
| 3030 // host page. | |
| 3031 if (GraphicsLayer* rootGraphicsLayer = | 3029 if (GraphicsLayer* rootGraphicsLayer = |
| 3032 view.compositor()->rootGraphicsLayer()) { | 3030 view.compositor()->rootGraphicsLayer()) { |
| 3033 synchronizedPaintRecursively(rootGraphicsLayer); | 3031 paintGraphicsLayerRecursively(rootGraphicsLayer); |
| 3034 } | 3032 } |
| 3035 | 3033 |
| 3036 // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some | 3034 // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some |
| 3037 // webkit_unit_tests (http://crbug.com/644788). | 3035 // webkit_unit_tests (http://crbug.com/644788). |
| 3038 if (m_viewportScrollableArea) { | 3036 if (m_viewportScrollableArea) { |
| 3039 if (GraphicsLayer* layerForHorizontalScrollbar = | 3037 if (GraphicsLayer* layerForHorizontalScrollbar = |
| 3040 m_viewportScrollableArea->layerForHorizontalScrollbar()) { | 3038 m_viewportScrollableArea->layerForHorizontalScrollbar()) { |
| 3041 synchronizedPaintRecursively(layerForHorizontalScrollbar); | 3039 paintGraphicsLayerRecursively(layerForHorizontalScrollbar); |
| 3042 } | 3040 } |
| 3043 if (GraphicsLayer* layerForVerticalScrollbar = | 3041 if (GraphicsLayer* layerForVerticalScrollbar = |
| 3044 m_viewportScrollableArea->layerForVerticalScrollbar()) { | 3042 m_viewportScrollableArea->layerForVerticalScrollbar()) { |
| 3045 synchronizedPaintRecursively(layerForVerticalScrollbar); | 3043 paintGraphicsLayerRecursively(layerForVerticalScrollbar); |
| 3046 } | 3044 } |
| 3047 if (GraphicsLayer* layerForScrollCorner = | 3045 if (GraphicsLayer* layerForScrollCorner = |
| 3048 m_viewportScrollableArea->layerForScrollCorner()) { | 3046 m_viewportScrollableArea->layerForScrollCorner()) { |
| 3049 synchronizedPaintRecursively(layerForScrollCorner); | 3047 paintGraphicsLayerRecursively(layerForScrollCorner); |
| 3050 } | 3048 } |
| 3051 } | 3049 } |
| 3052 } | 3050 } |
| 3053 | 3051 |
| 3054 forAllNonThrottledFrameViews([](FrameView& frameView) { | 3052 forAllNonThrottledFrameViews([](FrameView& frameView) { |
| 3055 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); | 3053 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); |
| 3056 LayoutViewItem layoutViewItem = frameView.layoutViewItem(); | 3054 LayoutViewItem layoutViewItem = frameView.layoutViewItem(); |
| 3057 if (!layoutViewItem.isNull()) | 3055 if (!layoutViewItem.isNull()) |
| 3058 layoutViewItem.layer()->clearNeedsRepaintRecursively(); | 3056 layoutViewItem.layer()->clearNeedsRepaintRecursively(); |
| 3059 }); | 3057 }); |
| 3060 } | 3058 } |
| 3061 | 3059 |
| 3062 void FrameView::synchronizedPaintRecursively(GraphicsLayer* graphicsLayer) { | 3060 void FrameView::paintGraphicsLayerRecursively(GraphicsLayer* graphicsLayer) { |
| 3063 if (graphicsLayer->drawsContent()) | 3061 if (graphicsLayer->drawsContent()) |
| 3064 graphicsLayer->paint(nullptr); | 3062 graphicsLayer->paint(nullptr); |
| 3065 | 3063 |
| 3066 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 3064 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 3067 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer()) | 3065 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer()) |
| 3068 synchronizedPaintRecursively(maskLayer); | 3066 paintGraphicsLayerRecursively(maskLayer); |
| 3069 if (GraphicsLayer* contentsClippingMaskLayer = | 3067 if (GraphicsLayer* contentsClippingMaskLayer = |
| 3070 graphicsLayer->contentsClippingMaskLayer()) | 3068 graphicsLayer->contentsClippingMaskLayer()) |
| 3071 synchronizedPaintRecursively(contentsClippingMaskLayer); | 3069 paintGraphicsLayerRecursively(contentsClippingMaskLayer); |
| 3072 } | 3070 } |
| 3073 | 3071 |
| 3074 for (auto& child : graphicsLayer->children()) | 3072 for (auto& child : graphicsLayer->children()) |
| 3075 synchronizedPaintRecursively(child); | 3073 paintGraphicsLayerRecursively(child); |
| 3076 } | 3074 } |
| 3077 | 3075 |
| 3078 void FrameView::pushPaintArtifactToCompositor() { | 3076 void FrameView::pushPaintArtifactToCompositor() { |
| 3079 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor"); | 3077 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor"); |
| 3080 | 3078 |
| 3081 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 3079 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 3082 | 3080 |
| 3083 Page* page = frame().page(); | 3081 Page* page = frame().page(); |
| 3084 if (!page) | 3082 if (!page) |
| 3085 return; | 3083 return; |
| (...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4916 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; | 4914 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; |
| 4917 ++reason) { | 4915 ++reason) { |
| 4918 if (m_mainThreadScrollingReasonsCounter[reason] > 0) { | 4916 if (m_mainThreadScrollingReasonsCounter[reason] > 0) { |
| 4919 reasons |= 1 << (reason - 1); | 4917 reasons |= 1 << (reason - 1); |
| 4920 } | 4918 } |
| 4921 } | 4919 } |
| 4922 return reasons; | 4920 return reasons; |
| 4923 } | 4921 } |
| 4924 | 4922 |
| 4925 } // namespace blink | 4923 } // namespace blink |
| OLD | NEW |