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

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

Issue 235323005: Revert of Optimize repaint on FrameView resize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 8 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') | Source/core/rendering/RenderObject.h » ('j') | 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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 881
882 Document* document = m_frame->document(); 882 Document* document = m_frame->document();
883 bool inSubtreeLayout = isSubtreeLayout(); 883 bool inSubtreeLayout = isSubtreeLayout();
884 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderer(); 884 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderer();
885 if (!rootForThisLayout) { 885 if (!rootForThisLayout) {
886 // FIXME: Do we need to set m_size here? 886 // FIXME: Do we need to set m_size here?
887 ASSERT_NOT_REACHED(); 887 ASSERT_NOT_REACHED();
888 return; 888 return;
889 } 889 }
890 890
891 bool shouldDoFullLayout = false;
891 FontCachePurgePreventer fontCachePurgePreventer; 892 FontCachePurgePreventer fontCachePurgePreventer;
892 RenderLayer* layer; 893 RenderLayer* layer;
893 { 894 {
894 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); 895 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
895 896
896 m_nestedLayoutCount++; 897 m_nestedLayoutCount++;
897 if (!inSubtreeLayout) { 898 if (!inSubtreeLayout) {
898 Document* document = m_frame->document(); 899 Document* document = m_frame->document();
899 Node* body = document->body(); 900 Node* body = document->body();
900 if (body && body->renderer()) { 901 if (body && body->renderer()) {
901 if (isHTMLFrameSetElement(*body)) { 902 if (isHTMLFrameSetElement(*body)) {
902 body->renderer()->setChildNeedsLayout(); 903 body->renderer()->setChildNeedsLayout();
903 } else if (isHTMLBodyElement(*body)) { 904 } else if (isHTMLBodyElement(*body)) {
904 if (!m_firstLayout && m_size.height() != layoutSize().height () && body->renderer()->enclosingBox()->stretchesToViewport()) 905 if (!m_firstLayout && m_size.height() != layoutSize().height () && body->renderer()->enclosingBox()->stretchesToViewport())
905 body->renderer()->setChildNeedsLayout(); 906 body->renderer()->setChildNeedsLayout();
906 } 907 }
907 } 908 }
908 } 909 }
909 updateCounters(); 910 updateCounters();
910 autoSizeIfEnabled(); 911 autoSizeIfEnabled();
911 912
912 ScrollbarMode hMode; 913 ScrollbarMode hMode;
913 ScrollbarMode vMode; 914 ScrollbarMode vMode;
914 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); 915 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode);
915 916
916 bool shouldDoFullRepaint = !inSubtreeLayout && (m_firstLayout || toRende rView(rootForThisLayout)->document().printing()); 917 shouldDoFullLayout = !inSubtreeLayout && (m_firstLayout || toRenderView( rootForThisLayout)->document().printing());
917 918
918 if (!inSubtreeLayout) { 919 if (!inSubtreeLayout) {
919 // Now set our scrollbar state for the layout. 920 // Now set our scrollbar state for the layout.
920 ScrollbarMode currentHMode = horizontalScrollbarMode(); 921 ScrollbarMode currentHMode = horizontalScrollbarMode();
921 ScrollbarMode currentVMode = verticalScrollbarMode(); 922 ScrollbarMode currentVMode = verticalScrollbarMode();
922 923
923 if (m_firstLayout) { 924 if (m_firstLayout) {
924 setScrollbarsSuppressed(true); 925 setScrollbarsSuppressed(true);
925 926
926 m_firstLayout = false; 927 m_firstLayout = false;
(...skipping 12 matching lines...) Expand all
939 setScrollbarsSuppressed(false, true); 940 setScrollbarsSuppressed(false, true);
940 } else if (hMode != currentHMode || vMode != currentVMode) { 941 } else if (hMode != currentHMode || vMode != currentVMode) {
941 setScrollbarModes(hMode, vMode); 942 setScrollbarModes(hMode, vMode);
942 } 943 }
943 944
944 LayoutSize oldSize = m_size; 945 LayoutSize oldSize = m_size;
945 946
946 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); 947 m_size = LayoutSize(layoutSize().width(), layoutSize().height());
947 948
948 if (oldSize != m_size) { 949 if (oldSize != m_size) {
949 // It's hard to predict here which of full repaint or per-descen dant repaint costs less. 950 shouldDoFullLayout = true;
950 // For vertical writing mode or width change, it's more likely t hat per-descendant repaint
951 // eventually turns out to be full repaint but with the cost to handle layout states and
952 // discrete repaint rects, so marking full repaint here is more likely to cost less.
953 // For height only changes, per-descendant repaint is more likel y to avoid unnecessary
954 // full repaints.
955 if (!renderView()->style()->isHorizontalWritingMode() || oldSize .width() != m_size.width())
956 shouldDoFullRepaint = true;
957
958 if (!m_firstLayout) { 951 if (!m_firstLayout) {
959 RenderBox* rootRenderer = document->documentElement() ? docu ment->documentElement()->renderBox() : 0; 952 RenderBox* rootRenderer = document->documentElement() ? docu ment->documentElement()->renderBox() : 0;
960 RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0; 953 RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0;
961 if (bodyRenderer && bodyRenderer->stretchesToViewport()) 954 if (bodyRenderer && bodyRenderer->stretchesToViewport())
962 bodyRenderer->setChildNeedsLayout(); 955 bodyRenderer->setChildNeedsLayout();
963 else if (rootRenderer && rootRenderer->stretchesToViewport() ) 956 else if (rootRenderer && rootRenderer->stretchesToViewport() )
964 rootRenderer->setChildNeedsLayout(); 957 rootRenderer->setChildNeedsLayout();
965 } 958 }
966 } 959 }
967 } 960 }
968 961
969 layer = rootForThisLayout->enclosingLayer(); 962 layer = rootForThisLayout->enclosingLayer();
970 963
971 // We need to set m_doFullRepaint before triggering layout as RenderObje ct::checkForRepaint 964 // We need to set m_doFullRepaint before triggering layout as RenderObje ct::checkForRepaint
972 // checks the boolean to disable local repaints. 965 // checks the boolean to disable local repaints.
973 m_doFullRepaint |= shouldDoFullRepaint; 966 m_doFullRepaint |= shouldDoFullLayout;
974 967
975 performLayout(rootForThisLayout, inSubtreeLayout); 968 performLayout(rootForThisLayout, inSubtreeLayout);
976 969
977 m_layoutSubtreeRoot = 0; 970 m_layoutSubtreeRoot = 0;
978 } // Reset m_layoutSchedulingEnabled to its previous value. 971 } // Reset m_layoutSchedulingEnabled to its previous value.
979 972
980 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) 973 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g())
981 adjustViewSize(); 974 adjustViewSize();
982 975
983 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); 976 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullRepaint));
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 } 1725 }
1733 1726
1734 void FrameView::contentsResized() 1727 void FrameView::contentsResized()
1735 { 1728 {
1736 if (isMainFrame() && m_frame->document()) { 1729 if (isMainFrame() && m_frame->document()) {
1737 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer()) 1730 if (FastTextAutosizer* textAutosizer = m_frame->document()->fastTextAuto sizer())
1738 textAutosizer->updatePageInfoInAllFrames(); 1731 textAutosizer->updatePageInfoInAllFrames();
1739 } 1732 }
1740 1733
1741 ScrollView::contentsResized(); 1734 ScrollView::contentsResized();
1742 if (RenderView* renderView = this->renderView()) { 1735 setNeedsLayout();
1743 // Don't directly repaint layer in setNeedsLayout. We'll handle repaint in layout().
1744 renderView->setNeedsLayout(MarkContainingBlockChain, 0, DontRepaintLayer );
1745 }
1746 } 1736 }
1747 1737
1748 void FrameView::scrollbarExistenceDidChange() 1738 void FrameView::scrollbarExistenceDidChange()
1749 { 1739 {
1750 // We check to make sure the view is attached to a frame() as this method ca n 1740 // We check to make sure the view is attached to a frame() as this method ca n
1751 // be triggered before the view is attached by LocalFrame::createView(...) s etting 1741 // be triggered before the view is attached by LocalFrame::createView(...) s etting
1752 // various values such as setScrollBarModes(...) for example. An ASSERT is 1742 // various values such as setScrollBarModes(...) for example. An ASSERT is
1753 // triggered when a view is layout before being attached to a frame(). 1743 // triggered when a view is layout before being attached to a frame().
1754 if (!frame().view()) 1744 if (!frame().view())
1755 return; 1745 return;
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
3219 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3209 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3220 { 3210 {
3221 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3211 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3222 if (AXObjectCache* cache = axObjectCache()) { 3212 if (AXObjectCache* cache = axObjectCache()) {
3223 cache->remove(scrollbar); 3213 cache->remove(scrollbar);
3224 cache->handleScrollbarUpdate(this); 3214 cache->handleScrollbarUpdate(this);
3225 } 3215 }
3226 } 3216 }
3227 3217
3228 } // namespace WebCore 3218 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/rendering/RenderObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698