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 paintTree(); |
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 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); | 2989 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.PrePaint.UpdateTime"); |
2991 | 2990 |
2992 if (!m_paintController) | 2991 if (!m_paintController) |
2993 m_paintController = PaintController::create(); | 2992 m_paintController = PaintController::create(); |
2994 | 2993 |
2995 forAllNonThrottledFrameViews([](FrameView& frameView) { | 2994 forAllNonThrottledFrameViews([](FrameView& frameView) { |
2996 frameView.lifecycle().advanceTo(DocumentLifecycle::InPrePaint); | 2995 frameView.lifecycle().advanceTo(DocumentLifecycle::InPrePaint); |
2997 }); | 2996 }); |
2998 | 2997 |
2999 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) | 2998 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
3000 PrePaintTreeWalk().walk(*this); | 2999 PrePaintTreeWalk().walk(*this); |
3001 | 3000 |
3002 forAllNonThrottledFrameViews([](FrameView& frameView) { | 3001 forAllNonThrottledFrameViews([](FrameView& frameView) { |
3003 frameView.lifecycle().advanceTo(DocumentLifecycle::PrePaintClean); | 3002 frameView.lifecycle().advanceTo(DocumentLifecycle::PrePaintClean); |
3004 }); | 3003 }); |
3005 } | 3004 } |
3006 | 3005 |
3007 void FrameView::synchronizedPaint() { | 3006 void FrameView::paintTree() { |
3008 TRACE_EVENT0("blink", "FrameView::synchronizedPaint"); | 3007 TRACE_EVENT0("blink", "FrameView::paintTree"); |
3009 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); | 3008 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); |
3010 | 3009 |
3011 ASSERT(frame() == page()->mainFrame() || | 3010 ASSERT(frame() == page()->mainFrame() || |
3012 (!frame().tree().parent()->isLocalFrame())); | 3011 (!frame().tree().parent()->isLocalFrame())); |
3013 | 3012 |
3014 LayoutViewItem view = layoutViewItem(); | 3013 LayoutViewItem view = layoutViewItem(); |
3015 ASSERT(!view.isNull()); | 3014 ASSERT(!view.isNull()); |
3016 forAllNonThrottledFrameViews([](FrameView& frameView) { | 3015 forAllNonThrottledFrameViews([](FrameView& frameView) { |
3017 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint); | 3016 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint); |
3018 }); | 3017 }); |
3019 | 3018 |
3020 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 3019 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
3021 if (layoutView()->layer()->needsRepaint()) { | 3020 if (layoutView()->layer()->needsRepaint()) { |
3022 GraphicsContext graphicsContext(*m_paintController); | 3021 GraphicsContext graphicsContext(*m_paintController); |
3023 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect())); | 3022 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect())); |
3024 m_paintController->commitNewDisplayItems(LayoutSize()); | 3023 m_paintController->commitNewDisplayItems(LayoutSize()); |
3025 } | 3024 } |
3026 } else { | 3025 } else { |
3027 // A null graphics layer can occur for painting of SVG images that are not | 3026 // A null graphics layer can occur for painting of SVG images that are not |
3028 // parented into the main frame tree, or when the FrameView is the main | 3027 // parented into the main frame tree, or when the FrameView is the main |
3029 // frame view of a page overlay. The page overlay is in the layer tree of | 3028 // frame view of a page overlay. The page overlay is in the layer tree of |
3030 // the host page and will be painted during synchronized painting of the | 3029 // the host page and will be painted during painting of the host page. |
3031 // host page. | |
3032 if (GraphicsLayer* rootGraphicsLayer = | 3030 if (GraphicsLayer* rootGraphicsLayer = |
3033 view.compositor()->rootGraphicsLayer()) { | 3031 view.compositor()->rootGraphicsLayer()) { |
3034 synchronizedPaintRecursively(rootGraphicsLayer); | 3032 paintGraphicsLayerRecursively(rootGraphicsLayer); |
3035 } | 3033 } |
3036 | 3034 |
3037 // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some | 3035 // TODO(sataya.m):Main frame doesn't create RootFrameViewport in some |
3038 // webkit_unit_tests (http://crbug.com/644788). | 3036 // webkit_unit_tests (http://crbug.com/644788). |
3039 if (m_viewportScrollableArea) { | 3037 if (m_viewportScrollableArea) { |
3040 if (GraphicsLayer* layerForHorizontalScrollbar = | 3038 if (GraphicsLayer* layerForHorizontalScrollbar = |
3041 m_viewportScrollableArea->layerForHorizontalScrollbar()) { | 3039 m_viewportScrollableArea->layerForHorizontalScrollbar()) { |
3042 synchronizedPaintRecursively(layerForHorizontalScrollbar); | 3040 paintGraphicsLayerRecursively(layerForHorizontalScrollbar); |
3043 } | 3041 } |
3044 if (GraphicsLayer* layerForVerticalScrollbar = | 3042 if (GraphicsLayer* layerForVerticalScrollbar = |
3045 m_viewportScrollableArea->layerForVerticalScrollbar()) { | 3043 m_viewportScrollableArea->layerForVerticalScrollbar()) { |
3046 synchronizedPaintRecursively(layerForVerticalScrollbar); | 3044 paintGraphicsLayerRecursively(layerForVerticalScrollbar); |
3047 } | 3045 } |
3048 if (GraphicsLayer* layerForScrollCorner = | 3046 if (GraphicsLayer* layerForScrollCorner = |
3049 m_viewportScrollableArea->layerForScrollCorner()) { | 3047 m_viewportScrollableArea->layerForScrollCorner()) { |
3050 synchronizedPaintRecursively(layerForScrollCorner); | 3048 paintGraphicsLayerRecursively(layerForScrollCorner); |
3051 } | 3049 } |
3052 } | 3050 } |
3053 } | 3051 } |
3054 | 3052 |
3055 forAllNonThrottledFrameViews([](FrameView& frameView) { | 3053 forAllNonThrottledFrameViews([](FrameView& frameView) { |
3056 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); | 3054 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); |
3057 LayoutViewItem layoutViewItem = frameView.layoutViewItem(); | 3055 LayoutViewItem layoutViewItem = frameView.layoutViewItem(); |
3058 if (!layoutViewItem.isNull()) | 3056 if (!layoutViewItem.isNull()) |
3059 layoutViewItem.layer()->clearNeedsRepaintRecursively(); | 3057 layoutViewItem.layer()->clearNeedsRepaintRecursively(); |
3060 }); | 3058 }); |
3061 } | 3059 } |
3062 | 3060 |
3063 void FrameView::synchronizedPaintRecursively(GraphicsLayer* graphicsLayer) { | 3061 void FrameView::paintGraphicsLayerRecursively(GraphicsLayer* graphicsLayer) { |
3064 if (graphicsLayer->drawsContent()) | 3062 if (graphicsLayer->drawsContent()) |
3065 graphicsLayer->paint(nullptr); | 3063 graphicsLayer->paint(nullptr); |
3066 | 3064 |
3067 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 3065 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
3068 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer()) | 3066 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer()) |
3069 synchronizedPaintRecursively(maskLayer); | 3067 paintGraphicsLayerRecursively(maskLayer); |
3070 if (GraphicsLayer* contentsClippingMaskLayer = | 3068 if (GraphicsLayer* contentsClippingMaskLayer = |
3071 graphicsLayer->contentsClippingMaskLayer()) | 3069 graphicsLayer->contentsClippingMaskLayer()) |
3072 synchronizedPaintRecursively(contentsClippingMaskLayer); | 3070 paintGraphicsLayerRecursively(contentsClippingMaskLayer); |
3073 } | 3071 } |
3074 | 3072 |
3075 for (auto& child : graphicsLayer->children()) | 3073 for (auto& child : graphicsLayer->children()) |
3076 synchronizedPaintRecursively(child); | 3074 paintGraphicsLayerRecursively(child); |
3077 } | 3075 } |
3078 | 3076 |
3079 void FrameView::pushPaintArtifactToCompositor() { | 3077 void FrameView::pushPaintArtifactToCompositor() { |
3080 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor"); | 3078 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor"); |
3081 | 3079 |
3082 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 3080 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
3083 | 3081 |
3084 Page* page = frame().page(); | 3082 Page* page = frame().page(); |
3085 if (!page) | 3083 if (!page) |
3086 return; | 3084 return; |
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4917 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; | 4915 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; |
4918 ++reason) { | 4916 ++reason) { |
4919 if (m_mainThreadScrollingReasonsCounter[reason] > 0) { | 4917 if (m_mainThreadScrollingReasonsCounter[reason] > 0) { |
4920 reasons |= 1 << (reason - 1); | 4918 reasons |= 1 << (reason - 1); |
4921 } | 4919 } |
4922 } | 4920 } |
4923 return reasons; | 4921 return reasons; |
4924 } | 4922 } |
4925 | 4923 |
4926 } // namespace blink | 4924 } // namespace blink |
OLD | NEW |