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

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: fix under invalidation (override LayoutView::visualOverflowRect), revise LayoutBoxModelObject::styl… 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 if (document().settings() && document().settings()->rootLayerScrolls())
274 return LayoutBlockFlow::visualOverflowRect();
275 return LayoutRect(unscaledDocumentRect());
chrishtr 2015/06/08 20:30:58 Add a TODO to remove unscaledDocumentRect() in ano
trchen 2015/06/08 22:46:55 Done in the header.
276 }
277
273 void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati onContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* was Fixed, const PaintInvalidationState* paintInvalidationState) const 278 void LayoutView::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati onContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* was Fixed, const PaintInvalidationState* paintInvalidationState) const
274 { 279 {
275 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed)); 280 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed));
276 281
277 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) { 282 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor mFromContainer(0)) {
278 TransformationMatrix t; 283 TransformationMatrix t;
279 getTransformFromContainer(0, LayoutSize(), t); 284 getTransformFromContainer(0, LayoutSize(), t);
280 transformState.applyTransform(t); 285 transformState.applyTransform(t);
281 } 286 }
282 287
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 842
838 IntRect LayoutView::unscaledDocumentRect() const 843 IntRect LayoutView::unscaledDocumentRect() const
839 { 844 {
840 LayoutRect overflowRect(layoutOverflowRect()); 845 LayoutRect overflowRect(layoutOverflowRect());
841 flipForWritingMode(overflowRect); 846 flipForWritingMode(overflowRect);
842 return pixelSnappedIntRect(overflowRect); 847 return pixelSnappedIntRect(overflowRect);
843 } 848 }
844 849
845 bool LayoutView::rootBackgroundIsEntirelyFixed() const 850 bool LayoutView::rootBackgroundIsEntirelyFixed() const
846 { 851 {
847 if (LayoutObject* backgroundLayoutObject = this->backgroundLayoutObject()) 852 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 } 853 }
860 854
861 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const 855 LayoutRect LayoutView::backgroundRect(LayoutBox* backgroundLayoutObject) const
862 { 856 {
863 return LayoutRect(unscaledDocumentRect()); 857 return LayoutRect(unscaledDocumentRect());
864 } 858 }
865 859
866 IntRect LayoutView::documentRect() const 860 IntRect LayoutView::documentRect() const
867 { 861 {
868 FloatRect overflowRect(unscaledDocumentRect()); 862 FloatRect overflowRect(unscaledDocumentRect());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 return viewHeight(IncludeScrollbars) / scale; 968 return viewHeight(IncludeScrollbars) / scale;
975 } 969 }
976 970
977 void LayoutView::willBeDestroyed() 971 void LayoutView::willBeDestroyed()
978 { 972 {
979 LayoutBlockFlow::willBeDestroyed(); 973 LayoutBlockFlow::willBeDestroyed();
980 m_compositor.clear(); 974 m_compositor.clear();
981 } 975 }
982 976
983 } // namespace blink 977 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698