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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 #include "core/layout/compositing/PaintLayerCompositor.h" | 83 #include "core/layout/compositing/PaintLayerCompositor.h" |
84 #include "core/layout/svg/LayoutSVGRoot.h" | 84 #include "core/layout/svg/LayoutSVGRoot.h" |
85 #include "core/loader/DocumentLoader.h" | 85 #include "core/loader/DocumentLoader.h" |
86 #include "core/loader/FrameLoader.h" | 86 #include "core/loader/FrameLoader.h" |
87 #include "core/loader/FrameLoaderClient.h" | 87 #include "core/loader/FrameLoaderClient.h" |
88 #include "core/page/AutoscrollController.h" | 88 #include "core/page/AutoscrollController.h" |
89 #include "core/page/ChromeClient.h" | 89 #include "core/page/ChromeClient.h" |
90 #include "core/page/FocusController.h" | 90 #include "core/page/FocusController.h" |
91 #include "core/page/FrameTree.h" | 91 #include "core/page/FrameTree.h" |
92 #include "core/page/Page.h" | 92 #include "core/page/Page.h" |
93 #include "core/page/PrintContext.h" | |
93 #include "core/page/scrolling/RootScrollerUtil.h" | 94 #include "core/page/scrolling/RootScrollerUtil.h" |
94 #include "core/page/scrolling/ScrollingCoordinator.h" | 95 #include "core/page/scrolling/ScrollingCoordinator.h" |
95 #include "core/page/scrolling/TopDocumentRootScrollerController.h" | 96 #include "core/page/scrolling/TopDocumentRootScrollerController.h" |
96 #include "core/paint/FramePainter.h" | 97 #include "core/paint/FramePainter.h" |
97 #include "core/paint/PaintLayer.h" | 98 #include "core/paint/PaintLayer.h" |
98 #include "core/paint/PaintTiming.h" | 99 #include "core/paint/PaintTiming.h" |
99 #include "core/paint/PrePaintTreeWalk.h" | 100 #include "core/paint/PrePaintTreeWalk.h" |
100 #include "core/plugins/PluginView.h" | 101 #include "core/plugins/PluginView.h" |
101 #include "core/style/ComputedStyle.h" | 102 #include "core/style/ComputedStyle.h" |
102 #include "core/svg/SVGDocumentExtensions.h" | 103 #include "core/svg/SVGDocumentExtensions.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 visitor->trace(m_fragmentAnchor); | 228 visitor->trace(m_fragmentAnchor); |
228 visitor->trace(m_scrollableAreas); | 229 visitor->trace(m_scrollableAreas); |
229 visitor->trace(m_animatingScrollableAreas); | 230 visitor->trace(m_animatingScrollableAreas); |
230 visitor->trace(m_autoSizeInfo); | 231 visitor->trace(m_autoSizeInfo); |
231 visitor->trace(m_children); | 232 visitor->trace(m_children); |
232 visitor->trace(m_viewportScrollableArea); | 233 visitor->trace(m_viewportScrollableArea); |
233 visitor->trace(m_visibilityObserver); | 234 visitor->trace(m_visibilityObserver); |
234 visitor->trace(m_scrollAnchor); | 235 visitor->trace(m_scrollAnchor); |
235 visitor->trace(m_anchoringAdjustmentQueue); | 236 visitor->trace(m_anchoringAdjustmentQueue); |
236 visitor->trace(m_scrollbarManager); | 237 visitor->trace(m_scrollbarManager); |
238 visitor->trace(m_printContext); | |
237 Widget::trace(visitor); | 239 Widget::trace(visitor); |
238 ScrollableArea::trace(visitor); | 240 ScrollableArea::trace(visitor); |
239 } | 241 } |
240 | 242 |
241 void FrameView::reset() { | 243 void FrameView::reset() { |
242 // The compositor throttles the main frame using deferred commits, we can't | 244 // The compositor throttles the main frame using deferred commits, we can't |
243 // throttle it here or it seems the root compositor doesn't get setup | 245 // throttle it here or it seems the root compositor doesn't get setup |
244 // properly. | 246 // properly. |
245 if (RuntimeEnabledFeatures:: | 247 if (RuntimeEnabledFeatures:: |
246 renderingPipelineThrottlingLoadingIframesEnabled()) | 248 renderingPipelineThrottlingLoadingIframesEnabled()) |
(...skipping 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2879 SourceLocation::capture(m_frame->document()), nullptr); | 2881 SourceLocation::capture(m_frame->document()), nullptr); |
2880 m_frame->document()->dispatchErrorEvent(error, NotSharableCrossOrigin); | 2882 m_frame->document()->dispatchErrorEvent(error, NotSharableCrossOrigin); |
2881 // Ensure notifications will get delivered in next cycle. | 2883 // Ensure notifications will get delivered in next cycle. |
2882 if (FrameView* frameView = m_frame->view()) | 2884 if (FrameView* frameView = m_frame->view()) |
2883 frameView->scheduleAnimation(); | 2885 frameView->scheduleAnimation(); |
2884 } | 2886 } |
2885 | 2887 |
2886 DCHECK(!layoutView()->needsLayout()); | 2888 DCHECK(!layoutView()->needsLayout()); |
2887 } | 2889 } |
2888 | 2890 |
2891 void FrameView::dispatchEventsForPrintingOnAllFrames() { | |
2892 DCHECK(m_frame->isMainFrame()); | |
2893 for (Frame* currentFrame = m_frame; currentFrame; | |
2894 currentFrame = currentFrame->tree().traverseNext(m_frame)) { | |
2895 if (currentFrame->isLocalFrame()) | |
2896 toLocalFrame(currentFrame)->document()->dispatchEventsForPrinting(); | |
2897 } | |
2898 } | |
2899 | |
2889 // TODO(leviw): We don't assert lifecycle information from documents in child | 2900 // TODO(leviw): We don't assert lifecycle information from documents in child |
2890 // PluginViews. | 2901 // PluginViews. |
2891 void FrameView::updateLifecyclePhasesInternal( | 2902 void FrameView::updateLifecyclePhasesInternal( |
2892 DocumentLifecycle::LifecycleState targetState) { | 2903 DocumentLifecycle::LifecycleState targetState) { |
2893 if (m_currentUpdateLifecyclePhasesTargetState != | 2904 if (m_currentUpdateLifecyclePhasesTargetState != |
2894 DocumentLifecycle::Uninitialized) { | 2905 DocumentLifecycle::Uninitialized) { |
2895 NOTREACHED() << "FrameView::updateLifecyclePhasesInternal() reentrance"; | 2906 NOTREACHED() << "FrameView::updateLifecyclePhasesInternal() reentrance"; |
2896 return; | 2907 return; |
2897 } | 2908 } |
2898 | 2909 |
(...skipping 12 matching lines...) Expand all Loading... | |
2911 | 2922 |
2912 AutoReset<DocumentLifecycle::LifecycleState> targetStateScope( | 2923 AutoReset<DocumentLifecycle::LifecycleState> targetStateScope( |
2913 &m_currentUpdateLifecyclePhasesTargetState, targetState); | 2924 &m_currentUpdateLifecyclePhasesTargetState, targetState); |
2914 | 2925 |
2915 if (shouldThrottleRendering()) { | 2926 if (shouldThrottleRendering()) { |
2916 updateViewportIntersectionsForSubtree( | 2927 updateViewportIntersectionsForSubtree( |
2917 std::min(targetState, DocumentLifecycle::CompositingClean)); | 2928 std::min(targetState, DocumentLifecycle::CompositingClean)); |
2918 return; | 2929 return; |
2919 } | 2930 } |
2920 | 2931 |
2932 if (RuntimeEnabledFeatures::printBrowserEnabled()) { | |
2933 if (!m_frame->document()->printing()) { | |
pdr.
2017/02/08 04:28:05
Can you split this logic out into a helper? I thin
gozzard
2017/02/08 05:40:20
Done.
| |
2934 if (!m_printContext) | |
2935 m_printContext = new PrintContext(m_frame); | |
2936 if (m_frame->settings()) | |
2937 m_frame->settings()->setShouldPrintBackgrounds(true); | |
2938 int pageWidth = 595, pageHeight = 842; // A4 Portrait | |
pdr.
2017/02/08 04:28:05
Nit: can you break these into constants?
Maybe "co
gozzard
2017/02/08 05:40:20
Done.
| |
2939 FloatRect pageRect(0, 0, pageWidth, pageHeight); | |
2940 m_printContext->begin(pageRect.width(), pageRect.height()); | |
2941 float height; | |
pdr.
2017/02/08 04:28:05
Do we need to do this print context and page rect
gozzard
2017/02/08 05:40:20
m_printContext->begin() indirectly sets m_frame->d
| |
2942 m_printContext->computePageRects(pageRect, 0, 0, 1.0, height); | |
2943 dispatchEventsForPrintingOnAllFrames(); | |
2944 } | |
2945 } else if (m_printContext) { | |
2946 m_printContext->end(); | |
2947 m_printContext.clear(); | |
2948 } | |
2949 | |
2921 updateStyleAndLayoutIfNeededRecursive(); | 2950 updateStyleAndLayoutIfNeededRecursive(); |
2922 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); | 2951 DCHECK(lifecycle().state() >= DocumentLifecycle::LayoutClean); |
2923 | 2952 |
2924 if (targetState == DocumentLifecycle::LayoutClean) { | 2953 if (targetState == DocumentLifecycle::LayoutClean) { |
2925 updateViewportIntersectionsForSubtree(targetState); | 2954 updateViewportIntersectionsForSubtree(targetState); |
2926 return; | 2955 return; |
2927 } | 2956 } |
2928 | 2957 |
2929 forAllNonThrottledFrameViews([](FrameView& frameView) { | 2958 forAllNonThrottledFrameViews([](FrameView& frameView) { |
2930 frameView.performScrollAnchoringAdjustments(); | 2959 frameView.performScrollAnchoringAdjustments(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2983 // TODO(pdr): prePaint should be under the "Paint" devtools timeline step | 3012 // TODO(pdr): prePaint should be under the "Paint" devtools timeline step |
2984 // for slimming paint v2. | 3013 // for slimming paint v2. |
2985 if (targetState >= DocumentLifecycle::PrePaintClean) | 3014 if (targetState >= DocumentLifecycle::PrePaintClean) |
2986 prePaint(); | 3015 prePaint(); |
2987 } | 3016 } |
2988 | 3017 |
2989 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 3018 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
2990 DocumentAnimations::updateAnimations(layoutView()->document()); | 3019 DocumentAnimations::updateAnimations(layoutView()->document()); |
2991 | 3020 |
2992 if (targetState == DocumentLifecycle::PaintClean) { | 3021 if (targetState == DocumentLifecycle::PaintClean) { |
2993 if (!m_frame->document()->printing()) | 3022 if (!m_frame->document()->printing() || |
3023 RuntimeEnabledFeatures::printBrowserEnabled()) | |
2994 paintTree(); | 3024 paintTree(); |
2995 | 3025 |
2996 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 3026 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
2997 pushPaintArtifactToCompositor(); | 3027 pushPaintArtifactToCompositor(); |
2998 | 3028 |
2999 DCHECK(!view.hasPendingSelection()); | 3029 DCHECK(!view.hasPendingSelection()); |
3000 DCHECK((m_frame->document()->printing() && | 3030 DCHECK((m_frame->document()->printing() && |
3001 lifecycle().state() == DocumentLifecycle::PrePaintClean) || | 3031 lifecycle().state() == DocumentLifecycle::PrePaintClean) || |
3002 lifecycle().state() == DocumentLifecycle::PaintClean); | 3032 lifecycle().state() == DocumentLifecycle::PaintClean); |
3003 } | 3033 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3075 | 3105 |
3076 LayoutViewItem view = layoutViewItem(); | 3106 LayoutViewItem view = layoutViewItem(); |
3077 ASSERT(!view.isNull()); | 3107 ASSERT(!view.isNull()); |
3078 forAllNonThrottledFrameViews([](FrameView& frameView) { | 3108 forAllNonThrottledFrameViews([](FrameView& frameView) { |
3079 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint); | 3109 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint); |
3080 }); | 3110 }); |
3081 | 3111 |
3082 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 3112 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
3083 if (layoutView()->layer()->needsRepaint()) { | 3113 if (layoutView()->layer()->needsRepaint()) { |
3084 GraphicsContext graphicsContext(*m_paintController); | 3114 GraphicsContext graphicsContext(*m_paintController); |
3115 if (RuntimeEnabledFeatures::printBrowserEnabled()) | |
pdr.
2017/02/08 04:28:05
WDYT about implementing this for both spv2 (as you
gozzard
2017/02/08 05:40:20
I had a look into this and found that it would req
| |
3116 graphicsContext.setPrinting(true); | |
3085 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect())); | 3117 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect())); |
3086 m_paintController->commitNewDisplayItems(LayoutSize()); | 3118 m_paintController->commitNewDisplayItems(LayoutSize()); |
3087 notifyPaint(*m_paintController); | 3119 notifyPaint(*m_paintController); |
3088 } | 3120 } |
3089 } else { | 3121 } else { |
3090 // A null graphics layer can occur for painting of SVG images that are not | 3122 // A null graphics layer can occur for painting of SVG images that are not |
3091 // parented into the main frame tree, or when the FrameView is the main | 3123 // parented into the main frame tree, or when the FrameView is the main |
3092 // frame view of a page overlay. The page overlay is in the layer tree of | 3124 // frame view of a page overlay. The page overlay is in the layer tree of |
3093 // the host page and will be painted during painting of the host page. | 3125 // the host page and will be painted during painting of the host page. |
3094 if (GraphicsLayer* rootGraphicsLayer = | 3126 if (GraphicsLayer* rootGraphicsLayer = |
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5095 std::unique_ptr<CompositorAnimationTimeline> timeline) { | 5127 std::unique_ptr<CompositorAnimationTimeline> timeline) { |
5096 m_animationTimeline = std::move(timeline); | 5128 m_animationTimeline = std::move(timeline); |
5097 } | 5129 } |
5098 | 5130 |
5099 void FrameView::setAnimationHost( | 5131 void FrameView::setAnimationHost( |
5100 std::unique_ptr<CompositorAnimationHost> host) { | 5132 std::unique_ptr<CompositorAnimationHost> host) { |
5101 m_animationHost = std::move(host); | 5133 m_animationHost = std::move(host); |
5102 } | 5134 } |
5103 | 5135 |
5104 } // namespace blink | 5136 } // namespace blink |
OLD | NEW |