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

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: revert to patchset 10 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (!style()->isHorizontalWritingMode()) 188 if (!style()->isHorizontalWritingMode())
189 return true; 189 return true;
190 190
191 // The width/height checks below assume horizontal writing mode. 191 // The width/height checks below assume horizontal writing mode.
192 ASSERT(style()->isHorizontalWritingMode()); 192 ASSERT(style()->isHorizontalWritingMode());
193 193
194 if (size().width() != viewLogicalWidthForBoxSizing()) 194 if (size().width() != viewLogicalWidthForBoxSizing())
195 return true; 195 return true;
196 196
197 if (size().height() != viewLogicalHeightForBoxSizing()) { 197 if (size().height() != viewLogicalHeightForBoxSizing()) {
198 if (LayoutObject* backgroundLayoutObject = this->backgroundLayoutObject( )) { 198 // When background-attachment is 'fixed', we treat the viewport (instead of the 'root'
199 // When background-attachment is 'fixed', we treat the viewport (ins tead of the 'root' 199 // i.e. html or body) as the background positioning area, and we should full paint invalidation
200 // i.e. html or body) as the background positioning area, and we sho uld full paint invalidation 200 // viewport resize if the background image is not composited and needs f ull paint invalidation on
201 // viewport resize if the background image is not composited and nee ds full paint invalidation on 201 // background positioning area resize.
202 // background positioning area resize. 202 if (!m_compositor || !m_compositor->needsFixedRootBackgroundLayer(layer( ))) {
203 if (!m_compositor || !m_compositor->needsFixedRootBackgroundLayer(la yer())) { 203 if (style()->hasFixedBackgroundImage()
204 if (backgroundLayoutObject->style()->hasFixedBackgroundImage() 204 && mustInvalidateFillLayersPaintOnHeightChange(style()->backgrou ndLayers()))
205 && mustInvalidateFillLayersPaintOnHeightChange(backgroundLay outObject->style()->backgroundLayers())) 205 return true;
206 return true;
207 }
208 } 206 }
209 } 207 }
210 208
211 return false; 209 return false;
212 } 210 }
213 211
214 void LayoutView::layout() 212 void LayoutView::layout()
215 { 213 {
216 if (!document().paginated()) 214 if (!document().paginated())
217 setPageLogicalHeight(0); 215 setPageLogicalHeight(0);
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 835
838 IntRect LayoutView::unscaledDocumentRect() const 836 IntRect LayoutView::unscaledDocumentRect() const
839 { 837 {
840 LayoutRect overflowRect(layoutOverflowRect()); 838 LayoutRect overflowRect(layoutOverflowRect());
841 flipForWritingMode(overflowRect); 839 flipForWritingMode(overflowRect);
842 return pixelSnappedIntRect(overflowRect); 840 return pixelSnappedIntRect(overflowRect);
843 } 841 }
844 842
845 bool LayoutView::rootBackgroundIsEntirelyFixed() const 843 bool LayoutView::rootBackgroundIsEntirelyFixed() const
846 { 844 {
847 if (LayoutObject* backgroundLayoutObject = this->backgroundLayoutObject()) 845 return style()->hasEntirelyFixedBackground();
848 return backgroundLayoutObject->style()->hasEntirelyFixedBackground();
849 return false;
850 }
851
852 LayoutObject* LayoutView::backgroundLayoutObject() const
853 {
854 if (Element* documentElement = document().documentElement()) {
855 if (LayoutObject* rootObject = documentElement->layoutObject())
856 return rootObject->layoutObjectForRootBackground();
857 }
858 return 0;
859 } 846 }
860 847
861 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const 848 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const
862 { 849 {
863 return LayoutRect(unscaledDocumentRect()); 850 return LayoutRect(unscaledDocumentRect());
864 } 851 }
865 852
866 IntRect LayoutView::documentRect() const 853 IntRect LayoutView::documentRect() const
867 { 854 {
868 FloatRect overflowRect(unscaledDocumentRect()); 855 FloatRect overflowRect(unscaledDocumentRect());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 return viewHeight(IncludeScrollbars) / scale; 961 return viewHeight(IncludeScrollbars) / scale;
975 } 962 }
976 963
977 void LayoutView::willBeDestroyed() 964 void LayoutView::willBeDestroyed()
978 { 965 {
979 LayoutBlockFlow::willBeDestroyed(); 966 LayoutBlockFlow::willBeDestroyed();
980 m_compositor.clear(); 967 m_compositor.clear();
981 } 968 }
982 969
983 } // namespace blink 970 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698