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

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

Issue 275543003: Don't always fully repaint on viewport resize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 7 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
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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 887
888 Document* document = m_frame->document(); 888 Document* document = m_frame->document();
889 bool inSubtreeLayout = isSubtreeLayout(); 889 bool inSubtreeLayout = isSubtreeLayout();
890 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderer(); 890 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderer();
891 if (!rootForThisLayout) { 891 if (!rootForThisLayout) {
892 // FIXME: Do we need to set m_size here? 892 // FIXME: Do we need to set m_size here?
893 ASSERT_NOT_REACHED(); 893 ASSERT_NOT_REACHED();
894 return; 894 return;
895 } 895 }
896 896
897 bool shouldDoFullLayout = false;
898 FontCachePurgePreventer fontCachePurgePreventer; 897 FontCachePurgePreventer fontCachePurgePreventer;
899 RenderLayer* layer; 898 RenderLayer* layer;
900 { 899 {
901 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); 900 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
902 901
903 m_nestedLayoutCount++; 902 m_nestedLayoutCount++;
904 if (!inSubtreeLayout) { 903 if (!inSubtreeLayout) {
905 Document* document = m_frame->document(); 904 Document* document = m_frame->document();
906 Node* body = document->body(); 905 Node* body = document->body();
907 if (body && body->renderer()) { 906 if (body && body->renderer()) {
908 if (isHTMLFrameSetElement(*body)) { 907 if (isHTMLFrameSetElement(*body)) {
909 body->renderer()->setChildNeedsLayout(); 908 body->renderer()->setChildNeedsLayout();
910 } else if (isHTMLBodyElement(*body)) { 909 } else if (isHTMLBodyElement(*body)) {
911 if (!m_firstLayout && m_size.height() != layoutSize().height () && body->renderer()->enclosingBox()->stretchesToViewport()) 910 if (!m_firstLayout && m_size.height() != layoutSize().height () && body->renderer()->enclosingBox()->stretchesToViewport())
912 body->renderer()->setChildNeedsLayout(); 911 body->renderer()->setChildNeedsLayout();
913 } 912 }
914 } 913 }
915 } 914 }
916 updateCounters(); 915 updateCounters();
917 autoSizeIfEnabled(); 916 autoSizeIfEnabled();
918 917
919 ScrollbarMode hMode; 918 ScrollbarMode hMode;
920 ScrollbarMode vMode; 919 ScrollbarMode vMode;
921 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); 920 calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode);
922 921
923 shouldDoFullLayout = !inSubtreeLayout && (m_firstLayout || toRenderView( rootForThisLayout)->document().printing());
924
925 if (!inSubtreeLayout) { 922 if (!inSubtreeLayout) {
926 // Now set our scrollbar state for the layout. 923 // Now set our scrollbar state for the layout.
927 ScrollbarMode currentHMode = horizontalScrollbarMode(); 924 ScrollbarMode currentHMode = horizontalScrollbarMode();
928 ScrollbarMode currentVMode = verticalScrollbarMode(); 925 ScrollbarMode currentVMode = verticalScrollbarMode();
929 926
930 if (m_firstLayout) { 927 if (m_firstLayout) {
931 setScrollbarsSuppressed(true); 928 setScrollbarsSuppressed(true);
932 929
930 m_doFullRepaint = true;
933 m_firstLayout = false; 931 m_firstLayout = false;
934 m_firstLayoutCallbackPending = true; 932 m_firstLayoutCallbackPending = true;
935 m_lastViewportSize = layoutSize(IncludeScrollbars); 933 m_lastViewportSize = layoutSize(IncludeScrollbars);
936 m_lastZoomFactor = rootForThisLayout->style()->zoom(); 934 m_lastZoomFactor = rootForThisLayout->style()->zoom();
937 935
938 // Set the initial vMode to AlwaysOn if we're auto. 936 // Set the initial vMode to AlwaysOn if we're auto.
939 if (vMode == ScrollbarAuto) 937 if (vMode == ScrollbarAuto)
940 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear. 938 setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
941 // Set the initial hMode to AlwaysOff if we're auto. 939 // Set the initial hMode to AlwaysOff if we're auto.
942 if (hMode == ScrollbarAuto) 940 if (hMode == ScrollbarAuto)
943 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus es a horizontal scrollbar to disappear. 941 setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This caus es a horizontal scrollbar to disappear.
944 942
945 setScrollbarModes(hMode, vMode); 943 setScrollbarModes(hMode, vMode);
946 setScrollbarsSuppressed(false, true); 944 setScrollbarsSuppressed(false, true);
947 } else if (hMode != currentHMode || vMode != currentVMode) { 945 } else if (hMode != currentHMode || vMode != currentVMode) {
948 setScrollbarModes(hMode, vMode); 946 setScrollbarModes(hMode, vMode);
949 } 947 }
950 948
951 LayoutSize oldSize = m_size; 949 LayoutSize oldSize = m_size;
952 950
953 m_size = LayoutSize(layoutSize().width(), layoutSize().height()); 951 m_size = LayoutSize(layoutSize().width(), layoutSize().height());
954 952
955 if (oldSize != m_size) { 953 if (oldSize != m_size && !m_firstLayout) {
956 shouldDoFullLayout = true; 954 RenderBox* rootRenderer = document->documentElement() ? document ->documentElement()->renderBox() : 0;
957 if (!m_firstLayout) { 955 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc ument->body()->renderBox() : 0;
958 RenderBox* rootRenderer = document->documentElement() ? docu ment->documentElement()->renderBox() : 0; 956 if (bodyRenderer && bodyRenderer->stretchesToViewport())
959 RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0; 957 bodyRenderer->setChildNeedsLayout();
960 if (bodyRenderer && bodyRenderer->stretchesToViewport()) 958 else if (rootRenderer && rootRenderer->stretchesToViewport())
961 bodyRenderer->setChildNeedsLayout(); 959 rootRenderer->setChildNeedsLayout();
962 else if (rootRenderer && rootRenderer->stretchesToViewport() )
963 rootRenderer->setChildNeedsLayout();
964 }
965 } 960 }
961
962 // We need to set m_doFullRepaint before triggering layout as Render Object::checkForRepaint
963 // checks the boolean to disable local repaints.
964 m_doFullRepaint |= renderView()->shouldDoFullRepaintForNextLayout();
966 } 965 }
967 966
968 layer = rootForThisLayout->enclosingLayer(); 967 layer = rootForThisLayout->enclosingLayer();
969 968
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); 969 performLayout(rootForThisLayout, inSubtreeLayout);
975 970
976 m_layoutSubtreeRoot = 0; 971 m_layoutSubtreeRoot = 0;
977 } // Reset m_layoutSchedulingEnabled to its previous value. 972 } // Reset m_layoutSchedulingEnabled to its previous value.
978 973
979 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g()) 974 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin g())
980 adjustViewSize(); 975 adjustViewSize();
981 976
982 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullRepaint)); 977 layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPos itionFlags(layer, inSubtreeLayout, m_doFullRepaint));
983 renderView()->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter Layout); 978 renderView()->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter Layout);
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 1916
1922 RenderView* renderView = this->renderView(); 1917 RenderView* renderView = this->renderView();
1923 return layoutPending() 1918 return layoutPending()
1924 || (renderView && renderView->needsLayout()) 1919 || (renderView && renderView->needsLayout())
1925 || isSubtreeLayout(); 1920 || isSubtreeLayout();
1926 } 1921 }
1927 1922
1928 void FrameView::setNeedsLayout() 1923 void FrameView::setNeedsLayout()
1929 { 1924 {
1930 if (RenderView* renderView = this->renderView()) 1925 if (RenderView* renderView = this->renderView())
1931 renderView->setNeedsLayoutAndFullRepaint(); 1926 renderView->setNeedsLayout();
1932 } 1927 }
1933 1928
1934 bool FrameView::isTransparent() const 1929 bool FrameView::isTransparent() const
1935 { 1930 {
1936 return m_isTransparent; 1931 return m_isTransparent;
1937 } 1932 }
1938 1933
1939 void FrameView::setTransparent(bool isTransparent) 1934 void FrameView::setTransparent(bool isTransparent)
1940 { 1935 {
1941 m_isTransparent = isTransparent; 1936 m_isTransparent = isTransparent;
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3274 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3280 { 3275 {
3281 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3276 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3282 if (AXObjectCache* cache = axObjectCache()) { 3277 if (AXObjectCache* cache = axObjectCache()) {
3283 cache->remove(scrollbar); 3278 cache->remove(scrollbar);
3284 cache->handleScrollbarUpdate(this); 3279 cache->handleScrollbarUpdate(this);
3285 } 3280 }
3286 } 3281 }
3287 3282
3288 } // namespace WebCore 3283 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698