Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 351673007: Move paint invalidation after compositing update (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Epic patch ready for review. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« Source/core/frame/FrameView.h ('K') | « Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 ownerElement->setWidget(nullptr); 188 ownerElement->setWidget(nullptr);
189 } 189 }
190 190
191 void FrameView::reset() 191 void FrameView::reset()
192 { 192 {
193 m_cannotBlitToWindow = false; 193 m_cannotBlitToWindow = false;
194 m_isOverlapped = false; 194 m_isOverlapped = false;
195 m_contentIsOpaque = false; 195 m_contentIsOpaque = false;
196 m_hasPendingLayout = false; 196 m_hasPendingLayout = false;
197 m_layoutSubtreeRoot = 0; 197 m_layoutSubtreeRoot = 0;
198 m_paintInvalidationSubtreeRoot = 0;
198 m_doFullPaintInvalidation = false; 199 m_doFullPaintInvalidation = false;
199 m_layoutSchedulingEnabled = true; 200 m_layoutSchedulingEnabled = true;
200 m_inPerformLayout = false; 201 m_inPerformLayout = false;
201 m_canInvalidatePaintDuringPerformLayout = false; 202 m_canInvalidatePaintDuringPerformLayout = false;
202 m_inSynchronousPostLayout = false; 203 m_inSynchronousPostLayout = false;
203 m_layoutCount = 0; 204 m_layoutCount = 0;
204 m_nestedLayoutCount = 0; 205 m_nestedLayoutCount = 0;
205 m_postLayoutTasksTimer.stop(); 206 m_postLayoutTasksTimer.stop();
206 m_updateWidgetsTimer.stop(); 207 m_updateWidgetsTimer.stop();
207 m_firstLayout = true; 208 m_firstLayout = true;
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation 952 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation
952 // checks the boolean to disable local paint invalidations. 953 // checks the boolean to disable local paint invalidations.
953 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout(); 954 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout();
954 } 955 }
955 956
956 layer = rootForThisLayout->enclosingLayer(); 957 layer = rootForThisLayout->enclosingLayer();
957 958
958 performLayout(rootForThisLayout, inSubtreeLayout); 959 performLayout(rootForThisLayout, inSubtreeLayout);
959 960
960 m_layoutSubtreeRoot = 0; 961 m_layoutSubtreeRoot = 0;
962 m_paintInvalidationSubtreeRoot = rootForThisLayout;
abarth-chromium 2014/06/24 22:57:26 What happens if there are multiple layouts between
Julien - ping for review 2014/06/25 22:34:30 That's indeed a bug. I will fix it and land a test
961 } // Reset m_layoutSchedulingEnabled to its previous value. 963 } // Reset m_layoutSchedulingEnabled to its previous value.
962 964
963 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) 965 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g())
964 adjustViewSize(); 966 adjustViewSize();
965 967
966 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullPaintInvalidation)); 968 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullPaintInvalidation));
967 renderView()->compositor()->didLayout(); 969 renderView()->compositor()->didLayout();
968 970
969 m_layoutCount++; 971 m_layoutCount++;
970 972
(...skipping 12 matching lines...) Expand all
983 scheduleOrPerformPostLayoutTasks(); 985 scheduleOrPerformPostLayoutTasks();
984 986
985 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout)); 987 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout));
986 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. 988 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
987 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); 989 InspectorInstrumentation::didLayout(cookie, rootForThisLayout);
988 990
989 m_nestedLayoutCount--; 991 m_nestedLayoutCount--;
990 if (m_nestedLayoutCount) 992 if (m_nestedLayoutCount)
991 return; 993 return;
992 994
993 invalidateTree(rootForThisLayout);
994
995 m_doFullPaintInvalidation = false;
996
997 #ifndef NDEBUG 995 #ifndef NDEBUG
998 // Post-layout assert that nobody was re-marked as needing layout during lay out. 996 // Post-layout assert that nobody was re-marked as needing layout during lay out.
999 document->renderView()->assertSubtreeIsLaidOut(); 997 document->renderView()->assertSubtreeIsLaidOut();
1000 #endif 998 #endif
1001 999
1002 // FIXME: It should be not possible to remove the FrameView from the frame/p age during layout 1000 // FIXME: It should be not possible to remove the FrameView from the frame/p age during layout
1003 // however m_inPerformLayout is not set for most of this function, so none o f our RELEASE_ASSERTS 1001 // however m_inPerformLayout is not set for most of this function, so none o f our RELEASE_ASSERTS
1004 // in LocalFrame/Page will fire. One of the post-layout tasks is disconnecti ng the LocalFrame from 1002 // in LocalFrame/Page will fire. One of the post-layout tasks is disconnecti ng the LocalFrame from
1005 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml 1003 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml
1006 // necessitating this check here. 1004 // necessitating this check here.
1007 // ASSERT(frame()->page()); 1005 // ASSERT(frame()->page());
1008 if (frame().page()) 1006 if (frame().page())
1009 frame().page()->chrome().client().layoutUpdated(m_frame.get()); 1007 frame().page()->chrome().client().layoutUpdated(m_frame.get());
1010 } 1008 }
1011 1009
1012 // The plan is to move to compositor-queried paint invalidation, in which case t his 1010 // The plan is to move to compositor-queried paint invalidation, in which case t his
1013 // method would setNeedsRedraw on the GraphicsLayers with invalidations and 1011 // method would setNeedsRedraw on the GraphicsLayers with invalidations and
1014 // let the compositor pick which to actually draw. 1012 // let the compositor pick which to actually draw.
1015 // See http://crbug.com/306706 1013 // See http://crbug.com/306706
1016 void FrameView::invalidateTree(RenderObject* root) 1014 void FrameView::invalidateTreeIfNeeded()
1017 { 1015 {
1018 ASSERT(!root->needsLayout()); 1016 if (!m_paintInvalidationSubtreeRoot)
1019 // We should only invalidate paints for the outer most layout. This works as 1017 return;
1020 // we continue to track paint invalidation rects until this function is call ed.
1021 ASSERT(!m_nestedLayoutCount);
1022 1018
1023 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", root->debugName() .ascii()); 1019 RenderObject* rootForPaintInvalidation = m_paintInvalidationSubtreeRoot;
1020 ASSERT(!rootForPaintInvalidation->needsLayout());
1024 1021
1025 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal. 1022 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation->debugName().ascii());
1026 // Until those states are fully fledged, I'll just disable the ASSERTS.
1027 DisableCompositingQueryAsserts compositingQueryAssertsDisabler;
1028 1023
1029 LayoutState rootLayoutState(*root); 1024 LayoutState rootLayoutState(*rootForPaintInvalidation);
1030 1025
1031 root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation()); 1026 rootForPaintInvalidation->invalidateTreeAfterLayout(*rootForPaintInvalidatio n->containerForPaintInvalidation());
1032 1027
1033 // Invalidate the paint of the frameviews scrollbars if needed 1028 // Invalidate the paint of the frameviews scrollbars if needed
1034 if (hasVerticalBarDamage()) 1029 if (hasVerticalBarDamage())
1035 invalidateRect(verticalBarDamage()); 1030 invalidateRect(verticalBarDamage());
1036 if (hasHorizontalBarDamage()) 1031 if (hasHorizontalBarDamage())
1037 invalidateRect(horizontalBarDamage()); 1032 invalidateRect(horizontalBarDamage());
1038 resetScrollbarDamage(); 1033 resetScrollbarDamage();
1034
1035 m_paintInvalidationSubtreeRoot = 0;
1036 m_doFullPaintInvalidation = false;
1039 } 1037 }
1040 1038
1041 DocumentLifecycle& FrameView::lifecycle() const 1039 DocumentLifecycle& FrameView::lifecycle() const
1042 { 1040 {
1043 return m_frame->document()->lifecycle(); 1041 return m_frame->document()->lifecycle();
1044 } 1042 }
1045 1043
1046 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot) 1044 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot)
1047 { 1045 {
1048 bool isTracing; 1046 bool isTracing;
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2821 2819
2822 if (RenderView* view = renderView()) { 2820 if (RenderView* view = renderView()) {
2823 InspectorInstrumentation::willUpdateLayerTree(view->frame()); 2821 InspectorInstrumentation::willUpdateLayerTree(view->frame());
2824 2822
2825 view->compositor()->updateIfNeededRecursive(); 2823 view->compositor()->updateIfNeededRecursive();
2826 2824
2827 if (view->compositor()->inCompositingMode() && m_frame->isMainFrame()) 2825 if (view->compositor()->inCompositingMode() && m_frame->isMainFrame())
2828 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded(); 2826 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded();
2829 2827
2830 InspectorInstrumentation::didUpdateLayerTree(view->frame()); 2828 InspectorInstrumentation::didUpdateLayerTree(view->frame());
2829
2830 invalidateTreeIfNeededRecursive();
2831 } 2831 }
2832 2832
2833 scrollContentsIfNeededRecursive(); 2833 scrollContentsIfNeededRecursive();
2834 } 2834 }
2835 2835
2836 void FrameView::updateLayoutAndStyleIfNeededRecursive() 2836 void FrameView::updateLayoutAndStyleIfNeededRecursive()
2837 { 2837 {
2838 // We have to crawl our entire tree looking for any FrameViews that need 2838 // We have to crawl our entire tree looking for any FrameViews that need
2839 // layout and make sure they are up to date. 2839 // layout and make sure they are up to date.
2840 // Mac actually tests for intersection with the dirty region and tries not t o 2840 // Mac actually tests for intersection with the dirty region and tries not t o
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2876 2876
2877 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. 2877 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style.
2878 ASSERT(!needsLayout()); 2878 ASSERT(!needsLayout());
2879 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); 2879 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate());
2880 #ifndef NDEBUG 2880 #ifndef NDEBUG
2881 m_frame->document()->renderView()->assertRendererLaidOut(); 2881 m_frame->document()->renderView()->assertRendererLaidOut();
2882 #endif 2882 #endif
2883 2883
2884 } 2884 }
2885 2885
2886 void FrameView::invalidateTreeIfNeededRecursive()
2887 {
2888 // FIXME: We should be more aggressive cutting sub-branches tree traversals.
2889 invalidateTreeIfNeeded();
2890
2891 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2892 if (!child->isLocalFrame())
2893 continue;
2894
2895 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive();
2896 }
2897 }
2898
2886 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize) 2899 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize)
2887 { 2900 {
2888 ASSERT(!enable || !minSize.isEmpty()); 2901 ASSERT(!enable || !minSize.isEmpty());
2889 ASSERT(minSize.width() <= maxSize.width()); 2902 ASSERT(minSize.width() <= maxSize.width());
2890 ASSERT(minSize.height() <= maxSize.height()); 2903 ASSERT(minSize.height() <= maxSize.height());
2891 2904
2892 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize) 2905 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize)
2893 return; 2906 return;
2894 2907
2895 2908
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3280 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3268 { 3281 {
3269 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3282 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3270 if (AXObjectCache* cache = axObjectCache()) { 3283 if (AXObjectCache* cache = axObjectCache()) {
3271 cache->remove(scrollbar); 3284 cache->remove(scrollbar);
3272 cache->handleScrollbarUpdate(this); 3285 cache->handleScrollbarUpdate(this);
3273 } 3286 }
3274 } 3287 }
3275 3288
3276 } // namespace WebCore 3289 } // namespace WebCore
OLDNEW
« Source/core/frame/FrameView.h ('K') | « Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698