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

Side by Side Diff: Source/core/layout/LayoutView.cpp

Issue 1145993002: Refactor root element background painting (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase & revise expectation Created 5 years, 6 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) 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (!style()->isHorizontalWritingMode()) 197 if (!style()->isHorizontalWritingMode())
198 return true; 198 return true;
199 199
200 // The width/height checks below assume horizontal writing mode. 200 // The width/height checks below assume horizontal writing mode.
201 ASSERT(style()->isHorizontalWritingMode()); 201 ASSERT(style()->isHorizontalWritingMode());
202 202
203 if (size().width() != viewLogicalWidthForBoxSizing()) 203 if (size().width() != viewLogicalWidthForBoxSizing())
204 return true; 204 return true;
205 205
206 if (size().height() != viewLogicalHeightForBoxSizing()) { 206 if (size().height() != viewLogicalHeightForBoxSizing()) {
207 if (LayoutObject* backgroundLayoutObject = this->backgroundLayoutObject( )) { 207 // When background-attachment is 'fixed', we treat the viewport (instead of the 'root'
208 // When background-attachment is 'fixed', we treat the viewport (ins tead of the 'root' 208 // i.e. html or body) as the background positioning area, and we should full paint invalidation
209 // i.e. html or body) as the background positioning area, and we sho uld full paint invalidation 209 // viewport resize if the background image is not composited and needs f ull paint invalidation on
210 // viewport resize if the background image is not composited and nee ds full paint invalidation on 210 // background positioning area resize.
211 // background positioning area resize. 211 if (!m_compositor || !m_compositor->needsFixedRootBackgroundLayer(layer( ))) {
212 if (!m_compositor || !m_compositor->needsFixedRootBackgroundLayer(la yer())) { 212 if (style()->hasFixedBackgroundImage()
213 if (backgroundLayoutObject->style()->hasFixedBackgroundImage() 213 && mustInvalidateFillLayersPaintOnHeightChange(style()->backgrou ndLayers()))
214 && mustInvalidateFillLayersPaintOnHeightChange(backgroundLay outObject->style()->backgroundLayers())) 214 return true;
215 return true;
216 }
217 } 215 }
218 } 216 }
219 217
220 return false; 218 return false;
221 } 219 }
222 220
223 void LayoutView::layout() 221 void LayoutView::layout()
224 { 222 {
225 if (!document().paginated()) 223 if (!document().paginated())
226 setPageLogicalHeight(0); 224 setPageLogicalHeight(0);
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 844
847 IntRect LayoutView::unscaledDocumentRect() const 845 IntRect LayoutView::unscaledDocumentRect() const
848 { 846 {
849 LayoutRect overflowRect(layoutOverflowRect()); 847 LayoutRect overflowRect(layoutOverflowRect());
850 flipForWritingMode(overflowRect); 848 flipForWritingMode(overflowRect);
851 return pixelSnappedIntRect(overflowRect); 849 return pixelSnappedIntRect(overflowRect);
852 } 850 }
853 851
854 bool LayoutView::rootBackgroundIsEntirelyFixed() const 852 bool LayoutView::rootBackgroundIsEntirelyFixed() const
855 { 853 {
856 if (LayoutObject* backgroundLayoutObject = this->backgroundLayoutObject()) 854 return style()->hasEntirelyFixedBackground();
857 return backgroundLayoutObject->style()->hasEntirelyFixedBackground();
858 return false;
859 }
860
861 LayoutObject* LayoutView::backgroundLayoutObject() const
862 {
863 if (Element* documentElement = document().documentElement()) {
864 if (LayoutObject* rootObject = documentElement->layoutObject())
865 return rootObject->layoutObjectForRootBackground();
866 }
867 return 0;
868 } 855 }
869 856
870 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const 857 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const
871 { 858 {
872 if (!hasColumns()) 859 if (!hasColumns())
873 return LayoutRect(unscaledDocumentRect()); 860 return LayoutRect(unscaledDocumentRect());
874 861
875 ColumnInfo* columnInfo = this->columnInfo(); 862 ColumnInfo* columnInfo = this->columnInfo();
876 LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo ->columnHeight() * columnInfo->columnCount()); 863 LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo ->columnHeight() * columnInfo->columnCount());
877 if (!isHorizontalWritingMode()) 864 if (!isHorizontalWritingMode())
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 return viewHeight(IncludeScrollbars) / scale; 979 return viewHeight(IncludeScrollbars) / scale;
993 } 980 }
994 981
995 void LayoutView::willBeDestroyed() 982 void LayoutView::willBeDestroyed()
996 { 983 {
997 LayoutBlockFlow::willBeDestroyed(); 984 LayoutBlockFlow::willBeDestroyed();
998 m_compositor.clear(); 985 m_compositor.clear();
999 } 986 }
1000 987
1001 } // namespace blink 988 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698