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

Side by Side Diff: Source/core/rendering/RenderView.cpp

Issue 275543003: Don't always fully repaint on viewport resize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: NeedsRebaseline 2 tests 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
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | Source/core/rendering/style/FillLayer.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 void RenderView::checkLayoutState() 178 void RenderView::checkLayoutState()
179 { 179 {
180 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { 180 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) {
181 ASSERT(layoutDeltaMatches(LayoutSize())); 181 ASSERT(layoutDeltaMatches(LayoutSize()));
182 } 182 }
183 ASSERT(!m_layoutStateDisableCount); 183 ASSERT(!m_layoutStateDisableCount);
184 ASSERT(!m_layoutState->next()); 184 ASSERT(!m_layoutState->next());
185 } 185 }
186 #endif 186 #endif
187 187
188 bool RenderView::shouldDoFullRepaintForNextLayout() const
189 {
190 // It's hard to predict here which of full repaint or per-descendant repaint costs less.
191 // For vertical writing mode or width change it's more likely that per-desce ndant repaint
192 // eventually turns out to be full repaint but with the cost to handle more layout states
193 // and discrete repaint rects, so marking full repaint here is more likely t o cost less.
194 // Otherwise, per-descendant repaint is more likely to avoid unnecessary ful l repaints.
195
196 if (shouldUsePrintingLayout())
197 return true;
198
199 if (!style()->isHorizontalWritingMode() || width() != viewWidth())
200 return true;
201
202 if (height() != viewHeight()) {
203 if (RenderObject* backgroundRenderer = this->backgroundRenderer()) {
204 if (backgroundRenderer->style()->backgroundImageNeedsFullRepaintOnCo ntainerHeightChange())
205 return true;
206 }
207 }
208
209 return false;
210 }
211
188 void RenderView::layout() 212 void RenderView::layout()
189 { 213 {
190 if (!document().paginated()) 214 if (!document().paginated())
191 setPageLogicalHeight(0); 215 setPageLogicalHeight(0);
192 216
193 if (shouldUsePrintingLayout()) 217 if (shouldUsePrintingLayout())
194 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ; 218 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ;
195 219
196 SubtreeLayoutScope layoutScope(*this); 220 SubtreeLayoutScope layoutScope(*this);
197 221
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 804
781 IntRect RenderView::unscaledDocumentRect() const 805 IntRect RenderView::unscaledDocumentRect() const
782 { 806 {
783 LayoutRect overflowRect(layoutOverflowRect()); 807 LayoutRect overflowRect(layoutOverflowRect());
784 flipForWritingMode(overflowRect); 808 flipForWritingMode(overflowRect);
785 return pixelSnappedIntRect(overflowRect); 809 return pixelSnappedIntRect(overflowRect);
786 } 810 }
787 811
788 bool RenderView::rootBackgroundIsEntirelyFixed() const 812 bool RenderView::rootBackgroundIsEntirelyFixed() const
789 { 813 {
790 RenderObject* rootObject = document().documentElement() ? document().documen tElement()->renderer() : 0; 814 if (RenderObject* backgroundRenderer = this->backgroundRenderer())
791 if (!rootObject) 815 return backgroundRenderer->hasEntirelyFixedBackground();
792 return false; 816 return false;
817 }
793 818
794 RenderObject* rootRenderer = rootObject->rendererForRootBackground(); 819 RenderObject* RenderView::backgroundRenderer() const
795 return rootRenderer->hasEntirelyFixedBackground(); 820 {
821 if (Element* documentElement = document().documentElement()) {
822 if (RenderObject* rootObject = documentElement->renderer())
823 return rootObject->rendererForRootBackground();
824 }
825 return 0;
796 } 826 }
797 827
798 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const 828 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const
799 { 829 {
800 if (!hasColumns()) 830 if (!hasColumns())
801 return unscaledDocumentRect(); 831 return unscaledDocumentRect();
802 832
803 ColumnInfo* columnInfo = this->columnInfo(); 833 ColumnInfo* columnInfo = this->columnInfo();
804 LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo ->columnHeight() * columnInfo->columnCount()); 834 LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo ->columnHeight() * columnInfo->columnCount());
805 if (!isHorizontalWritingMode()) 835 if (!isHorizontalWritingMode())
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 return viewWidth(IncludeScrollbars) / scale; 993 return viewWidth(IncludeScrollbars) / scale;
964 } 994 }
965 995
966 double RenderView::layoutViewportHeight() const 996 double RenderView::layoutViewportHeight() const
967 { 997 {
968 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; 998 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
969 return viewHeight(IncludeScrollbars) / scale; 999 return viewHeight(IncludeScrollbars) / scale;
970 } 1000 }
971 1001
972 } // namespace WebCore 1002 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | Source/core/rendering/style/FillLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698