Chromium Code Reviews| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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_paintInvalidationSubtreeRoots.clear(); | |
| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 return parentView->isEnclosedInCompositingLayer(); | 697 return parentView->isEnclosedInCompositingLayer(); |
| 697 | 698 |
| 698 return false; | 699 return false; |
| 699 } | 700 } |
| 700 | 701 |
| 701 RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const | 702 RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const |
| 702 { | 703 { |
| 703 return onlyDuringLayout && layoutPending() ? 0 : m_layoutSubtreeRoot; | 704 return onlyDuringLayout && layoutPending() ? 0 : m_layoutSubtreeRoot; |
| 704 } | 705 } |
| 705 | 706 |
| 707 void FrameView::rendererWillBeDestroyed(RenderObject* renderer) | |
| 708 { | |
| 709 if (m_layoutSubtreeRoot == renderer) { | |
| 710 if (!m_layoutSubtreeRoot->documentBeingDestroyed()) | |
| 711 ASSERT_NOT_REACHED(); | |
|
esprehn
2014/07/01 20:03:34
RELEASE_ASSERT(!m_layoutSubtreeRoot->documentBeing
| |
| 712 // This indicates a failure to layout the child, which is why | |
| 713 // the layout root is still set to |this|. Make sure to clear it | |
| 714 // since we are getting destroyed. | |
| 715 m_layoutSubtreeRoot = 0; | |
| 716 } | |
| 717 | |
| 718 m_paintInvalidationSubtreeRoots.remove(renderer); | |
| 719 } | |
| 720 | |
| 706 inline void FrameView::forceLayoutParentViewIfNeeded() | 721 inline void FrameView::forceLayoutParentViewIfNeeded() |
| 707 { | 722 { |
| 708 RenderPart* ownerRenderer = m_frame->ownerRenderer(); | 723 RenderPart* ownerRenderer = m_frame->ownerRenderer(); |
| 709 if (!ownerRenderer || !ownerRenderer->frame()) | 724 if (!ownerRenderer || !ownerRenderer->frame()) |
| 710 return; | 725 return; |
| 711 | 726 |
| 712 RenderBox* contentBox = embeddedContentBox(); | 727 RenderBox* contentBox = embeddedContentBox(); |
| 713 if (!contentBox) | 728 if (!contentBox) |
| 714 return; | 729 return; |
| 715 | 730 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 951 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation | 966 // We need to set m_doFullPaintInvalidation before triggering layout as RenderObject::checkForPaintInvalidation |
| 952 // checks the boolean to disable local paint invalidations. | 967 // checks the boolean to disable local paint invalidations. |
| 953 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout(); | 968 m_doFullPaintInvalidation |= renderView()->shouldDoFullRepaintForNex tLayout(); |
| 954 } | 969 } |
| 955 | 970 |
| 956 layer = rootForThisLayout->enclosingLayer(); | 971 layer = rootForThisLayout->enclosingLayer(); |
| 957 | 972 |
| 958 performLayout(rootForThisLayout, inSubtreeLayout); | 973 performLayout(rootForThisLayout, inSubtreeLayout); |
| 959 | 974 |
| 960 m_layoutSubtreeRoot = 0; | 975 m_layoutSubtreeRoot = 0; |
| 976 if (rootForThisLayout) | |
| 977 m_paintInvalidationSubtreeRoots.add(rootForThisLayout); | |
| 961 } // Reset m_layoutSchedulingEnabled to its previous value. | 978 } // Reset m_layoutSchedulingEnabled to its previous value. |
| 962 | 979 |
| 963 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) | 980 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) |
| 964 adjustViewSize(); | 981 adjustViewSize(); |
| 965 | 982 |
| 966 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullPaintInvalidation)); | 983 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullPaintInvalidation)); |
| 967 renderView()->compositor()->didLayout(); | 984 renderView()->compositor()->didLayout(); |
| 968 | 985 |
| 969 m_layoutCount++; | 986 m_layoutCount++; |
| 970 | 987 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 983 scheduleOrPerformPostLayoutTasks(); | 1000 scheduleOrPerformPostLayoutTasks(); |
| 984 | 1001 |
| 985 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", " endData", InspectorLayoutEvent::endData(rootForThisLayout)); | 1002 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. | 1003 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. |
| 987 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); | 1004 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); |
| 988 | 1005 |
| 989 m_nestedLayoutCount--; | 1006 m_nestedLayoutCount--; |
| 990 if (m_nestedLayoutCount) | 1007 if (m_nestedLayoutCount) |
| 991 return; | 1008 return; |
| 992 | 1009 |
| 993 invalidateTree(rootForThisLayout); | |
| 994 | |
| 995 m_doFullPaintInvalidation = false; | |
| 996 | |
| 997 #ifndef NDEBUG | 1010 #ifndef NDEBUG |
| 998 // Post-layout assert that nobody was re-marked as needing layout during lay out. | 1011 // Post-layout assert that nobody was re-marked as needing layout during lay out. |
| 999 document->renderView()->assertSubtreeIsLaidOut(); | 1012 document->renderView()->assertSubtreeIsLaidOut(); |
| 1000 #endif | 1013 #endif |
| 1001 | 1014 |
| 1002 // FIXME: It should be not possible to remove the FrameView from the frame/p age during layout | 1015 // 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 | 1016 // 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 | 1017 // 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 | 1018 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml |
| 1006 // necessitating this check here. | 1019 // necessitating this check here. |
| 1007 // ASSERT(frame()->page()); | 1020 // ASSERT(frame()->page()); |
| 1008 if (frame().page()) | 1021 if (frame().page()) |
| 1009 frame().page()->chrome().client().layoutUpdated(m_frame.get()); | 1022 frame().page()->chrome().client().layoutUpdated(m_frame.get()); |
| 1010 } | 1023 } |
| 1011 | 1024 |
| 1012 // The plan is to move to compositor-queried paint invalidation, in which case t his | 1025 // 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 | 1026 // method would setNeedsRedraw on the GraphicsLayers with invalidations and |
| 1014 // let the compositor pick which to actually draw. | 1027 // let the compositor pick which to actually draw. |
| 1015 // See http://crbug.com/306706 | 1028 // See http://crbug.com/306706 |
| 1016 void FrameView::invalidateTree(RenderObject* root) | 1029 void FrameView::invalidateTreeIfNeeded() |
| 1017 { | 1030 { |
| 1018 ASSERT(!root->needsLayout()); | 1031 HashSet<RenderObject*>::const_iterator end = m_paintInvalidationSubtreeRoots .end(); |
| 1019 // We should only invalidate paints for the outer most layout. This works as | 1032 for (HashSet<RenderObject*>::const_iterator it = m_paintInvalidationSubtreeR oots.begin(); it != end; ++it) { |
| 1020 // we continue to track paint invalidation rects until this function is call ed. | 1033 RenderObject* rootForPaintInvalidation = *it; |
| 1021 ASSERT(!m_nestedLayoutCount); | 1034 ASSERT(!rootForPaintInvalidation->needsLayout()); |
| 1022 | 1035 |
| 1023 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", root->debugName() .ascii()); | 1036 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintI nvalidation->debugName().ascii()); |
| 1024 | 1037 |
| 1025 // FIXME: really, we're in the paint invalidation phase here, and the compos iting queries are legal. | 1038 LayoutState rootLayoutState(*rootForPaintInvalidation); |
| 1026 // Until those states are fully fledged, I'll just disable the ASSERTS. | |
| 1027 DisableCompositingQueryAsserts compositingQueryAssertsDisabler; | |
| 1028 | 1039 |
| 1029 LayoutState rootLayoutState(*root); | 1040 rootForPaintInvalidation->invalidateTreeAfterLayout(*rootForPaintInvalid ation->containerForPaintInvalidation()); |
| 1030 | 1041 |
| 1031 root->invalidateTreeAfterLayout(*root->containerForPaintInvalidation()); | 1042 // Invalidate the paint of the frameviews scrollbars if needed |
| 1043 if (hasVerticalBarDamage()) | |
| 1044 invalidateRect(verticalBarDamage()); | |
| 1045 if (hasHorizontalBarDamage()) | |
| 1046 invalidateRect(horizontalBarDamage()); | |
| 1047 resetScrollbarDamage(); | |
| 1048 } | |
| 1032 | 1049 |
| 1033 // Invalidate the paint of the frameviews scrollbars if needed | 1050 m_paintInvalidationSubtreeRoots.clear(); |
| 1034 if (hasVerticalBarDamage()) | 1051 m_doFullPaintInvalidation = false; |
| 1035 invalidateRect(verticalBarDamage()); | |
| 1036 if (hasHorizontalBarDamage()) | |
| 1037 invalidateRect(horizontalBarDamage()); | |
| 1038 resetScrollbarDamage(); | |
| 1039 } | 1052 } |
| 1040 | 1053 |
| 1041 DocumentLifecycle& FrameView::lifecycle() const | 1054 DocumentLifecycle& FrameView::lifecycle() const |
| 1042 { | 1055 { |
| 1043 return m_frame->document()->lifecycle(); | 1056 return m_frame->document()->lifecycle(); |
| 1044 } | 1057 } |
| 1045 | 1058 |
| 1046 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot) | 1059 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot) |
| 1047 { | 1060 { |
| 1048 bool isTracing; | 1061 bool isTracing; |
| (...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2821 | 2834 |
| 2822 if (RenderView* view = renderView()) { | 2835 if (RenderView* view = renderView()) { |
| 2823 InspectorInstrumentation::willUpdateLayerTree(view->frame()); | 2836 InspectorInstrumentation::willUpdateLayerTree(view->frame()); |
| 2824 | 2837 |
| 2825 view->compositor()->updateIfNeededRecursive(); | 2838 view->compositor()->updateIfNeededRecursive(); |
| 2826 | 2839 |
| 2827 if (view->compositor()->inCompositingMode() && m_frame->isMainFrame()) | 2840 if (view->compositor()->inCompositingMode() && m_frame->isMainFrame()) |
| 2828 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded(); | 2841 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang eIfNeeded(); |
| 2829 | 2842 |
| 2830 InspectorInstrumentation::didUpdateLayerTree(view->frame()); | 2843 InspectorInstrumentation::didUpdateLayerTree(view->frame()); |
| 2844 | |
| 2845 invalidateTreeIfNeededRecursive(); | |
| 2831 } | 2846 } |
| 2832 | 2847 |
| 2833 scrollContentsIfNeededRecursive(); | 2848 scrollContentsIfNeededRecursive(); |
| 2834 } | 2849 } |
| 2835 | 2850 |
| 2836 void FrameView::updateLayoutAndStyleIfNeededRecursive() | 2851 void FrameView::updateLayoutAndStyleIfNeededRecursive() |
| 2837 { | 2852 { |
| 2838 // We have to crawl our entire tree looking for any FrameViews that need | 2853 // We have to crawl our entire tree looking for any FrameViews that need |
| 2839 // layout and make sure they are up to date. | 2854 // layout and make sure they are up to date. |
| 2840 // Mac actually tests for intersection with the dirty region and tries not t o | 2855 // 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 Loading... | |
| 2876 | 2891 |
| 2877 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. | 2892 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. |
| 2878 ASSERT(!needsLayout()); | 2893 ASSERT(!needsLayout()); |
| 2879 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); | 2894 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); |
| 2880 #ifndef NDEBUG | 2895 #ifndef NDEBUG |
| 2881 m_frame->document()->renderView()->assertRendererLaidOut(); | 2896 m_frame->document()->renderView()->assertRendererLaidOut(); |
| 2882 #endif | 2897 #endif |
| 2883 | 2898 |
| 2884 } | 2899 } |
| 2885 | 2900 |
| 2901 void FrameView::invalidateTreeIfNeededRecursive() | |
| 2902 { | |
| 2903 // FIXME: We should be more aggressive cutting sub-branches tree traversals. | |
| 2904 invalidateTreeIfNeeded(); | |
| 2905 | |
| 2906 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { | |
| 2907 if (!child->isLocalFrame()) | |
| 2908 continue; | |
| 2909 | |
| 2910 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); | |
| 2911 } | |
| 2912 } | |
| 2913 | |
| 2886 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize) | 2914 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize) |
| 2887 { | 2915 { |
| 2888 ASSERT(!enable || !minSize.isEmpty()); | 2916 ASSERT(!enable || !minSize.isEmpty()); |
| 2889 ASSERT(minSize.width() <= maxSize.width()); | 2917 ASSERT(minSize.width() <= maxSize.width()); |
| 2890 ASSERT(minSize.height() <= maxSize.height()); | 2918 ASSERT(minSize.height() <= maxSize.height()); |
| 2891 | 2919 |
| 2892 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize) | 2920 if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize) |
| 2893 return; | 2921 return; |
| 2894 | 2922 |
| 2895 | 2923 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3267 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) | 3295 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) |
| 3268 { | 3296 { |
| 3269 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3297 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3270 if (AXObjectCache* cache = axObjectCache()) { | 3298 if (AXObjectCache* cache = axObjectCache()) { |
| 3271 cache->remove(scrollbar); | 3299 cache->remove(scrollbar); |
| 3272 cache->handleScrollbarUpdate(this); | 3300 cache->handleScrollbarUpdate(this); |
| 3273 } | 3301 } |
| 3274 } | 3302 } |
| 3275 | 3303 |
| 3276 } // namespace WebCore | 3304 } // namespace WebCore |
| OLD | NEW |