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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 ownerElement->setWidget(nullptr); | 213 ownerElement->setWidget(nullptr); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void FrameView::reset() | 216 void FrameView::reset() |
| 217 { | 217 { |
| 218 m_cannotBlitToWindow = false; | 218 m_cannotBlitToWindow = false; |
| 219 m_isOverlapped = false; | 219 m_isOverlapped = false; |
| 220 m_contentIsOpaque = false; | 220 m_contentIsOpaque = false; |
| 221 m_hasPendingLayout = false; | 221 m_hasPendingLayout = false; |
| 222 m_layoutSubtreeRoot = 0; | 222 m_layoutSubtreeRoot = 0; |
| 223 m_doFullRepaint = false; | |
| 224 m_layoutSchedulingEnabled = true; | 223 m_layoutSchedulingEnabled = true; |
| 225 m_inPerformLayout = false; | 224 m_inPerformLayout = false; |
| 226 m_canRepaintDuringPerformLayout = false; | 225 m_canRepaintDuringPerformLayout = false; |
| 227 m_inSynchronousPostLayout = false; | 226 m_inSynchronousPostLayout = false; |
| 228 m_layoutCount = 0; | 227 m_layoutCount = 0; |
| 229 m_nestedLayoutCount = 0; | 228 m_nestedLayoutCount = 0; |
| 230 m_postLayoutTasksTimer.stop(); | 229 m_postLayoutTasksTimer.stop(); |
| 231 m_updateWidgetsTimer.stop(); | 230 m_updateWidgetsTimer.stop(); |
| 232 m_firstLayout = true; | 231 m_firstLayout = true; |
| 233 m_firstLayoutCallbackPending = false; | 232 m_firstLayoutCallbackPending = false; |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 887 | 886 |
| 888 Document* document = m_frame->document(); | 887 Document* document = m_frame->document(); |
| 889 bool inSubtreeLayout = isSubtreeLayout(); | 888 bool inSubtreeLayout = isSubtreeLayout(); |
| 890 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderer(); | 889 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderer(); |
| 891 if (!rootForThisLayout) { | 890 if (!rootForThisLayout) { |
| 892 // FIXME: Do we need to set m_size here? | 891 // FIXME: Do we need to set m_size here? |
| 893 ASSERT_NOT_REACHED(); | 892 ASSERT_NOT_REACHED(); |
| 894 return; | 893 return; |
| 895 } | 894 } |
| 896 | 895 |
| 897 bool shouldDoFullLayout = false; | |
| 898 FontCachePurgePreventer fontCachePurgePreventer; | 896 FontCachePurgePreventer fontCachePurgePreventer; |
| 899 RenderLayer* layer; | 897 RenderLayer* layer; |
| 900 { | 898 { |
| 901 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); | 899 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); |
| 902 | 900 |
| 903 m_nestedLayoutCount++; | 901 m_nestedLayoutCount++; |
| 904 if (!inSubtreeLayout) { | 902 if (!inSubtreeLayout) { |
| 905 Document* document = m_frame->document(); | 903 Document* document = m_frame->document(); |
| 906 Node* body = document->body(); | 904 Node* body = document->body(); |
| 907 if (body && body->renderer()) { | 905 if (body && body->renderer()) { |
| 908 if (isHTMLFrameSetElement(*body)) { | 906 if (isHTMLFrameSetElement(*body)) { |
| 909 body->renderer()->setChildNeedsLayout(); | 907 body->renderer()->setChildNeedsLayout(); |
| 910 } else if (isHTMLBodyElement(*body)) { | 908 } else if (isHTMLBodyElement(*body)) { |
| 911 if (!m_firstLayout && m_size.height() != layoutSize().height () && body->renderer()->enclosingBox()->stretchesToViewport()) | 909 if (!m_firstLayout && m_size.height() != layoutSize().height () && body->renderer()->enclosingBox()->stretchesToViewport()) |
| 912 body->renderer()->setChildNeedsLayout(); | 910 body->renderer()->setChildNeedsLayout(); |
| 913 } | 911 } |
| 914 } | 912 } |
| 915 } | 913 } |
| 916 updateCounters(); | 914 updateCounters(); |
| 917 autoSizeIfEnabled(); | 915 autoSizeIfEnabled(); |
| 918 | 916 |
| 919 ScrollbarMode hMode; | 917 ScrollbarMode hMode; |
| 920 ScrollbarMode vMode; | 918 ScrollbarMode vMode; |
| 921 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); | 919 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); |
| 922 | 920 |
| 923 shouldDoFullLayout = !inSubtreeLayout && (m_firstLayout || toRenderView( rootForThisLayout)->document().printing()); | |
|
dsinclair
2014/05/20 17:37:39
What about the document().printing() case? I don't
Xianzhu
2014/05/20 18:32:21
The full repaint logic is moved into RenderView wh
| |
| 924 | |
| 925 if (!inSubtreeLayout) { | 921 if (!inSubtreeLayout) { |
| 926 // Now set our scrollbar state for the layout. | 922 // Now set our scrollbar state for the layout. |
| 927 ScrollbarMode currentHMode = horizontalScrollbarMode(); | 923 ScrollbarMode currentHMode = horizontalScrollbarMode(); |
| 928 ScrollbarMode currentVMode = verticalScrollbarMode(); | 924 ScrollbarMode currentVMode = verticalScrollbarMode(); |
| 929 | 925 |
| 930 if (m_firstLayout) { | 926 if (m_firstLayout) { |
| 927 renderView()->setShouldDoFullRepaintAfterLayout(true); | |
| 931 setScrollbarsSuppressed(true); | 928 setScrollbarsSuppressed(true); |
| 932 | 929 |
| 933 m_firstLayout = false; | 930 m_firstLayout = false; |
| 934 m_firstLayoutCallbackPending = true; | 931 m_firstLayoutCallbackPending = true; |
| 935 m_lastViewportSize = layoutSize(IncludeScrollbars); | 932 m_lastViewportSize = layoutSize(IncludeScrollbars); |
| 936 m_lastZoomFactor = rootForThisLayout->style()->zoom(); | 933 m_lastZoomFactor = rootForThisLayout->style()->zoom(); |
| 937 | 934 |
| 938 // Set the initial vMode to AlwaysOn if we're auto. | 935 // Set the initial vMode to AlwaysOn if we're auto. |
| 939 if (vMode == ScrollbarAuto) | 936 if (vMode == ScrollbarAuto) |
| 940 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear. | 937 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear. |
| 941 // Set the initial hMode to AlwaysOff if we're auto. | 938 // Set the initial hMode to AlwaysOff if we're auto. |
| 942 if (hMode == ScrollbarAuto) | 939 if (hMode == ScrollbarAuto) |
| 943 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus es a horizontal scrollbar to disappear. | 940 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus es a horizontal scrollbar to disappear. |
| 944 | 941 |
| 945 setScrollbarModes(hMode, vMode); | 942 setScrollbarModes(hMode, vMode); |
| 946 setScrollbarsSuppressed(false, true); | 943 setScrollbarsSuppressed(false, true); |
| 947 } else if (hMode != currentHMode || vMode != currentVMode) { | 944 } else if (hMode != currentHMode || vMode != currentVMode) { |
| 948 setScrollbarModes(hMode, vMode); | 945 setScrollbarModes(hMode, vMode); |
| 949 } | 946 } |
| 950 | 947 |
| 951 LayoutSize oldSize = m_size; | 948 LayoutSize oldSize = m_size; |
| 952 | 949 |
| 953 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); | 950 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); |
| 954 | 951 |
| 955 if (oldSize != m_size) { | 952 if (oldSize != m_size && !m_firstLayout) { |
| 956 shouldDoFullLayout = true; | 953 RenderBox* rootRenderer = document->documentElement() ? document ->documentElement()->renderBox() : 0; |
| 957 if (!m_firstLayout) { | 954 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc ument->body()->renderBox() : 0; |
| 958 RenderBox* rootRenderer = document->documentElement() ? docu ment->documentElement()->renderBox() : 0; | 955 if (bodyRenderer && bodyRenderer->stretchesToViewport()) |
| 959 RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0; | 956 bodyRenderer->setChildNeedsLayout(); |
| 960 if (bodyRenderer && bodyRenderer->stretchesToViewport()) | 957 else if (rootRenderer && rootRenderer->stretchesToViewport()) |
| 961 bodyRenderer->setChildNeedsLayout(); | 958 rootRenderer->setChildNeedsLayout(); |
| 962 else if (rootRenderer && rootRenderer->stretchesToViewport() ) | |
| 963 rootRenderer->setChildNeedsLayout(); | |
| 964 } | |
| 965 } | 959 } |
| 966 } | 960 } |
| 967 | 961 |
| 968 layer = rootForThisLayout->enclosingLayer(); | 962 layer = rootForThisLayout->enclosingLayer(); |
| 969 | 963 |
| 970 // We need to set m_doFullRepaint before triggering layout as RenderObje ct::checkForRepaint | |
| 971 // checks the boolean to disable local repaints. | |
| 972 m_doFullRepaint |= shouldDoFullLayout; | |
| 973 | |
| 974 performLayout(rootForThisLayout, inSubtreeLayout); | 964 performLayout(rootForThisLayout, inSubtreeLayout); |
| 975 | 965 |
| 976 m_layoutSubtreeRoot = 0; | 966 m_layoutSubtreeRoot = 0; |
| 977 } // Reset m_layoutSchedulingEnabled to its previous value. | 967 } // Reset m_layoutSchedulingEnabled to its previous value. |
| 978 | 968 |
| 979 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) | 969 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) |
| 980 adjustViewSize(); | 970 adjustViewSize(); |
| 981 | 971 |
| 982 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); | 972 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, renderView()->shouldDoFullRepaintAfterLayout( ))); |
| 983 renderView()->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter Layout); | 973 renderView()->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter Layout); |
| 984 | 974 |
| 985 m_layoutCount++; | 975 m_layoutCount++; |
| 986 | 976 |
| 987 if (AXObjectCache* cache = rootForThisLayout->document().axObjectCache()) { | 977 if (AXObjectCache* cache = rootForThisLayout->document().axObjectCache()) { |
| 988 const KURL& url = rootForThisLayout->document().url(); | 978 const KURL& url = rootForThisLayout->document().url(); |
| 989 if (url.isValid() && !url.isAboutBlankURL()) | 979 if (url.isValid() && !url.isAboutBlankURL()) |
| 990 cache->handleLayoutComplete(rootForThisLayout); | 980 cache->handleLayoutComplete(rootForThisLayout); |
| 991 } | 981 } |
| 992 updateAnnotatedRegions(); | 982 updateAnnotatedRegions(); |
| 993 | 983 |
| 994 ASSERT(!rootForThisLayout->needsLayout()); | 984 ASSERT(!rootForThisLayout->needsLayout()); |
| 995 | 985 |
| 996 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) | 986 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) |
| 997 updateOverflowStatus(layoutSize().width() < contentsWidth(), layoutSize( ).height() < contentsHeight()); | 987 updateOverflowStatus(layoutSize().width() < contentsWidth(), layoutSize( ).height() < contentsHeight()); |
| 998 | 988 |
| 999 scheduleOrPerformPostLayoutTasks(); | 989 scheduleOrPerformPostLayoutTasks(); |
| 1000 | 990 |
| 1001 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)); |
| 1002 // 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. |
| 1003 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); | 993 InspectorInstrumentation::didLayout(cookie, rootForThisLayout); |
| 1004 | 994 |
| 1005 m_nestedLayoutCount--; | 995 m_nestedLayoutCount--; |
| 1006 if (m_nestedLayoutCount) | 996 if (m_nestedLayoutCount) |
| 1007 return; | 997 return; |
| 1008 | 998 |
| 1009 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { | 999 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
| 1010 repaintTree(rootForThisLayout); | 1000 repaintTree(rootForThisLayout); |
| 1011 } else if (m_doFullRepaint) { | 1001 } else if (renderView()->shouldDoFullRepaintAfterLayout()) { |
| 1012 // FIXME: This isn't really right, since the RenderView doesn't fully en compass | 1002 // FIXME: This isn't really right, since the RenderView doesn't fully en compass |
| 1013 // the visibleContentRect(). It just happens to work out most of the tim e, | 1003 // the visibleContentRect(). It just happens to work out most of the tim e, |
| 1014 // since first layouts and printing don't have you scrolled anywhere. | 1004 // since first layouts and printing don't have you scrolled anywhere. |
| 1015 renderView()->repaint(); | 1005 renderView()->repaint(); |
| 1016 } | 1006 } |
| 1017 | 1007 |
| 1018 m_doFullRepaint = false; | |
| 1019 | |
| 1020 #ifndef NDEBUG | 1008 #ifndef NDEBUG |
| 1021 // Post-layout assert that nobody was re-marked as needing layout during lay out. | 1009 // Post-layout assert that nobody was re-marked as needing layout during lay out. |
| 1022 document->renderer()->assertSubtreeIsLaidOut(); | 1010 document->renderer()->assertSubtreeIsLaidOut(); |
| 1023 #endif | 1011 #endif |
| 1024 | 1012 |
| 1025 // FIXME: It should be not possible to remove the FrameView from the frame/p age during layout | 1013 // FIXME: It should be not possible to remove the FrameView from the frame/p age during layout |
| 1026 // however m_inPerformLayout is not set for most of this function, so none o f our RELEASE_ASSERTS | 1014 // however m_inPerformLayout is not set for most of this function, so none o f our RELEASE_ASSERTS |
| 1027 // in LocalFrame/Page will fire. One of the post-layout tasks is disconnecti ng the LocalFrame from | 1015 // in LocalFrame/Page will fire. One of the post-layout tasks is disconnecti ng the LocalFrame from |
| 1028 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml | 1016 // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.ht ml |
| 1029 // necessitating this check here. | 1017 // necessitating this check here. |
| (...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3279 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) | 3267 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) |
| 3280 { | 3268 { |
| 3281 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3269 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3282 if (AXObjectCache* cache = axObjectCache()) { | 3270 if (AXObjectCache* cache = axObjectCache()) { |
| 3283 cache->remove(scrollbar); | 3271 cache->remove(scrollbar); |
| 3284 cache->handleScrollbarUpdate(this); | 3272 cache->handleScrollbarUpdate(this); |
| 3285 } | 3273 } |
| 3286 } | 3274 } |
| 3287 | 3275 |
| 3288 } // namespace WebCore | 3276 } // namespace WebCore |
| OLD | NEW |