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

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 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 rootObject->setShouldDoFullPaintInvalidation(); 261 rootObject->setShouldDoFullPaintInvalidation();
264 } 262 }
265 } 263 }
266 264
267 #if ENABLE(ASSERT) 265 #if ENABLE(ASSERT)
268 checkLayoutState(); 266 checkLayoutState();
269 #endif 267 #endif
270 clearNeedsLayout(); 268 clearNeedsLayout();
271 } 269 }
272 270
271 LayoutRect LayoutView::visualOverflowRect() const
272 {
273 // In root layer scrolling mode, the LayoutView performs overflow clipping
274 // like a regular scrollable div.
275 if (document().settings() && document().settings()->rootLayerScrolls())
276 return LayoutBlockFlow::visualOverflowRect();
277
278 // Ditto when not in compositing mode.
279 if (!usesCompositing())
280 return LayoutBlockFlow::visualOverflowRect();
281
282 // In normal compositing mode, LayoutView doesn't actually apply clipping
283 // on its descendants. Instead their visual overflow is propagated to
284 // compositor()->m_rootContentLayer for accelerated scrolling.
285 return LayoutRect(unscaledDocumentRect());
286 }
287
273 void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati onContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* was Fixed, const PaintInvalidationState* paintInvalidationState) const 288 void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati onContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* was Fixed, const PaintInvalidationState* paintInvalidationState) const
274 { 289 {
275 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed)); 290 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed));
276 291
277 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) { 292 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) {
278 TransformationMatrix t; 293 TransformationMatrix t;
279 getTransformFromContainer(0, LayoutSize(), t); 294 getTransformFromContainer(0, LayoutSize(), t);
280 transformState.applyTransform(t); 295 transformState.applyTransform(t);
281 } 296 }
282 297
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 852
838 IntRect LayoutView::unscaledDocumentRect() const 853 IntRect LayoutView::unscaledDocumentRect() const
839 { 854 {
840 LayoutRect overflowRect(layoutOverflowRect()); 855 LayoutRect overflowRect(layoutOverflowRect());
841 flipForWritingMode(overflowRect); 856 flipForWritingMode(overflowRect);
842 return pixelSnappedIntRect(overflowRect); 857 return pixelSnappedIntRect(overflowRect);
843 } 858 }
844 859
845 bool LayoutView::rootBackgroundIsEntirelyFixed() const 860 bool LayoutView::rootBackgroundIsEntirelyFixed() const
846 { 861 {
847 if (LayoutObject* backgroundLayoutObject = this->backgroundLayoutObject()) 862 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 nullptr;
859 } 863 }
860 864
861 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const 865 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const
862 { 866 {
863 return LayoutRect(unscaledDocumentRect()); 867 return LayoutRect(unscaledDocumentRect());
864 } 868 }
865 869
866 IntRect LayoutView::documentRect() const 870 IntRect LayoutView::documentRect() const
867 { 871 {
868 FloatRect overflowRect(unscaledDocumentRect()); 872 FloatRect overflowRect(unscaledDocumentRect());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 return viewHeight(IncludeScrollbars) / scale; 978 return viewHeight(IncludeScrollbars) / scale;
975 } 979 }
976 980
977 void LayoutView::willBeDestroyed() 981 void LayoutView::willBeDestroyed()
978 { 982 {
979 LayoutBlockFlow::willBeDestroyed(); 983 LayoutBlockFlow::willBeDestroyed();
980 m_compositor.clear(); 984 m_compositor.clear();
981 } 985 }
982 986
983 } // namespace blink 987 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698