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

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: Added some missing entries in TestExpectations 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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation 951 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation
952 // checks the boolean to disable local paint invalidations. 952 // checks the boolean to disable local paint invalidations.
953 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout(); 953 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout();
954 } 954 }
955 955
956 layer = rootForThisLayout->enclosingLayer(); 956 layer = rootForThisLayout->enclosingLayer();
957 957
958 performLayout(rootForThisLayout, inSubtreeLayout); 958 performLayout(rootForThisLayout, inSubtreeLayout);
959 959
960 m_layoutSubtreeRoot = 0; 960 m_layoutSubtreeRoot = 0;
961 // The following loop ensures that we mark up all renderers up to the Re nderView
962 // for paint invalidation. This simplifies our code as we just always do a full
963 // tree walk. FIXME: This loop will probably make us over-mark as we don 't skip
964 // containers and we can't use containingBlock as it skips some cases (s ee markContainingBlocksForLayout).
965 for (RenderObject* container = rootForThisLayout->container(); container ; container = container->container())
966 container->setMayNeedPaintInvalidation(true);
abarth-chromium 2014/07/01 20:02:19 void setMayNeedPaintInvalidation(bool b) {
esprehn 2014/07/01 20:03:34 This shouldn't be needed, setMayNeedPaintInvalidat
Julien - ping for review 2014/07/01 21:44:36 I do need to call rootForThisLayout->container()->
961 } // Reset m_layoutSchedulingEnabled to its previous value. 967 } // Reset m_layoutSchedulingEnabled to its previous value.
962 968
963 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) 969 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g())
964 adjustViewSize(); 970 adjustViewSize();
965 971
966 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullPaintInvalidation)); 972 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullPaintInvalidation));
967 renderView()->compositor()->didLayout(); 973 renderView()->compositor()->didLayout();
968 974
969 m_layoutCount++; 975 m_layoutCount++;
970 976
(...skipping 12 matching lines...) Expand all
983 scheduleOrPerformPostLayoutTasks(); 989 scheduleOrPerformPostLayoutTasks();
984 990
985 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout)); 991 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. 992 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
987 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); 993 InspectorInstrumentation::didLayout(cookie, rootForThisLayout);
988 994
989 m_nestedLayoutCount--; 995 m_nestedLayoutCount--;
990 if (m_nestedLayoutCount) 996 if (m_nestedLayoutCount)
991 return; 997 return;
992 998
993 invalidateTree(rootForThisLayout);
994
995 m_doFullPaintInvalidation = false;
996
997 #ifndef NDEBUG 999 #ifndef NDEBUG
998 // Post-layout assert that nobody was re-marked as needing layout during lay out. 1000 // Post-layout assert that nobody was re-marked as needing layout during lay out.
999 document->renderView()->assertSubtreeIsLaidOut(); 1001 document->renderView()->assertSubtreeIsLaidOut();
1000 #endif 1002 #endif
1001 1003
1002 // FIXME: It should be not possible to remove the FrameView from the frame/p age during layout 1004 // 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 1005 // 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 1006 // 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 1007 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml
1006 // necessitating this check here. 1008 // necessitating this check here.
1007 // ASSERT(frame()->page()); 1009 // ASSERT(frame()->page());
1008 if (frame().page()) 1010 if (frame().page())
1009 frame().page()->chrome().client().layoutUpdated(m_frame.get()); 1011 frame().page()->chrome().client().layoutUpdated(m_frame.get());
1010 } 1012 }
1011 1013
1012 // The plan is to move to compositor-queried paint invalidation, in which case t his 1014 // 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 1015 // method would setNeedsRedraw on the GraphicsLayers with invalidations and
1014 // let the compositor pick which to actually draw. 1016 // let the compositor pick which to actually draw.
1015 // See http://crbug.com/306706 1017 // See http://crbug.com/306706
1016 void FrameView::invalidateTree(RenderObject* root) 1018 void FrameView::invalidateTreeIfNeeded()
1017 { 1019 {
1018 ASSERT(!root->needsLayout()); 1020 RenderObject* rootForPaintInvalidation = renderView();
1019 // We should only invalidate paints for the outer most layout. This works as 1021 ASSERT(!rootForPaintInvalidation->needsLayout());
1020 // we continue to track paint invalidation rects until this function is call ed.
1021 ASSERT(!m_nestedLayoutCount);
1022 1022
1023 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", root->debugName() .ascii()); 1023 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation->debugName().ascii());
1024 1024
1025 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal. 1025 LayoutState rootLayoutState(*rootForPaintInvalidation);
1026 // Until those states are fully fledged, I'll just disable the ASSERTS.
1027 DisableCompositingQueryAsserts compositingQueryAssertsDisabler;
1028 1026
1029 LayoutState rootLayoutState(*root); 1027 rootForPaintInvalidation->invalidateTreeAfterLayout(*rootForPaintInvalidatio n->containerForPaintInvalidation());
1030
1031 root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation());
1032 1028
1033 // Invalidate the paint of the frameviews scrollbars if needed 1029 // Invalidate the paint of the frameviews scrollbars if needed
1034 if (hasVerticalBarDamage()) 1030 if (hasVerticalBarDamage())
1035 invalidateRect(verticalBarDamage()); 1031 invalidateRect(verticalBarDamage());
1036 if (hasHorizontalBarDamage()) 1032 if (hasHorizontalBarDamage())
1037 invalidateRect(horizontalBarDamage()); 1033 invalidateRect(horizontalBarDamage());
1038 resetScrollbarDamage(); 1034 resetScrollbarDamage();
1035
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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 2817
2820 if (RenderView* view = renderView()) { 2818 if (RenderView* view = renderView()) {
2821 InspectorInstrumentation::willUpdateLayerTree(view->frame()); 2819 InspectorInstrumentation::willUpdateLayerTree(view->frame());
2822 2820
2823 view->compositor()->updateIfNeededRecursive(); 2821 view->compositor()->updateIfNeededRecursive();
2824 2822
2825 if (view->compositor()->inCompositingMode() && m_frame->isMainFrame()) 2823 if (view->compositor()->inCompositingMode() && m_frame->isMainFrame())
2826 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded(); 2824 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded();
2827 2825
2828 InspectorInstrumentation::didUpdateLayerTree(view->frame()); 2826 InspectorInstrumentation::didUpdateLayerTree(view->frame());
2827
2828 invalidateTreeIfNeededRecursive();
2829 } 2829 }
2830 2830
2831 scrollContentsIfNeededRecursive(); 2831 scrollContentsIfNeededRecursive();
2832 } 2832 }
2833 2833
2834 void FrameView::updateLayoutAndStyleIfNeededRecursive() 2834 void FrameView::updateLayoutAndStyleIfNeededRecursive()
2835 { 2835 {
2836 // We have to crawl our entire tree looking for any FrameViews that need 2836 // We have to crawl our entire tree looking for any FrameViews that need
2837 // layout and make sure they are up to date. 2837 // layout and make sure they are up to date.
2838 // Mac actually tests for intersection with the dirty region and tries not t o 2838 // 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
2874 2874
2875 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. 2875 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style.
2876 ASSERT(!needsLayout()); 2876 ASSERT(!needsLayout());
2877 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); 2877 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate());
2878 #ifndef NDEBUG 2878 #ifndef NDEBUG
2879 m_frame->document()->renderView()->assertRendererLaidOut(); 2879 m_frame->document()->renderView()->assertRendererLaidOut();
2880 #endif 2880 #endif
2881 2881
2882 } 2882 }
2883 2883
2884 void FrameView::invalidateTreeIfNeededRecursive()
2885 {
2886 // FIXME: We should be more aggressive at cutting tree traversals.
2887 invalidateTreeIfNeeded();
2888
2889 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2890 if (!child->isLocalFrame())
2891 continue;
2892
2893 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive();
2894 }
2895 }
2896
2884 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize) 2897 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize)
2885 { 2898 {
2886 ASSERT(!enable || !minSize.isEmpty()); 2899 ASSERT(!enable || !minSize.isEmpty());
2887 ASSERT(minSize.width() <= maxSize.width()); 2900 ASSERT(minSize.width() <= maxSize.width());
2888 ASSERT(minSize.height() <= maxSize.height()); 2901 ASSERT(minSize.height() <= maxSize.height());
2889 2902
2890 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize) 2903 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize)
2891 return; 2904 return;
2892 2905
2893 2906
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3278 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3266 { 3279 {
3267 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3280 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3268 if (AXObjectCache* cache = axObjectCache()) { 3281 if (AXObjectCache* cache = axObjectCache()) {
3269 cache->remove(scrollbar); 3282 cache->remove(scrollbar);
3270 cache->handleScrollbarUpdate(this); 3283 cache->handleScrollbarUpdate(this);
3271 } 3284 }
3272 } 3285 }
3273 3286
3274 } // namespace WebCore 3287 } // 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