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

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: Rebaselined (again) Created 6 years, 5 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
« no previous file with comments | « 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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation 945 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation
946 // checks the boolean to disable local paint invalidations. 946 // checks the boolean to disable local paint invalidations.
947 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout(); 947 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout();
948 } 948 }
949 949
950 layer = rootForThisLayout->enclosingLayer(); 950 layer = rootForThisLayout->enclosingLayer();
951 951
952 performLayout(rootForThisLayout, inSubtreeLayout); 952 performLayout(rootForThisLayout, inSubtreeLayout);
953 953
954 m_layoutSubtreeRoot = 0; 954 m_layoutSubtreeRoot = 0;
955 // The following loop ensures that we mark up all renderers up to the Re nderView
ojan 2014/07/02 03:33:58 This comment is out of data now that this isn't a
Julien - ping for review 2014/07/02 18:27:06 oops, got catch. I have amended the comment to avo
956 // for paint invalidation. This simplifies our code as we just always do a full
957 // tree walk. FIXME: This loop will probably make us over-mark as we don 't skip
958 // containers and we can't use containingBlock as it skips some cases (s ee markContainingBlocksForLayout).
959 if (RenderObject* container = rootForThisLayout->container())
960 container->setMayNeedPaintInvalidation(true);
ojan 2014/07/02 03:33:58 Why not just have this be rootForThisLayout->setMa
Julien - ping for review 2014/07/02 18:27:06 It's not needed to mark rootForThisLayout for mayN
955 } // Reset m_layoutSchedulingEnabled to its previous value. 961 } // Reset m_layoutSchedulingEnabled to its previous value.
956 962
957 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) 963 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g())
958 adjustViewSize(); 964 adjustViewSize();
959 965
960 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullPaintInvalidation)); 966 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullPaintInvalidation));
961 renderView()->compositor()->didLayout(); 967 renderView()->compositor()->didLayout();
962 968
963 m_layoutCount++; 969 m_layoutCount++;
964 970
(...skipping 12 matching lines...) Expand all
977 scheduleOrPerformPostLayoutTasks(); 983 scheduleOrPerformPostLayoutTasks();
978 984
979 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout)); 985 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout));
980 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. 986 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
981 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); 987 InspectorInstrumentation::didLayout(cookie, rootForThisLayout);
982 988
983 m_nestedLayoutCount--; 989 m_nestedLayoutCount--;
984 if (m_nestedLayoutCount) 990 if (m_nestedLayoutCount)
985 return; 991 return;
986 992
987 invalidateTree(rootForThisLayout);
988
989 m_doFullPaintInvalidation = false;
990
991 #ifndef NDEBUG 993 #ifndef NDEBUG
992 // Post-layout assert that nobody was re-marked as needing layout during lay out. 994 // Post-layout assert that nobody was re-marked as needing layout during lay out.
993 document->renderView()->assertSubtreeIsLaidOut(); 995 document->renderView()->assertSubtreeIsLaidOut();
994 #endif 996 #endif
995 997
996 // FIXME: It should be not possible to remove the FrameView from the frame/p age during layout 998 // FIXME: It should be not possible to remove the FrameView from the frame/p age during layout
997 // however m_inPerformLayout is not set for most of this function, so none o f our RELEASE_ASSERTS 999 // however m_inPerformLayout is not set for most of this function, so none o f our RELEASE_ASSERTS
998 // in LocalFrame/Page will fire. One of the post-layout tasks is disconnecti ng the LocalFrame from 1000 // in LocalFrame/Page will fire. One of the post-layout tasks is disconnecti ng the LocalFrame from
999 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml 1001 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml
1000 // necessitating this check here. 1002 // necessitating this check here.
1001 // ASSERT(frame()->page()); 1003 // ASSERT(frame()->page());
1002 if (frame().page()) 1004 if (frame().page())
1003 frame().page()->chrome().client().layoutUpdated(m_frame.get()); 1005 frame().page()->chrome().client().layoutUpdated(m_frame.get());
1004 } 1006 }
1005 1007
1006 // The plan is to move to compositor-queried paint invalidation, in which case t his 1008 // The plan is to move to compositor-queried paint invalidation, in which case t his
1007 // method would setNeedsRedraw on the GraphicsLayers with invalidations and 1009 // method would setNeedsRedraw on the GraphicsLayers with invalidations and
1008 // let the compositor pick which to actually draw. 1010 // let the compositor pick which to actually draw.
1009 // See http://crbug.com/306706 1011 // See http://crbug.com/306706
1010 void FrameView::invalidateTree(RenderObject* root) 1012 void FrameView::invalidateTreeIfNeeded()
1011 { 1013 {
1012 ASSERT(!root->needsLayout()); 1014 RenderObject* rootForPaintInvalidation = renderView();
1013 // We should only invalidate paints for the outer most layout. This works as 1015 ASSERT(!rootForPaintInvalidation->needsLayout());
1014 // we continue to track paint invalidation rects until this function is call ed.
1015 ASSERT(!m_nestedLayoutCount);
1016 1016
1017 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", root->debugName() .ascii()); 1017 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation->debugName().ascii());
1018 1018
1019 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal. 1019 LayoutState rootLayoutState(*rootForPaintInvalidation);
1020 // Until those states are fully fledged, I'll just disable the ASSERTS.
1021 DisableCompositingQueryAsserts compositingQueryAssertsDisabler;
1022 1020
1023 LayoutState rootLayoutState(*root); 1021 rootForPaintInvalidation->invalidateTreeAfterLayout(*rootForPaintInvalidatio n->containerForPaintInvalidation());
1024
1025 root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation());
1026 1022
1027 // Invalidate the paint of the frameviews scrollbars if needed 1023 // Invalidate the paint of the frameviews scrollbars if needed
1028 if (hasVerticalBarDamage()) 1024 if (hasVerticalBarDamage())
1029 invalidateRect(verticalBarDamage()); 1025 invalidateRect(verticalBarDamage());
1030 if (hasHorizontalBarDamage()) 1026 if (hasHorizontalBarDamage())
1031 invalidateRect(horizontalBarDamage()); 1027 invalidateRect(horizontalBarDamage());
1032 resetScrollbarDamage(); 1028 resetScrollbarDamage();
1029
1030 m_doFullPaintInvalidation = false;
1033 } 1031 }
1034 1032
1035 DocumentLifecycle& FrameView::lifecycle() const 1033 DocumentLifecycle& FrameView::lifecycle() const
1036 { 1034 {
1037 return m_frame->document()->lifecycle(); 1035 return m_frame->document()->lifecycle();
1038 } 1036 }
1039 1037
1040 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot) 1038 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot)
1041 { 1039 {
1042 bool isTracing; 1040 bool isTracing;
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 2811
2814 if (RenderView* view = renderView()) { 2812 if (RenderView* view = renderView()) {
2815 InspectorInstrumentation::willUpdateLayerTree(view->frame()); 2813 InspectorInstrumentation::willUpdateLayerTree(view->frame());
2816 2814
2817 view->compositor()->updateIfNeededRecursive(); 2815 view->compositor()->updateIfNeededRecursive();
2818 2816
2819 if (view->compositor()->inCompositingMode() && m_frame->isMainFrame()) 2817 if (view->compositor()->inCompositingMode() && m_frame->isMainFrame())
2820 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded(); 2818 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded();
2821 2819
2822 InspectorInstrumentation::didUpdateLayerTree(view->frame()); 2820 InspectorInstrumentation::didUpdateLayerTree(view->frame());
2821
2822 invalidateTreeIfNeededRecursive();
2823 } 2823 }
2824 2824
2825 scrollContentsIfNeededRecursive(); 2825 scrollContentsIfNeededRecursive();
2826 } 2826 }
2827 2827
2828 void FrameView::updateLayoutAndStyleIfNeededRecursive() 2828 void FrameView::updateLayoutAndStyleIfNeededRecursive()
2829 { 2829 {
2830 // We have to crawl our entire tree looking for any FrameViews that need 2830 // We have to crawl our entire tree looking for any FrameViews that need
2831 // layout and make sure they are up to date. 2831 // layout and make sure they are up to date.
2832 // Mac actually tests for intersection with the dirty region and tries not t o 2832 // 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
2868 2868
2869 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. 2869 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style.
2870 ASSERT(!needsLayout()); 2870 ASSERT(!needsLayout());
2871 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); 2871 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate());
2872 #ifndef NDEBUG 2872 #ifndef NDEBUG
2873 m_frame->document()->renderView()->assertRendererLaidOut(); 2873 m_frame->document()->renderView()->assertRendererLaidOut();
2874 #endif 2874 #endif
2875 2875
2876 } 2876 }
2877 2877
2878 void FrameView::invalidateTreeIfNeededRecursive()
2879 {
2880 // FIXME: We should be more aggressive at cutting tree traversals.
2881 invalidateTreeIfNeeded();
2882
2883 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2884 if (!child->isLocalFrame())
2885 continue;
2886
2887 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive();
2888 }
2889 }
2890
2878 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize) 2891 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize)
2879 { 2892 {
2880 ASSERT(!enable || !minSize.isEmpty()); 2893 ASSERT(!enable || !minSize.isEmpty());
2881 ASSERT(minSize.width() <= maxSize.width()); 2894 ASSERT(minSize.width() <= maxSize.width());
2882 ASSERT(minSize.height() <= maxSize.height()); 2895 ASSERT(minSize.height() <= maxSize.height());
2883 2896
2884 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize) 2897 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize)
2885 return; 2898 return;
2886 2899
2887 2900
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3272 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3260 { 3273 {
3261 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3274 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3262 if (AXObjectCache* cache = axObjectCache()) { 3275 if (AXObjectCache* cache = axObjectCache()) {
3263 cache->remove(scrollbar); 3276 cache->remove(scrollbar);
3264 cache->handleScrollbarUpdate(this); 3277 cache->handleScrollbarUpdate(this);
3265 } 3278 }
3266 } 3279 }
3267 3280
3268 } // namespace WebCore 3281 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698